<PAGE>

                                                                    EXHIBIT 10.5

                               SECURITY AGREEMENT

      THIS SECURITY AGREEMENT dated as of July 13, 2004 (this "Security
Agreement") is by and among HEP OPERATING COMPANY, L.P., a Delaware limited
partnership ("Borrower"), each other party and each subsidiary of the Borrower
signatory hereto (together with the Borrower, the "Grantors" and individually,
each a "Grantor") and UNION BANK OF CALIFORNIA, N.A., a national association, as
Administrative Agent (the "Secured Party") for the ratable benefit of itself,
the Banks (as defined below), the Issuing Banks (as defined below), and the Swap
Counterparties (as defined below) (together with the Administrative Agent, the
Issuing Banks, the Banks, individually a "Beneficiary", and collectively, the
"Beneficiaries").

                                    RECITALS

      A. This Security Agreement is entered into in connection with that certain
Credit Agreement dated as of July 7, 2004 (as it has been or may be amended,
supplemented or otherwise modified from time to time, the "Credit Agreement"),
among the Borrower, the banks party thereto from time to time (individually, a
"Bank" and collectively, the "Banks"), the Banks issuing letters of credit
thereunder from time to time (individually, an "Issuing Bank" and collectively,
the "Issuing Banks") and Secured Party.

      B. Each Grantor is a Subsidiary of the Borrower and will derive
substantial direct and indirect benefit from (i) the transactions contemplated
by the Credit Agreement and the other Credit Documents (as defined in the Credit
Agreement) and (ii) the Interest Rate Contracts (as defined in the Credit
Agreement) entered into by the Borrower or any of its Subsidiaries with a Bank
or an Affiliate of a Bank (each such counterparty, a "Swap Counterparty").

      C. It is a requirement under the Credit Agreement that the Grantors shall
secure the due payment and performance of all Obligations (as defined in the
Credit Agreement) by entering into this Security Agreement.

                                    AGREEMENT

NOW, THEREFORE, in consideration of the foregoing and other good and valuable
consideration, the receipt and sufficiency of which is hereby acknowledged and
confessed, each Grantor hereby agrees with the Secured Party for the benefit of
the Beneficiaries as follows:

      Section 1. Definitions; Interpretation. (a) All capitalized terms not
otherwise defined in this Security Agreement that are defined in the Credit
Agreement shall have the meanings assigned to such terms by the Credit
Agreement. Any terms used in this Security Agreement that are defined in the UCC
(as defined below) and not otherwise defined herein or in the Credit Agreement,
shall have the meanings assigned to those terms by the UCC. All meanings to
defined terms, unless otherwise indicated, are to be equally applicable to both
the singular and plural forms of the terms defined. The following terms shall
have the meanings specified below:

      "Accounts" means an "account" as defined in the UCC, including, without
      limitation, all of any Grantor's rights to payment for goods sold or
      leased, services performed, or otherwise, whether now in existence or
      arising from time to time hereafter, including,

                                       1

<PAGE>

      without limitation, rights arising under any of the Contracts or evidenced
      by an account, note, contract, security agreement, Chattel Paper
      (including, without limitation, tangible Chattel Paper and electronic
      Chattel Paper), or other evidence of indebtedness or security, together
      with all of the right, title and interest of any Grantor in and to (i) all
      security pledged, assigned, hypothecated or granted to or held by any
      Grantor to secure the foregoing, (ii) all of any Grantor's right, title
      and interest in and to any goods or services, the sale of which gave rise
      thereto, (iii) all guarantees, endorsements and indemnifications on, or
      of, any of the foregoing, (iv) all powers of attorney granted to any
      Grantor for the execution of any evidence of indebtedness or security or
      other writing in connection therewith, (v) all books, correspondence,
      credit files, records, ledger cards, invoices, and other papers relating
      thereto, including without limitation all similar information stored on a
      magnetic medium or other similar storage device and other papers and
      documents in the possession or under the control of any Grantor or any
      computer bureau from time to time acting for any Grantor, (vi) all
      evidences of the filing of financing statements and other statements
      granted to any Grantor and the registration of other instruments in
      connection therewith and amendments thereto, notices to other creditors or
      secured parties, and certificates from filing or other registration
      officers, (vii) all credit information, reports and memoranda relating
      thereto, and (viii) all other writings related in any way to the
      foregoing.

      "Cash Collateral" means all amounts from time to time held in any
      checking, savings, deposit or other account of such Grantor, including, if
      applicable, the Cash Collateral Account, all monies, proceeds or sums due
      or to become due therefrom or thereon and all documents (including, but
      not limited to passbooks, certificates and receipts) evidencing all funds
      and investments held in such accounts.

      "Chattel Paper" has the meaning set forth in the UCC.

      "Collateral" has the meaning set forth in Section 2 of this Security
      Agreement.

      "Contracts" means all contracts to which any Grantor now is, or hereafter
      will be, bound, or to which such Grantor is a party, beneficiary or
      assignee all Insurance Contracts, and all exhibits, schedules and other
      attachments to such contracts, as the same may be amended, supplemented or
      otherwise modified or replaced from time to time.

      "Contract Documents" means all Instruments, Chattel Paper, letters of
      credit, bonds, guarantees or similar documents evidencing, representing,
      arising from or existing in respect of, relating to, securing or otherwise
      supporting the payment of, the Contract Rights.

      "Contract Rights" means (i) all (A) of any Grantor's rights to payment
      under any Contract or Contract Document and (B) payments due and to become
      due to any Grantor under any Contract or Contract Document, in each case
      whether as contractual obligations, damages or otherwise; (ii) all of any
      Grantor's claims, rights, powers, or privileges and remedies under any
      Contract or Contract Document; and (iii) all of any Grantor's rights under
      any Contract or Contract Document to make determinations, to exercise any
      election (including, but not limited to, election of remedies) or option
      or to give or

                                       2

<PAGE>

      receive any notice, consent, waiver or approval together with full power
      and authority with respect to any Contract or Contract Document to demand,
      receive, enforce or collect any of the foregoing rights or any property
      which is the subject of any Contract or Contract Document, to enforce or
      execute any checks, or other instruments or orders, to file any claims and
      to take any action which, in the reasonable opinion of the Secured Party,
      may be necessary or advisable in connection with any of the foregoing.

      "Document" means a bill of lading, dock warrant, dock receipt, warehouse
      receipt or order for the delivery of goods, and also any other document
      which in the regular course of business or financing is treated as
      adequately evidencing that the person in possession of it is entitled to
      receive, hold and dispose of the document and the goods it covers.

      "Equipment" means any equipment now or hereafter owned or leased by any
      Grantor, or in which any Grantor holds or acquires any other right, title
      or interest, constituting "equipment" under the UCC, including, without
      limitation, all surface or subsurface machinery, equipment, facilities,
      supplies, or other tangible personal property, including tubing, rods,
      pumps, pumping units and engines, pipe, pipelines, meters, apparatus,
      boilers, compressors, liquid extractors, connectors, valves, fittings,
      power plants, poles, lines, cables, wires, transformers, starters and
      controllers, machine shops, tools, machinery and parts, storage yards and
      equipment stored therein, buildings and camps, telegraph, telephone, and
      other communication systems, loading docks, loading racks, and shipping
      facilities, and any manuals, instructions, blueprints, computer software
      (including software that is imbedded in and part of the equipment), and
      similar items which relate to the above, and any and all additions,
      substitutions and replacements of any of the foregoing, wherever located
      together with all improvements thereon and all attachments, components,
      parts, equipment and accessories installed thereon or affixed thereto.

      "Fixtures" means any fixtures now or hereafter owned or leased by any
      Grantor, or in which any Grantor holds or acquires any other right, title
      or interest, constituting "fixtures" under the UCC, including without
      limitation any and all additions, substitutions and replacements of any of
      the foregoing, wherever located together with all improvements thereon and
      all attachments, components, parts, equipment and accessories installed
      thereon or affixed thereto.

      "General Intangibles" means all general intangibles now or hereafter owned
      by any Grantor, or in which any Grantor holds or acquires any other right,
      title or interest, constituting "general intangibles" or "payment
      intangibles" under the UCC, including, but not limited to, all trademarks,
      trademark applications, trademark registrations, tradenames, fictitious
      business names, business names, company names, business identifiers,
      prints, labels, trade styles and service marks (whether or not
      registered), trade dress, including logos and/or designs, copyrights,
      patents, patent applications, goodwill of any Grantor's business
      symbolized by any of the foregoing, trade secrets, license rights, license
      agreements, permits, franchises, and any rights to tax refunds to which
      any Grantor is now or hereafter may be entitled.

                                       3

<PAGE>

      "Instrument" means an "instrument" as defined in the UCC, including,
      without limitation, any Negotiable Instrument, or any other writing which
      evidences a right to the payment of money and is not itself a security
      agreement or lease and is of a type which is in the ordinary course of
      business transferred by delivery with any necessary endorsement or
      assignment (other than Instruments constituting Chattel Paper).

      "Insurance Contracts" means all contracts and policies of insurance and
      re-insurance maintained or required to be maintained by or on behalf of
      any Grantor under the Credit Documents.

      "Interest Rate Contract" has the meaning set forth in the Credit
      Agreement.

      "Inventory" means all of the inventory of any Grantor, or in which any
      Grantor holds or acquires any right, title or interest, of every type or
      description, now owned or hereafter acquired and wherever located, whether
      raw, in process or finished, and all materials usable in processing the
      same and all documents of title covering any inventory, including, without
      limitation, work in process, materials used or consumed in any Grantor's
      business, now owned or hereafter acquired or manufactured by any Grantor
      and held for sale in the ordinary course of its business, all present and
      future substitutions therefor, parts and accessories thereof and all
      additions thereto, all Proceeds thereof and products of such inventory in
      any form whatsoever, and any other item constituting "inventory" under the
      UCC.

      "Inventory Records" means all books, records, other similar property, and
      General Intangibles at any time relating to Inventory.

      "Investment Property" means "investment property" as defined in the UCC,
      including, without limitation, all securities (whether certificated or
      uncertificated), security entitlements, securities accounts, commodity
      contracts, and commodity accounts.

      "Negotiable Instrument" means a "negotiable instrument" as defined in the
      UCC.

      "Proceeds" means all proceeds (as defined in the UCC) of any or all of the
      Collateral, including without limitation (i) any and all proceeds of, all
      claims for, and all rights of any Grantor to receive the return of any
      premiums for, any insurance, indemnity, warranty or guaranty payable from
      time to time with respect to any of the Collateral, (ii) any and all
      payments (in any form whatsoever) made or due and payable from time to
      time in connection with any requisition, confiscation, condemnation,
      seizure or forfeiture of all or any part of the Collateral by any
      Governmental Authority (or any Person acting under color of any
      Governmental Authority), (iii) all proceeds received or receivable when
      any or all of the Collateral is sold, exchanged or otherwise disposed,
      whether voluntarily, involuntarily, in foreclosure or otherwise, (iv) all
      claims of any Grantor for damages arising out of, or for breach of or
      default under, any Collateral, (v) all rights of any Grantor to terminate,
      amend, supplement, modify or waive performance under any Contracts, to
      perform thereunder and to compel performance and otherwise exercise all
      remedies thereunder, and (vi) any and all other amounts from time to time
      paid or payable under or in connection with any of the Collateral.

                                       4

<PAGE>

      "Secured Obligations" means all Obligations now or hereafter existing,
      including any extensions, modifications, substitutions, amendments and
      renewals thereof, whether for principal, interest, fees, expenses,
      indemnification, or otherwise.

      "Security Agreement" means this Security Agreement, as the same may be
      modified, supplemented or amended from time to time in accordance with its
      terms.

      "UCC" shall mean the Uniform Commercial Code as the same may, from time to
      time, be in effect in the State of Texas; provided, however, in the event
      that, by reason of mandatory provisions of law, any or all of the
      attachment, perfection or priority of the security interest in any
      Collateral is governed by the Uniform Commercial Code as in effect in a
      jurisdiction other than the State of Texas, the term "UCC" shall mean the
      Uniform Commercial Code as in effect in such other jurisdiction for
      purposes of the provisions hereof relating to such attachment, perfection
      or priority and for purposes of definitions related to such provisions.

      (b) All meanings to defined terms, unless otherwise indicated, are to be
equally applicable to both the singular and plural forms of the terms defined.
Article, Section, Schedule, and Exhibit references are to Articles and Sections
of and Schedules and Exhibits to this Security Agreement, unless otherwise
specified. All references to instruments, documents, contracts, and agreements
are references to such instruments, documents, contracts, and agreements as the
same may be amended, supplemented, and otherwise modified from time to time,
unless otherwise specified. The words "hereof", "herein" and "hereunder" and
words of similar import when used in this Security Agreement shall refer to this
Security Agreement as a whole and not to any particular provision of this
Security Agreement. As used herein, the term "including" means "including,
without limitation". Paragraph headings have been inserted in this Security
Agreement as a matter of convenience for reference only and it is agreed that
such paragraph headings are not a part of this Security Agreement and shall not
be used in the interpretation of any provision of this Security Agreement.

      Section 2. Assignment, Pledge and Grant of Security Interest.

      (a) As collateral security for the prompt and complete payment and
performance when due of all Secured Obligations, each Grantor hereby assigns,
pledges, and grants to the Secured Party for the benefit of the Beneficiaries a
lien on and continuing security interest in all of such Grantor's right, title
and interest in, to and under, all items described in this Section 2, whether
now owned or hereafter acquired by such Grantor and wherever located and whether
now owned or hereafter existing or arising (collectively, the "Collateral"):

            (i)   all Contracts, all Contract Rights, Contract Documents and
                  Accounts associated with such Contracts and each and every
                  document granting security to such Grantor under any such
                  Contract;

            (ii)  all Accounts;

            (iii) all Inventory;

            (iv)  all Equipment;

                                       5

<PAGE>

            (v)    all General Intangibles;

            (vi)   all Investment Property (other than (A) any Investment
                   Property to the extent pledged by a Grantor under the Pledge
                   Agreement dated of even date herewith among the Borrower,
                   certain Subsidiaries of the Borrower party thereto from time
                   to time, and the Secured Party and (B) the Equity Interest in
                   Rio Grande Pipeline Company owned by Navajo Southern, Inc.);

            (vii)  all Fixtures;

            (viii) all Cash Collateral;

            (ix)   any Legal Requirements now or hereafter held by such Grantor
                   (except that any Legal Requirement which would by its terms
                   or under applicable law become void, voidable, terminable or
                   revocable by being subjected to the Lien of this Security
                   Agreement or in which a Lien is not permitted to be granted
                   under applicable law, is hereby excluded from such Lien to
                   the extent necessary so as to avoid such voidness,
                   voidability, terminability or revocability);

            (x)    any right to receive a payment under any Interest Rate
                   Contract in connection with a termination thereof;

            (xi)   (A) all policies of insurance and Insurance Contracts, now or
                   hereafter held by or on behalf of such Grantor, including
                   casualty and liability, business interruption, and any title
                   insurance, (B) all Proceeds of insurance, and (C) all rights,
                   now or hereafter held by such Grantor to any warranties of
                   any manufacturer or contractor of any other Person;

            (xii)  any and all liens and security interests (together with the
                   documents evidencing such security interests) granted to such
                   Grantor by an obligor to secure such obligor's obligations
                   owing under any Instrument, Chattel Paper, or Contract which
                   is pledged hereunder or with respect to which a security
                   interest in such Grantor's rights in such Instrument, Chattel
                   Paper, or Contract is granted hereunder;

            (xiii) any and all guaranties given by any Person for the benefit of
                   such Grantor which guarantees the obligations of an obligor
                   under any Instrument, Chattel Paper or Contract, which are
                   pledged hereunder;

            (xiv)  without limiting the generality of the foregoing, all other

                   personal property, goods, Instruments, Chattel Paper,
                   Documents, Fixtures, credits, claims, demands and assets of
                   such Grantor whether now existing or hereafter acquired from
                   time to time; and

                                       6

<PAGE>

            (xv)  any and all additions, accessions and improvements to, all
                  substitutions and replacements for and all products and
                  Proceeds of or derived from all of the items described above
                  in this Section 2.

      (b) Notwithstanding anything contained herein to the contrary, it is the
intention of each Grantor, the Secured Party and the other Beneficiaries that
the amount of the Secured Obligation secured by each Grantor's interests in any
of its Property shall be in, but not in excess of, the maximum amount permitted
by fraudulent conveyance, fraudulent transfer and other similar law, rule or
regulation of any Governmental Authority applicable to such Grantor.
Accordingly, notwithstanding anything to the contrary contained in this Security
Agreement or in any other agreement or instrument executed in connection with
the payment of any of the Secured Obligations, the amount of the Secured
Obligations secured by each Grantor's interests in any of its Property pursuant
to this Security Agreement shall be limited to an aggregate amount equal to the
largest amount that would not render such Grantor's obligations hereunder or the
liens and security interest granted to the Secured Party hereunder subject to
avoidance under Section 548 of the United States Bankruptcy Code or any
comparable provision of any other applicable law.

      Section 3. Representations and Warranties. Each Grantor hereby represents
and warrants the following to the Secured Party and the other Beneficiaries:

      (a) Records. Such Grantor's sole jurisdiction of formation and type of
organization are as set forth in Schedule 1 attached hereto. Other than for
Accounts which individually or in the aggregate do not exceed $500,000, none of
the Accounts is evidenced by a promissory note or other instrument.

      (b) Other Liens. Such Grantor is, and will be the record, legal, and
beneficial owner of all of the Collateral pledged by such Grantor free and clear
of any Lien, except for the Permitted Liens. No effective financing statement or
other instrument similar in effect covering all or any part of the Collateral
is, or will be, on file in any recording office, except such as may be filed in
connection with this Security Agreement or in connection with other Permitted
Liens or for which satisfactory releases have been received by the Secured
Party.

      (c) Lien Priority and Perfection.

            (i) Subject only to Permitted Liens, this Security Agreement creates
valid and continuing security interests in the Collateral, securing the payment
and performance of all the Secured Obligations. Upon the filing of financing
statements with the jurisdiction listed in Schedule 1, the security interests
granted to the Secured Party hereunder will constitute valid first-priority
perfected security interests in all Collateral with respect to which a security
interest can be perfected by the filing of a financing statement, subject only
to Permitted Liens.

            (ii) No consent of any other Person and no authorization, approval,
or other action by, and no notice to or filing with any Governmental Authority
is required (A) for the grant by such Grantor of the pledge, assignment, and
security interest granted hereby or for the execution, delivery, or performance
of this Security Agreement by such Grantor, (B) for the validity, perfection, or
maintenance of the pledge, assignment, lien, and security interest created

                                       7

<PAGE>

hereby (including the first-priority (subject to Permitted Liens) nature
thereof), except for security interests that cannot be perfected by filing under
the UCC, or (C) for the exercise by the Secured Party of the rights provided for
in this Security Agreement or the remedies in respect of the Collateral pursuant
to this Security Agreement, except (1) those consents to assignment of licenses,
permits, approvals, and other rights that are as a matter of law not assignable,
(2) those consents, approvals, authorizations, actions, notices or filings which
have been duly obtained or made and, in the case of the maintenance of
perfection, the filing of continuation statements under the UCC, and (3) those
filings and actions described in Section 3(c)(i).

      (d) Tax Identification Number and Organizational Number. The federal tax
identification number of such Grantor and the organizational number (if any) of
such Grantor are as set forth in Schedule 1.

      (e) Tradenames; Prior Names. Except as set forth on Schedule 1, such
Grantor has not conducted business under any name other than its current name
during the five years immediately prior to the date of this Security Agreement.

      Section 4. Covenants.

      (a) Further Assurances.

            (i) Each Grantor agrees that from time to time, at its expense, such
Grantor shall promptly execute and deliver all instruments and documents, and
take all action, that may be reasonably necessary or desirable, or that the
Secured Party may reasonably request, in order to perfect and protect any
pledge, assignment, or security interest granted or intended to be granted
hereby or to enable the Secured Party to exercise and enforce its rights and
remedies hereunder with respect to any Collateral. Without limiting the
generality of the foregoing, each Grantor (A) at the request of Secured Party,
shall execute such instruments, endorsements or notices, as may be reasonably
necessary or desirable or as the Secured Party may reasonably request, in order
to perfect and preserve the assignments and security interests granted or
purported to be granted hereby, (B) shall, if any Collateral shall be evidenced
by a promissory note or other Instrument or Chattel Paper and such promissory
note, Instrument or Chattel Paper shall, individually or in the aggregate,
exceed $500,000, deliver and pledge to the Secured Party hereunder such note or
Instrument or Chattel Paper duly endorsed and accompanied by duly executed
instruments of transfer or assignment, all in form and substance satisfactory to
the Secured Party, and (C) authorizes the Secured Party to file any financing
statements, amendments or continuations without the signature of such Grantor to
the extent permitted by applicable law in order to perfect or maintain the
perfection of any security interest granted under this Security Agreement
(including, without limitation, financing statements using an "all assets" or
"all personal property" collateral description). Notwithstanding anything in
this Security Agreement to the contrary, the Grantor shall not be required to
take any action with respect to the perfection of the security interest in any
Cash Collateral which is not then held by a Lender or the Borrower or a
Subsidiary of the Borrower.

            (ii) Following written request by the Secured Party, each Grantor
shall pay all filing, registration and recording fees and all refiling,
re-registration and re-recording fees, and all other reasonable expenses
incident to the execution and acknowledgment of this Security

                                       8

<PAGE>

Agreement, any assurance, and all federal, state, county and municipal stamp
taxes and other taxes, duties, imports, assessments and charges arising out of
or in connection with the execution and delivery of this Security Agreement, any
agreement supplemental hereto, any financing statements, and any instruments of
further assurance.

            (iii) Each Grantor shall promptly provide to the Secured Party all
information and evidence the Secured Party may reasonably request concerning the
Collateral to enable the Secured Party to enforce the provisions of this
Security Agreement.

      Section 5. Change of Name; State of Formation. Each Grantor shall give the
Secured Party at least 30 days' prior written notice before it (i) in the case
of any Grantor that is not a "registered organization" (as such term is defined
in Section 9-102 of the UCC), changes the location of its principal place of
business and chief executive office, (ii) changes the location of its
jurisdiction of formation or organization, (iii) changes the location of the
original copies of any Chattel Paper evidencing Accounts if such Chattel Paper,
individually or in the aggregate, exceeds $500,000, or (iv) changes its name or
uses a trade name other than its current name used on the date hereof. Other
than as permitted by Section 6.09 of the Credit Agreement or as permitted in the
preceding sentence, no Grantor shall amend, supplement, modify or restate its
articles or certificate of incorporation, bylaws, limited liability company
agreements, or other equivalent organizational documents, without the prior
written consent of the Secured Party.

      (a) Right of Inspection. Each Grantor shall hold and preserve, at its own
cost and expense reasonably satisfactory and complete records of the Collateral,
including, but not limited to, Instruments, Chattel Paper, Contracts, and
records with respect to the Accounts, and will permit representatives of the
Secured Party, upon reasonable advance notice, at any time during normal
business hours to inspect and copy them. Upon the occurrence and during the
continuation of any Event of Default, at the Secured Party's request, each
Grantor shall promptly deliver copies of any and all such records to the Secured
Party.

      (b) Liability Under Contracts and Accounts. Notwithstanding anything in
this Security Agreement to the contrary, (i) the execution of this Security
Agreement shall not release any Grantor from its obligations and duties under
any of the Contract Documents, or any other contract or instrument which are
part of the Collateral and Accounts included in the Collateral, (ii) the
exercise by the Secured Party of any of its rights hereunder shall not release
any Grantor from any of its duties or obligations under any Contract Documents,
or any other Contract or Instrument which are part of the Collateral and
Accounts included in the Collateral, and (iii) the Secured Party shall not have
any obligation or liability under any Contract Documents, or any other contract
or instrument which are part of the Collateral and Accounts included in the
Collateral by reason of the execution and delivery of this Security Agreement,
nor shall the Secured Party be obligated to perform any of the obligations or
duties of any Grantor thereunder or to take any action to collect or enforce any
claim for payment assigned hereunder.

      (c) Transfer of Certain Collateral; Release of Certain Security Interest.
Each Grantor agrees that it shall not sell, assign, or otherwise dispose of any
Collateral, except as otherwise permitted under the Credit Agreement. The
Secured Party shall promptly, at the Grantors' expense, execute and deliver all
further instruments and documents, and take all further action

                                       9

<PAGE>

that a Grantor may reasonably request in order to release its security interest
in any Collateral which is disposed of in accordance with the terms of the
Credit Agreement.

      (d) Accounts. Each Grantor agrees that it will use commercially reasonable
efforts to ensure that each Account (i) is and will be, in all material
respects, the genuine, legal, valid, and binding obligations of the account
debtor in respect thereof, representing an unsatisfied obligation of such
account debtor, (ii) is and will be, in all material respects, enforceable in
accordance with its terms, is not and will not be subject to any setoffs,
defenses, taxes, counterclaims, except in the ordinary course of business, (iii)
is and will be, in all material respects, in compliance with all applicable
laws, whether federal, state, local or foreign, and (iv) if evidenced by Chattel
Paper, will not require the consent of the account debtor in respect thereof in
connection with its assignment hereunder.

      (e) Negotiable Instrument. If any Grantor shall at any time hold or
acquire any Negotiable Instruments, including promissory notes, and such
Negotiable Instruments, individually or in the aggregate, exceed $500,000, then
such Grantor shall forthwith endorse, assign and deliver the same to the Secured
Party, accompanied by such instruments of transfer or assignment duly executed
in blank as the Secured Party may from time to time reasonably request.

      (f) Other Covenants of Grantor. Each Grantor agrees that (i) any action or
proceeding to enforce this Security Agreement may be taken by the Secured Party
either in such Grantor's name or in the Secured Party's name, as the Secured
Party may deem necessary, and (ii) such Grantor will, until the indefeasible
payment in full in cash of the Secured Obligations (including all Letter of
Credit Obligations), the termination of all obligations of the Issuing Banks and
the Banks in respect of Letters of Credit, and the termination or expiration of
the Commitments, warrant and defend its title to the Collateral and the interest
of the Secured Party in the Collateral against any claim or demand of any
Persons (other than Permitted Liens) which could reasonably be expected to
materially adversely affect such Grantor's title to, or the Secured Party's
right or interest in, such Collateral.

      Section 6. Termination of Security Interest. Upon the indefeasible payment
in full in cash of the Secured Obligations (including all Letter of Credit
Obligations), the termination or expiration of all Letters of Credit and the
termination of all obligations of the Issuing Banks and the Banks in respect of
Letters of Credit, and the termination or expiration of the Commitments, the
security interest granted hereby shall terminate and all rights to the
Collateral shall revert to the applicable Grantor to the extent such Collateral
shall not have been sold or otherwise applied pursuant to the terms hereof. Upon
any such termination, the Secured Party will promptly, at the Grantors' expense,
execute and deliver to the applicable Grantor such documents (including, without
limitation, UCC-3 termination statements) as such Grantor shall reasonably
request to evidence such termination.

      Section 7. Reinstatement. If, at any time after payment in full of all
Secured Obligations and termination of the Secured Party's security interest,
any payments on the Secured Obligations previously made must be disgorged by the
Secured Party for any reason whatsoever, including, without limitation, the
insolvency, bankruptcy or reorganization of any Grantor or any other Person,
this Security Agreement and the Secured Party's security interests

                                       10

<PAGE>

herein shall be reinstated as to all disgorged payments as though such payments
had not been made, and each Grantor shall sign and deliver to the Secured Party
all documents, and shall do such other acts and things, as may be reasonably
necessary to reinstate and perfect the Secured Party's security interest (other
than the Secured Party's security interest in Cash Collateral that is held by a
Person other than a Lender, the Borrower or any Subsidiary of the Borrower).
EACH GRANTOR SHALL DEFEND AND INDEMNIFY EACH BENEFICIARY FROM AND AGAINST ANY
CLAIM, DAMAGE, LOSS, LIABILITY, COST OR EXPENSE UNDER THIS SECTION 7 (INCLUDING
REASONABLE ATTORNEYS' FEES AND EXPENSES) IN THE DEFENSE OF ANY SUCH ACTION OR
SUIT INCLUDING SUCH CLAIM, DAMAGE, LOSS, LIABILITY, COST, OR EXPENSE ARISING AS
A RESULT OF THE INDEMNIFIED BENEFICIARY'S OWN NEGLIGENCE BUT EXCLUDING SUCH
CLAIM, DAMAGE, LOSS, LIABILITY, COST, OR EXPENSE THAT IS FOUND IN A FINAL,
NON-APPEALABLE JUDGMENT BY A COURT OF COMPETENT JURISDICTION TO HAVE RESULTED
FROM SUCH INDEMNIFIED BENEFICIARY'S GROSS NEGLIGENCE OR WILLFUL MISCONDUCT.

      Section 8. Remedies upon Event of Default.

      (a) If any Event of Default has occurred and is continuing, the Secured
Party may (and shall at the written request of the Majority Banks), (i) proceed
to protect and enforce the rights vested in it by this Security Agreement or
otherwise available to it, including but not limited to, the right to cause all
revenues and other moneys pledged hereby as Collateral to be paid directly to
it, and to enforce its rights hereunder to such payments and all other rights
hereunder by such appropriate judicial proceedings as it shall deem most
effective to protect and enforce any of such rights, either at law or in equity
or otherwise, whether for specific enforcement of any covenant or agreement
contained in any of the Contract Documents, or in aid of the exercise of any
power therein or herein granted, or for any foreclosure hereunder and sale under
a judgment or decree in any judicial proceeding, or to enforce any other legal
or equitable right vested in it by this Security Agreement or by law; (ii) cause
any action at law or suit in equity or other proceeding to be instituted and
prosecuted and enforce any rights hereunder or included in the Collateral,
subject to the provisions and requirements thereof; (iii) sell or otherwise
dispose of any or all of the Collateral or cause the Collateral to be sold or
otherwise disposed of in one or more sales or transactions, at such prices and
in such manner as may be commercially reasonable, and for cash or on credit or
for future delivery, without assumption of any credit risk, at public or private
sale, without demand of performance or notice of intention to sell or of time or
place of sale (except such notice as is required by applicable statute and
cannot be waived), it being agreed that the Secured Party may be a purchaser on
behalf of the Beneficiaries or on its own behalf at any such sale and that the
Secured Party, any other Beneficiary, or any other Person who may be a bona fide
purchaser for value and without notice of any claims of any or all of the
Collateral so sold shall thereafter hold the same absolutely free from any claim
or right of whatsoever kind, including any equity of redemption of any Grantor,
any such demand, notice or right and equity being hereby expressly waived and
released to the extent permitted by law; (iv) incur reasonable expenses,
including reasonable attorneys' fees, reasonable consultants' fees, and other
costs appropriate to the exercise of any right or power under this Security
Agreement; (v) perform any obligation of any Grantor hereunder and make
payments, purchase, contest or compromise any encumbrance, charge or lien, and
pay taxes and expenses, without, however, any obligation to do so; (vi) in
connection with any acceleration and

                                       11

<PAGE>

foreclosure, take possession of the Collateral and render it usable and repair
and renovate the same, without, however, any obligation to do so, and enter upon
any location where the Collateral may be located for that purpose, control,
manage, operate, rent and lease the Collateral, collect all rents and income
from the Collateral and apply the same to reimburse the Beneficiaries for any
cost or expenses incurred hereunder or under any of the Credit Documents and to
the payment or performance of any Grantor's obligations hereunder or under any
of the Credit Documents, and apply the balance to the other Secured Obligations
and any remaining excess balance to whomsoever is legally entitled thereto;
(vii) secure the appointment of a receiver for the Collateral or any part
thereof; (viii) require any Grantor to, and each Grantor hereby agrees that it
will at its expense and upon request of the Secured Party forthwith, assemble
all or part of the Collateral as directed by the Secured Party and make it
available to the Secured Party at a place to be designated by the Secured Party
which is reasonably convenient to both parties; (ix) exercise any other or
additional rights or remedies granted to a secured party under the UCC; or (x)
occupy any premises owned or leased by any Grantor where the Collateral or any
part thereof is assembled for a reasonable period in order to effectuate its
rights and remedies hereunder or under law, without obligation to any Grantor in
respect of such occupation. If, pursuant to applicable law, prior notice of sale
of the Collateral under this Section is required to be given to any Grantor,
each Grantor hereby acknowledges that the minimum time required by such
applicable law, or if no minimum time is specified, 10 days, shall be deemed a
reasonable notice period. The Secured Party shall not be obligated to make any
sale of Collateral regardless of notice of sale having been given. The Secured
Party may adjourn any public or private sale from time to time by announcement
at the time and place fixed therefor, and such sale may, without further notice,
be made at the time and place to which it was so adjourned.

      (b) All reasonable costs and expenses (including reasonable attorneys'
fees and expenses) incurred by the Secured Party in connection with any suit or
proceeding in connection with the performance by the Secured Party of any of the
agreements contained in any of the Contract Documents, or in connection with any
exercise of its rights or remedies hereunder, pursuant to the terms of this
Security Agreement, shall constitute additional indebtedness secured by this
Security Agreement and shall be paid on demand by the Grantors to the Secured
Party on behalf of the Beneficiaries.

      Section 9. Remedies Cumulative; Delay Not Waiver.

      (a) No right, power or remedy herein conferred upon or reserved to the
Secured Party is intended to be exclusive of any other right, power or remedy
and every such right, power and remedy shall, to the extent permitted by law, be
cumulative and in addition to every other right, power and remedy given
hereunder or now or hereafter existing at law or in equity or otherwise. The
assertion or employment of any right or remedy hereunder or otherwise shall not
prevent the concurrent assertion or employment of any other appropriate right or
remedy. Resort to any or all security now or hereafter held by the Secured Party
may be taken concurrently or successively and in one or several consolidated or
independent judicial actions or lawfully taken nonjudicial proceedings, or both.

      (b) No delay or omission of the Secured Party to exercise any right or
power accruing upon the occurrence and during the continuance of any Event of
Default as aforesaid shall impair

                                       12

<PAGE>

any such right or power or shall be construed to be a waiver of any such Event
of Default or an acquiescence therein; and every power and remedy given by this
Security Agreement may be exercised from time to time, and as often as shall be
deemed expedient, by the Secured Party.

      Section 10. Contract Rights. Upon the occurrence and during the
continuance of an Event of Default, the Secured Party may exercise any of the
Contract Rights and remedies of any Grantor under or in connection with the
Instruments, Chattel Paper, or Contracts which represent Accounts, the General
Intangibles, or which otherwise relate to the Collateral, including, without
limitation, any rights of any Grantor to demand or otherwise require payment of
any amount under, or performance of any provisions of, the Instruments, Chattel
Paper, or Contracts which represent Accounts, or the General Intangibles.

      Section 11. Accounts.

      (a) Upon the occurrence and during the continuance of an Event of Default,
the Secured Party may, or may direct any Grantor to, take any action reasonably
necessary or advisable to enforce collection of the Accounts, including, without
limitation, notifying the account debtors or obligors under any Accounts of the
assignment of such Accounts to the Secured Party and directing such account
debtors or obligors to make payment of all amounts due or to become due directly
to the Secured Party. Upon such notification and direction, and at the expense
of the Grantors, the Secured Party may enforce collection of any such Accounts,
and adjust, settle, or compromise the amount or payment thereof in the same
manner and to the same extent as any Grantor might have done.

      (b) Upon the occurrence and during the continuance of an Event of Default,
and upon receipt by any Grantor of written notice from the Secured Party that an
Event of Default has occurred and is continuing, all amounts and proceeds
(including instruments) received by such Grantor in respect of the Accounts
shall be received in trust for the benefit of the Secured Party hereunder, shall
be segregated from other funds of such Grantor, and shall promptly be paid over
to the Secured Party in the same form as so received (with any necessary
indorsement) to be held as Collateral. Following receipt of such notice and
prior to the waiver or cure of the applicable Event of Default, no Grantor shall
adjust, settle, or compromise the amount or payment of any Account, nor release
wholly or partly any account debtor or obligor thereof, nor allow any credit or
discount thereon.

      Section 12. Application of Collateral. The proceeds of any sale, or other
realization (other than that received from a sale or other realization permitted
by the Credit Agreement) upon all or any part of the Collateral pledged by any
Grantor shall be applied by the Secured Party as set forth in Section 7.06 of
the Credit Agreement.

      Section 13. Secured Party as Attorney-in-Fact for Grantor. Each Grantor
hereby constitutes and irrevocably appoints the Secured Party, acting for and on
behalf of itself and the Beneficiaries and each successor or assign of the
Secured Party and the Beneficiaries, the true and lawful attorney-in-fact of
such Grantor, with full power and authority in the place and stead of such
Grantor and in the name of such Grantor, the Secured Party or otherwise to take
any action and execute any instrument at the written direction of the
Beneficiaries and enforce all rights, interests and remedies of such Grantor
with respect to the Collateral, including the right:

                                       13

<PAGE>

      (a) to ask, require, demand, receive and give acquittance for any and all
moneys and claims for moneys due and to become due under or arising out of the
any of the other Collateral, including without limitation, any Insurance
Contracts;

      (b) to elect remedies thereunder and to endorse any checks or other
instruments or orders in connection therewith;

      (c) to file any claims or take any action or institute any proceedings in
connection therewith which the Secured Party may deem to be reasonably necessary
or advisable;

      (d) to pay, settle or compromise all bills and claims which may be or
become liens or security interests against any or all of the Collateral, or any
part thereof, unless a bond or other security satisfactory to the Secured Party
has been provided; and

      (e) upon foreclosure, to do any and every act which any Grantor may do on
its behalf with respect to the Collateral or any part thereof and to exercise
any or all of such Grantor's rights and remedies under any or all of the
Collateral;

provided, however, that the Secured Party shall not exercise any such rights
except upon the occurrence and continuation of an Event of Default. THIS POWER
OF ATTORNEY IS A POWER COUPLED WITH AN INTEREST AND SHALL BE IRREVOCABLE.

      Section 14. Secured Party May Perform. The Secured Party may from
time-to-time perform any act which any Grantor has agreed hereunder to perform
and which such Grantor shall fail to perform after being requested in writing to
so perform (it being understood that no such request need be given after the
occurrence and during the continuance of any Event of Default and after notice
thereof by the Secured Party to any Grantor) and the Secured Party may from
time-to-time take any other action which the Secured Party deems reasonably
necessary for the maintenance, preservation or protection of any of the
Collateral or of its security interest therein, and the reasonable expenses of
the Secured Party incurred in connection therewith shall be part of the Secured
Obligations and shall be secured hereby.

      Section 15. Secured Party Has No Duty. The powers conferred on the Secured
Party hereunder are solely to protect its interest in the Collateral and shall
not impose any duty on it to exercise any such powers. Except for reasonable
care of any Collateral in its possession and the accounting for moneys actually
received by it hereunder, the Secured Party shall have no duty as to any
Collateral or responsibility for taking any necessary steps to preserve rights
against prior parties or any other rights pertaining to any Collateral.

      Section 16. Reasonable Care. The Secured Party shall be deemed to have
exercised reasonable care in the custody and preservation of the Collateral in
its possession if the Collateral is accorded treatment substantially equal to
that which the Secured Party accords its own Property.

      Section 17. Payments Held in Trust. After the occurrence and during the
continuance of an Event of Default, all payments received by any Grantor under
or in connection with any Collateral shall be received in trust for the benefit
of the Secured Party, and shall be segregated

                                       14

<PAGE>

from other funds of such Grantor and shall be forthwith paid over to the Secured
Party in the same form as received (with any necessary endorsement).

      Section 18. Miscellaneous.

      (a) Expenses. Each Grantor will upon demand pay to the Secured Party for
its benefit and the benefit of the Beneficiaries the amount of any reasonable
out-of-pocket expenses, including the reasonable fees and disbursements of its
counsel and of any experts, which the Secured Party and the Beneficiaries may
incur in connection with (i) the custody, preservation, use, or operation of, or
the sale, collection, or other realization of, any of the Collateral, (ii) the
exercise or enforcement of any of the rights of the Secured Party or any
Beneficiary hereunder, and (iii) the failure by any Grantor to perform or
observe any of the provisions hereof.

      (b) Amendments; Etc. No amendment or waiver of any provision of this
Security Agreement nor consent to any departure by any Grantor herefrom shall be
effective unless the same shall be in writing and authenticated by the affected
Grantor, the Secured Party and either, as required by the Credit Agreement, the
Majority Banks or all of the Banks, and then such waiver or consent shall be
effective only in the specific instance and for the specific purpose for which
given.

      (c) Addresses for Notices. All notices and other communications provided
for hereunder shall be made in the manner and to the addresses set forth in the
Credit Agreement or on the signature page hereto.

      (d) Continuing Security Interest; Transfer of Interest. This Security
Agreement shall create a continuing security interest in the Collateral and,
unless expressly released by the Secured Party, shall (a) remain in full force
and effect until the indefeasible payment in full in cash of the Secured
Obligations (including all Letter of Credit Obligations), the termination or
expiration of all Letters of Credit and the termination of all obligations of
the Issuing Banks and the Banks in respect of Letters of Credit, and the
termination or expiration of the Commitments, (b) be binding upon each Grantor
and its successors, tranferees and assigns, and (c) inure, together with the
rights and remedies of the Secured Party hereunder, to the benefit of and be
binding upon, the Secured Party, the Issuing Banks, and the Banks and their
respective successors, transferees, and assigns, and to the benefit of and be
binding upon, the Swap Counterparties, and each of their respective successors,
transferees, and assigns to the extent such successors, transferees, and assigns
of a Swap Counterparty is a Bank or an Affiliate of a Bank. Without limiting the
generality of the foregoing clause, when any Bank assigns or otherwise transfers
any interest held by it under the Credit Agreement or other Credit Document to
any other Person pursuant to the terms of the Credit Agreement or such other
Credit Document, that other Person shall thereupon become vested with all the
benefits held by such Bank under this Security Agreement.

      (e) Severability. Wherever possible each provision of this Security
Agreement shall be interpreted in such manner as to be effective and valid under
applicable law, but if any provision of this Security Agreement shall be
prohibited by or invalid under such law, such provision shall be ineffective to
the extent of such prohibition or invalidity, without invalidating the remainder
of such provision or the remaining provisions of this Security Agreement.

                                       15

<PAGE>

      (f) Choice of Law. This Security Agreement shall be governed by and
construed and enforced in accordance with the laws of the State of Texas, except
to the extent that the validity or perfection of the security interests
hereunder, or remedies hereunder, in respect of any particular Collateral are
governed by the laws of a jurisdiction other than the state of Texas.

      (g) Counterparts. The parties may execute this Security Agreement in any
number of duplicate originals, each of which constitutes an original, and all of
which, collectively, constitute only one agreement. The parties may execute this
Security Agreement in counterparts, each of which constitutes an original, and
all of which, collectively, constitute only one agreement. Delivery of an
executed counterpart signature page by facsimile is as effective as executing
and delivering this Security Agreement in the presence of the other parties to
this Security Agreement. In proving this Security Agreement, a party must
produce or account only for the executed counterpart of the party to be charged.

      (h) Headings. Paragraph headings have been inserted in this Security
Agreement as a matter of convenience for reference only and it is agreed that
such paragraph headings are not a part of this Security Agreement and shall not
be used in the interpretation of any provision of this Security Agreement.

      (i) Conflicts. In the event of any explicit or implicit conflict between
any provision of this Security Agreement and any provision of the Credit
Agreement, the terms of the Credit Agreement shall be controlling.

      (j) Additional Grantors. Pursuant to Section 5.10 of the Credit Agreement,
each Subsidiary of the Borrower that was not in existence on the date of the
Credit Agreement is required to enter into this Security Agreement as a Grantor
upon becoming a Subsidiary of the Borrower. Upon execution and delivery after
the date hereof by the Secured Party and such Subsidiary of an instrument in the
form of Annex 1, such Subsidiary shall become a Grantor hereunder with the same
force and effect as if originally named as a Grantor herein. The execution and
delivery of any instrument adding an additional Grantor as a party to this
Security Agreement shall not require the consent of any other Grantor hereunder.
The rights and obligations of each Grantor hereunder shall remain in full force
and effect notwithstanding the addition of any new Grantor as a party to this
Security Agreement.

      (k) Entire Agreement. THIS SECURITY AGREEMENT AND THE OTHER CREDIT
DOCUMENTS, AS DEFINED IN THE CREDIT AGREEMENT REPRESENT THE FINAL AGREEMENT
AMONG THE PARTIES AND MAY NOT BE CONTRADICTED BY EVIDENCE OF PRIOR,
CONTEMPORANEOUS, OR SUBSEQUENT ORAL AGREEMENTS OF THE PARTIES.

      THERE ARE NO UNWRITTEN ORAL AGREEMENTS AMONG THE PARTIES HERETO.

                            [SIGNATURE PAGES FOLLOW]

                                       16

<PAGE>

           The parties hereto have caused this Security Agreement to be duly
executed as of the date first above written.

GRANTORS:                         HEP OPERATING COMPANY, L.P., a Delaware
                                    limited partnership

                                    By: HEP Logistics GP, L.L.C., a Delaware
                                        limited liability company, its General
                                        Partner

                                    By: Holly Energy Partners, L.P., a Delaware
                                        limited partnership, its Managing Member

                                    By: HEP Logistics Holdings, L.P., a Delaware
                                        limited partnership, its General Partner

                                    By: Holly Logistic Services, L.L.C., a
                                        Delaware limited liability company, its
                                        General Partner

                                        By:  /s/ M. Neale Hickerson
                                            ------------------------------------
                                                 M. Neale Hickerson
                                                 Vice President - Treasury and
                                                 Investor Relations

                           [Signature pages continue.]

                      Signature Page to Security Agreement

<PAGE>

                                  HEP PIPELINE GP, L.L.C., a Delaware limited
                                                 liability company
                                  HEP REFINING GP, L.L.C., a Delaware limited
                                                 liability company
                                  HEP MOUNTAIN HOME, L.L.C., a Delaware
                                                 limited liability company
                                  HEP PIPELINE, L.L.C., a Delaware limited
                                                 liability company
                                  HEP REFINING, L.L.C., a Delaware limited
                                                 liability company
                                  HEP WOODS CROSS, L.L.C., a Delaware
                                                 limited liability company

                                  Each by: HEP Operating Company, L.P., a
                                           Delaware limited partnership and its
                                           Sole Member

                                    By: HEP Logistics GP, L.L.C., a Delaware
                                        limited liability company, its General
                                        Partner

                                    By: Holly Energy Partners, L.P., a Delaware
                                        limited partnership, its Managing Member

                                    By: HEP Logistics Holdings, L.P., a Delaware
                                        limited partnership, its General Partner

                                    By: Holly Logistic Services, L.L.C., a
                                        Delaware limited liability company, its
                                        General Partner

                                        By:  /s/ M. Neale Hickerson
                                            ------------------------------------
                                                 M. Neale Hickerson
                                                 Vice President - Treasury and
                                                 Investor Relations

                           [Signature pages continue.]

                      Signature Page to Security Agreement

<PAGE>

                                  HEP NAVAJO SOUTHERN, L.P., a Delaware limited
                                       partnership
                                  HEP PIPELINE ASSETS, LIMITED PARTNERSHIP,
                                       a Delaware limited partnership

                                   Each by: HEP Pipeline GP, L.L.C., a Delaware
                                          limited liability company and its
                                          General Partner

                                    By: HEP Operating Company, L.P., a Delaware
                                        limited partnership and its Sole Member

                                    By: HEP Logistics GP, L.L.C., a Delaware
                                        limited liability company, its General
                                        Partner

                                    By: Holly Energy Partners, L.P., a Delaware
                                        limited partnership, its Managing Member

                                    By: HEP Logistics Holdings, L.P., a Delaware
                                        limited partnership, its General Partner

                                    By: Holly Logistic Services, L.L.C., a
                                        Delaware limited liability company, its
                                        General Partner

                                        By:  /s/ M. Neale Hickerson
                                            ------------------------------------
                                                 M. Neale Hickerson
                                                 Vice President - Treasury and
                                                 Investor Relations

                           [Signature pages continue.]

                      Signature Page to Security Agreement

<PAGE>

                                  HEP REFINING ASSETS, L.P., a Delaware limited
                                              partnership

                                    By: HEP Refining GP, L.L.C., a Delaware
                                        limited liability company and its
                                        General Partner

                                    By: HEP Operating Company, L.P., a Delaware
                                        limited partnership and its Sole Member

                                    By: HEP Logistics GP, L.L.C., a Delaware
                                        limited liability company, its General
                                        Partner

                                    By: Holly Energy Partners, L.P., a Delaware
                                        limited partnership, its Managing Member

                                    By: HEP Logistics Holdings, L.P., a Delaware
                                        limited partnership, its General Partner

                                    By: Holly Logistic Services, L.L.C., a
                                        Delaware limited liability company, its
                                        General Partner

                                        By:  /s/ M. Neale Hickerson
                                            ------------------------------------
                                                 M. Neale Hickerson
                                                 Vice President - Treasury and
                                                 Investor Relations

                           [Signature pages continue.]

                      Signature Page to Security Agreement

<PAGE>

SECURED PARTY:                      UNION BANK OF CALIFORNIA, N.A., as
                                    Secured Party for the ratable benefit of the
                                    Beneficiaries

                                    By:  /s/ Sean Murphy
                                        ----------------------------------------
                                             Sean Murphy, Vice President

                      Signature Page to Security Agreement