Hi Researchers,
The Motive of this post is to ask a question on how to go-ahead in a situation like this and also i would like to share few tips/tricks i used to dig few juicy information.
Was testing an android application, the API has HMAC signature validation which i couldn’t bypass yet, the API is built using the Spring Architecture in Java, although its a JSON Rest API,when i change the content-type to application/xml with invalid chars, i get 400 bad request with Xml Parsing errors.
Sample Response
{"timestamp":1498844084320,"status":400,"error":"Bad Request","exception":"org.springframework.http.converter.HttpMessageNotReadableException","message":"Could not unmarshal to [class com.xxxx.xxxxx.xxxxxxx]: null; nested exception is javax.xml.bind.UnmarshalException\n - with linked exception:\n[org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.]","path":"/ixxxx/xxxx/1.0"}
Ive tried out the usual XXE payloads, yet to try OOB Blind ones. on seeing the presence of SAXParse exception i strongly believe its an xml parser, only thing i have to check is if its configured with external entity interaction. But the problem i am facing here is if i give the json body as XML the server isnt able to recognize the hmac param and throws signature validation failed errors, because the hmac is verified even before the input is sent into the xml parser i guess.
I would like to hear from you guys where am i going wrong and also if anyone has ever encountered spring application xxe challenges do let me know.
Finally for new researchers in this area, when pentesting mobile application do not completely look only into the API requests itself. I’ve opened the API domain in my browser found spring boot admin ui, read through the spring docs and got to know spring provides several endpoints enabled by default for developers,i’ve picked few endpoints and tried those in my target, was amazed to see information like,server access logs, trace logs for last 100 requests with users public and private ips, environment variables etc.
Reference : Spring Boot Endpoints