89luca89 / pakkero

Pakkero is a binary packer written in Go made for fun and educational purpose. Its main goal is to take in input a program file (elf binary, script, even appimage) and compress it, protect it from tampering and intrusion.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not working

griefrelayer opened this issue · comments

I'm trying to use pakkero on ubuntu 21.04 and amd ryzen 7, but only getting errors after trying to open packed binary.
For example, i'm trying to do make test, the log is here:

make test
rm -rf dist/;
go build -i \
        -gcflags="-N" \
        -gcflags="-nolocalimports" \
        -gcflags="-pack" \
        -gcflags="-trimpath=." \
        -asmflags="-trimpath=." \
        -gcflags="-trimpath=$GOPATH/src/" \
        -asmflags="-trimpath=$GOPATH/src/" \
        -ldflags="-X github.com/89luca89/pakkero/internal/pakkero.LauncherStub=$(base64 -w0 data/launcher.go) -s" \
        -o dist/pakkero;
go: -i flag is deprecated
strip \
        -sxXwSgd \
        --remove-section=.bss \
        --remove-section=.comment \
        --remove-section=.eh_frame \
        --remove-section=.eh_frame_hdr \
        --remove-section=.fini \
        --remove-section=.fini_array \
        --remove-section=.gnu.build.attributes \
        --remove-section=.gnu.hash \
        --remove-section=.gnu.version \
        --remove-section=.got \
        --remove-section=.note.ABI-tag \
        --remove-section=.note.gnu.build-id \
        --remove-section=.note.go.buildid \
        --remove-section=.shstrtab \
        --remove-section=.typelink \
        dist/pakkero
dist/pakkero \
        -file /usr/bin/echo \
        -o /tmp/test.enc \
        -offset 2850000 \
        -enable-stdout \
        -register-dep /usr/bin/bash;
 → Randomizing offset...                [ OK ]
 → Registering Dependencies...          [ OK ]
 → Creating Launcher Stub...            [ OK ]
 → Obfuscating Launcher Stub...         [ OK ]
 → Compiling Launcher...                [ OK ]
 → Stripping Launcher...                [ OK ]
 → Compressing Launcher...              [ SKIPPING ]
 → Cleaning up...                       [ OK ]
 → Verifying input offset...            [ OK ]
 → Adding garbage...                    [ OK ]
 → Reading payload...                   [ OK ]
 → Compressing payload...               [ OK ]
 → Encrypting payload...                [ OK ]
 → Adding garbage to payload...         [ OK ]
sync;
for i in $(seq 1 20); do /tmp/test.enc $i; done;
make: *** [Makefile:64: test] Error 1
yartsevilya@yartsevilya-hp:~/go/pkg/mod/github.com/89luca89/pakkero@v0.0.0-20211020112830-e5bffbdbbbd5$ /tmp/test.enc
 error: unexpected signal during  execution
[signal SIGSEGV: segmentation violation code=0x80 addr=0x0 pc=0x4028f4]

 stack:
({0x4ca63d?, 0xc000391ed0?})
        :992 +0x71
()
        :802 +0x3a9
indexbytebody()
        :35 +0x14
(0xc00045f800)
        :415 +0x31
(0xc00045f800)
        :440 +0x7d
(0xc000038b38)
        :296 +0x45
(0xc000038b38, 0x10000)
        :1141 +0x8a
(0xc00008b6c0, 0xc000394af8?)
        :558 +0xef
()
        :469 +0x25
()
        :469 +0x49

goroutine 26 [GC assist marking]:
()
        :436 fp=0xc000394ae8 sp=0xc000394ae0 pc=0x45ab00
(0xc00008b6c0)
        :468 +0x18b fp=0xc000394b48 sp=0xc000394ae8 pc=0x41a5eb
(0x140, 0x0, 0x0)
        :973 +0x11f fp=0xc000394bc0 sp=0xc000394b48 pc=0x40b51f
(0x50)
        :301 +0x10a fp=0xc000394c18 sp=0xc000394bc0 pc=0x44b50a
(0xc000394cc8, {0x4cd6d0, 0x96})
        :197 +0xca fp=0xc000394c60 sp=0xc000394c18 pc=0x44b0ca
()
        ./launcher.go:697 +0x357 fp=0xc000394e78 sp=0xc000394c60 pc=0x4a34b7
()
        ./launcher.go:133 +0x1e5 fp=0xc000394fe0 sp=0xc000394e78 pc=0x49b925
()
        :1571 +0x1 fp=0xc000394fe8 sp=0xc000394fe0 pc=0x45cbe1
