delivered the opinion of the court.
In a-suit to foreclose a mortgage pending in the district court of Rosebud county, wherein the Northwestern Trust Company, mortgagee, was plaintiff, and the Carterville Irrigated Land Company, mortgagor, and the First National Bank of Forsyth were defendants, Donald Campbell was appointed receiver of the property in controversy. Thereafter on August 3, 1916, a decree by consent was rendered and entered, which, among other things, provided that the receivership should be continued; that the land company, should convey the mortgaged property to the receiver; that the receiver should sell the property or so much thereof as should be necessary to realize a sum sufficient to pay all costs and expenses and satisfy the mortgage indebtedness; and that the residue, if any, should be reconveyed to the land company. The decree fixed the minimum price for which each legal subdivision could be sold, and authorized the receiver to accept cash for one-third of the sale price and promissory notes payable to the trust company and secured by mortgage on the property sold, for the remaining two-thirds. For the purposes of his trust the receiver was authorized to treat such notes as cash and credit the receipts from the sales upon the indebtedness after deducting the expense. The decree prescribes the manner of conducting the sales and enumerates certain terms which should be contained in any mortgage securing deferred payments.
*465On September 3, 1917, the receiver entered into a contract with the Interior Securities Company, by 'the terms of which he agreed to sell to that company all the land then held by him (excepting 1,146 acres) for the sum of $180,000 (in round numbers), one-third payable in cash and the remainder to be represented by the securities company’s note payable to the trust company and secured by a mortgage upon the property sold. Thereafter the receiver declined to carry the agreement into effect, unless and until the same was approved by the court,' and this action was instituted to enforce specific performance, and, as ancillary relief, to secure an injunction pendente lite restraining the receiver from selling these lands to any other person. The trust company and land company were joined with the receiver as defendants, and all answered. The land company made common cause with the plaintiff, while the receiver and the trust company interposed substantially the same defenses. After a hearing, the injunction was denied, and a trial upon the merits resulted in a judgment dismissing the ■ complaint of the plaintiff and the cross-complaint of the land company. Plaintiff and the land company each appealed from the judgment and from the order overruling its motion for a new trial. These appeals have been consolidated. Upon application of the appellants this court issued an injunction pending the determination of the appeals.
This cause was tried to the lower court upon the theory that [1] an independent action may be maintained to compel a receiver to specifically perform a contract entered into by him, and we shall determine the appeals upon the same theory without, however, expressing any opinion as to its correctness.
1. In view of the allegations contained in plaintiff’s complaint, it would seem that it is estopped to say that Mr. Campbell was not receiver; but whether he was technically a receiver, a trustee, or a master in chancery, is of little consequence in [2] our view of the case. For convenience only he will be designated “receiver.” He was not merely the agent of the parties to the foreclosure suit, but was an officer of the court. *466When he took possession of the property, it thereby passed into the custody of the law. His authority was limited by the terms of the decree, and plaintiff, contracting with him, did so at its peril.
The fact that (the decree was entered by consent did not [3] change the status of this officer from what it would have been had the decree been entered after contest, for a decree by consent has all the force and effect of a judgment in invitum (Harding v. Harding, 198 U. S. 317, 49 L. Ed. 1066, 25 Sup. Ct. Rep. 679; 15 R. C. L. 645; 23 Cye. 729), with the additional characteristic that it is nonappealable (Corby v. Abbott, 28 Mont. 523, 73 Pac. 120).
2. If this contract had been fully executed, the resulting [4] transaction would have constituted a judicial sale. A sale made pursuant to a decree of court in an action to foreclose a mortgage instituted under section 6861, Revised Codes, is a “judicial sale.” (Black v. Caldwell (C. C.), 83 Fed. 880.) We agree with appellants that under our statute such sale, if made, would not have required confirmation by the court in order to pass title to the purchaser. Mr. Campbell was the officer designated by the court to carry its decree into effect, and the decree itself was the authority by virtue of which the property was to be sold. (Thomas v. Thomas, 44 Mont. 102, Ann. Cas. 1913B, 616, 119 Pac. 283.)
But granting that the court’s approval of the contract was not necessary to authorize the sale and that confirmation of the sale, if made, would not have been necessary to pass title, still it does not follow that appellants are entitled to a decree awarding specific performance. They cannot insist that this [5] contract should be enforced if as a matter of fact the receiver exceeded his authority in entering into it, and that he did exceed his authority is manifest.
The decree directs the receiver to sell the property and by necessary implication authorizes him to make proper conveyance. By the terms of the contract he agreed to convey the property by warranty deed, and, to the end that he might be *467able to do so, he agreed further to perfect the title to any lot, piece or parcel of land the title to which was defective. We need only refer to the character of a judicial sale to determine that the receiver was without authority to convey by warranty deed or to contract to do so. “A judicial sale is one which is made by a court of competent jurisdiction, in a pending suit, [6] through its authorized agent.” (4 Words and Phrases,' 3867.) In every such sale the court itself is the vendor (Hess v. Deppen, 125 Ky. 424, 15 Ann. Cas. 670, 101 S. W. 362), and the officer executing the power, by whatever name designated, [7] is a ministerial agent (16 R. C. L. 6). The rule of caveat emptor applies in its utmost vigor. The court undertakes to sell, and can only sell, the right, title and interest of the parties to the action, and the purchaser is charged with knowledge of this fact. He steps into the shoes of the parties, stands in their places, acquires their interest as it existed in their hands, subject to all the infirmities of title then attaching to the estate, and to all equities which operated as a limitation upon the apparent estate which they had. (16 R. C. L. 119-138.) In view of this rule, it is apparent from the terms of the decree that the receiver was not authorized to warrant the title to the property sold, or to waste the funds of the estate in his hands in an effort to perfect the title.
There are other respects in which we think the receiver exceeded his authority, but these need not be considered further.
Whether, upon the showing made, the court would have been justified in reforming the contract and decreeing its performance, is a question not presented to the trial court nor here. The court below was not.requested to reform the contract, but to enforce it as written.
3. This case is somewhat anomalous, in that the contract is attacked on the ground that the receiver agreed to sell these lands at a price greatly in excess of the minimum fixed by the decree and greatly in excess of their fair market value. At the time the contract was entered into, there was due from the land company to the trust company $140,000, and this indebted*468ness was secured by the mortgage upon all the real estate in the hands of the receiver — 5,326 acres — and by a pledge of $40,000 worth of personal property belonging to P. J. Lyons. The 1,146 acres of land held by the receiver but not included in the contract are of the value of approximately $100,000. In view of the fact that the compensation of the receiver had not been fixed by the court and that the exact amount of other expenses could not be determined in advance, we must assume for present purposes that the receiver did not undertake to sell more land than necessary to raise a sum sufficient to pay the costs and expenses and discharge the mortgage indebtedness. If this contemplated' sale, then, had materialized, the receiver, acting pursuant to the provisions of the decree, would have credited the original mortgage indebtedness with the amount of the securities company’s note ($120,000) and $20,000 of the cash payment, thereby satisfying and discharging that indebtedness in full. The remainder of the $60,000 would have been applied in satisfaction of the costs and expenses of the receivership and trusteeship, and the costs and expenses of the foreclosure suit. The 1,146 acres would have been reconveyed to the land company, and the Lyons pledge would have been released. The trust company would have received the $20,000 in cash and the securities company’s note for $120,000, secured by the mortgage on the 4,180 acres described in the contract.
In his answer the receiver sets forth that he entered into this contract inadvertently and without due appreciation of the results to flow from its execution. He alleges that the land described in the contract is worth not to exceed two-thirds of the sale price mentioned, and offers to execute the contract provided the sale price is reduced one-third, or provided other lands in his possession, sufficient to raise the valuation to the contract price, are included. The trust company makes the same charge of overvaluation, alleges that the receiver exceeded his authority in many particulars, which are enumerated, and alleges further that the securities company was organized *469for the express purpose of procuring this contract; that it is not financially responsible;.find that the securities company, the land company, and Lyons entered into a conspiracy to cheat and defraud the trust company and secured this contract as the means through which to carry their conspiracy into effect; that it was the intention of the securities company to default in payment of the principal and interest on the note for $120,000 and in the payment of taxes against the land; and that the land itself is not of sufficient value to secure the payment of the note. The trust company contends in effect that, if this .sale is consummated, it will be called upon to surrender its original claim for $140,000 secured by property worth $260,000, and to accept in lieu thereof $20,000 in cash and a note for $120,000 secured by mortgage upon lands worth less than the face of the note, without recourse except to foreclose, obtain a worthless deficiency judgment and suffer substantial loss, whereas by the expenditure of the $60,000 the land company and Lyons will have turned back to them property of the value of $140,000 free from encumbrance. From the record before it, the trial court might fairly infer that this contention is well founded and that the' contract is not reasonable, equitable and fair.
There are some facts and circumstances disclosed by this record which reflect upon appellants’ good faith, but it is not necessary that the alleged conspiracy be proved in order that [8] the trial court’s conclusions be justified. The court was not merely permitted, but was required, to look beyond the receiver (the nominal party to the contract), to the trust company and land company (the real parties in interest), and refuse specific performance of the contract if its terms, as to either of them, are not just and reasonable (sec. 6103, Rev. Codes), or if the performance would operate more harshly upon either of them than its refusal would upon the plaintiff who seeks performance (see. 6105, Rev. Codes), and it is immaterial that appellants may have acted in good faith. The [9] authority of a court of equity over its own process to *470prevent abuse by its officer is inherent and as extensive and efficient as the exigencies of the case require; and, if the receiver in entering into this contract acted improvidently or inadvertently to the prejudice of the trust company, the court was justified in withholding its approval (In re First Trust & Sewings Bank, 45 Mont. 89, Ann. Cas. 1913C, 1327, 122 Pac. 561).
We think the evidence is sufficient to justify the court’s [10] conclusion. Appellants were required to sustain the burden of proof and to show that the contract was just and fair in all respects. There is a conflict in the evidence as to whether the property described in the contract is sufficient security for the debt. This conflict was resolved by the court in favor of the trust company and the receiver, and with this finding we do not feel inclined to interfere. The appellants have not acquired any fixed right to have this sale completed, and under the circumstances it appears more' equitable that they should lose their bargain, than that the trust company should be made to suffer loss through compelling the receiver to execute the contract. Finally, appellants must assume the burden of showing that by its decision the trial court committed error to their prejudice.
A decree for specific performance is not granted as a matter [11, 12] of abstract right, but in every instance the application for such relief is addressed to the sound, legal discretion of the court. (Wolf v. Great Falls W. P. & T. Co., 15 Mont. 49, 38 Pac. 115.) To secure the desired relief in this instance, appellants were required to come into court with clean hands and with a cause whose ethical qualities were such as to commend it to the conscience of the chancellor. The case comes within the general rule, often adverted to by this court, that in the absence of a clear showing of abuse of discretion the decision of the lower court will be affirmed.
The judgment and order in each instance are affirmed, and the injunction heretofore granted by this court is dissolved.
Affirmed.
Mr. Chief Justice Brantly concurs.