{"id":820,"date":"2025-06-11T18:22:57","date_gmt":"2025-06-11T16:22:57","guid":{"rendered":"https:\/\/www.cloudtango.net\/blog\/?p=820"},"modified":"2025-06-11T18:22:58","modified_gmt":"2025-06-11T16:22:58","slug":"cracking-the-puzzle-unveiling-the-flaws-of-insecure-design","status":"publish","type":"post","link":"https:\/\/www.cloudtango.net\/blog\/2025\/06\/11\/cracking-the-puzzle-unveiling-the-flaws-of-insecure-design\/","title":{"rendered":"Cracking the Puzzle: Unveiling the Flaws of Insecure Design"},"content":{"rendered":"<p><span data-contrast=\"auto\">Sometimes as a penetration tester, you instantly know there is an issue. However, simply explaining the security flaw isn\u2019t sufficient, and you need to show why it\u2019s an issue and how to exploit it!&nbsp;<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240}\">&nbsp;<\/span><\/p>\n<p><span data-contrast=\"auto\">This is a narrative following a desktop application penetration test, doing just that.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240}\">&nbsp;<\/span><\/p>\n<p><span data-contrast=\"auto\">Firstly, it was noted that while the Desktop Application was well-designed in some aspects, the SQL Database was public-facing and lacked Application Programming Interface (API) based segmentation or something similar to segment all the sensitive data, which made the tester think there must be a significant exploit, and would just need direct access to the SQL Database.&nbsp;<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240}\">&nbsp;<\/span><\/p>\n<p><span data-contrast=\"auto\">When the Desktop Application&nbsp;started, it enforced TDSENCRYPTION utilising Transport Layer Security (TLS), enforced for all communications through the application. This led to man in the middle Attacks (MitM) failing during the testing. We tried generating our own TLS Certificate, but it was not trusted. Replacing the certificate in the application would take significant resources with no guarantee to succeed, since hashes would change and&nbsp;could be checked on the backend.<\/span><\/p>\n<p><span data-contrast=\"auto\">Below are details of some steps taken trying to MitM the traffic to and from the application.<\/span><\/p>\n<p><span data-contrast=\"auto\">First, we used Wireshark to monitor the traffic and identify the servers used by the desktop application.<\/span><\/p>\n<p><span data-contrast=\"auto\">Two key IPv4 addresses were identified, which have the hostname &lt;redacted&gt;.database.windows.net.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240}\">&nbsp;<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.cybaverse.co.uk\/hs-fs\/hubfs\/Images%20for%20article-1.jpg?width=280&amp;height=307&amp;name=Images%20for%20article-1.jpg\" alt=\"Shows the Wireshark traffic which was active when interacting with the Desktop Application\" width=\"280\" height=\"307\"><\/p>\n<p><em>Shows the Wireshark traffic which was active when interacting with the Desktop Application<\/em><\/p>\n<p><span lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\">Shodan was used next, a search engine that scans devices and services connected to the internet,&nbsp;which&nbsp;disclosed&nbsp;the service as&nbsp;AzureSQL.&nbsp;<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240}\">&nbsp;<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240}\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.cybaverse.co.uk\/hs-fs\/hubfs\/Untitled%20design%20(1)-1.jpg?width=457&amp;height=209&amp;name=Untitled%20design%20(1)-1.jpg\" alt=\"Shows the service in Shodan\" width=\"457\" height=\"209\"><\/span><\/p>\n<p><em>Shows the service in Shodan<\/em><\/p>\n<p><span lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\">A direct Nmap scan with some common Microsoft SQL scripts revealed the version, on a positive, although not the most recent version, it did not have any publicly disclosed vulnerabilities.&nbsp;<\/span><\/p>\n<p><em><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240}\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.cybaverse.co.uk\/hs-fs\/hubfs\/Shows%20a%20Nmap%20scan%20result.jpg?width=386&amp;height=346&amp;name=Shows%20a%20Nmap%20scan%20result.jpg\" alt=\"Shows a Nmap scan result\" width=\"386\" height=\"346\"><\/span><\/em><\/p>\n<p><em>Shows a Nmap scan result<\/em><\/p>\n<p>Direct brute force attacks on the database failed. However, since the service was Azure SQL, the default SA password would not be permitted by default. After only one failed credential using another guessed username, the server blocked the IP. A round-robin (rotating IPs) could be performed, but without knowing the username, the probability is extremely low and time-consuming. So, we moved on!<\/p>\n<p>Next, a MitM attack was attempted. It was noted reviewing the previously obtained Wireshark network traffic that it was not using standard HTTP\/HTTPS, which adds some complexity. Full details of the tool used can be found here&nbsp;<a href=\"https:\/\/portswigger.net\/bappstore\/12e84399d46a408dbe970f181391f781\">NoPE<\/a>. However, it was evident that the SSL\/TLS certificate could not be replaced to facilitate MitM attacks, with all communication attempts failing.<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.cybaverse.co.uk\/hs-fs\/hubfs\/Shows%20a%20connection%20to%20the%20host%20is%20closed%20after%20turning%20on%20our%20MitM%20encryption%20certificate.jpg?width=513&amp;height=413&amp;name=Shows%20a%20connection%20to%20the%20host%20is%20closed%20after%20turning%20on%20our%20MitM%20encryption%20certificate.jpg\" alt=\"Shows a connection to the host is closed after turning on our MitM encryption certificate\" width=\"513\" height=\"413\"><\/p>\n<p><em>Shows a connection to the host is closed after turning on our MitM encryption certificate<\/em><\/p>\n<p>Further attempts were made. The next image shows a connection intercepted without presenting our TLS\/SSL certificate, as expected, it is encrypted.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.cybaverse.co.uk\/hs-fs\/hubfs\/Shows%20a%20snippet%20of%20the%20encrypted%20traffic.jpg?width=499&amp;height=341&amp;name=Shows%20a%20snippet%20of%20the%20encrypted%20traffic.jpg\" alt=\"Shows a snippet of the encrypted traffic\" width=\"499\" height=\"341\"><\/p>\n<p><em>Shows a snippet of the encrypted traffic<\/em><\/p>\n<p>The configuration protecting MitM attacks was evident again when we enabled our certificate, we got an immediate error.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.cybaverse.co.uk\/hs-fs\/hubfs\/Shows%20a%20connection%20error.jpg?width=519&amp;height=389&amp;name=Shows%20a%20connection%20error.jpg\" alt=\"Shows a connection error\" width=\"519\" height=\"389\"><\/p>\n<p><em>Shows a connection error<\/em><\/p>\n<p>All of the above enumeration and exploitation attempts concluded that the data in transit from the application was well-designed and secure. Therefore, in typical Penetration Testing style, we tried another route, going for direct access to the SQL Database.<\/p>\n<h2>Direct Access: The Insecure Design<\/h2>\n<p>Finally, delving into the core of the issue, we knew from the outset it had to be an insecure design! Although the Desktop Application was well configured, mitigating MitM, how did it make the initial connection to enforce the TLS Certificate? Usually, this is done on the backend via private APIs, for example. However, we could see in Wireshark that this wasn\u2019t the case and the SQL Database was public-facing.<\/p>\n<p>Insecure design is a broad category representing different weaknesses, expressed as \u201cmissing or ineffective control design.\u201d In this specific scenario, following a few rabbit holes and failed attempts to enumerate how the connection was occurring, we got some results.<\/p>\n<p>First, the application was reverse-engineered and decompiled to enable reading of the source code.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.cybaverse.co.uk\/hs-fs\/hubfs\/Shows%20a%20snippet%20of%20the%20reserve%20engineering%20attempts%20with%20some%20decompiled%20code.jpg?width=593&amp;height=278&amp;name=Shows%20a%20snippet%20of%20the%20reserve%20engineering%20attempts%20with%20some%20decompiled%20code.jpg\" alt=\"Shows a snippet of the reserve engineering attempts with some decompiled code\" width=\"593\" height=\"278\"><\/p>\n<p><em>Shows a snippet of the reserve engineering attempts with some decompiled code<\/em><\/p>\n<p>Once all the files were decompiled, common keywords like Password, SQL, and ConnectionString were searched. One of these searches led to a DLL that was updated on the day the application was installed.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.cybaverse.co.uk\/hs-fs\/hubfs\/Shows%20a%20string%20of%20code%20SQLOLEDB%20Error%20Lookup%2c%20which%20is%20associated%20with%20a%20file%20sqloledb.dll.jpg?width=800&amp;height=343&amp;name=Shows%20a%20string%20of%20code%20SQLOLEDB%20Error%20Lookup%2c%20which%20is%20associated%20with%20a%20file%20sqloledb.dll.jpg\" alt=\"Shows a string of code SQLOLEDB Error Lookup, which is associated with a file sqloledb.dll\" width=\"800\" height=\"343\"><\/p>\n<p><em>Shows a string of code &#8220;SQLOLEDB Error Lookup&#8221;, which is associated with a file sqloledb.dll<\/em><\/p>\n<p>The sqloledb.dll file is a dynamic-link library (DLL) provided by Microsoft, used to enable OLE DB (Object Linking and Embedding, Database) connections specifically for Microsoft SQL Server databases.<\/p>\n<p>Further enumeration and research led to the conclusion that this DLL, which runs in memory, was used to establish the connection to the Database, and did this when the application was executed. This facilitated the consultant to identify the Process ID (PID) and carry out a memory dump during the start-up of the application.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.cybaverse.co.uk\/hs-fs\/hubfs\/Shows%20the%20PID%20as%203828.jpg?width=621&amp;height=600&amp;name=Shows%20the%20PID%20as%203828.jpg\" alt=\"Shows the PID as 3828\" width=\"621\" height=\"600\"><\/p>\n<p><em>Shows the PID as 3828<\/em><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.cybaverse.co.uk\/hs-fs\/hubfs\/Shows%20a%20process%20dump%20of%20the%20PID.jpg?width=800&amp;height=208&amp;name=Shows%20a%20process%20dump%20of%20the%20PID.jpg\" alt=\"Shows a process dump of the PID\" width=\"800\" height=\"208\"><\/p>\n<p><em>Shows a process dump of the PID<\/em><\/p>\n<p>Although the memory dump had 1,215,487 lines of data, a keyword search revealed the database connection string.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.cybaverse.co.uk\/hs-fs\/hubfs\/Shows%20the%20connection%20string%20with%20an%20obfuscated%20password.jpg?width=800&amp;height=60&amp;name=Shows%20the%20connection%20string%20with%20an%20obfuscated%20password.jpg\" alt=\"Shows the connection string with an obfuscated password\" width=\"800\" height=\"60\"><\/p>\n<p><em>Shows the connection string with an obfuscated password<\/em><\/p>\n<p>Jackpot, these details facilitated a direct connection to the database, and we could access everything, including a ton of sensitive information which could be exfiltrated and edited. For obvious reasons, it\u2019s heavily redacted, but the next image shows a direct connection to the database.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.cybaverse.co.uk\/hs-fs\/hubfs\/Shows%20a%20direct%20connection%20to%20the%20SQL%20Database%20using%20the%20credentials%20obtained.jpg?width=731&amp;height=600&amp;name=Shows%20a%20direct%20connection%20to%20the%20SQL%20Database%20using%20the%20credentials%20obtained.jpg\" alt=\"Shows a direct connection to the SQL Database using the credentials obtained\" width=\"731\" height=\"600\"><\/p>\n<p><em>Shows a direct connection to the SQL Database using the credentials obtained<\/em><\/p>\n<p>This led to the conclusion that all data held by the application could be accessed, and would very likely impact Confidentiality, Integrity, and Availability (CIA) if ever exploited.<\/p>\n<h2>Our Recommendation<\/h2>\n<p>Aside from limiting access to download the application, and considerations around allowing listing a&nbsp;potential interim mitigation could be adding the SSL certificate (.cer) as a requirement to connect directly (same certificate mitigating MitM attacks). However, a persistent skilled attacker may still be able to extract and use it to connect directly.<\/p>\n<p>Ultimately, we recommended that the Desktop Application connect via APIs instead of directly accessing the database. Using APIs enhances security, as it restricts direct data access and reduces potential vulnerabilities. Additionally, APIs can offer better control over data flow and allow for easier updates and maintenance without affecting the core database structure.<\/p>\n<p data-start=\"110\" data-end=\"430\">This assessment highlights how even well-configured components\u2014like enforced TLS for transport\u2014can be undermined by insecure architectural decisions, such as direct database access from a desktop application. It\u2019s a clear reminder that security must be considered at every layer of the system, not just the obvious ones.<\/p>\n<p data-start=\"432\" data-end=\"666\">At <a href=\"http:\/\/cybaverse.co.uk\">CybaVerse<\/a>, our penetration testing team doesn\u2019t stop at surface-level scans. We go deeper, combining technical expertise with an attacker\u2019s mindset to uncover hidden risks and help you fix them before someone else finds them first.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes as a penetration tester, you instantly know there is an issue. However, simply explaining the security flaw isn\u2019t sufficient, and you need to show why it\u2019s an issue and how to exploit it!&nbsp;&nbsp; This is a narrative following a desktop application penetration test, doing just that.&nbsp; Firstly, it was noted that while the Desktop[\u2026] <a class=\"read-more\" href=\"https:\/\/www.cloudtango.net\/blog\/2025\/06\/11\/cracking-the-puzzle-unveiling-the-flaws-of-insecure-design\/\">Read<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" enable-background=\"new 0 0 24 24\" height=\"16px\" viewBox=\"0 0 24 24\" width=\"16px\" fill=\"#091926\"><rect fill=\"none\" height=\"16\" width=\"16\"\/><path d=\"M14.29,5.71L14.29,5.71c-0.39,0.39-0.39,1.02,0,1.41L18.17,11H3c-0.55,0-1,0.45-1,1v0c0,0.55,0.45,1,1,1h15.18l-3.88,3.88 c-0.39,0.39-0.39,1.02,0,1.41l0,0c0.39,0.39,1.02,0.39,1.41,0l5.59-5.59c0.39-0.39,0.39-1.02,0-1.41L15.7,5.71 C15.32,5.32,14.68,5.32,14.29,5.71z\"\/><\/svg><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,15],"tags":[],"class_list":["post-820","post","type-post","status-publish","format-standard","hentry","category-cybersecurity","category-mssps"],"_links":{"self":[{"href":"https:\/\/www.cloudtango.net\/blog\/wp-json\/wp\/v2\/posts\/820","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cloudtango.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cloudtango.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cloudtango.net\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cloudtango.net\/blog\/wp-json\/wp\/v2\/comments?post=820"}],"version-history":[{"count":2,"href":"https:\/\/www.cloudtango.net\/blog\/wp-json\/wp\/v2\/posts\/820\/revisions"}],"predecessor-version":[{"id":825,"href":"https:\/\/www.cloudtango.net\/blog\/wp-json\/wp\/v2\/posts\/820\/revisions\/825"}],"wp:attachment":[{"href":"https:\/\/www.cloudtango.net\/blog\/wp-json\/wp\/v2\/media?parent=820"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cloudtango.net\/blog\/wp-json\/wp\/v2\/categories?post=820"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cloudtango.net\/blog\/wp-json\/wp\/v2\/tags?post=820"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}