Bitcoin Forum

Bitcoin => Bitcoin Discussion => Topic started by: mvdheuvel1983 on September 17, 2023, 01:03:52 PM



Title: How Do I Verify the Integrity of Open-Source Code
Post by: mvdheuvel1983 on September 17, 2023, 01:03:52 PM
The general advice is the a Bitcoin tool such as a wallet is okay to use if it is open-source. Aside this there are crypto companies that post their open source code online. I consider my self a skeptic to a degree and I know that there is always the possibility that these companies could post the open source code online but run a different code on your device. There's also another possibility that it could be tampered with during transit.Is there anyway that I can verify the integrity of open-source code and ensure that the code running on your device matches the published code?



Title: Re: How Do I Verify the Integrity of Open-Source Code
Post by: _act_ on September 17, 2023, 01:11:12 PM
If you are not a developer, you can not know it, only developers can be able to completely know if a code is completely open source or not. For wallets, you can ask on this forum.

You can check this website also: https://walletscrutiny.com/

If you are a developer, the open source wallets leave their code public on GitHub.


Title: Re: How Do I Verify the Integrity of Open-Source Code
Post by: AbuBhakar on September 17, 2023, 01:14:53 PM
Is there anyway that I can verify the integrity of open-source code and ensure that the code running on your device matches the published code?


Use the forum to help you verify it. There’s a lot of good developer here on the technical board that can help you verify the code.

There’s no way to verify it if you didn’t know how to read a code since you will need to determine how it was coded to verify if the code use is safe for user safety. I was wondering if there’s a specifi code line that a non-developer can use a reference to watch out if the code is safe or not.



Title: Re: How Do I Verify the Integrity of Open-Source Code
Post by: Cantsay on September 17, 2023, 01:17:17 PM
If you can read codes then you’ll be able to read through to see if there’s any back door, but if you’re not you could take them to someone who can and if they confirm that it’s safe then you can proceed to compiling them yourself if you don’t trust the app that was uploaded or if you’re skeptical about using the software since they can use a different code for it.

I don’t know if it’s practical but you could watch a few tutorials on how to work your way through compiling the files depending on the language to an .exe file. I have never tried it myself but it’s never bad to learn something new.


Title: Re: How Do I Verify the Integrity of Open-Source Code
Post by: SquirrelJulietGarden on September 17, 2023, 01:20:29 PM
I consider my self a skeptic to a degree and I know that there is always the possibility that these companies could post the open source code online but run a different code on your device. There's also another possibility that it could be tampered with during transit.Is there anyway that I can verify the integrity of open-source code and ensure that the code running on your device matches the published code?
You have to be a professional coder to be able to verify source code of Bitcoin wallet software.

If you are like me, you have to rely on reviews from community including professional coders, Bitcoin developers on wallet softwares. You can use websites like https://walletscrutiny.com/ that is from a professional Bitcoin developer.

Or some review websites like https://www.cryptowisser.com/wallets/


Title: Re: How Do I Verify the Integrity of Open-Source Code
Post by: BitMaxz on September 17, 2023, 01:31:30 PM
Is there anyway that I can verify the integrity of open-source code and ensure that the code running on your device matches the published code?


Most of the open source have public GPG keys, checksums, and signatures you can verify their integrity by verifying these. Sample Electrum if you download it from GitHub or their website it also provides a GPG signature you can verify it by using the GPG tool.

Other open-source codes also provide checksum files you will need a checksum tool to verify its authenticity there are some guides out there on how to verify checksum or check this link below.

- https://codesigningstore.com/how-to-check-file-checksum

Another thing is you can directly build it from the source if you don't trust the file that you downloaded or installed.


