Vector35 / Vector35/binaryninja-api
scc defaults to 32-bit shellcode without warning, causing unexpected behavior
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 1.3k
- Forks
- 298
- Avg merge
- 5d 5h
- Merged PRs (30d)
- 19
Description
Version and Platform (required):
- Binary Ninja Version: N/A (Issue is with the
scccompiler, not Binary Ninja itself) - OS: Windows (Issue observed on Windows, but likely platform-independent)
- OS Version: 10
- CPU Architecture: x64
Bug Description:
The scc compiler defaults to generating 32-bit shellcode when no target architecture is explicitly specified via command-line arguments. This is not clearly communicated to the user and can lead to wasted time debugging when the user expects a different architecture.
Steps To Reproduce:
- Create a C file (e.g.,
solution.c) with simple code, such as:
char data[64];
void main()
{
write(1, "HI\n", 3);
return;
}
- Compile the code using
sccwithout specifying a target architecture:
scc solution.c -o solution.bin
- Observe that the compiler outputs only
Output is N byteswith no indication of the generated architecture (32-bit in this case).
Expected Behavior:
Ideally, scc should:
- Option 1 (Recommended): Fail compilation with a clear error message if no target architecture is specified. The error message should explicitly state that a target architecture (e.g.,
-arch x64or-arch x86) must be provided. This would prevent users from unknowingly generating incompatible code. - Option 2: Print a clear warning message indicating that the compiler is defaulting to 32-bit shellcode. This warning should be prominently displayed and easily noticeable.
- Option 3 (Less Ideal): The architecture should be detected correctly (e.g. based on compilation platform)
Screenshots/Video Recording:
N/A - No visual component to the bug.
Binary:
N/A - Issue is with the compiler itself. Example C code provided in "Steps To Reproduce".
Additional Information:
As per a discussion with one of the devs, it was mentioned that scc is no longer actively maintained and might be open-sourced in the future. This issue might be a good candidate for a community contribution if/when that happens. The silent defaulting to 32-bit can lead to significant debugging time spent trying to resolve seemingly unrelated issues.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source file or test is named. Start by locating the scc compiler entry point and the command-line handling for target architecture, then reproduce with scc solution.c -o solution.bin without -arch. Done means the compiler either rejects the missing target with a clear error or prominently warns that it defaults to 32-bit shellcode.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100