SCP - service that works with scp documents and provides query language to manipulate documents. This language can create, aggregate documents and hide some information in documents.
- Let's start analyze from frontend. We can see that frontend sends some queries
@doc <- {(${offset}, ${limit}) -> list};{(@doc) -> result};
. Server returns response that contains some id and owner. But frontend makes other query@docId <- ${id};@doc <- {(@docId) -> get};{(@doc) -> result}
, This query returns some text withДАННЫЕ УДАЛЕНЫ
and we can realize that here is something hidden. - So we have some query language that makes some queries and hide some fields. Let's try to analyze binary file.
- By searching
token
in binary we can find SQL queries and recognize that user identify by token - Let's try to find variables linked with user by pattern
@user
. We can find@userspace
- Now we can try to put
@userspace = "{some_username}"
and get document with{user_name}
owner. Magic! it returns hidden fields.
- By searching .java in binary we can find all Java classes. In a few minutes or hours we can find
Specials.java
and one line belowUSER_SPACE({*})
. We know that string with prefix@
is a variable, and we haveSpecials.java
withUSER_SPACE
. Let's suppose thatUSER_SPACE
is special variable and try to find@user
and we get@userspace
. - Now we can try to put
@userspace = "{some_username}"
and get document with{user_name}
owner. Magic! it returns hidden fields.
- First of all we need to get documents with owner. It possible to do with query
@docs <- {(0, 50) -> list};
{(@docs) -> result};
- We have users with their documents. Now we need rewrite
@userspace
and get every document
for doc, user in doc_with_user:
userspace = f'@userspace <- "{u}";'
doc = '@doc <- {(' + d + ') -> get};'
res = '{(@doc) -> result};'
query = userspace + doc + res
- Make request with rewritten
@userspace
. Congrats!
- We need to forbid change
@userspace
from request. We know that@userspace
determine by token - By searching
TOKEN
we can find enum that containsSCPQL
andTOKEN
- By searching
scpql
we can findserver.pragmaAuth=scpql
. Little thinking and we recognize that it is auth property - We can replace
server.pragmaAuth=scpql
withserver.pragmaAuth=token
and forbid redefinition of@userspace