'?' Character in Dates in Sequoia

Google informed me this is the result of Language & Region settings, but they’re all correct. 12:36:27 PM - visually this looks “normal”, but is I save this to a text file and open in BBEdit, the “space” between the ‘7’ and ‘P’ shows as a read dot. And the script complains when trying to do math on that date that "Can’t get date “12:46:22?PM”. Any other ideas on what causes this. I replaced a system running Monterey and lots of scripting with an M4 Mini & Sequoia, that’s when it started doing t...

Late Night Software Ltd.

#blue_team #macOS #AppleScript

Как защититься

- Изменить приложение по умолчанию для .scpt файлов на TextEdit.
- Включить в Finder отображение расширений.​
- Настроить EDR для мониторинга запусков Script Editor с последующей сетевой активностью.
- Использовать Sigma-правила для детектирования подозрительных executions из Script Editor​.
- Отслеживать файлы с двойными расширениями типа .docx.scpt, .pdf.scpt через file event monitoring.
- Блокировать домены из IOC-списка: endesway[.]life, foldgalaxy[.]com, aubr[.]io, dosmac[.]top и другие из исследования​.

Подробности: (https://pberba.github.io/security/2025/11/11/macos-infection-vector-applescript-bypass-gatekeeper/).

MacOS Infection Vector: Using AppleScripts to bypass Gatekeeper

A look at how threat actors are abusing AppleScript .scpt files to deliver macOS malware, from fake documents to browser update lures, and how these scripts ...

pepe berba

#blue_team #macOS #AppleScript

Пример атаки

- Доставка: Жертве приходит email с ZIP-архивом, внутри которого лежит файл с иконкой Word.​
- Маскировка: При распаковке в Finder пользователь видит файл с иконкой Word, расширение .scpt скрыто.​
- Открытие: Двойной клик запускает Script Editor вместо Word/Preview, отображая комментарии с инструкцией «нажмите Run для просмотра документа».​
- Выполнение: Нажатие Run (⌘+R) запускает `do shell script`, который Gatekeeper не блокирует, так как код выполняется через легитимное системное приложение Script Editor.​
- Заражение: Загруженная malware работает в фоне, выполняя вредоносные действия.

#blue_team #macOS #AppleScript

Технические особенности

- Вредоносный код скрывается за сотнями пустых строк, в начале скрипта видны только комментарии типа Click to install update.​
- Использует do shell script для bash-команд: загрузка malware через curl, распаковка в /tmp, запуск, эксфильтрация данных на C2.​
- Resource fork (legacy-технология Mac OS 9) хранит кастомные иконки .docx/.pptx, которые корректно распаковываются из ZIP/DMG и отображаются в Finder, создавая убедительно выглядящие фейковые документы.​
- Extended attributes манипулируют флагом com.apple.FinderInfo для per-file скрытия расширения .scpt, обходя глобальную настройку Finder Show all filename extensions.

AppleScript-файлы пришли на замену уязвимости в Gatekeeper

#blue_team #macOS #AppleScript

В августе 2024 года Apple устранила функцию right-click and open, позволяющую обходить защиту Gatekeeper. После этого атакующие переключились на .scpt AppleScript-файлы для распространения commodity-стилеров и проведения APT-операций.

Техника эксплуатирует особенность macOS — .scpt по умолчанию открывается в Script Editor, где пользователь может немедленно выполнить код кнопкой Run (⌘+R) в обход проверки Gatekeeper. То есть macOS по умолчанию открывает такие файлы в Script Editor, и Gatekeeper это не заблокирует даже если файл помечен как «скачанный из интернета».

Is there a full AppleScript grammar anywhere? The Language Guide has syntax diagrams for most of it and you could probably derive most of the grammar from that but there would definitely be some guesswork needed.

Legend has it everything was in lex and yacc, I’m wondering if it ever ended up in a textbook or something. William R. Cook’s paper has a fragment of the grammar.

#programming #applescript

📢 Un décompilateur AppleScript run-only validé sur XCSSET et OSAMiner
📝 Source: blog de Pepe Berba — Le 14 décembre 2025, Pepe Berba présente « applescript-decompiler », un outil capable de reconstruire le code lisible de scr...
📖 cyberveille : https://cyberveille.ch/posts/2025-12-16-un-decompilateur-applescript-run-only-valide-sur-xcsset-et-osaminer/
🌐 source : https://pberba.github.io/security/2025/12/14/decompiling-run-only-applescripts/
#AppleScript #OSAMiner #Cyberveille
Un décompilateur AppleScript run-only validé sur XCSSET et OSAMiner

Source: blog de Pepe Berba — Le 14 décembre 2025, Pepe Berba présente « applescript-decompiler », un outil capable de reconstruire le code lisible de scripts AppleScript compilés en mode run-only, avec des démonstrations sur des échantillons XCSSET et OSAMiner. 🛠️ L’auteur souligne que les scripts AppleScript, de plus en plus exploités par des malwares macOS, tirent parti de l’automatisation UI et des Apple events, et que la variante « run-only » complique l’analyse. En s’appuyant sur applescript-disassembler, l’outil comble un manque de tooling que Microsoft Threat Intelligence jugeait jusque-là difficile, voire infaisable à résoudre en décompilation directe.

CyberVeille

Revelando archivos en el Finder desde el Terminal utilizando AppleScript

Una de las mejores y más únicas características de macOS (nacido como Mac OS X, y transitoriamente como OS X) es su capacidad de combinar el interfaz clásico para navegación de archivos del Mac, el Finder, con el Terminal, y el soporte para ese lenguaje de pegamento y automatización que es AppleScript.

A veces uno realiza una búsqueda en terminal con comandos como find, grep, locate, o mdfind (el interfaz de terminal al motor de búsqueda Spotlight), pero quiere poder ver esos archivos en el Finder. Un podría usar la opción -R en el comando open, pero eso sirve sólo para un único archivo/carpeta (aunque la documentación dice que sirve para múltiples archivos). ¿Cómo hacerlo para múltiples archivos?

La clave está en AppleScript: el diccionario de comandos del Finder contiene un comando reveal_files al que se le puede pasar una lista de archivos. Como los archivos en terminal van separados por barras inclinadas (/), es necesario agregar as POSIX file al final de cada uno.

Con esa precaución, he creado una función reveal_files que lee sobre toda la lista de argumentos ($@), y para cada archivo ($file) genera la lista de AppleScript para después, con ella, llamar al comando osascript con el comando tell application "Finder" to reveal files {/path/file1 as POSIX file, /path/file2 as POSIX file, /path/file3 as POSIX file…}, que instruye al Finder a que muestre tantas carpetas como sea necesario, con los archivos que pertenezcan a cada una seleccionados.

El código completo del script podéis verlo a continuación (o en este link al Gist reveal_files.sh). ¡Espero que os sea útil!

https://gist.github.com/juandesant/8c288d7ac7d8578b53799fadfe34dfa8

Actualización 2025-12-18: El script no sirve si no le pasas archivos que estén con toda la ruta completa. Por ejemplo, reveal_files MiArchivo1.pdf MiArchivo2.pdf no funcionaba con la versión anterior, así como tampoco reveal_files *.pdf. Con la actualización de hoy (añadido una comprobación de si el archivo comienza con el carácter “/”), se añade el camino al path actual en el momento de llamar la utilidad.

Otra forma de utilizarlo es utilizar la utilidad find de forma intermedia:

reveal_files $(find $(pwd) -iname "*.pdf")

Al pasar $(pwd) como primer argumento a find todos los path van a empezar for “/”, y la búsqueda con -iname es insensible a mayúsculas/minúsculas. Esta fórmula sí era compatible con la versión anterior del script, pero también se puede utilizar con la actualizada.

#AppleScript #bash #Finder #osascript #scripting #TerminalApp #zsh
Introduction to AppleScript Language Guide

Defines the AppleScript scripting language. Includes many brief sample scripts.

The Final Countdown

For me, and I assume not a few of us, once Script Debugger ceases to work on the latest macOS (assuming we’re running it in “production”), our scripting days will come to a close, kicking and screaming. Can we just keep a running “sound off” as OS updates are rolled out to track/count this down?

Late Night Software Ltd.

macOS Infection Vector: Using AppleScripts to bypass Gatekeeper

Shows how attackers use AppleScript files disguised as fake docs or update installers to bypass Gatekeeper on macOS.

https://pberba.github.io/security/2025/11/11/macos-infection-vector-applescript-bypass-gatekeeper/

#macOS #AppleScript

MacOS Infection Vector: Using AppleScripts to bypass Gatekeeper

A look at how threat actors are abusing AppleScript .scpt files to deliver macOS malware, from fake documents to browser update lures, and how these scripts ...

pepe berba