Open n1ete opened 1 year ago
We technically don't support MIPS, but it should build the stock executable. Looks like a bug in the Linux build constraints that causes a CGO dependency to be included in the build.
IIRC those imports are for the screenshot feature.
I'm guessing our build constraint is only for Linux and not Linux/amd64
Yes that would make sense.
Looking at that lib, it seems to supports i386, amd64 and arm64 so we should probably restrict to that. Also, a quick search seems to imply that all the SHM syscall numbers (used by the gen2brain/shm
package) are not defined in the standard lib for the MIPS architecture anyway, so we can probably exclude MIPS from the build constraints by default for the screen
package in the implant.
I've fixed the build constraints, but it appears that there's an upstream Garble issue that prevents the build from succeeding:
# github.com/bishopfox/sliver
aTZ5WkAu.(*M9GTSgMZEBA9AZ).pnEVb4Qd8: relocation target runtime/internal/atomic.LoadAcquintptr not defined
aTZ5WkAu.(*M9GTSgMZEBA9AZ).hw53wf5zL0: relocation target runtime/internal/atomic.LoadAcquintptr not defined
exit status 2
For now you have to build with --skip-symbols
This is potentially fixed in upstream Garble as we're a little behind their latest release, we should update our internal Garble before filing an upstream issue.
Is it possible to point to custom garble for building? Thank you for the support of unsupported features anyways!
Seems like i didnt pay attention to the build architecture of my target hosts that i want to control. I am interested in the ramips Ralink/Mediathek devices with 'mipsel_24k' Architecture. It seems they are used in a lot of IOT/Router hardware products. How would i add a new build architecture to sliver?
You'd have to add support to Golang, the Sliver --os
and --arch
flags are essentially passed through to the golang compiler.
ok building mips beacons/implants went fine with the fix in #1066. and it should run afaik with gooarch=mips but i tried all mips builds (just in case i missed some releveant information)
generate -a mips -o linux -b https://some.domain:443 -l -s .
however running the binary on the devices returns:
root@mipsdevice:~# ./SELFISH_BITTER_mips64le
./SELFISH_BITTER_mips64le: line 2: syntax error: unexpected "("
any ideas ? since mips isnt supported please just close the issue and i know i am on my own here. ;) thanks for your help!
If there is an issue with the compiled binary (that's not a stack trace) it's likely an issue with upstream Go.
@n1ete it looks like the machine may be trying to execute it as a shell script instead of a native binary?
@moloch--
investigated this further and tried to run the beacon implant with exec /PATH/TO/BACON_CHEESE
and got either
cannot execute binary file: Exec format error
<-- thinking this is related to wrong architecture
or
Illegal instruction
OS is openwrt any ideas or hints left you have guys?
I'd look to see if anyone in the wider Go community has run into this problem or managed to solve it, if you can get any Go program to run on the target device you should be able to get the generic version of the Sliver implant running (the generic version is pure Go).
Thanks, if you need further debug data i am happy to provide them to you. I have a few different boxes laying around with these chip-sets.
i stumbled upon GOMIPS=softfloat
and GOMIPS=hardfloat
could this be related?
This is potentially fixed in upstream Garble as we're a little behind their latest release, we should update our internal Garble before filing an upstream issue.
We're going to fix it soon: https://github.com/burrowers/garble/issues/646
The issue above is fixed with yesterday's garble v0.9.1 release.
@n1ete I've merged v0.9.1 of Garble into the Sliver master
branch if you compile from source you should get the updates.
Still some problems with building for mips. this is the command i used
here the corresponding server logs
also i see frequently these messages in the logs .....thinking this is LXC container related...