Rather than redirecting to another to a malicious endpoint (which will expose authorization code), higher probability is to have a Cross-site request forgery (CSRF) attack. For this OAuth 2.0 spec provide you with state parameter (more on this).
Regarding possibility of redirecting to a malicious endpoint, for this to be done,
- Your original request must contain redirect url of malicious endpoit
- Identity server must validate this url and then decide to perform the redirect
The second point is difficult to exploit (but possible). Because from OAuth 2.0 definition you register redirect URL when you register your client
The authorization server redirects the user-agent to the
client's redirection endpoint previously established with the
authorization server during the client registration process or when
making the authorization request.
So this means your identity server has been breached OR your registration was exploited. And you will have to worry about user being redirected to a malicious website, which could extract other important details rather than exposing authorization code.
This is emphasised in specification under Authorization Code Redirection URI Manipulation
An attacker can create an account at a legitimate client and initiate
the authorization flow. When the attacker's user-agent is sent to
the authorization server to grant access, the attacker grabs the
authorization URI provided by the legitimate client and replaces the
client's redirection URI with a URI under the control of the
attacker. The attacker then tricks the victim into following the
manipulated link to authorize access to the legitimate client.