View Issue Details

IDProjectCategoryView StatusLast Update
0000682fileGeneralpublic2025-09-09 17:37
Reporteralip Assigned To 
PrioritynormalSeverityfeatureReproducibilityN/A
Status newResolutionopen 
Summary0000682: Feature request: Recognize files encrypted by Syd sandbox
DescriptionHello dear kind people,

I am Ali Polatel, an Exherbo Linux developer and the main author of Syd sandbox.
I have written a patch for file(1) to recognize files encrypted by Syd. You may find it attached.

I am also attaching an encrypted test file called test.crypt which has the plaintext "The meaning of life is 42.\n"
and it is encrypted with the key "0ce20c69e248311f50f51bdea4feac01d063ee57e051de6af3b7477eff9df23a".
Running patched file(1) on the file gives the following output:

test.crypt: SYD encrypted file, version 3, AES-256-CTR; HMAC-SHA256:86daea48e958ce631d9209ad6ecf919037f7c17562eaecb57ece75d0c83c96be, IV:4fc988c179ade4e6754b785c7f29c111, ciphertext 27 bytes

To decrypt the file you install syd with "cargo install syd --locked" (packaged on Alpine, Arch, Exherbo, Gentoo, but alpine version is a bit old)
And use the syd-aes tool:

alip@hex ~ $ tail -c +54 test.crypt | syd-aes -d -k${SYD_KEY} -i 4fc988c179ade4e6754b785c7f29c111 -t SYD-ENC
The meaning of life is 42.
alip@hex ~ $

There's no defined extension for this encrypted file yet. You may find documentation here: https://man.exherbo.org/syd.7.html#Crypt_Sandboxing
The URL is also mentoned in the patch.

The magic file "syd" is also attached separately, so you may quickly test with an unpatched file(1) using -m.

Thank you for the wonderful software! May you be forever young!

Best regards,
Ali Polatel
Tagslibmagic, magic, patch

Activities

alip

2025-09-09 17:37

reporter  

0001-magic-recognize-syd-encrypted-files.patch (2,249 bytes)   
From 113236754315de718857edea23d7aaa513bbe5cf Mon Sep 17 00:00:00 2001
From: Ali Polatel <alip@hexsys.org>
Date: Tue, 9 Sep 2025 16:28:02 +0200
Subject: [PATCH] magic: recognize syd encrypted files

Documentation: https://man.exherbo.org/syd.7.html#Crypt_Sandboxing
Signed-off-by: Ali Polatel <alip@hexsys.org>
---
 magic/Magdir/syd  | 37 +++++++++++++++++++++++++++++++++++++
 magic/Makefile.am |  1 +
 2 files changed, 38 insertions(+)
 create mode 100644 magic/Magdir/syd

diff --git a/magic/Magdir/syd b/magic/Magdir/syd
new file mode 100644
index 00000000..0203d6f8
--- /dev/null
+++ b/magic/Magdir/syd
@@ -0,0 +1,37 @@
+#------------------------------------------------------------------------------
+# $File: syd,v $
+# syd: file(1) magic for syd(1) encrypted files
+#
+# From: Ali Polatel <alip@chesswob.org>
+# Documentation: https://man.exherbo.org/syd.7.html#Crypt_Sandboxing
+# No defined extension yet; files are recognized by magic header only.
+#
+# Layout:
+#   0..3   : "\x7fSYD"
+#   4	   : version byte (current API: 3)
+#   5..36  : HMAC (32 bytes, SHA256)
+#   37..52 : IV (16 bytes)
+#   53..   : ciphertext (AES-256-CTR)
+#------------------------------------------------------------------------------
+
+# Header and version
+0		string		\x7fSYD		SYD encrypted file
+>4		ubyte		x		\b, version %u
+
+# Version 3: algorithm + HMAC/IV as hex blobs + ciphertext size
+>>4		ubyte		=3		\b, AES-256-CTR; HMAC-SHA256:
+>>>5		 belong		 x		\b%08x
+>>>9		 belong		 x		\b%08x
+>>>13		 belong		 x		\b%08x
+>>>17		 belong		 x		\b%08x
+>>>21		 belong		 x		\b%08x
+>>>25		 belong		 x		\b%08x
+>>>29		 belong		 x		\b%08x
+>>>33		 belong		 x		\b%08x
+>>>37		 belong		 x		\b, IV:%08x
+>>>41		 belong		 x		\b%08x
+>>>45		 belong		 x		\b%08x
+>>>49		 belong		 x		\b%08x
+>>>-0		 offset-53	 x		\b, ciphertext %llu bytes
+
+# End of syd
diff --git a/magic/Makefile.am b/magic/Makefile.am
index 0a99b836..49241d5b 100644
--- a/magic/Makefile.am
+++ b/magic/Makefile.am
@@ -304,6 +304,7 @@ $(MAGIC_FRAGMENT_DIR)/statistics \
 $(MAGIC_FRAGMENT_DIR)/subtitle \
 $(MAGIC_FRAGMENT_DIR)/sun \
 $(MAGIC_FRAGMENT_DIR)/svf \
+$(MAGIC_FRAGMENT_DIR)/syd \
 $(MAGIC_FRAGMENT_DIR)/sylk \
 $(MAGIC_FRAGMENT_DIR)/symbos \
 $(MAGIC_FRAGMENT_DIR)/sysex \
-- 
2.51.0

test.crypt (80 bytes)
syd (1,175 bytes)   
#------------------------------------------------------------------------------
# $File: syd,v $
# syd: file(1) magic for syd(1) encrypted files
#
# From: Ali Polatel <alip@chesswob.org>
# Documentation: https://man.exherbo.org/syd.7.html#Crypt_Sandboxing
# No defined extension yet; files are recognized by magic header only.
#
# Layout:
#   0..3   : "\x7fSYD"
#   4	   : version byte (current API: 3)
#   5..36  : HMAC (32 bytes, SHA256)
#   37..52 : IV (16 bytes)
#   53..   : ciphertext (AES-256-CTR)
#------------------------------------------------------------------------------

# Header and version
0		string		\x7fSYD		SYD encrypted file
>4		ubyte		x		\b, version %u

# Version 3: algorithm + HMAC/IV as hex blobs + ciphertext size
>>4		ubyte		=3		\b, AES-256-CTR; HMAC-SHA256:
>>>5		 belong		 x		\b%08x
>>>9		 belong		 x		\b%08x
>>>13		 belong		 x		\b%08x
>>>17		 belong		 x		\b%08x
>>>21		 belong		 x		\b%08x
>>>25		 belong		 x		\b%08x
>>>29		 belong		 x		\b%08x
>>>33		 belong		 x		\b%08x
>>>37		 belong		 x		\b, IV:%08x
>>>41		 belong		 x		\b%08x
>>>45		 belong		 x		\b%08x
>>>49		 belong		 x		\b%08x
>>>-0		 offset-53	 x		\b, ciphertext %llu bytes

# End of syd
syd (1,175 bytes)   

Issue History

Date Modified Username Field Change
2025-09-09 17:37 alip New Issue
2025-09-09 17:37 alip Tag Attached: libmagic
2025-09-09 17:37 alip Tag Attached: magic
2025-09-09 17:37 alip Tag Attached: patch
2025-09-09 17:37 alip File Added: 0001-magic-recognize-syd-encrypted-files.patch
2025-09-09 17:37 alip File Added: test.crypt
2025-09-09 17:37 alip File Added: syd