Title: Re: How Do I Verify the Integrity of Open-Source Code
Post by: Z-tight on September 17, 2023, 01:45:00 PM
The general advice is the a Bitcoin tool such as a wallet is okay to use if it is open-source.
Open source code or software is recommended, but it doesn't mean they are safe by default, it means that the code can be reviewed, while bugs and attacks can be found easily and quicker. If it is a source code that has been reviewed by a lot of developers in the community, you can tick it as safe.
companies could post the open source code online but run a different code on your device.
If you have downloaded the original software and not a malicious one, and you've also verified your download; then you can be sure you are running the original software. If it is a well reviewed software, then if anything is slipped into its code in any of its new update, it will be easily identified and users will be warned not to make the update locally on their device.
there anyway that I can verify the integrity of open-source code and ensure that the code running on your device matches the published code?
The only way is by verifying it, if you don't have the skill to do it, then use software that is well reviewed and recommended by the community.


Title: Re: How Do I Verify the Integrity of Open-Source Code
Post by: Faisal2202 on September 17, 2023, 02:47:28 PM
The general advice is the a Bitcoin tool such as a wallet is okay to use if it is open-source. Aside this there are crypto companies that post their open source code online. I consider my self a skeptic to a degree and I know that there is always the possibility that these companies could post the open source code online but run a different code on your device. There's also another possibility that it could be tampered with during transit.Is there anyway that I can verify the integrity of open-source code and ensure that the code running on your device matches the published code?
I think you can solve this skepticism by comparing the GPG code (signature code which is used to verify that the code is not tampered with) or hashes. I hope you can do that. Otherwise you simply have to find the resource code of the product you are using and then can compare that code with the code which the publishers have published. You should take some products as an example.


Title: Re: How Do I Verify the Integrity of Open-Source Code
Post by: pooya87 on September 17, 2023, 03:50:11 PM
Is there anyway that I can verify the integrity of open-source code and ensure that the code running on your device matches the published code?

Most of the open source have public GPG keys, checksums, and signatures you can verify their integrity by verifying these. Sample Electrum if you download it from GitHub or their website it also provides a GPG signature you can verify it by using the GPG tool.
Technically the thing you are verifying using GPG signatures is the authenticity of the binary or in simple terms you make sure that the binary is released by the person who owns that key. It does NOT tell you whether the binary has anything to do with the open source code you saw on the GitHub.

In order to know whether the binary is actually built from the source code you saw, the project has to support what's called "deterministic builds"[1]. This means no matter who compiles the code and where, they should all get the same exact binaries. That way different people could verify that the binary is indeed built from the source code we see by simply comparing the checksums.
Electrum supports deterministic builds by the way.

[1] https://en.wikipedia.org/wiki/Reproducible_builds


Title: Re: How Do I Verify the Integrity of Open-Source Code
Post by: _act_ on September 17, 2023, 04:13:31 PM
I think you can solve this skepticism by comparing the GPG code (signature code which is used to verify that the code is not tampered with) or hashes. I hope you can do that. Otherwise you simply have to find the resource code of the product you are using and then can compare that code with the code which the publishers have published. You should take some products as an example.
You are getting it wrongly. GPG or PGP or anything that we call a way to verify that we downloaded the right app and not the fake one is not a way to know that a software is open source or close source. Assuming I downloaded Electrum and verify its signature, I will know that Electrum site has not been compromised and that the wallet I downloaded from the Electrum site is from the Electrum developer. If Electrum site is compromised and the hacker that compromised it changed the original Electrum app to fake apps, I will be able to know that it is fake if the PGP signature fails.


Title: Re: How Do I Verify the Integrity of Open-Source Code
Post by: m2017 on September 17, 2023, 05:28:56 PM
The general advice is the a Bitcoin tool such as a wallet is okay to use if it is open-source. Aside this there are crypto companies that post their open source code online. I consider my self a skeptic to a degree and I know that there is always the possibility that these companies could post the open source code online but run a different code on your device. There's also another possibility that it could be tampered with during transit.Is there anyway that I can verify the integrity of open-source code and ensure that the code running on your device matches the published code?


