-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Merged document might always be the remote after merging #1
Comments
Yep, I think you're right. |
blochberger
added a commit
to blochberger/WordGit
that referenced
this issue
Apr 10, 2020
The previous code used double quotes to surround paths, which still allows environment variables and shell code to be evaluated by the shell. Hence, we use single quotes now, to avoid this problem. PoC exploit: #!/bin/sh -eux POC=$(mktemp -d) mkdir -p "$POC" cd "$POC" git init git config difftool.Word.cmd '/path/to/WordGit/diff.js "$LOCAL" "$REMOTE"' # Test case Gaelan#1 touch '`touch foo`.docx' git add ./*.docx test ! -e foo # Will fail if file 'foo' exists (sanity check) git difftool -t Word --cached test ! -e foo # Will fail if file 'foo' exists. Oops. git reset --hard # Test case Gaelan#2 touch "'"'`touch bar`.docx'"'" git add ./*.docx* test ! -e bar # Will fail if file 'bar' exists (sanity check) ls git difftool -t Word --cached test ! -e bar # Will fail if file 'bar' exists. Oops. git reset --hard # Cleanup #rm -rf "$POC" You need to change the path to WordGit. Then you can run it and test the exit code. If the exit code is 1, the exploit worked. If the exit code is 0 the exploit is fixed.
blochberger
added a commit
to blochberger/WordGit
that referenced
this issue
Apr 10, 2020
The previous code used double quotes to surround paths, which still allows environment variables and shell code to be evaluated by the shell. Hence, we use single quotes now, to avoid this problem. PoC exploit: #!/bin/sh -eux POC=$(mktemp -d) mkdir -p "$POC" cd "$POC" git init git config difftool.Word.cmd '/path/to/WordGit/diff.js "$LOCAL" "$REMOTE"' # Test case Gaelan#1 touch '`touch foo`.docx' git add ./*.docx test ! -e foo # Will fail if file 'foo' exists (sanity check) git difftool -t Word --cached test ! -e foo # Will fail if file 'foo' exists. Oops. git reset --hard # Test case Gaelan#2 touch "'"'`touch bar`.docx'"'" git add ./*.docx* test ! -e bar # Will fail if file 'bar' exists (sanity check) ls git difftool -t Word --cached test ! -e bar # Will fail if file 'bar' exists. Oops. git reset --hard # Cleanup #rm -rf "$POC" You need to change the path to WordGit. Then you can run it and test the exit code. If the exit code is 1, the exploit worked. If the exit code is 0 the exploit is fixed.
blochberger
added a commit
to blochberger/WordGit
that referenced
this issue
Apr 10, 2020
The merged result was discarded and the remote document was always used after a merge.
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
WordGit/merge.js
Line 40 in 4a6672f
Shouldn't this be:
The text was updated successfully, but these errors were encountered: