Skip to content

error: unsafe attribute used without unsafe #3

@kayabaguette

Description

@kayabaguette

OS

# cat /etc/fedora-release 
Fedora release 41 (Forty One)

Current environment

Rust version

# rustup --version
rustup 1.27.1
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.85.0 (4d91de4e4 2025-02-17)`

Targets installed

# rustup target list | grep "(installed)"
x86_64-pc-windows-gnu (installed)
x86_64-unknown-linux-gnu (installed)

Command and result

# ./FaceDancer_linux_amd64 attack -P msedge -O test.dll -I Payload.dll 

    ___________                   ________                                    
    \_   _____/____    ____  ____ \______ \ _____    ____   ____  ___________ 
     |    __) \__  \ _/ ___\/ __ \ |    |  \\__  \  /    \_/ ___\/ __ \_  __ \
     |     \   / __ \\  \__\  ___/ |    `   \/ __ \|   |  \  \__\  ___/|  | \/
     \___  /  (____  /\___  >___  >_______  (____  /___|  /\___  >___  >__|   
         \/        \/     \/    \/        \/     \/     \/     \/    \/                                              
                                    (@Tyl0us)
                
[+] Execution mode: 'Targeted Process' proxying selected
[*] msedge selected for creation
[*] Created new Rust project: msedge
[*] Starting SRDI processing of Payload.dll 
[*] SRDI process completed
[*] Chose a random COM related to process msedge: {1299CF18-C4F5-4B6A-BB0F-2299F0398E27}
[*] Added dependency to Cargo.toml
[*] Adding Process check
[+] DLL will only run under msedge.exe
[*] Sandbox evasion not enabled...
[*] Compiling Payload... please be patient
error: unsafe attribute used without unsafe
  --> src/lib.rs:40:3
   |
40 | #[no_mangle]
   |   ^^^^^^^^^ usage of unsafe attribute
   |
help: wrap the attribute in `unsafe(...)`
   |
40 | #[unsafe(no_mangle)]
   |   +++++++         +

error: could not compile `msedge` (lib) due to 1 previous error
Error: 'cargo build' failed. Please ensure you have the following:
- The Target 'x86_64-pc-windows-gnu'

Note : This error appears whatever the payload we want to compile.

Current solution

In file lib/src/lib.rs : update the line 60 from : #[no_mangle] to #[unsafe(no_mangle)] then build the project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions