I did start writing out all the code you'll need but as you know, Joomla 2.5 differs and I haven't worked with it for a long time, so I won't go down that route.
Step 1: Take a backup of your site before doing this!
You'll need to download the Joomla 3.6.4 to 3.6.5 update package (direct download link) from joomla.org
The files you'll need will be in the following directories:
Open the file in your IDE (Sublime, Notepadd++), side-by-side with the same files from a Joomla 3.6.4 installation.
You'll then be able to see the code differences between 3.6.4 and 3.6.5, like so:
You code that has been added, you can then copy over to the same file on your Joomla 2.5.28 file.
Apply the same process for all the files from the update package.
Please note that there are a lot of differences in code between Joomla 2.5 and 3.x, so you may need to make some code tweaks.
Hope this helps