Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to obtain line number information #5

Open
sunbeomso opened this issue Dec 13, 2022 · 3 comments
Open

how to obtain line number information #5

sunbeomso opened this issue Dec 13, 2022 · 3 comments

Comments

@sunbeomso
Copy link

Hi,

If Solidity source code of a contract is available, how can I obtain line number information from Smartian's bug detection results?

For example, if I run the command:

dotnet build/Smartian.dll fuzz -p examples/bc/SC.bin -a examples/abi/SC.abi -t 2 -o .

Smartian outputs the following log:

...
[00:00:00:01] Tx#3 found SuicidalContract at b50
[00:00:00:01] [*] Save bug seed id-00000-SC_00001: 
...

In the above, what does b50 mean? How can I know that b50 matches with line 139?

@jchoi2022
Copy link
Collaborator

jchoi2022 commented Dec 17, 2022

Hi, Smartian runs on EVM bytecode, so it cannot report the bug location in source line number.
In Smartian's output log, b50 is the address of the EVM bytecode instruction (i.e., program counter).

Therefore, it needs some manual analysis to compare Smartian against source-based tools.
For example, on our B1 benchmark (see our arfiact repository), we identified and recorded the bug locations both at source level and bytecode level: ground truth.. This way, we can decide whether source-based tools and Smartian are reporting the same bug or not.

@sunbeomso
Copy link
Author

Thanks for your reply.

I am still wondering how the manual analysis is conducted.

If possible, could you explain in more detail using an example below?
https://github.com/SoftSec-KAIST/Smartian/blame/main/examples/bc/SC.bin

Or, could you recommend some useful references?

Thanks for your time!

@jchoi2022
Copy link
Collaborator

I'm sorry, I thought I had already answered to this issue. Although it's late, here is some more information.

We manually analyzed the EVM bytecode to figure out the correspondence between buggy line number (at source level) and buggy address (of EVM instruction). While you can use any tool you prefer for this, we internally used CFG visualizer equipped in B2R2, which we used as our front-end. It allows us to navigate the CFG of EVM bytecode as shown in the screenshot below.

CFG

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants