Meta tags:
Headings (most frequently used words):
device, ids, understanding, keys, an, aside, about, collisions, problems, and, vulnerabilities, connection, establishment, discovery, spoofing, long, are, painful, navigation, related, topics, quick, search, donate, support,
Text of the page (most frequently used words):
the (82), #device (34), that (26), and (24), syncthing (17), this (15), are (15), for (14), key (13), hash (12), certificate (12), with (11), you (11), 256 (11), ids (9), not (9), can (8), have (8), connection (7), sha (7), there (6), discovery (6), collision (6), about (6), address (6), bit (6), public (6), but (5), local (5), any (5), bits (5), need (5), using (5), messages (5), tls (5), probability (5), port (5), number (5), next (4), use (4), out (4), authentication (4), into (4), connect (4), both (4), once (4), far (4), know (4), same (4), create (4), every (4), than (4), which (4), here (4), configuration (4), global (4), will (4), base32 (4), pem (4), x509v3 (4), api (3), event (3), understanding (3), web (3), usage (3), one (3), pin (3), user (3), verify (3), mechanism (3), means (3), itself (3), these (3), above (3), find (3), has (3), already (3), collisions (3), then (3), instance (3), what (3), handshake (3), server (3), used (3), characters (3), form (3), subject (3), algorithm (3), signature (3), 3072 (3), keys (3), infrastructure (2), automatic (2), crash (2), reporting (2), developers (2), development (2), documentation (2), utility (2), release (2), signing (2), introduction (2), version (2), shorter (2), other (2), correct (2), before (2), mfzwi3 (2), isn (2), such (2), possible (2), even (2), each (2), currently (2), issues (2), also (2), good (2), valid (2), der (2), signed (2), difficulty (2), property (2), resistance (2), attack (2), two (2), result (2), doesn (2), message (2), second (2), more (2), important (2), billion (2), few (2), actually (2), amount (2), against (2), when (2), certificates (2), remote (2), drop (2), performed (2), part (2), enabled (2), static (2), seen (2), broadcasts (2), information (2), where (2), name (2), might (2), add (2), first (2), padding (2), resulting (2), encode (2), something (2), like (2), data (2), could (2), keypair (2), openssl (2), cert (2), serial (2), issuer (2), sha1withrsaencryption (2), critical (2), rsa (2), gmt (2), look (2), prior (2), private (2), self (2), donate, support, quick, search, previous, overview, related, topics, specifications, http, services, rest, creating, issue, management, debugging, building, working, gui, navigation, written, gf020590, edit, page, github, band, bluetooth, pairing, enter, time, give, plus, short, another, initial, sides, knows, accepting, verification, based, full, entered, found, connected, dbonsg, yyltmr, wgc43e, nrqxgz, dmmfzw, i3dbon, sgyylt, mrwa, please, confirm, vulnerability, experience, problem, various, solutions, mouthful, read, over, phone, annoying, type, sms, computer, needs, done, twice, side, long, painful, protected, crypto, theory, announce, potentially, receive, connections, from, network, spoofing, potential, problems, vulnerabilities, note, enough, random, blob, happen, encoded, mine, staggeringly, beyond, staggering, finding, worth, noting, simply, preimage, help, general, hashes, exactly, won, get, mass, murderer, space, rock, happens, million, years, average, leads, occurring, orders, magnitude, probable, briefly, stated, scary, your, priorities, wrong, perfect, function, output, size, individual, length, approximation, small, substantially, smaller, usual, answer, goes, thus, rogue, asteroid, crashes, earth, within, obliterating, civilization, killing, off, people, argued, unlucky, lower, very, going, quote, stack, overflow, argue, course, infinite, inputs, finite, outputs, definition, infinitely, many, cryptographically, resistant, way, different, aside, everything, checks, accept, default, expect, custom, changed, commonname, expecting, talk, weed, misconfigurations, active, cases, calculate, processing, received, tcp, established, devices, present, their, completed, peer, known, following, steps, announces, service, external, internal, announced, don, haven, announcements, queried, lan, periodically, given, try, set, statically, equally, well, host, dynamic, dns, setup, option, now, how, they, attempt, thing, figure, three, possibilities, establishment, ltmrwad, bonsgyy, fzwi3dp, qxgzdmm, c43enr5, yltmrwg, bonsgyc, mfzwi3d, stripped, away, split, four, groups, added, group, presentation, purposes, grouped, dashes, final, value, check, digits, mfzwi3dbonsgyyltmrwgc43enrqxgzdmmfzwi3dbonsgyyltmrwa, hashing, results, encodes, five, per, character, becomes, practice, would, decode, 260, whole, bytes, encoding, adds, 280, multiple, looks, calculated, covers, all, under, section, advanced, replace, files, generated, directly, see, little, container, zero, qualified, otherwise, expected, false, constraints, basic, client, extended, encipherment, digital, extensions, 0x10001, 65537, exponent, modulus, rsaencryption, info, 2049, dec, after, 2014, mar, validity, 0x0, 0x2, typical, inspected, x509, ed25519, 384, ecdsa, example, article, saved, security, functionality, concerned, enables, standard, exchange, understand, underlying, mechanisms, startup, identified, resolution, authorization, term, interchangeably, been, since, direct,
Text of the page (random words):
understanding device ids syncthing documentation understanding device ids every device is identified by a device id the device id is used for address resolution authentication and authorization the term device id could interchangeably have been key id since the device id is a direct property of the public key in use keys to understand device ids we need to look at the underlying mechanisms at first startup syncthing will create a public private keypair currently this is a 256 bit ed25519 key 384 bit ecdsa prior to v2 0 0 and 3072 bit rsa prior to v0 12 5 which is what is used as an example in this article the keys are saved in the form of the private key key pem and a self signed certificate cert pem the self signing part doesn t actually add any security or functionality as far as syncthing is concerned but it enables the use of the keys in a standard tls exchange the typical certificate will look something like this inspected with openssl x509 certificate data version 3 0x2 serial number 0 0x0 signature algorithm sha1withrsaencryption issuer cn syncthing validity not before mar 30 21 10 52 2014 gmt not after dec 31 23 59 59 2049 gmt subject cn syncthing subject public key info public key algorithm rsaencryption rsa public key 3072 bit modulus 3072 bit 00 da 83 8 a c0 95 af 0 a 42 af 43 74 65 29 f2 30 e3 b9 12 d2 6 b 70 93 da 0 b 7 b 8 a 1 e e5 79 99 09 4 c a9 7 b ba 4 a 6 a 8 b 3 b e6 e7 c7 2 c 00 90 aa bc ad 94 e7 80 95 d2 1 b exponent 65537 0x10001 x509v3 extensions x509v3 key usage critical digital signature key encipherment x509v3 extended key usage tls web server authentication tls web client authentication x509v3 basic constraints critical ca false signature algorithm sha1withrsaencryption 68 72 43 8 b 83 61 09 68 f0 ef f0 43 b7 30 a6 73 1 e a8 d9 24 6 c 2 d b4 bc c9 e8 3 e 0 b 1 e 3 c cc 7 a b2 c8 f1 1 d 88 7 e e2 61 aa 4 c 02 e3 64 b0 da 70 3 a cd 1 c 3 d 86 db df 54 b9 4 e be 1 b we can see here that the certificate is little more than a container for the public key the serial number is zero and the issuer and subject are both syncthing where a qualified name might otherwise be expected an advanced user could replace the key pem and cert pem files with a keypair generated directly by the openssl utility or other mechanism device ids to form a device id the sha 256 hash of the certificate data in der form is calculated this means the hash covers all information under the certificate section above the hashing results in a 256 bit hash which we encode using base32 base32 encodes five bits per character so we need 256 5 51 2 characters to encode the device id this becomes 52 characters in practice but 52 characters of base32 would decode to 260 bits which is not a whole number of bytes the base32 encoding adds padding to 280 bits the next multiple of both 5 and 8 bits so the resulting id looks something like mfzwi3dbonsgyyltmrwgc43enrqxgzdmmfzwi3dbonsgyyltmrwa the padding is stripped away the device id split into four groups and check digits are added for each group for presentation purposes the device id is grouped with dashes resulting in the final value mfzwi3d bonsgyc yltmrwg c43enr5 qxgzdmm fzwi3dp bonsgyy ltmrwad connection establishment now we know what device ids are here s how they are used in syncthing when you add a device id to the configuration syncthing will attempt to connect to that device the first thing we need to do is figure out the ip and port to connect to there are three possibilities here the ip and port can be set statically in the configuration the ip can equally well be a host name so if you have a static ip or a dynamic dns setup this might be a good option using local discovery if enabled every syncthing instance on a lan periodically broadcasts information about itself device id address port number if we ve seen one of these broadcasts for a given device id that s where we try to connect using global discovery if enabled every syncthing instance announces itself to the global discovery service device id and external port number the internal address is not announced to the global server if we don t have a static address and haven t seen any local announcements the global discovery server will be queried for an address once we have an address and port a tcp connection is established and a tls handshake performed as part of the handshake both devices present their certificates once the handshake has completed and the peer certificate is known the following steps are performed calculate the remote device id by processing the received certificate as above weed out a few possible misconfigurations i e if the device id is that of the local device or of a device we already have an active connection to drop the connection in these cases verify the remote device id against the configuration if it is not a device id we are expecting to talk to drop the connection verify the certificate commonname against the configuration by default we expect it to be syncthing but when using custom certificates this can be changed if everything checks out so far accept the connection an aside about collisions the sha 256 hash is cryptographically collision resistant this means that there is no way that we know of to create two different messages with the same hash you can argue that of course there are collisions there s an infinite amount of inputs and a finite amount of outputs so by definition there are infinitely many messages that result in the same hash i m going to quote stack overflow here the usual answer goes thus what is the probability that a rogue asteroid crashes on earth within the next second obliterating civilization as we know it and killing off a few billion people it can be argued that any unlucky event with a probability lower than that is not actually very important if we have a perfect hash function with output size n and we have p messages to hash individual message length is not important then probability of collision is about p2 2n 1 this is an approximation which is valid for small p i e substantially smaller than 2n 2 for instance with sha 256 n 256 and one billion messages p 10 9 then the probability is about 4 3 10 60 a mass murderer space rock happens about once every 30 million years on average this leads to a probability of such an event occurring in the next second to about 10 15 that s 45 orders of magnitude more probable than the sha 256 collision briefly stated if you find sha 256 collisions scary then your priorities are wrong it s also worth noting that the property of sha 256 that we are using is not simply collision resistance but resistance to a preimage attack i e even if you can find two messages that result in a hash collision that doesn t help you attack syncthing or tls in general you need to create a message that hashes to exactly the hash that my certificate already has or you won t get in note also that it s not good enough to find a random blob of bits that happen to have the same hash as my certificate you need to create a valid der encoded signed certificate that has the same hash as mine the difficulty of this is staggeringly far beyond the already staggering difficulty of finding a sha 256 collision problems and vulnerabilities as far as i know these are the issues or potential issues with the above mechanism discovery spoofing currently the local discovery mechanism isn t protected by crypto this means that any device can in theory announce itself for any device id and potentially receive connections for that device from the local network long device ids are painful it s a mouthful to read over the phone annoying to type into an sms or even into a computer and it needs to be done twice once for each side this isn t a vulnerability as such but a user experience problem there are various possible solutions use shorter device ids with verification based on the full id you entered mfzwi3 i found and connected to a device with the id mfzwi3 dbonsg yyltmr wgc43e nrqxgz dmmfzw i3dbon sgyylt mrwa please confirm that this is correct use shorter device ids with an out of band authentication a la bluetooth pairing you enter a one time pin into syncthing and give that pin plus a short device id to another user on initial connect both sides verify that the other knows the correct pin before accepting the connection edit this page on github version v2 1 0 26 gf020590 written for v2 1 0 navigation introduction usage development introduction working on the web gui building syncthing debugging syncthing automatic crash reporting for developers understanding device ids syncthing infrastructure issue management creating a release release signing rest api event api http utility services api specifications related topics documentation overview development previous automatic crash reporting for developers next syncthing infrastructure quick search donate support
|