Vector35 / Vector35/binaryninja-api

scc defaults to 32-bit shellcode without warning, causing unexpected behavior

Open
#6,577 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Component: SCC Effort: Low Impact: Low
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 scc compiler, 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:

  1. Create a C file (e.g., solution.c) with simple code, such as:
char data[64];

void main()
{
    write(1, "HI\n", 3);
    return;
}
  1. Compile the code using scc without specifying a target architecture:
scc solution.c -o solution.bin
  1. Observe that the compiler outputs only Output is N bytes with 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 x64 or -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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.