Scan from right to left to find the first element that is smaller than its right neighbor. Call this the pivot. Everything to the right of the pivot is in descending order (otherwise you'd have found the pivot earlier).
Now find the smallest element to the right of the pivot that is still larger than the pivot. Swap them. After swapping, the suffix is still descending. Reverse it to make it ascending. That gives you the next permutation.
If no pivot exists (the entire array is descending), just reverse the whole array.