sysPass / syspass-decrypter

An standalone tool for decrypting sysPass exported XML files
GNU General Public License v3.0
6 stars 6 forks source link

Decrypter doesn't seem to work? Probably my fault, but not sure where I messed up. "[error] Invalid XML schema" #2

Closed CeliaTatu closed 5 years ago

CeliaTatu commented 5 years ago

Thanks Rubén :)

CeliaTatu commented 5 years ago

Also: When I vim syspass.xml; https://pastebin.com/aNXHEG1A .

It shows other information within the syspass.xml, but I obviously won't link it (it includes Hash Sign and Encrypted Hash lines).

nuxsmin commented 5 years ago

Hello, it's an error message related to the XML schema itself, so it's not about an application error. The key point here is that the schema is being validated using XSD (https://github.com/sysPass/syspass-decrypter/blob/master/schemas/syspass.xsd), so there should be some missing fields in your XML (or the XSD).

The tool is tested against XML file generated by sysPass (demo site) and on-the-fly generated XML with random data to test structure and performance (https://github.com/sysPass/syspass-decrypter/blob/master/tests/XmlBuilder.php).

Could you validate the schema on your own using xmllint and tell me the errors found? (https://stackoverflow.com/questions/42809088/how-to-validate-a-xml-file-with-xsd-through-xmllint)

Regards

CeliaTatu commented 5 years ago

The command I used is:

xmllint --schema syspass.xsd syspass.xml --noout

The output:

syspass.xml validates

Without "--noout," it appears to just read out the encrypted data of the xml file.

After using "syspass-decrypter.phar spd:search-account --xmlpath ./syspass.xml" again, here is the error output again: https://pastebin.com/E78hKRzy


What else should I try?

nuxsmin commented 5 years ago

It seems to fail after decrypting the data. Could you check the XML schema again with an unencrypted XML?

nuxsmin commented 5 years ago

Passwords will remain encrypted

CeliaTatu commented 5 years ago

XML password:

password

Master password:

dfbY8IEbEOI41IxGPD8p3B2OJ0CNoHyX

[info] initialize [info] Reading XML file "./syspass.xml" [info] checkFile [info] readXMLFile [info] Encrypted XML detected [info] Processing encrypted data

I think you're right about it "failing after decrypting the data." Also, sorry, I guess I should have included those lines earlier on in our discussion.

How would I create the unencrypted XML, with encrypted passwords? I assume it wouldn't be through SysPass, but instead via an alternate program?

nuxsmin commented 5 years ago

it's very easy, do not set the password when exporting on sysPass.

CeliaTatu commented 5 years ago

Alright, so I outputted without a password on the .xml, and here is the output:

https://pastebin.com/JkEvyDDE

Now it ends at "[info] readXMLFile" while before, it ended at "[info] Processing encrypted data"

When I vim the syspass.xml, here is a snippet of what is seen: https://pastebin.com/gmGkn035 (I'm the one who changed the hash value; mine appears as letters and numbers). It appears to be correct; all of the categories are what I set, as well as their respective descriptions.


Would the issue be that I messed up something in the syspass export, or am missing some file/program in my syspass install? Maybe I'm missing something to correctly run the .phar file?

nuxsmin commented 5 years ago

Please validate the unencrypted file again (xmllint --schema syspass.xsd syspass.xml --noout) and let me know the results

CeliaTatu commented 5 years ago

Now I got some errors; https://pastebin.com/0FWuD0Bq

FYI, just double checking; I got the syspass.xsd from syspass-decrypter-masster/schemas/syspass.xsd , and the syspass.xml is the one I obtained from my own export of my syspass install. I simply moved the syspass.xsd into the same folder as the syspass.xml , and then run the xmllint command.

nuxsmin commented 5 years ago

It seems you don't use tags and some accounts have a blank login. I'll modify the schema to avoid these side cases.

CeliaTatu commented 5 years ago

That is correct; many (or all?) of my Syspass entries do not have any tags associated with them. The blank logins are probably from an import from keepass.

Thank you for the help Rubén :) Is there anything that you need me to do?

nuxsmin commented 5 years ago

Thank you for helping to debug the issue, no worries, it's in my side now :wink:

CeliaTatu commented 5 years ago

Oh cool! I was worried that I was doing something wrong lol

Thank you for all the help on this issue Rubén, and a big thank you for developing SysPass and making it work amazingly! :D

nuxsmin commented 5 years ago

@CeliaTatu I'm really glad you find sysPass useful!, Thanks for your support!

The new phar archive will be available within minutes ;)

nuxsmin commented 5 years ago

Ready, please check out the issue is fixed now

CeliaTatu commented 5 years ago

Yup, it worked! I was able to do

php syspass-decrypter.phar spd:search-account --xmlpath ./syspass.xml --withCategories=yes --wide=yes --masterPassword dfbY8IEbEOI41IxGPD8p3B2OJ0CNoHyX > test.txt

just fine. Now I can print off my SysPass database of 366 accounts, and keep it in my safe.

One thing I noticed with the export is that most of the space was filled up with "-----" lines (https://imgur.com/a/vfTeNua). Before printing, I personally removed it with "find and replace" within Microsoft Word, however, it was a bit tedious.

Would it be possible to reduce the sizing of spaces between entries?

Thank you Ruben! :D

nuxsmin commented 5 years ago

One thing I noticed with the export is that most of the space was filled up with "-----" lines (https://imgur.com/a/vfTeNua). Before printing, I personally removed it with "find and replace" within Microsoft Word, however, it was a bit tedious.

Hmm, I can't figure out what is causing those weird lines, since console output is fine.

This tool is focused on security, so any printing would be avoided and it will enhance account searching and output through the console, so I would rather store the encrypted (or not) XML file in a secure place among this tool, so you can run it whenever your sysPass instance fails.

CeliaTatu commented 5 years ago

This tool is focused on security, so any printing would be avoided and it will enhance account searching and output through the console, so I would rather store the encrypted (or not) XML file in a secure place among this tool, so you can run it whenever your sysPass instance fails.

Yeah, I had a feeling you didn't intend for people to print out their database files :p Sorry about that.

I currently have not backed up my .xml file in multiple places (yet), but will do that later today!

Thanks for all the help Ruben!

nuxsmin commented 5 years ago

No worries, the data belong to you (or your company), so I try to enforce a security chain...

You're welcome!

CeliaTatu commented 4 years ago

Alright, I'm back!


Similar error to before. Here's the command I type out, and the output: https://pastebin.com/nJSGiHLb

As you can see, I'm getting this error again:

[error] Invalid XML schema


Here's the command I run, and the associated output, using xmllint, based on our previous conversation in this post

[root@localhost ~]# xmllint --schema syspass.xsd syspass.xml --noout syspass.xml:8: element Group: Schemas validity error : Element 'Group': [facet 'minLength'] The value has a length of '0'; this underruns the allowed minimum length of '1'. syspass.xml:8: element Group: Schemas validity error : Element 'Group': '' is not a valid value of the atomic type 'NonEmptyString'. syspass.xml:9: element Hash: Schemas validity error : Element 'Hash': The attribute 'sign' is required but missing. syspass.xml fails to validate [root@localhost ~]#


When I use this command (vim syspass.xml), here is what is located on lines 8 and 9:

8: <Group id="1"/> 9: <Hash>**ThisIsAFakeHash**</Hash>


Now I am stuck. I'm not really sure what to do past this. If you need more information nuxsmin, let me know!