When I read the documentation of the fossil sync protocol, I noticed that a nonce is used which is a function of the message contents only.

This means an attacker can record each message and replay it at any time.

It is not clear to me from the documentation whether or not any possible message contains some unique information that will never be repeated in any later messages.

If this is the case, feel free to close this ticket but please clarify the documentation accordingly.

Otherwise, I would strongly suggest to add some sort of transaction counter to the hash from which the nonce will be created.

A simple incrementing counter should suffice, as the hash function will totally garble the bits anyway.

However, even then the question arises when the counter is initialized and where it is stored.

For that reason, it might be better if the server created a "session string" at the beginning of each sync session and sends it to the client.

This string could consist, for instance, of the current date and time plus a small random number in order to thwart scripted replay attacks which might exploit a low clock resolution of the server.

This session string is then augmented by an integer counter that starts at 0 at the beginning of each session.

Using this or a similar scheme will guarantee that each combination of session string and message counter will always be unique, and an attacker has no chance of launching a replay attack.