created by 
        ./launcher.go:574 +0x189

goroutine 1 [runnable]:
()
        :308 +0x3f
()
        :50 +0xdb
({0xc0000ce070, 0xd})
        ./launcher.go:225 +0x158
()
        ./launcher.go:328 +0x699
()
        ./launcher.go:575 +0x19a
()
        :250 +0x212
()
        :1571 +0x1

goroutine 2 [force gc (idle)]:
(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        :361 +0xd6
(...)
        :367
()
        :301 +0xad
()
        :1571 +0x1

goroutine 3 [GC sweep wait]:
(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        :361 +0xd6
(...)
        :367
(0x0?)
        :278 +0x8e
()
        :177 +0x26
()
        :1571 +0x1

goroutine 4 [runnable]:
(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        :361 +0xd6
(...)
        :367
(0x0?)
        :272 +0xec
()
        :178 +0x26
()
        :1571 +0x1

goroutine 18 [sys]:
(0x0?, 0x0?)
        :235 +0x34
()
        :151 +0x2f
()
        :23 +0x19
()
        :1571 +0x1

goroutine 19 [chan receive]:
(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        :361 +0xd6
(0xc0000bc120, 0xc000056fa0, 0x1)
        :577 +0x56c
(0x0?, 0x0?)
        :440 +0x18
(0xc0000bc120)
        ./launcher.go:46 +0x32
()
        ./launcher.go:572 +0x2b
()
        :1571 +0x1

goroutine 5 [GC worker (idle)]:
(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        :361 +0xd6
()
        :1207 +0xe5
()
        :1571 +0x1

goroutine 50 [GC worker (idle)]:
(0x1?, 0x1?, 0xd0?, 0x8f?, 0x49c0fd?)
        :361 +0xd6
()
        :1207 +0xe5
()
        :1571 +0x1

goroutine 6 [GC worker (idle)]:
(0x4ccbcc?, 0x82?, 0xa5?, 0xd5?, 0x95?)
        :361 +0xd6
()
        :1207 +0xe5
()
        :1571 +0x1

goroutine 25 [runnable]:
()
        :308 +0x3f
()
        :50 +0xdb
({0xc0001b0050, 0xd})
        ./launcher.go:225 +0x134
()
        ./launcher.go:328 +0x699
()
        :1571 +0x1

goroutine 49 [GC worker (idle)]:
(0xac?, 0xc0000d8fd0?, 0x15?, 0xc2?, 0x5644d8?)
        :361 +0xd6
()
        :1207 +0xe5
()
        :1571 +0x1

goroutine 33 [GC worker (idle)]:
(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        :361 +0xd6
()
        :1207 +0xe5
()
        :1571 +0x1

goroutine 34 [GC worker (idle)]:
(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        :361 +0xd6
()
        :1207 +0xe5
()
        :1571 +0x1

goroutine 35 [GC worker (idle)]:
(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        :361 +0xd6
()
        :1207 +0xe5
()
        :1571 +0x1

goroutine 7 [GC worker (idle)]:
(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        :361 +0xd6
()
        :1207 +0xe5
()
        :1571 +0x1

goroutine 36 [GC worker (idle)]:
(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        :361 +0xd6
()
        :1207 +0xe5
()
        :1571 +0x1

goroutine 37 [GC worker (idle)]:
(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        :361 +0xd6
()
        :1207 +0xe5
()
        :1571 +0x1

goroutine 51 [GC worker (idle)]:
(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        :361 +0xd6
()
        :1207 +0xe5
()
        :1571 +0x1

goroutine 52 [GC worker (idle)]:
(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        :361 +0xd6
()
        :1207 +0xe5
()
        :1571 +0x1

goroutine 53 [GC worker (idle)]:
(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        :361 +0xd6
()
        :1207 +0xe5
()
        :1571 +0x1

goroutine 8 [GC worker (idle)]:
(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        :361 +0xd6
()
        :1207 +0xe5
()
        :1571 +0x1

goroutine 9 [GC worker (idle)]:
(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        :361 +0xd6
()
        :1207 +0xe5
()
        :1571 +0x1

goroutine 38 [GC worker (idle)]:
(0x59fe60?, 0x1?, 0x5a?, 0xb4?, 0x0?)
        :361 +0xd6
()
        :1207 +0xe5
()
        :1571 +0x1

Hi @griefrelayer thanks for reporting!

I've pushed a new commit that fixes the problem 👍

Thank you very much! I enjoy your creation.