
Confluence अनधिकृत टेम्पलेट इंजेक्शन
confluence.home का मान बदलकर ./confluence/WEB-INF/classes/confluence-init.properties फ़ाइल में confluence home का पता सेट करें।CATALINA_OPTS मान जोड़ें।Windows के लिए, फ़ाइल ./bin/setenv.bat
set CATALINA_OPTS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005
Linux के लिए, फ़ाइल ./bin/setenv.sh
CATALINA_OPTS="-Xrunjdwp:transport=dt_socket,suspend=n,server=y,address=5005 ${CATALINA_OPTS}"
Remote JVM Debug जिसमें host और port के मान localhost:5005 हों और Command line aguments for remote JVM के लिए निम्न हो:-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005
$ su - postgres
postgres@ubuntu:~$ psql -U postgres
postgres@ubuntu:~$ psql -U postgres
psql (10.6 (Ubuntu 10.6-0ubuntu0.18.04.1))
Type "help" for help.
postgres=# CREATE USER wiki WITH PASSWORD 'wiki';
CREATE ROLE
postgres=# CREATE DATABASE wiki OWNER wiki;
CREATE DATABASE
postgres=# GRANT ALL PRIVILEGES ON DATABASE jira TO wiki;
GRANT
हमें lib में jar जोड़ने की आवश्यकता है: ./confluence/WEB-INF/atlassian-bundled-plugins/widgetconnector-x.x.x.jar, ./confluence/WEB-INF/lib/confluence-x.x.x.jar, ./confluence/WEB-INF/lib/velocity-x.x.x-atlassian-x.jar, ताकि डिबग करते समय हम आवश्यक source देख सकें।
हम ./bin/start-confluence.bat फ़ाइल चलाते हैं और आप source से इंस्टॉल करने के लिए यह मार्गदर्शिका देख सकते हैं।
विवरण पढ़ने के बाद, हम जान सकते हैं कि यह बग Widget Connector सुविधा से शुरू होता है, इसलिए मैंने तुरंत Google किया कि यह सुविधा क्या है और इसे कैसे उपयोग करें:
एक पेज एडिट करें

अन्य Macros चुनें
Widget connector चुनें

मैंने बेतरतीब पैरामीटर चुने और preview दबाया, फिर कुछ दिलचस्प देखने के लिए burp पर गया।

इस पैकेट में, मैंने एक पैरामीटर देखा "pluginKey":"com.atlassian.confluence.extra.widgetconnector", इसलिए मैंने अनुमान लगाया कि Widget Connector सुविधा class com.atlassian.confluence.extra.widgetconnector में परिभाषित है, इसलिए मैंने path में खोजा कि कोई संदिग्ध jar पैकेज है या नहीं।

मैंने source code पढ़ने और debug करने के लिए ./confluence/WEB-INF/atlassian-bundled-plugins/widgetconnector-x.x.x.jar फ़ाइल को project की lib में जोड़ने की कोशिश की।
lib में jar फ़ाइल जोड़ने का तरीका
widgetconnector पैकेज खोलने पर मुझे WidgetMacro class पसंद आया, इसलिए मैंने इस class के constructor और execute फ़ंक्शन पर breakpoint लगाया ताकि देख सकूँ कि Preview सुविधा का उपयोग करने पर यह class कॉल होता है या नहीं 🕵️

execute फ़ंक्शन कॉल हुआ, फिर प्रोग्राम DefaultRenderManager.getEmbeddedHtml को कॉल करता है।