I, too, have always had similar skepticism about open source applications, which for some reason everyone perceives as a panacea for possible backdoors from a wallet provider. I also have doubts that a cryptocompany may provide completely different source code for testing on specialized resources, such as github. Also, it always seemed strange to me that if the source code is open, then someone necessarily checks this code. What if everyone hopes that the other will do it and in the end no one checks? :) Do people have nothing better to do than check the source code of every application? In this case, I am ready to trust completely only myself, but I don't have the skills to independently check the source code of applications. So how can someone like me, who are the majority, check the source code and make sure that it is the right source code and not a fake? In general, I support OP’s questions.


Title: Re: How Do I Verify the Integrity of Open-Source Code
Post by: vv181 on September 17, 2023, 06:55:53 PM
Also, it always seemed strange to me that if the source code is open, then someone necessarily checks this code. What if everyone hopes that the other will do it and in the end no one checks? :) Do people have nothing better to do than check the source code of every application? In this case, I am ready to trust completely only myself, but I don't have the skills to independently check the source code of applications. So how can someone like me, who are the majority, check the source code and make sure that it is the right source code and not a fake? In general, I support OP’s questions.

The motivation of others to check an open source project is because they simply use or build something from the particular project, in consequence, they are encouraged to eventually check the code. Furthermore, the question arises about what if there isn't anyone even checking the code is a valid one, hence, open source does not mean it would be automatically secure and trusted. It is still necessary to use a project that has gained trust within the open source community, so there are many eyes that scrutinise the project in case something goes wrong. It also helps to those who can not manually check and comprehend the code by themselves.


Title: Re: How Do I Verify the Integrity of Open-Source Code
Post by: OgNasty on September 17, 2023, 07:10:31 PM
As others have already said you can use a checksum to verify the authenticity of a file. The best way is always to obtain the source code from the official trusted source and build it yourself though. It’s not even a very difficult task, you just need to get in the habit of doing it. I myself usually don’t go through the extra steps out of laziness, but it doesn’t take a lot of time or effort so it’s a good habit to get into.


Title: Re: How Do I Verify the Integrity of Open-Source Code
Post by: BlackHatCoiner on September 17, 2023, 07:25:48 PM
I consider my self a skeptic to a degree and I know that there is always the possibility that these companies could post the open source code online but run a different code on your device.
When software is said to be open-source, it means you can verify this yourself. All you need to do is download the repository, and follow the instructions, which more or less go as following:

