Skip to content

Commit f976c89

Browse files
committed
Merge branch 'mm/push-social-engineering-attack-doc' into maint
Doc update on fetching and pushing. * mm/push-social-engineering-attack-doc: doc: mention transfer data leaks in more places
2 parents 8ee6fc9 + 235ec24 commit f976c89

File tree

6 files changed

+51
-22
lines changed

6 files changed

+51
-22
lines changed

Documentation/config.txt

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2940,6 +2940,11 @@ is omitted from the advertisements but `refs/heads/master` and
29402940
`refs/namespaces/bar/refs/heads/master` are still advertised as so-called
29412941
"have" lines. In order to match refs before stripping, add a `^` in front of
29422942
the ref name. If you combine `!` and `^`, `!` must be specified first.
2943+
+
2944+
Even if you hide refs, a client may still be able to steal the target
2945+
objects via the techniques described in the "SECURITY" section of the
2946+
linkgit:gitnamespaces[7] man page; it's best to keep private data in a
2947+
separate repository.
29432948

29442949
transfer.unpackLimit::
29452950
When `fetch.unpackLimit` or `receive.unpackLimit` are
@@ -2949,7 +2954,7 @@ transfer.unpackLimit::
29492954
uploadarchive.allowUnreachable::
29502955
If true, allow clients to use `git archive --remote` to request
29512956
any tree, whether reachable from the ref tips or not. See the
2952-
discussion in the `SECURITY` section of
2957+
discussion in the "SECURITY" section of
29532958
linkgit:git-upload-archive[1] for more details. Defaults to
29542959
`false`.
29552960

@@ -2963,13 +2968,19 @@ uploadpack.allowTipSHA1InWant::
29632968
When `uploadpack.hideRefs` is in effect, allow `upload-pack`
29642969
to accept a fetch request that asks for an object at the tip
29652970
of a hidden ref (by default, such a request is rejected).
2966-
see also `uploadpack.hideRefs`.
2971+
See also `uploadpack.hideRefs`. Even if this is false, a client
2972+
may be able to steal objects via the techniques described in the
2973+
"SECURITY" section of the linkgit:gitnamespaces[7] man page; it's
2974+
best to keep private data in a separate repository.
29672975

29682976
uploadpack.allowReachableSHA1InWant::
29692977
Allow `upload-pack` to accept a fetch request that asks for an
29702978
object that is reachable from any ref tip. However, note that
29712979
calculating object reachability is computationally expensive.
2972-
Defaults to `false`.
2980+
Defaults to `false`. Even if this is false, a client may be able
2981+
to steal objects via the techniques described in the "SECURITY"
2982+
section of the linkgit:gitnamespaces[7] man page; it's best to
2983+
keep private data in a separate repository.
29732984

29742985
uploadpack.allowAnySHA1InWant::
29752986
Allow `upload-pack` to accept a fetch request that asks for any

Documentation/git-fetch.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,8 @@ The first command fetches the `maint` branch from the repository at
192192
objects will eventually be removed by git's built-in housekeeping (see
193193
linkgit:git-gc[1]).
194194

195+
include::transfer-data-leaks.txt[]
196+
195197
BUGS
196198
----
197199
Using --recurse-submodules can only fetch new commits in already checked

Documentation/git-pull.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,8 @@ If you tried a pull which resulted in complex conflicts and
237237
would want to start over, you can recover with 'git reset'.
238238

239239

240+
include::transfer-data-leaks.txt[]
241+
240242
BUGS
241243
----
242244
Using --recurse-submodules can only fetch new commits in already checked

Documentation/git-push.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,8 @@ Commits A and B would no longer belong to a branch with a symbolic name,
559559
and so would be unreachable. As such, these commits would be removed by
560560
a `git gc` command on the origin repository.
561561

562+
include::transfer-data-leaks.txt[]
563+
562564
GIT
563565
---
564566
Part of the linkgit:git[1] suite

Documentation/gitnamespaces.txt

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -61,22 +61,4 @@ For a simple local test, you can use linkgit:git-remote-ext[1]:
6161
git clone ext::'git --namespace=foo %s /tmp/prefixed.git'
6262
----------
6363

64-
SECURITY
65-
--------
66-
67-
Anyone with access to any namespace within a repository can potentially
68-
access objects from any other namespace stored in the same repository.
69-
You can't directly say "give me object ABCD" if you don't have a ref to
70-
it, but you can do some other sneaky things like:
71-
72-
. Claiming to push ABCD, at which point the server will optimize out the
73-
need for you to actually send it. Now you have a ref to ABCD and can
74-
fetch it (claiming not to have it, of course).
75-
76-
. Requesting other refs, claiming that you have ABCD, at which point the
77-
server may generate deltas against ABCD.
78-
79-
None of this causes a problem if you only host public repositories, or
80-
if everyone who may read one namespace may also read everything in every
81-
other namespace (for instance, if everyone in an organization has read
82-
permission to every repository).
64+
include::transfer-data-leaks.txt[]

Documentation/transfer-data-leaks.txt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
SECURITY
2+
--------
3+
The fetch and push protocols are not designed to prevent one side from
4+
stealing data from the other repository that was not intended to be
5+
shared. If you have private data that you need to protect from a malicious
6+
peer, your best option is to store it in another repository. This applies
7+
to both clients and servers. In particular, namespaces on a server are not
8+
effective for read access control; you should only grant read access to a
9+
namespace to clients that you would trust with read access to the entire
10+
repository.
11+
12+
The known attack vectors are as follows:
13+
14+
. The victim sends "have" lines advertising the IDs of objects it has that
15+
are not explicitly intended to be shared but can be used to optimize the
16+
transfer if the peer also has them. The attacker chooses an object ID X
17+
to steal and sends a ref to X, but isn't required to send the content of
18+
X because the victim already has it. Now the victim believes that the
19+
attacker has X, and it sends the content of X back to the attacker
20+
later. (This attack is most straightforward for a client to perform on a
21+
server, by creating a ref to X in the namespace the client has access
22+
to and then fetching it. The most likely way for a server to perform it
23+
on a client is to "merge" X into a public branch and hope that the user
24+
does additional work on this branch and pushes it back to the server
25+
without noticing the merge.)
26+
27+
. As in #1, the attacker chooses an object ID X to steal. The victim sends
28+
an object Y that the attacker already has, and the attacker falsely
29+
claims to have X and not Y, so the victim sends Y as a delta against X.
30+
The delta reveals regions of X that are similar to Y to the attacker.

0 commit comments

Comments
 (0)