Step 0: Have a compiler (i.e., gcc (https://gcc.gnu.org/)).
Step 1: Install some libraries (the instructions will give you the precise command to enter in terminal).
Step 2: Compile. Probably with some Makefile, which is essentially an automated way to build the program.
Step 3: Verify the binaries' checksum (as you would in any case). 

This way you can verify that the binaries the company has in their main page are indeed not altered.


Title: Re: How Do I Verify the Integrity of Open-Source Code
Post by: JunaidAzizi on September 17, 2023, 07:35:31 PM
The general advice is the a Bitcoin tool such as a wallet is okay to use if it is open-source. Aside this there are crypto companies that post their open source code online. I consider my self a skeptic to a degree and I know that there is always the possibility that these companies could post the open source code online but run a different code on your device. There's also another possibility that it could be tampered with during transit.Is there anyway that I can verify the integrity of open-source code and ensure that the code running on your device matches the published code?

It is possible to verify the integrity of open source code that is running on your device is the same as the published. there are two ways through which it can be verified. The one is to compile the code yourself. This involves the compiler converting the source code into machine code that can be executed by your computer, If you are able to compile the code successfully then you are confident that the code is authentic. The second one is a signature tool that verifies the integrity of open-source code. A signature tool can generate a digital signature for a piece of software. this digital signature can then be used to verify that the software has not been tampered with.


Title: Re: How Do I Verify the Integrity of Open-Source Code
Post by: Hamza2424 on September 17, 2023, 08:17:06 PM
The general advice is the a Bitcoin tool such as a wallet is okay to use if it is open-source. Aside this there are crypto companies that post their open source code online. I consider my self a skeptic to a degree and I know that there is always the possibility that these companies could post the open source code online but run a different code on your device. There's also another possibility that it could be tampered with during transit.Is there anyway that I can verify the integrity of open-source code and ensure that the code running on your device matches the published code?

OP is to be mentioned first I think, this topic fits In technical discussion more effectively, Besides that IMO, as your concerns are legit by participation in the community discussion where people are likely using it, you can get engaged to authenticate the integrity as if anything wrong happens someone will post about it and you can get a pre-alert as well.

Secondly, I think tampered with during transit can be authenticated with digital signatures and most of the time it works well. Compiling the code by yourself and other ways may not be helpful for a day-to-day user who is not familiar with such things., so as above I had mentioned by reading the feedback and reviews, he can judge. Anyway, that was I nice topic for today's list haha I can read others and obtain some good insights as well.


Title: Re: How Do I Verify the Integrity of Open-Source Code
Post by: Medusah on September 17, 2023, 08:30:27 PM
The second one is a signature tool that verifies the integrity of open-source code. A signature tool can generate a digital signature for a piece of software. this digital signature can then be used to verify that the software has not been tampered with.

Digital signatures are used to verify that the binaries were not tampered during file transfer, but not that the source code shown corresponds to the binaries.  To verify that, you download the source code and build it yourself.  And then check for digital signature.


Title: Re: How Do I Verify the Integrity of Open-Source Code
Post by: Upgrade00 on September 17, 2023, 08:43:05 PM
So how can someone like me, who are the majority, check the source code and make sure that it is the right source code and not a fake? In general, I support OP’s questions.
I think it's down to having the option. If the code source is closed then no one can check what's going no regardless of the skills you possess. If it's open source the devs are aware that what they do is publicly available and there will at least be a couple of their usersbt verify that.

The question does not negate the need to use open source but just shows that not everyone can effectively utilize the feature.


Title: Re: How Do I Verify the Integrity of Open-Source Code
Post by: franky1 on September 17, 2023, 09:17:08 PM
when code is available on things like github. people (who dont have to be developers) can compile their own .exe file from that source code(easy tutorials are available)

they can also then look at the file hash of the compiled file to see it if matches file hashes of other already compiled .exe files attributed as the same version. and if it matches they can submit a comment that they too have matched the sourcecode to the .exe and the hashes match, thus one level of independently verifying the code matches the file and give independent opinion to other users that the promoted exe is legit too

i say this because:
sometimes there are 'open source' projects that are wrote by small groups. compiled by the same group and promoted by the same group. with no independent outside review/check thus people end up blindly trusting a small centralized group

the whole point is not just that the source code is open to view. but also that it should be independently reviewed at code level and independently validated at compile level

another level of integrity of open source is not just that its openly readable. but also that making improvements to it should not be closed off


Title: Re: How Do I Verify the Integrity of Open-Source Code
Post by: hatshepsut93 on September 17, 2023, 11:16:23 PM
The general advice is the a Bitcoin tool such as a wallet is okay to use if it is open-source.

No it's not. The general advice is that closed source wallets are bad, but this doesn't make all open source good. If you can't review the wallet code yourself, if no one that you trust has reviewed it, then it's not too different from a closed source. Like, there's less chance that someone would put backdoors into an open source wallet, because it's possible to spot it, but this doesn't mean that no one will try such thing.


Title: Re: How Do I Verify the Integrity of Open-Source Code
Post by: panganib999 on September 17, 2023, 11:19:02 PM
I don't think it's really that important, I'd argue that if you're going to buy a wallet with codebase that could easily be edited it's much better to just buy a wallet from a provider or use your hard disk instead. Cause you're putting yourself at a bigger risk of losing your money to bad actors and hackers. Plus when it comes to "open-source" you can't really do much to verify it besides take the developer's word for it. There's no way for the consumer to confirm whether a program is an open-source until they actually work upon said program.

Don't worry about the trivial details anymore, just make sure you buy a self-custodial wallet and for the most part of your crypto journey, that's going to be enough.


Title: Re: How Do I Verify the Integrity of Open-Source Code
Post by: Medusah on September 19, 2023, 09:21:35 AM
No it's not. The general advice is that closed source wallets are bad, but this doesn't make all open source good. If you can't review the wallet code yourself, if no one that you trust has reviewed it, then it's not too different from a closed source. Like, there's less chance that someone would put backdoors into an open source wallet, because it's possible to spot it, but this doesn't mean that no one will try such thing.

They definitely try those things: https://security.stackexchange.com/questions/23334/example-of-a-backdoor-submitted-to-an-open-source-project

It just happens to be big projects.  Fortunately, it's expert developers that work on these projects and spot them.  This linux backdoor attempt back in 2003 was difficult to spot: https://freedom-to-tinker.com/2003/11/12/linux-backdoor-attempt-thwarted/.  The attacker's added code was this:
Code:
if ((options == (__WCLONE|__WALL)) && (current->uid = 0))
        retval = -EINVAL;
]

If you're a C programmer you can spot it easier than a regular programmer.

Answer:
current->uid = 0 assigns value 0 to current->uid and then returns 0 to the condition, which means the condition is always false and current->uid value is always set to 0.  You would expect current->uid == 0 instead.

Today, that would be even easier to spot with things like Visual Studio Code.


Title: Re: How Do I Verify the Integrity of Open-Source Code
Post by: NotATether on September 19, 2023, 11:30:58 AM
I consider my self a skeptic to a degree and I know that there is always the possibility that these companies could post the open source code online but run a different code on your device.
When software is said to be open-source, it means you can verify this yourself. All you need to do is download the repository, and follow the instructions, which more or less go as following:

Step 0: Have a compiler (i.e., gcc (https://gcc.gnu.org/)).
Step 1: Install some libraries (the instructions will give you the precise command to enter in terminal).
Step 2: Compile. Probably with some Makefile, which is essentially an automated way to build the program.
Step 3: Verify the binaries' checksum (as you would in any case). 

This way you can verify that the binaries the company has in their main page are indeed not altered.

That only works if the project is written in C or Cpp. Most projects have an installation section with step-by-step instructions on how to build stuff written in other languages.

Also you forgot an important step - use Git to checkout the tag containing the version number. If you don't do this the checksums are going to be different at the end because more code was changed meanwhile.


Title: Re: How Do I Verify the Integrity of Open-Source Code
Post by: yhiaali3 on September 19, 2023, 05:11:32 PM
I don't think it's really that important, I'd argue that if you're going to buy a wallet with codebase that could easily be edited it's much better to just buy a wallet from a provider or use your hard disk instead. Cause you're putting yourself at a bigger risk of losing your money to bad actors and hackers. Plus when it comes to "open-source" you can't really do much to verify it besides take the developer's word for it. There's no way for the consumer to confirm whether a program is an open-source until they actually work upon said program.

Don't worry about the trivial details anymore, just make sure you buy a self-custodial wallet and for the most part of your crypto journey, that's going to be enough.
These are not trivial details, on the contrary they are extremely important, this relates directly to the security of your assets and any small mistake can cost you the loss of all your crypto assets.

Buying a self-custodial wallet is not enough. If you mean hard wallets, they also have programs, some of which are closed source and some of which are open source. As for closed source wallets like Ledger, they cannot be trusted, especially after it became clear that the company has access to the seed.

As for wallets that use open source software such as Trezor, we return to the same problem, which is how to make sure that we are downloading the correct software and not the wrong one, because if you download the wrong software, you will lose all your assets.